corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject [17/63] [abbrv] [partial] incubator-corinthia git commit: Moved 3rdparty to platform This is the first part of isolating 3rdparty within platform. The idea is that only platform.h should be used outside platform platform.h might contain includes to inter
Date Tue, 30 Dec 2014 14:44:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/ac70cb0e/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.c
----------------------------------------------------------------------
diff --git a/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.c b/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.c
deleted file mode 100755
index af22644..0000000
--- a/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/* Interface to mmap style I/O
-
-   (c) 2006-2008 (W3C) MIT, ERCIM, Keio University
-   See tidy.h for the copyright notice.
-
-   Originally contributed by Cory Nelson and Nuno Lopes
-
-*/
-
-/* keep these here to keep file non-empty */
-#include "forward.h"
-#include "mappedio.h"
-
-#if SUPPORT_POSIX_MAPPED_FILES
-
-#include "fileio.h"
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include <sys/mman.h>
-
-
-typedef struct
-{
-    TidyAllocator *allocator;
-    const byte *base;
-    size_t pos, size;
-} MappedFileSource;
-
-static int TIDY_CALL mapped_getByte( void* sourceData )
-{
-    MappedFileSource* fin = (MappedFileSource*) sourceData;
-    return fin->base[fin->pos++];
-}
-
-static Bool TIDY_CALL mapped_eof( void* sourceData )
-{
-    MappedFileSource* fin = (MappedFileSource*) sourceData;
-    return (fin->pos >= fin->size);
-}
-
-static void TIDY_CALL mapped_ungetByte( void* sourceData, byte ARG_UNUSED(bv) )
-{
-    MappedFileSource* fin = (MappedFileSource*) sourceData;
-    fin->pos--;
-}
-
-int TY_(initFileSource)( TidyAllocator *allocator, TidyInputSource* inp, FILE* fp )
-{
-    MappedFileSource* fin;
-    struct stat sbuf;
-    int fd;
-
-    fin = (MappedFileSource*) TidyAlloc( allocator, sizeof(MappedFileSource) );
-    if ( !fin )
-        return -1;
-
-    fd = fileno(fp);
-    if ( fstat(fd, &sbuf) == -1
-         || sbuf.st_size == 0
-         || (fin->base = mmap(0, fin->size = (size_t)sbuf.st_size, PROT_READ,
-                              MAP_SHARED, fd, 0)) == MAP_FAILED)
-    {
-        TidyFree( allocator, fin );
-        /* Fallback on standard I/O */
-        return TY_(initStdIOFileSource)( allocator, inp, fp );
-    }
-
-    fin->pos = 0;
-    fin->allocator = allocator;
-    fclose(fp);
-
-    inp->getByte    = mapped_getByte;
-    inp->eof        = mapped_eof;
-    inp->ungetByte  = mapped_ungetByte;
-    inp->sourceData = fin;
-
-    return 0;
-}
-
-void TY_(freeFileSource)( TidyInputSource* inp, Bool closeIt )
-{
-    if ( inp->getByte == mapped_getByte )
-    {
-        MappedFileSource* fin = (MappedFileSource*) inp->sourceData;
-        munmap( (void*)fin->base, fin->size );
-        TidyFree( fin->allocator, fin );
-    }
-    else
-        TY_(freeStdIOFileSource)( inp, closeIt );
-}
-
-#endif
-
-
-#if defined(_WIN32)
-#include "streamio.h"
-#include "tidy-int.h"
-#include "message.h"
-
-#include <errno.h>
-#if _MSC_VER < 1300  /* less than msvc++ 7.0 */
-#pragma warning(disable:4115) /* named type definition in parentheses in windows headers
*/
-#endif
-#include <windows.h>
-
-typedef struct _fp_input_mapped_source
-{
-    TidyAllocator *allocator;
-    LONGLONG size, pos;
-    HANDLE file, map;
-    byte *view, *iter, *end;
-    unsigned int gran;
-} MappedFileSource;
-
-static int mapped_openView( MappedFileSource *data )
-{
-    DWORD numb = ( ( data->size - data->pos ) > data->gran ) ?
-        data->gran : (DWORD)( data->size - data->pos );
-
-    if ( data->view )
-    {
-        UnmapViewOfFile( data->view );
-        data->view = NULL;
-    }
-
-    data->view = MapViewOfFile( data->map, FILE_MAP_READ,
-                                (DWORD)( data->pos >> 32 ),
-                                (DWORD)data->pos, numb );
-
-    if ( !data->view ) return -1;
-
-    data->iter = data->view;
-    data->end = data->iter + numb;
-
-    return 0;
-}
-
-static int TIDY_CALL mapped_getByte( void *sourceData )
-{
-    MappedFileSource *data = sourceData;
-
-    if ( !data->view || data->iter >= data->end )
-    {
-        data->pos += data->gran;
-
-        if ( data->pos >= data->size || mapped_openView(data) != 0 )
-            return EndOfStream;
-    }
-
-    return *( data->iter++ );
-}
-
-static Bool TIDY_CALL mapped_eof( void *sourceData )
-{
-    MappedFileSource *data = sourceData;
-    return ( data->pos >= data->size );
-}
-
-static void TIDY_CALL mapped_ungetByte( void *sourceData, byte ARG_UNUSED(bt) )
-{
-    MappedFileSource *data = sourceData;
-
-    if ( data->iter >= data->view )
-    {
-        --data->iter;
-        return;
-    }
-
-    if ( data->pos < data->gran )
-    {
-        assert(0);
-        return;
-    }
-
-    data->pos -= data->gran;
-    mapped_openView( data );
-}
-
-static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp, HANDLE fp
)
-{
-    MappedFileSource* fin = NULL;
-
-    inp->getByte    = mapped_getByte;
-    inp->eof        = mapped_eof;
-    inp->ungetByte  = mapped_ungetByte;
-
-    fin = (MappedFileSource*) TidyAlloc( allocator, sizeof(MappedFileSource) );
-    if ( !fin )
-        return -1;
-    
-#if _MSC_VER < 1300  /* less than msvc++ 7.0 */
-    {
-        LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size;
-        (DWORD)pli->LowPart = GetFileSize( fp, (DWORD *)&pli->HighPart );
-        if ( GetLastError() != NO_ERROR || fin->size <= 0 )
-        {
-            TidyFree(allocator, fin);
-            return -1;
-        }
-    }
-#else
-    if ( !GetFileSizeEx( fp, (LARGE_INTEGER*)&fin->size )
-         || fin->size <= 0 )
-    {
-        TidyFree(allocator, fin);
-        return -1;
-    }
-#endif
-
-    fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL );
-
-    if ( !fin->map )
-    {
-        TidyFree(allocator, fin);
-        return -1;
-    }
-
-    {
-        SYSTEM_INFO info;
-        GetSystemInfo( &info );
-        fin->gran = info.dwAllocationGranularity;
-    }
-
-    fin->allocator = allocator;
-    fin->pos    = 0;
-    fin->view   = NULL;
-    fin->iter   = NULL;
-    fin->end    = NULL;
-
-    if ( mapped_openView( fin ) != 0 )
-    {
-        CloseHandle( fin->map );
-        TidyFree( allocator, fin );
-        return -1;
-    }
-
-    fin->file = fp;
-    inp->sourceData = fin;
-
-    return 0;
-}
-
-static void freeMappedFileSource( TidyInputSource* inp, Bool closeIt )
-{
-    MappedFileSource* fin = (MappedFileSource*) inp->sourceData;
-    if ( closeIt && fin && fin->file != INVALID_HANDLE_VALUE )
-    {
-        if ( fin->view )
-            UnmapViewOfFile( fin->view );
-
-        CloseHandle( fin->map );
-        CloseHandle( fin->file );
-    }
-    TidyFree( fin->allocator, fin );
-}
-
-StreamIn* MappedFileInput ( TidyDocImpl* doc, HANDLE fp, int encoding )
-{
-    StreamIn *in = TY_(initStreamIn)( doc, encoding );
-    if ( initMappedFileSource( doc->allocator, &in->source, fp ) != 0 )
-    {
-        TY_(freeStreamIn)( in );
-        return NULL;
-    }
-    in->iotype = FileIO;
-    return in;
-}
-
-
-int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
-    int status = -ENOENT;
-    HANDLE fin = CreateFileA( filnam, GENERIC_READ, FILE_SHARE_READ, NULL,
-                              OPEN_EXISTING, 0, NULL );
-
-#if PRESERVE_FILE_TIMES
-    LONGLONG actime, modtime;
-    TidyClearMemory( &doc->filetimes, sizeof(doc->filetimes) );
-
-    if ( fin != INVALID_HANDLE_VALUE && cfgBool(doc,TidyKeepFileTimes) &&
-         GetFileTime(fin, NULL, (FILETIME*)&actime, (FILETIME*)&modtime) )
-    {
-#define TY_I64(str) TYDYAPPEND(str,LL)
-#if _MSC_VER < 1300  && !defined(__GNUC__) /* less than msvc++ 7.0 */
-# undef TY_I64
-# define TY_I64(str) TYDYAPPEND(str,i64)
-#endif
-        doc->filetimes.actime =
-            (time_t)( ( actime  - TY_I64(116444736000000000)) / 10000000 );
-
-        doc->filetimes.modtime =
-            (time_t)( ( modtime - TY_I64(116444736000000000)) / 10000000 );
-    }
-#endif
-
-    if ( fin != INVALID_HANDLE_VALUE )
-    {
-        StreamIn* in = MappedFileInput( doc, fin,
-                                        cfg( doc, TidyInCharEncoding ) );
-        if ( !in )
-        {
-            CloseHandle( fin );
-            return -ENOMEM;
-        }
-
-        status = TY_(DocParseStream)( doc, in );
-        freeMappedFileSource( &in->source, yes );
-        TY_(freeStreamIn)( in );
-    }
-    else /* Error message! */
-        TY_(FileError)( doc, filnam, TidyError );
-    return status;
-}
-
-#endif
-
-
-/*
- * local variables:
- * mode: c
- * indent-tabs-mode: nil
- * c-basic-offset: 4
- * eval: (c-set-offset 'substatement-open 0)
- * end:
- */

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/ac70cb0e/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.h
----------------------------------------------------------------------
diff --git a/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.h b/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.h
deleted file mode 100755
index 74ec059..0000000
--- a/DocFormats/3rdparty/external/w3c-tidy-html5/src/mappedio.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __TIDY_MAPPED_IO_H__
-#define __TIDY_MAPPED_IO_H__
-
-/* Interface to mmap style I/O
-
-   (c) 2006 (W3C) MIT, ERCIM, Keio University
-   See tidy.h for the copyright notice.
-
-*/
-
-#if defined(_WIN32)
-int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam );
-#endif
-
-#endif /* __TIDY_MAPPED_IO_H__ */

http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/ac70cb0e/DocFormats/3rdparty/external/w3c-tidy-html5/src/message.h
----------------------------------------------------------------------
diff --git a/DocFormats/3rdparty/external/w3c-tidy-html5/src/message.h b/DocFormats/3rdparty/external/w3c-tidy-html5/src/message.h
deleted file mode 100644
index 5c055df..0000000
--- a/DocFormats/3rdparty/external/w3c-tidy-html5/src/message.h
+++ /dev/null
@@ -1,201 +0,0 @@
-#ifndef __MESSAGE_H__
-#define __MESSAGE_H__
-
-/* message.h -- general message writing routines
-
-  (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
-  See tidy.h for the copyright notice.
-
-*/
-
-#include "forward.h"
-#include "tidy.h"  /* For TidyReportLevel */
-
-/* General message writing routines.
-** Each message is a single warning, error, etc.
-**
-** This routine will keep track of counts and,
-** if the caller has set a filter, it will be
-** called.  The new preferred way of handling
-** Tidy diagnostics output is either a) define
-** a new output sink or b) install a message
-** filter routine.
-**
-** Keeps track of ShowWarnings, ShowErrors, etc.
-*/
-
-ctmbstr TY_(ReleaseDate)(void);
-
-/* void TY_(ShowVersion)( TidyDocImpl* doc ); */
-void TY_(ReportUnknownOption)( TidyDocImpl* doc, ctmbstr option );
-void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
-void TY_(NeedsAuthorIntervention)( TidyDocImpl* doc );
-
-/* void TY_(HelloMessage)( TidyDocImpl* doc, ctmbstr date, ctmbstr filename ); */
-void TY_(ReportMarkupVersion)( TidyDocImpl* doc );
-void TY_(ReportNumWarnings)( TidyDocImpl* doc );
-
-void TY_(GeneralInfo)( TidyDocImpl* doc );
-/* void TY_(UnknownOption)( TidyDocImpl* doc, char c ); */
-/* void TY_(UnknownFile)( TidyDocImpl* doc, ctmbstr program, ctmbstr file ); */
-void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level );
-
-void TY_(ErrorSummary)( TidyDocImpl* doc );
-
-void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding);
-void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded);
-void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
-void TY_(ReportAttrError)( TidyDocImpl* doc, Node* node, AttVal* av, uint code );
-void TY_(ReportMissingAttr)( TidyDocImpl* doc, Node* node, ctmbstr name );
-
-#if SUPPORT_ACCESSIBILITY_CHECKS
-
-void TY_(ReportAccessWarning)( TidyDocImpl* doc, Node* node, uint code );
-void TY_(ReportAccessError)( TidyDocImpl* doc, Node* node, uint code );
-
-#endif
-
-void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code);
-void TY_(ReportWarning)(TidyDocImpl* doc, Node *element, Node *node, uint code);
-void TY_(ReportError)(TidyDocImpl* doc, Node* element, Node* node, uint code);
-void TY_(ReportFatal)(TidyDocImpl* doc, Node* element, Node* node, uint code);
-
-/* error codes for entities/numeric character references */
-
-#define MISSING_SEMICOLON            1
-#define MISSING_SEMICOLON_NCR        2
-#define UNKNOWN_ENTITY               3
-#define UNESCAPED_AMPERSAND          4
-#define APOS_UNDEFINED               5
-
-/* error codes for element messages */
-
-#define MISSING_ENDTAG_FOR           6
-#define MISSING_ENDTAG_BEFORE        7
-#define DISCARDING_UNEXPECTED        8
-#define NESTED_EMPHASIS              9
-#define NON_MATCHING_ENDTAG          10
-#define TAG_NOT_ALLOWED_IN           11
-#define MISSING_STARTTAG             12
-#define UNEXPECTED_ENDTAG            13
-#define USING_BR_INPLACE_OF          14
-#define INSERTING_TAG                15
-#define SUSPECTED_MISSING_QUOTE      16
-#define MISSING_TITLE_ELEMENT        17
-#define DUPLICATE_FRAMESET           18
-#define CANT_BE_NESTED               19
-#define OBSOLETE_ELEMENT             20
-#define PROPRIETARY_ELEMENT          21
-#define UNKNOWN_ELEMENT              22
-#define TRIM_EMPTY_ELEMENT           23
-#define COERCE_TO_ENDTAG             24
-#define ILLEGAL_NESTING              25
-#define NOFRAMES_CONTENT             26
-#define CONTENT_AFTER_BODY           27
-#define INCONSISTENT_VERSION         28
-#define MALFORMED_COMMENT            29
-#define BAD_COMMENT_CHARS            30
-#define BAD_XML_COMMENT              31
-#define BAD_CDATA_CONTENT            32
-#define INCONSISTENT_NAMESPACE       33
-#define DOCTYPE_AFTER_TAGS           34
-#define MALFORMED_DOCTYPE            35
-#define UNEXPECTED_END_OF_FILE       36
-#define DTYPE_NOT_UPPER_CASE         37
-#define TOO_MANY_ELEMENTS            38
-#define UNESCAPED_ELEMENT            39
-#define NESTED_QUOTATION             40
-#define ELEMENT_NOT_EMPTY            41
-#define ENCODING_IO_CONFLICT         42
-#define MIXED_CONTENT_IN_BLOCK       43
-#define MISSING_DOCTYPE              44
-#define SPACE_PRECEDING_XMLDECL      45
-#define TOO_MANY_ELEMENTS_IN         46
-#define UNEXPECTED_ENDTAG_IN         47
-#define REPLACING_ELEMENT            83
-#define REPLACING_UNEX_ELEMENT       84
-#define COERCE_TO_ENDTAG_WARN        85
-
-/* error codes used for attribute messages */
-
-#define UNKNOWN_ATTRIBUTE            48
-#define INSERTING_ATTRIBUTE          49
-#define MISSING_ATTR_VALUE           50
-#define BAD_ATTRIBUTE_VALUE          51
-#define UNEXPECTED_GT                52
-#define PROPRIETARY_ATTRIBUTE        53
-#define PROPRIETARY_ATTR_VALUE       54
-#define REPEATED_ATTRIBUTE           55
-#define MISSING_IMAGEMAP             56
-#define XML_ATTRIBUTE_VALUE          57
-#define UNEXPECTED_QUOTEMARK         58
-#define MISSING_QUOTEMARK            59
-#define ID_NAME_MISMATCH             60
-
-#define BACKSLASH_IN_URI             61
-#define FIXED_BACKSLASH              62
-#define ILLEGAL_URI_REFERENCE        63
-#define ESCAPED_ILLEGAL_URI          64
-
-#define NEWLINE_IN_URI               65
-#define ANCHOR_NOT_UNIQUE            66
-
-#define JOINING_ATTRIBUTE            68
-#define UNEXPECTED_EQUALSIGN         69
-#define ATTR_VALUE_NOT_LCASE         70
-#define XML_ID_SYNTAX                71
-
-#define INVALID_ATTRIBUTE            72
-
-#define BAD_ATTRIBUTE_VALUE_REPLACED 73
-
-#define INVALID_XML_ID               74
-#define UNEXPECTED_END_OF_FILE_ATTR  75
-#define MISSING_ATTRIBUTE            86
-#define WHITE_IN_URI                 87
-
-#define PREVIOUS_LOCATION            88 /* last */
-
-/* character encoding errors */
-
-#define VENDOR_SPECIFIC_CHARS        76
-#define INVALID_SGML_CHARS           77
-#define INVALID_UTF8                 78
-#define INVALID_UTF16                79
-#define ENCODING_MISMATCH            80
-#define INVALID_URI                  81
-#define INVALID_NCR                  82
-
-/* accessibility flaws */
-
-#define BA_MISSING_IMAGE_ALT       1
-#define BA_MISSING_LINK_ALT        2
-#define BA_MISSING_SUMMARY         4
-#define BA_MISSING_IMAGE_MAP       8
-#define BA_USING_FRAMES            16
-#define BA_USING_NOFRAMES          32
-#define BA_INVALID_LINK_NOFRAMES   64  /* WAI [6.5.1.4] */  
-#define BA_WAI                     (1 << 31)
-
-/* presentation flaws */
-
-#define USING_SPACER            1
-#define USING_LAYER             2
-#define USING_NOBR              4
-#define USING_FONT              8
-#define USING_BODY              16
-
-#define REPLACED_CHAR           0
-#define DISCARDED_CHAR          1
-
-/* badchar bit field */
-
-#define BC_VENDOR_SPECIFIC_CHARS   1
-#define BC_INVALID_SGML_CHARS      2
-#define BC_INVALID_UTF8            4
-#define BC_INVALID_UTF16           8
-#define BC_ENCODING_MISMATCH       16 /* fatal error */
-#define BC_INVALID_URI             32
-#define BC_INVALID_NCR             64
-
-#endif /* __MESSAGE_H__ */


Mime
View raw message