Browse Source

【同步】文字同步OC代码导入

lizhe 1 year ago
parent
commit
4f5fd2ee78
28 changed files with 18217 additions and 0 deletions
  1. 4 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift
  2. 32 0
      PDF Office/PDF Master/Class/Parsers/KMPDFSyncRecord.swift
  3. 622 0
      PDF Office/PDF Master/Class/Parsers/KMPDFSynchronizer.swift
  4. 52 0
      PDF Office/PDF Master/Class/Parsers/SKPDFSyncRecord.h
  5. 63 0
      PDF Office/PDF Master/Class/Parsers/SKPDFSyncRecord.m
  6. 90 0
      PDF Office/PDF Master/Class/Parsers/SKPDFSynchronizer.h
  7. 637 0
      PDF Office/PDF Master/Class/Parsers/SKPDFSynchronizer.m
  8. 2 0
      PDF Office/PDF Master/PDF_Reader_Pro DMG-Bridging-Header.h
  9. 2 0
      PDF Office/PDF Master/PDF_Reader_Pro Edition-Bridging-Header.h
  10. 2 0
      PDF Office/PDF Master/PDF_Reader_Pro-Bridging-Header.h
  11. 266 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/entries
  12. 346 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser.h.svn-base
  13. 4249 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser.m.svn-base
  14. 45 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_local.h.svn-base
  15. 141 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_readme.txt.svn-base
  16. 141 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_utils.h.svn-base
  17. 479 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_utils.m.svn-base
  18. 1 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_version.txt.svn-base
  19. 429 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser.h
  20. 8924 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser.m
  21. 554 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_advanced.h
  22. 45 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_local.h
  23. 204 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_readme.txt
  24. 163 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_utils.h
  25. 570 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_utils.m
  26. 1 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_version.txt
  27. 59 0
      PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_version.h
  28. 94 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

+ 4 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/PageDisplay/KMPageDisplayPropertiesViewController.swift

@@ -54,6 +54,8 @@ class KMPageDisplayPropertiesButton: NSButton {
     var readerModeBlock: ReaderModeCallBack?
     @IBOutlet weak var mainController: KMMainViewController?
     
+    @IBOutlet weak var contentView: NSClipView!
+    
     @IBOutlet private var pageLayoutLabel: NSTextField!
     @IBOutlet private var singlePageButton: KMPageDisplayPropertiesButton!
     @IBOutlet private var twoPagesButton: KMPageDisplayPropertiesButton!
@@ -112,6 +114,8 @@ class KMPageDisplayPropertiesButton: NSButton {
         super.viewDidLoad()
         // Do view setup here.
         
+        contentView.backgroundColor(NSColor.red)
+        
         themeCollectionView.register(KMPageDisplayThemeCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMPageDisplayThemeCollectionViewItem"))
         themeCollectionView.register(KMPageDisplayCustomThemesCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMPageDisplayCustomThemesCollectionViewItem"))
 

+ 32 - 0
PDF Office/PDF Master/Class/Parsers/KMPDFSyncRecord.swift

@@ -0,0 +1,32 @@
+//
+//  KMPDFSyncRecord.swift
+//  PDF Reader Pro
+//
+//  Created by lizhe on 2024/2/28.
+//
+
+import Cocoa
+
+class KMPDFSyncRecord: NSObject {
+    var recordIndex: Int = 0
+    var pageIndex: Int = 0
+    var point: NSPoint = NSZeroPoint
+    var file: String = ""
+    var line: Int = -1
+    var x: CGFloat {
+        get {
+            return point.x
+        }
+    }
+    
+    var y: CGFloat {
+        get {
+            return point.y
+        }
+    }
+    
+    init(recordIndex: Int) {
+        super.init()
+        self.recordIndex = recordIndex
+    }
+}

+ 622 - 0
PDF Office/PDF Master/Class/Parsers/KMPDFSynchronizer.swift

@@ -0,0 +1,622 @@
+//
+//  KMPDFSynchronizer.swift
+//  PDF Reader Pro
+//
+//  Created by lizhe on 2024/2/28.
+//
+
+import Cocoa
+
+enum KMPDFSynchronizerType: Int {
+    case defaultOptions = 0
+    case showReadingBarMask = 1
+    case flippedMask = 2
+}
+
+let PDFSYNC_TO_PDF: (CGFloat) -> CGFloat = { coord in
+    return CGFloat(coord) / 65536.0
+}
+
+let SKPDFSynchronizerPdfsyncExtension = "pdfsync"
+var SKPDFSynchronizerTexExtensions: [String] = ["tex", "ltx", "latex", "ctx", "lyx", "rnw"]
+
+let STACK_BUFFER_SIZE = 256
+
+func caseInsensitiveStringEqual(_ item1: UnsafeRawPointer, _ item2: UnsafeRawPointer, _ size: ((UnsafeRawPointer) -> Int)?) -> Bool {
+    return CFStringCompare(item1 as! CFString, item2 as! CFString, CFStringCompareFlags.compareCaseInsensitive) == CFComparisonResult.compareEqualTo
+}
+
+//func caseInsensitiveStringHash(item: UnsafeRawPointer, size: @escaping (UnsafeRawPointer) -> UInt) -> UInt {
+//    guard let item = item else { return 0 }
+//    
+//    var hash: UInt = 0
+//    let allocator = CFGetAllocator(item)
+//    let len = CFStringGetLength(item as! CFString)
+//    
+//    let STACK_BUFFER_SIZE = 1024 // 设置STACK_BUFFER_SIZE的值,以便与C代码匹配
+//    
+//    var buffer = [UniChar](repeating: 0, count: STACK_BUFFER_SIZE)
+//    let bufferPtr: UnsafeMutablePointer<UniChar>
+//    if len + 10 >= STACK_BUFFER_SIZE {
+//        bufferPtr = UnsafeMutablePointer<UniChar>(OpaquePointer(CFAllocatorAllocate(allocator, (len + 10) * MemoryLayout<UniChar>.size, 0)))
+//    } else {
+//        bufferPtr = UnsafeMutablePointer<UniChar>(mutating: buffer)
+//    }
+//    
+//    CFStringGetCharacters(item as! CFString, CFRange(location: 0, length: len), bufferPtr)
+//    
+//    let mutableString = CFStringCreateMutableWithExternalCharactersNoCopy(allocator, bufferPtr, len, len + 10, (bufferPtr != buffer ? allocator : kCFAllocatorNull))
+//    CFStringLowercase(mutableString, nil)
+//    hash = (mutableString as AnyObject).hash
+//    CFRelease(mutableString)
+//    
+//    if bufferPtr != buffer {
+//        CFAllocatorDeallocate(allocator, bufferPtr)
+//    }
+//    
+//    return hash
+//}
+
+protocol KMPDFSynchronizerDelegate: AnyObject {
+    func synchronizer(_ synchronizer: KMPDFSynchronizer, foundLine line: Int, inFile file: String)
+    func synchronizer(_ synchronizer: KMPDFSynchronizer, foundLocation point: NSPoint, atPageIndex pageIndex: UInt, options: Int)
+}
+
+class KMPDFSynchronizer: NSObject {
+    weak var delegate: KMPDFSynchronizerDelegate?
+    var fileName: String = ""
+    var shouldKeepRunning: Bool {
+        OSMemoryBarrier()
+        return shouldKeepRunningFlag == 1
+    }
+    
+    private var queue: DispatchQueue = DispatchQueue(label: "net.sourceforge.queue.KMPDFSynchronizer")
+    private var lockQueue: DispatchQueue = DispatchQueue(label: "net.sourceforge.lockQueue.KMPDFSynchronizer")
+    private var syncFileName: String = "" {
+        didSet {
+            if syncFileName.count == 0 {
+                lastModDate = nil
+            } else {
+                do {
+                    let attributes = try FileManager.default.attributesOfItem(atPath: syncFileName)
+                    lastModDate = attributes[.modificationDate] as? Date
+                } catch {
+                    
+                }
+            }
+        }
+    }
+    private var lastModDate: Date?
+    private var isPdfsync: Bool = true
+    private var fileManager: FileManager = FileManager()
+    private var pages: [Any] = []
+    private var lines: NSMapTable<AnyObject, AnyObject>?
+    private var filenames: NSMapTable<AnyObject, AnyObject>?
+    private var scanner: synctex_scanner_p?
+    private var shouldKeepRunningFlag: Int32 = 1
+    
+    func setFileName(_ newFileName: String) {
+        // We compare filenames in canonical form throughout, so we need to make sure fileName also is in canonical form
+        if let canonicalFileName = NSURL(fileURLWithPath: newFileName).resolvingSymlinksInPath?.standardizedFileURL.path {
+            DispatchQueue.global().async { [weak self] in
+                guard let self = self else { return }
+                self.lockQueue.sync {
+                    if self.fileName != canonicalFileName {
+                        if self.fileName != newFileName {
+                            self.syncFileName = ""
+                            self.lastModDate = nil
+                        }
+                        self.fileName = canonicalFileName
+                    }
+                }
+            }
+        }
+    }
+    
+    func terminate() {
+        delegate = nil
+        let originalValue = OSAtomicCompareAndSwap32Barrier(1, 0, &shouldKeepRunningFlag)
+        // originalValue 为原来的值,如果原来的值是 1,表示已经交换成功,如果是 0,表示没有成功交换
+        // 如果需要对返回值进行处理,可以在这里添加逻辑
+    }
+    
+    func findFileAndLine(forLocation point: NSPoint, inRect rect: NSRect, pageBounds bounds: NSRect, atPageIndex pageIndex: UInt) {
+        // Implement this method
+    }
+    
+    func findPageAndLocation(forLine line: Int, inFile file: String, options: Int) {
+        // Implement this method
+    }
+}
+
+//MARK: Support
+extension KMPDFSynchronizer {
+    func sourceFile(forFileName file: String, isTeX: Bool, removeQuotes: Bool) -> String {
+        var fileName = file
+        if removeQuotes && fileName.count > 2 && fileName.first == "\"" && fileName.last == "\"" {
+            fileName = String(fileName.dropFirst().dropLast())
+        }
+        if !(fileName as NSString).isAbsolutePath {
+            fileName = (self.fileName as NSString).deletingLastPathComponent + "/" + fileName
+        }
+        if isTeX && !FileManager.default.fileExists(atPath: fileName) && !SKPDFSynchronizerTexExtensions.contains((fileName as NSString).pathExtension.lowercased()) {
+            for ext in SKPDFSynchronizerTexExtensions {
+                let tryFile = fileName + "." + ext
+                if FileManager.default.fileExists(atPath: tryFile) {
+                    fileName = tryFile
+                    break
+                }
+            }
+        }
+        // Swift's `standardizedFileURL` property does both `resolvingSymlinksInPath` and `standardizingPath`
+        return URL(fileURLWithPath: fileName).standardizedFileURL.path
+    }
+    
+    func defaultSourceFile() -> String {
+        let file = (self.fileName as NSString).deletingPathExtension
+        for `extension` in SKPDFSynchronizerTexExtensions {
+            let tryFile = file + "." + `extension`
+            if FileManager.default.fileExists(atPath: tryFile) {
+                return tryFile
+            }
+        }
+        return file + "." + SKPDFSynchronizerTexExtensions.first!
+    }
+}
+
+//MARK: PDFSync
+extension KMPDFSynchronizer{
+    func recordForIndex(_ records: NSMapTable<AnyObject, AnyObject>, _ recordIndex: Int) -> KMPDFSyncRecord {
+        if let record = records.object(forKey: recordIndex as AnyObject) as? KMPDFSyncRecord {
+            return record
+        } else {
+            let record = KMPDFSyncRecord(recordIndex: recordIndex)
+            records.setObject(record, forKey: recordIndex as AnyObject)
+            return record
+        }
+    }
+    
+    func loadPdfsyncFile(_ theFileName: String) -> Bool {
+        pages.removeAll()
+        
+        if lines != nil {
+            lines?.removeAllObjects()
+        } else {
+//            let keyPointerFunctions = NSPointerFunctions(options: [.strongMemory, .objectPersonality])
+//            keyPointerFunctions.isEqualFunction = { (a, b) in
+//                caseInsensitiveStringEqual(a, b) { <#UnsafeRawPointer#> in
+//                    <#code#>
+//                }
+//                guard let strA = a as? String, let strB = b as? String else { return false }
+//                return strA.caseInsensitiveCompare(strB) == .orderedSame
+//            }
+//            keyPointerFunctions.hashFunction = { (ptr) in
+//                guard let str = ptr as? String else { return 0 }
+//                return str.hash
+//            }
+//            let valuePointerFunctions = NSPointerFunctions(options: [.strongMemory, .objectPersonality])
+//            lines = NSMapTable(keyPointerFunctions: keyPointerFunctions, valuePointerFunctions: valuePointerFunctions,capacity: 0)
+        }
+        
+        syncFileName = theFileName
+        isPdfsync = true
+        
+        guard let pdfsyncString = try? String(contentsOfFile: theFileName, encoding: .utf8) else { return false }
+        
+        var rv = false
+        
+        let records = NSMapTable<NSNumber, AnyObject>.strongToStrongObjects()
+        let files = NSMutableArray()
+        var recordIndex = 0, line = 0, pageIndex = 0
+        var x = 0.0, y = 0.0
+        var record: KMPDFSyncRecord?
+        var array: NSMutableArray?
+        var ch: unichar = 0
+        let sc = Scanner(string: pdfsyncString)
+        let newlines = CharacterSet.newlines
+        
+        sc.charactersToBeSkipped = CharacterSet.whitespaces
+        
+        var file: NSString?
+        var tryFile: String
+        
+        let scanString = sc.scanUpToCharacters(from: newlines)
+        let scanCharactersString = sc.scanCharacters(from: newlines)
+        if scanString?.count != 0 && scanCharactersString?.count != 0 {
+            file = sourceFile(forFileName: scanString! as String, isTeX: true, removeQuotes: true) as NSString
+            files.add(file!)
+            
+            array = NSMutableArray()
+            lines!.setObject(array!, forKey: file!)
+            
+            sc.scanString("version", into: nil)
+            sc.scanInt(nil)
+            sc.scanCharacters(from: newlines, into: nil)
+            
+//            while sc.shouldKeepRunning() && sc.scanCharacter(&ch) {
+//                switch ch {
+//                    case "l":
+//                        if sc.scanInt(&recordIndex) && sc.scanInt(&line) {
+//                            // we ignore the column
+//                            sc.scanInt(nil)
+//                            record = recordForIndex(records, recordIndex)
+//                            record!.file = file! as String
+//                            record!.line = line
+//                            lines!.object(forKey: file! as NSString)!.add(record!)
+//                        }
+//                    case "p":
+//                        // we ignore * and + modifiers
+//                        if !sc.scanString("*", into: nil) {
+//                            sc.scanString("+", into: nil)
+//                        }
+//                        if sc.scanInt(&recordIndex) && sc.scanDouble(&x) && sc.scanDouble(&y) {
+//                            record = recordForIndex(records, recordIndex)
+//                            record!.pageIndex = pages.count - 1
+//                            record!.point = NSMakePoint(CGFloat(PDFSYNC_TO_PDF(x) + pdfOffset.x), CGFloat(PDFSYNC_TO_PDF(y) + pdfOffset.y))
+//                            (pages.lastObject as! NSMutableArray).add(record!)
+//                        }
+//                    case "s":
+//                        // start of a new page, the scanned integer should always equal [pages count]+1
+//                        var tempPageIndex = 0
+//                        if !sc.scanInt(&tempPageIndex) {
+//                            pageIndex = pages.count + 1
+//                        } else {
+//                            pageIndex = tempPageIndex
+//                        }
+//                    while pageIndex > pages.count {
+//                            array = NSMutableArray()
+//                            pages.add(array!)
+//                        }
+//                    case "(":
+//                        // start of a new source file
+//                        var tempFile: NSString?
+//                        if sc.scanUpToCharacters(from: newlines, into: &tempFile as? String) {
+//                            file = sourceFile(forFileName: tempFile! as String, isTeX: true, removeQuotes: true) as NSString
+//                            files.add(file!)
+//                            if lines!.object(forKey: file!) == nil {
+//                                array = NSMutableArray()
+//                                lines!.setObject(array!, forKey: file!)
+//                            }
+//                        }
+//                    case ")":
+//                        // closing of a source file
+//                        if files.count > 0 {
+//                            files.removeLastObject()
+//                            file = files.lastObject as? NSString
+//                        }
+//                    default:
+//                        // shouldn't reach
+//                        break
+//                }
+//                
+//                sc.scanUpToCharacters(from: newlines, into: nil)
+//                sc.scanCharacters(from: newlines, into: nil)
+//            }
+            
+            let lineSortDescriptor = NSSortDescriptor(key: "line", ascending: true)
+            let lineSortDescriptors = [lineSortDescriptor]
+//            for array in lines!.objectEnumerator() {
+//                (array as! NSMutableArray).sort(using: lineSortDescriptors)
+//            }
+            for array in pages {
+                (array as! NSMutableArray).sort(using: [NSSortDescriptor(key: "y", ascending: false), NSSortDescriptor(key: "x", ascending: true)])
+            }
+            
+//            rv = sc.shouldKeepRunning
+        }
+        
+        return rv
+    }
+    
+    func pdfsyncFindFileLine(_ linePtr: inout Int, file filePtr: inout String?, forLocation point: NSPoint, inRect rect: NSRect, pageBounds bounds: NSRect, atPageIndex pageIndex: Int) -> Bool {
+        var rv = false
+        if pageIndex < pages.count {
+            
+            var record: KMPDFSyncRecord?
+            var beforeRecord: KMPDFSyncRecord?
+            var afterRecord: KMPDFSyncRecord?
+            var atRecords = [Double: KMPDFSyncRecord]()
+            
+//            for case let tempRecord as KMPDFSyncRecord in pages[pageIndex] {
+//                if tempRecord.line == 0 {
+//                    continue
+//                }
+//                let p = tempRecord.point
+//                if p.y > NSMaxY(rect) {
+//                    beforeRecord = tempRecord
+//                } else if p.y < NSMinY(rect) {
+//                    afterRecord = tempRecord
+//                    break
+//                } else if p.x < NSMinX(rect) {
+//                    beforeRecord = tempRecord
+//                } else if p.x > NSMaxX(rect) {
+//                    afterRecord = tempRecord
+//                    break
+//                } else {
+//                    atRecords[abs(p.x - point.x)] = tempRecord
+//                }
+//            }
+            
+            var nearestRecord: KMPDFSyncRecord?
+            if !atRecords.isEmpty {
+                let nearest = atRecords.keys.sorted()[0]
+                nearestRecord = atRecords[nearest]
+            } else if let beforeRecord = beforeRecord, let afterRecord = afterRecord {
+                let beforePoint = beforeRecord.point
+                let afterPoint = afterRecord.point
+                if beforePoint.y - point.y < point.y - afterPoint.y {
+                    nearestRecord = beforeRecord
+                } else if beforePoint.y - point.y > point.y - afterPoint.y {
+                    nearestRecord = afterRecord
+                } else if beforePoint.x - point.x < point.x - afterPoint.x {
+                    nearestRecord = beforeRecord
+                } else if beforePoint.x - point.x > point.x - afterPoint.x {
+                    nearestRecord = afterRecord
+                } else {
+                    nearestRecord = beforeRecord
+                }
+            } else if let beforeRecord = beforeRecord {
+                nearestRecord = beforeRecord
+            } else if let afterRecord = afterRecord {
+                nearestRecord = afterRecord
+            }
+            
+            if let record = nearestRecord {
+                linePtr = record.line
+                filePtr = record.file
+                rv = true
+            }
+        }
+        if !rv {
+            print("PDFSync was unable to find file and line.")
+        }
+        return rv
+    }
+    
+    func pdfsyncFindPage(_ pageIndexPtr: inout Int, location pointPtr: inout NSPoint, forLine line: Int, inFile file: String) -> Bool {
+        var rv = false
+        if let theLines = lines!.object(forKey: file as NSString) as? [KMPDFSyncRecord] {
+            
+            var record: KMPDFSyncRecord?
+            var beforeRecord: KMPDFSyncRecord?
+            var afterRecord: KMPDFSyncRecord?
+            var atRecord: KMPDFSyncRecord?
+            
+            for tempRecord in theLines {
+                if tempRecord.pageIndex == NSNotFound {
+                    continue
+                }
+                let l = tempRecord.line
+                if l < line {
+                    beforeRecord = tempRecord
+                } else if l > line {
+                    afterRecord = tempRecord
+                    break
+                } else {
+                    atRecord = tempRecord
+                    break
+                }
+            }
+            
+            if let atRecord = atRecord {
+                record = atRecord
+            } else if let beforeRecord = beforeRecord, let afterRecord = afterRecord {
+                let beforeLine = beforeRecord.line
+                let afterLine = afterRecord.line
+                if beforeLine - line > line - afterLine {
+                    record = afterRecord
+                } else {
+                    record = beforeRecord
+                }
+            } else if let beforeRecord = beforeRecord {
+                record = beforeRecord
+            } else if let afterRecord = afterRecord {
+                record = afterRecord
+            }
+            
+            if let record = record {
+                pageIndexPtr = record.pageIndex
+                pointPtr = record.point
+                rv = true
+            }
+        }
+        if !rv {
+            print("PDFSync was unable to find location and page.")
+        }
+        return rv
+    }
+}
+
+//MARK: SyncTeX
+extension KMPDFSynchronizer {
+    func loadSynctexFile(forFile theFileName: String) -> Bool {
+       var rv = false
+       if let scanner = scanner {
+           synctex_scanner_free(scanner)
+       }
+       scanner = synctex_scanner_new_with_output_file(theFileName.cString(using: .utf8), nil, 1)
+//       if let scanner = scanner {
+//           let fileRep = synctex_scanner_get_synctex(scanner)
+//           syncFileName = sourceFile(forFileName: String(cString: fileRep!), isTeX: false, removeQuotes: false)
+//           if let filenames = filenames {
+//               NSResetMapTable(filenames)
+//           } else {
+//               let keyPointerFunctions = NSPointerFunctions(options: [.strongMemory, .objectPersonality])
+//               keyPointerFunctions.isEqualFunction = { (a, b) in
+//                   guard let strA = a as? String, let strB = b as? String else { return false }
+//                   return strA.caseInsensitiveCompare(strB) == .orderedSame
+//               }
+//               keyPointerFunctions.hashFunction = { (ptr) in
+//                   guard let str = ptr as? String else { return 0 }
+//                   return str.hash
+//               }
+//               let valuePointerFunctions = NSPointerFunctions(options: [.mallocMemory, .cstringPersonality, .copyIn])
+//               filenames = NSMapTable(keyOptions: keyPointerFunctions, valueOptions: valuePointerFunctions)
+//           }
+//           var node = synctex_scanner_input(scanner)
+//           repeat {
+//               if let fileRep = synctex_scanner_get_name(scanner, synctex_node_tag(node)) {
+//                   filenames!.setObject(String(cString: fileRep), forKey: sourceFile(forFileName: String(cString: fileRep), isTeX: true, removeQuotes: false))
+//               }
+//           } while ((node = synctex_node_next(node)) != nil)
+//           isPdfsync = false
+//           rv = shouldKeepRunning
+//       }
+       return rv
+   }
+       
+   func synctexFindFileLine(_ linePtr: inout Int, file filePtr: inout String?, forLocation point: NSPoint, inRect rect: NSRect, pageBounds bounds: NSRect, atPageIndex pageIndex: Int) -> Bool {
+       var rv = false
+       if synctex_edit_query(scanner, Int32(pageIndex + 1), Float(Double(point.x)), Float(Double(NSMaxY(bounds) - point.y))) > 0 {
+           var node: synctex_node_p?
+           var file: UnsafePointer<Int8>?
+           while rv == false && (node = synctex_scanner_next_result(scanner)) != nil {
+               if let tempFile = synctex_scanner_get_name(scanner, synctex_node_tag(node)) {
+                   linePtr = Int(max(synctex_node_line(node), 1) - 1)
+                   filePtr = sourceFile(forFileName: String(cString: tempFile), isTeX: true, removeQuotes: false)
+                   rv = true
+               }
+           }
+       }
+       if rv == false {
+           NSLog("SyncTeX was unable to find file and line.")
+       }
+       return rv
+   }
+       
+    func synctexFindPage(pageIndexPtr: UnsafeMutablePointer<UInt>, pointPtr: UnsafeMutablePointer<CGPoint>, forLine line: Int, inFile file: String) -> Bool {
+        
+        guard let filenames = filenames else { return false }
+        
+        var rv = false
+//        var filename: UnsafeMutableRawPointer = NSMapGet(filenames, file) ?? UnsafeMutableRawPointer(<#Builtin.RawPointer#>)
+        //?? NSMapGet(filenames, (file as NSString).resolvingSymlinksInPath.standardizingPath)
+        
+//        if filename == nil {
+//            for fn in filenames.allKeys {
+//                if let fnString = fn as? String, fnString.lastPathComponent.caseInsensitiveCompare(file.lastPathComponent) == .orderedSame {
+//                    filename = NSMapGet(filenames, fn) as? UnsafePointer<Int8>
+//                    break
+//                }
+//            }
+//            
+//            if filename == nil {
+//                filename = (file as NSString).lastPathComponent.utf8String
+//            }
+//        }
+        
+//        if synctex_display_query(scanner, filename, Int32(line) + 1, 0, -1) > 0 {
+//            if let node = synctex_scanner_next_result(scanner) {
+//                let page = UInt(synctex_node_page(node))
+//                pageIndexPtr.pointee = max(page, 1) - 1
+//                pointPtr.pointee = CGPoint(x: CGFloat(synctex_node_visible_h(node)), y: CGFloat(synctex_node_visible_v(node)))
+//                rv = true
+//            }
+//        }
+        
+        if !rv {
+            NSLog("SyncTeX was unable to find location and page.")
+        }
+        
+        return rv
+    }
+}
+
+//MARK: Generic
+extension KMPDFSynchronizer {
+    func loadSyncFileIfNeeded() -> Bool {
+        let theFileName = fileName
+        var rv = false
+        
+        if theFileName.count != 0 {
+            var theSyncFileName = self.syncFileName
+            
+            var modDate: NSDate?
+            if theSyncFileName.count != 0 && fileManager.fileExists(atPath: theSyncFileName) {
+                do {
+                    let attributes = try FileManager.default.attributesOfItem(atPath: theFileName)
+                    modDate = attributes[.modificationDate] as? NSDate
+                } catch {
+                    
+                }
+                let currentModDate = self.lastModDate
+                
+                if (currentModDate != nil) && modDate?.compare(currentModDate!) != ComparisonResult.orderedDescending {
+                    rv = true
+                } else if (isPdfsync) {
+                    rv = self.loadPdfsyncFile(theSyncFileName)
+                } else {
+                    rv = self.loadSynctexFile(forFile: theFileName)
+                }
+            } else {
+                rv = self.loadSynctexFile(forFile: theFileName)
+                if rv == false {
+                    theSyncFileName = (theFileName as NSString).deletingPathExtension.stringByAppendingPathExtension("pdfsync")
+                    if fileManager.fileExists(atPath: theSyncFileName) {
+                        rv = self.loadPdfsyncFile(theSyncFileName)
+                    }
+                }
+            }
+        }
+        
+        if rv == false {
+            print("Unable to find or load synctex or pdfsync file.")
+        }
+        return rv
+    }
+    
+}
+
+//MARK: Finding API
+extension KMPDFSynchronizer {
+    func findFileAndLine(forLocation point: NSPoint, inRect rect: NSRect, pageBounds bounds: NSRect, atPageIndex pageIndex: Int) {
+           queue.async {
+               guard self.shouldKeepRunning, self.loadSyncFileIfNeeded() else { return }
+               
+               var foundLine = 0
+               var foundFile: String?
+               var success = false
+               
+               if self.isPdfsync {
+                   success = self.pdfsyncFindFileLine(&foundLine, file: &foundFile, forLocation: point, inRect: rect, pageBounds: bounds, atPageIndex: pageIndex)
+               } else {
+                   success = self.synctexFindFileLine(&foundLine, file: &foundFile, forLocation: point, inRect: rect, pageBounds: bounds, atPageIndex: pageIndex)
+               }
+               
+               if success, self.shouldKeepRunning {
+                   DispatchQueue.main.async {
+                       self.delegate?.synchronizer(self, foundLine: foundLine, inFile: foundFile ?? "")
+                   }
+               }
+           }
+       }
+       
+       func findPageAndLocation(forLine line: Int, inFile file: String?, options: Int) {
+           let fixedFile = file ?? defaultSourceFile()
+           
+//           queue.async {
+//               guard let fixedFile = fixedFile, self.shouldKeepRunning, self.loadSyncFileIfNeeded() else { return }
+//               
+//               var foundPageIndex = NSNotFound
+//               var foundPoint = NSZeroPoint
+//               var foundOptions = options
+//               
+//               if self.isPdfsync {
+//                   self.pdfsyncFindPage(&foundPageIndex, location: &foundPoint, forLine: line, inFile: fixedFile)
+//               } else {
+//                   self.synctexFindPage(&foundPageIndex, location: &foundPoint, forLine: line, inFile: fixedFile)
+//               }
+//               
+//               if self.shouldKeepRunning() {
+//                   if self.isPdfsync {
+//                       foundOptions &= ~KMPDFSynchronizerType.flippedMask
+//                   } else {
+//                       foundOptions |= KMPDFSynchronizerType.flippedMask
+//                   }
+//                   DispatchQueue.main.async {
+//                       self.delegate?.synchronizer(self, foundLocation: foundPoint, atPageIndex: foundPageIndex, options: foundOptions)
+//                   }
+//               }
+//           }
+       }
+}

+ 52 - 0
PDF Office/PDF Master/Class/Parsers/SKPDFSyncRecord.h

@@ -0,0 +1,52 @@
+//
+//  SKPDFSyncRecord.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 7/12/08.
+/*
+ This software is Copyright (c) 2008-2018
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface SKPDFSyncRecord : NSObject
+@property (nonatomic, readonly) NSInteger recordIndex;
+@property (nonatomic) NSInteger pageIndex;
+@property (nonatomic) NSPoint point;
+@property (nonatomic, readonly) CGFloat x, y;
+@property (nonatomic, retain) NSString *file;
+@property (nonatomic) NSInteger line;
+
+- (id)initWithRecordIndex:(NSInteger)aRecordIndex;
+
+@end

+ 63 - 0
PDF Office/PDF Master/Class/Parsers/SKPDFSyncRecord.m

@@ -0,0 +1,63 @@
+//
+//  SKPDFSyncRecord.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 7/12/08.
+/*
+ This software is Copyright (c) 2008-2018
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKPDFSyncRecord.h"
+
+@implementation SKPDFSyncRecord
+
+- (id)initWithRecordIndex:(NSInteger)aRecordIndex {
+    self = [super init];
+    if (self) {
+        _recordIndex = aRecordIndex;
+        _pageIndex = NSNotFound;
+        _point = NSZeroPoint;
+        _file = nil;
+        _line = -1;
+    }
+    return self;
+}
+
+- (CGFloat)x {
+    return _point.x;
+}
+
+- (CGFloat)y {
+    return _point.y;
+}
+
+@end

+ 90 - 0
PDF Office/PDF Master/Class/Parsers/SKPDFSynchronizer.h

@@ -0,0 +1,90 @@
+//
+//  SKPDFSynchronizer.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 4/21/07.
+/*
+ This software is Copyright (c) 2007-2018
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import "synctex_parser.h"
+
+enum {
+    SKPDFSynchronizerDefaultOptions = 0,
+    SKPDFSynchronizerShowReadingBarMask = 1 << 0,
+    SKPDFSynchronizerFlippedMask = 1 << 1,
+};
+
+@protocol SKPDFSynchronizerDelegate;
+
+@interface SKPDFSynchronizer : NSObject {
+    id <SKPDFSynchronizerDelegate> delegate;
+    
+    dispatch_queue_t queue;
+    dispatch_queue_t lockQueue;
+    
+    NSString *syncFileName;
+    
+    BOOL isPdfsync;
+    
+    NSFileManager *fileManager;
+    
+    NSMutableArray *pages;
+    NSMapTable *lines;
+    
+    NSMapTable *filenames;
+    synctex_scanner_p scanner;
+    
+    volatile int32_t shouldKeepRunning;
+}
+
+@property (nonatomic, strong) NSString *fileName;
+@property (nonatomic, strong) NSDate *lastModDate;
+@property (nonatomic, assign) id <SKPDFSynchronizerDelegate> delegate;
+@property (readonly) BOOL shouldKeepRunning;
+
+- (void)findFileAndLineForLocation:(NSPoint)point inRect:(NSRect)rect pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex;
+- (void)findPageAndLocationForLine:(NSInteger)line inFile:(NSString *)file options:(NSInteger)options;
+
+// this must be called to stop the DO server from running in the server thread
+- (void)terminate;
+
+@end
+
+
+@protocol SKPDFSynchronizerDelegate <NSObject>
+
+- (void)synchronizer:(SKPDFSynchronizer *)synchronizer foundLine:(NSInteger)line inFile:(NSString *)file;
+- (void)synchronizer:(SKPDFSynchronizer *)synchronizer foundLocation:(NSPoint)point atPageIndex:(NSUInteger)pageIndex options:(NSInteger)options;
+
+@end

+ 637 - 0
PDF Office/PDF Master/Class/Parsers/SKPDFSynchronizer.m

@@ -0,0 +1,637 @@
+//
+//  SKPDFSynchronizer.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 4/21/07.
+/*
+ This software is Copyright (c) 2007-2018
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "SKPDFSynchronizer.h"
+#import <libkern/OSAtomic.h>
+#import "SKPDFSyncRecord.h"
+//#import "NSCharacterSet_SKExtensions.h"
+//#import "NSScanner_SKExtensions.h"
+//#import <CoreFoundation/CoreFoundation.h>
+//#import "NSFileManager_SKExtensions.h"
+
+#define PDFSYNC_TO_PDF(coord) ((CGFloat)coord / 65536.0)
+
+// Offset of coordinates in PDFKit and what pdfsync tells us. Don't know what they are; is this implementation dependent?
+static NSPoint pdfOffset = {0.0, 0.0};
+
+#define SKPDFSynchronizerPdfsyncExtension @"pdfsync"
+static NSArray *SKPDFSynchronizerTexExtensions = nil;
+
+static BOOL caseInsensitiveStringEqual(const void *item1, const void *item2, NSUInteger (*size)(const void *item));
+static NSUInteger caseInsensitiveStringHash(const void *item, NSUInteger (*size)(const void *item));
+
+#pragma mark -
+
+@implementation SKPDFSynchronizer
+
+//@synthesize delegate;
+//@dynamic fileName, shouldKeepRunning;
+
++ (void)initialize {
+//    SKINITIALIZE;
+    SKPDFSynchronizerTexExtensions = [[NSArray alloc] initWithObjects:@"tex", @"ltx", @"latex", @"ctx", @"lyx", @"rnw", nil];
+}
+
+- (id)init {
+    self = [super init];
+    if (self) {
+        queue = NULL;
+        lockQueue = dispatch_queue_create("net.sourceforge.skim-app.lockQueue.SKPDFSynchronizer", NULL);
+        
+        syncFileName = nil;
+        isPdfsync = YES;
+        
+        pages = nil;
+        lines = nil;
+        
+        filenames = nil;
+        scanner = NULL;
+        
+        shouldKeepRunning = 1;
+        
+        // it is not safe to use the defaultManager on background threads
+        fileManager = [[NSFileManager alloc] init];
+    }
+    return self;
+}
+
+- (void)dealloc {
+//    SKDISPATCHDESTROY(queue);
+//    SKDISPATCHDESTROY(lockQueue);
+//    SKDESTROY(fileManager);
+//    SKDESTROY(pages);
+//    SKDESTROY(lines);
+//    SKDESTROY(filenames);
+//    SKDESTROY(fileName);
+//    SKDESTROY(syncFileName);
+//    SKDESTROY(lastModDate);
+//    if (scanner) synctex_scanner_free(scanner);
+//    scanner = NULL;
+//    [super dealloc];
+}
+
+- (void)terminate {
+    // make sure we're not calling our delegate
+    delegate = nil;
+    // set the stop flag immediately, so any running task may stop in its tracks
+    OSAtomicCompareAndSwap32Barrier(1, 0, (int32_t *)&shouldKeepRunning);
+}
+
+#pragma mark Thread safe accessors
+
+- (BOOL)shouldKeepRunning {
+    OSMemoryBarrier();
+    return shouldKeepRunning == 1;
+}
+
+- (void)setFileName:(NSString *)newFileName {
+    // we compare filenames in canonical form throughout, so we need to make sure fileName also is in canonical form
+    newFileName = [[newFileName stringByResolvingSymlinksInPath] stringByStandardizingPath];
+    _fileName = newFileName;
+}
+
+// this should only be used from the server thread
+- (void)setSyncFileName:(NSString *)newSyncFileName {
+    dispatch_async(lockQueue, ^{
+        syncFileName = newSyncFileName;
+        _lastModDate = (syncFileName ? [[fileManager attributesOfItemAtPath:syncFileName error:NULL] fileModificationDate] : nil);
+    });
+}
+
+#pragma mark Support
+
+- (NSString *)sourceFileForFileName:(NSString *)file isTeX:(BOOL)isTeX removeQuotes:(BOOL)removeQuotes {
+    if (removeQuotes && [file length] > 2 && [file characterAtIndex:0] == '"' && [file characterAtIndex:[file length] - 1] == '"')
+        file = [file substringWithRange:NSMakeRange(1, [file length] - 2)];
+    if ([file isAbsolutePath] == NO)
+        file = [[[self fileName] stringByDeletingLastPathComponent] stringByAppendingPathComponent:file];
+    if (isTeX && [fileManager fileExistsAtPath:file] == NO && [SKPDFSynchronizerTexExtensions containsObject:[[file pathExtension] lowercaseString]] == NO) {
+        for (NSString *extension in SKPDFSynchronizerTexExtensions) {
+            NSString *tryFile = [file stringByAppendingPathExtension:extension];
+            if ([fileManager fileExistsAtPath:tryFile]) {
+                file = tryFile;
+                break;
+            }
+        }
+    }
+    // the docs say -stringByStandardizingPath uses -stringByResolvingSymlinksInPath, but it doesn't 
+    return [[file stringByResolvingSymlinksInPath] stringByStandardizingPath];
+}
+
+- (NSString *)defaultSourceFile {
+    NSString *file = [[self fileName] stringByDeletingPathExtension];
+    for (NSString *extension in SKPDFSynchronizerTexExtensions) {
+        NSString *tryFile = [file stringByAppendingPathExtension:extension];
+        if ([fileManager fileExistsAtPath:tryFile])
+            return tryFile;
+    }
+    return [file stringByAppendingPathExtension:[SKPDFSynchronizerTexExtensions firstObject]];
+}
+
+#pragma mark PDFSync
+
+static inline SKPDFSyncRecord *recordForIndex(NSMapTable *records, NSInteger recordIndex) {
+    SKPDFSyncRecord *record = (__bridge SKPDFSyncRecord *)(NSMapGet(records, (const void *)recordIndex));
+    if (record == nil) {
+        record = [[SKPDFSyncRecord alloc] initWithRecordIndex:recordIndex];
+        NSMapInsert(records, (const void *)recordIndex, CFBridgingRetain(record));
+    }
+    return record;
+}
+
+- (BOOL)loadPdfsyncFile:(NSString *)theFileName {
+
+    if (pages)
+        [pages removeAllObjects];
+    else
+        pages = [[NSMutableArray alloc] init];
+    if (lines) {
+        [lines removeAllObjects];
+    } else {
+        NSPointerFunctions *keyPointerFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality];
+        [keyPointerFunctions setIsEqualFunction:&caseInsensitiveStringEqual];
+        [keyPointerFunctions setHashFunction:&caseInsensitiveStringHash];
+        NSPointerFunctions *valuePointerFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality];
+        lines = [[NSMapTable alloc] initWithKeyPointerFunctions:keyPointerFunctions valuePointerFunctions:valuePointerFunctions capacity:0];
+    }
+    
+    [self setSyncFileName:theFileName];
+    isPdfsync = YES;
+    
+    NSString *pdfsyncString = [NSString stringWithContentsOfFile:theFileName encoding:NSUTF8StringEncoding error:NULL];
+    BOOL rv = NO;
+    
+    if ([pdfsyncString length]) {
+        
+        NSMapTable *records = NSCreateMapTable(NSIntegerMapKeyCallBacks, NSObjectMapValueCallBacks, 0);
+        NSMutableArray *files = [[NSMutableArray alloc] init];
+        NSString *file;
+        NSInteger recordIndex, line, pageIndex;
+        double x, y;
+        SKPDFSyncRecord *record;
+        NSMutableArray *array;
+        unichar ch;
+        NSScanner *sc = [[NSScanner alloc] initWithString:pdfsyncString];
+        NSCharacterSet *newlines = [NSCharacterSet newlineCharacterSet];
+        
+        [sc setCharactersToBeSkipped:[NSCharacterSet whitespaceCharacterSet]];
+        
+        if ([sc scanUpToCharactersFromSet:newlines intoString:&file] &&
+            [sc scanCharactersFromSet:newlines intoString:NULL]) {
+            
+            file = [self sourceFileForFileName:file isTeX:YES removeQuotes:YES];
+            [files addObject:file];
+            
+            array = [[NSMutableArray alloc] init];
+            [lines setObject:array forKey:file];
+            
+            // we ignore the version
+            if ([sc scanString:@"version" intoString:NULL] && [sc scanInteger:NULL]) {
+                
+                [sc scanCharactersFromSet:newlines intoString:NULL];
+                
+                while ([self shouldKeepRunning] && [self scanCharacter:sc ch:&ch]) {
+                    
+                    switch (ch) {
+                        case 'l':
+                            if ([sc scanInteger:&recordIndex] && [sc scanInteger:&line]) {
+                                // we ignore the column
+                                [sc scanInteger:NULL];
+                                record = recordForIndex(records, recordIndex);
+                                [record setFile:file];
+                                [record setLine:line];
+                                [[lines objectForKey:file] addObject:record];
+                            }
+                            break;
+                        case 'p':
+                            // we ignore * and + modifiers
+                            if ([sc scanString:@"*" intoString:NULL] == NO)
+                                [sc scanString:@"+" intoString:NULL];
+                            if ([sc scanInteger:&recordIndex] && [sc scanDouble:&x] && [sc scanDouble:&y]) {
+                                record = recordForIndex(records, recordIndex);
+                                [record setPageIndex:[pages count] - 1];
+                                [record setPoint:NSMakePoint(PDFSYNC_TO_PDF(x) + pdfOffset.x, PDFSYNC_TO_PDF(y) + pdfOffset.y)];
+                                [[pages lastObject] addObject:record];
+                            }
+                            break;
+                        case 's':
+                            // start of a new page, the scanned integer should always equal [pages count]+1
+                            if ([sc scanInteger:&pageIndex] == NO) pageIndex = [pages count] + 1;
+                            while (pageIndex > (NSInteger)[pages count]) {
+                                array = [[NSMutableArray alloc] init];
+                                [pages addObject:array];
+                            }
+                            break;
+                        case '(':
+                            // start of a new source file
+                            if ([sc scanUpToCharactersFromSet:newlines intoString:&file]) {
+                                file = [self sourceFileForFileName:file isTeX:YES removeQuotes:YES];
+                                [files addObject:file];
+                                if ([lines objectForKey:file] == nil) {
+                                    array = [[NSMutableArray alloc] init];
+                                    [lines setObject:array forKey:file];
+                                }
+                            }
+                            break;
+                        case ')':
+                            // closing of a source file
+                            if ([files count]) {
+                                [files removeLastObject];
+                                file = [files lastObject];
+                            }
+                            break;
+                        default:
+                            // shouldn't reach
+                            break;
+                    }
+                    
+                    [sc scanUpToCharactersFromSet:newlines intoString:NULL];
+                    [sc scanCharactersFromSet:newlines intoString:NULL];
+                }
+                
+                NSSortDescriptor *lineSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"line" ascending:YES];
+                NSSortDescriptor *xSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"x" ascending:YES];
+                NSSortDescriptor *ySortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"y" ascending:NO];
+                NSArray *lineSortDescriptors = [NSArray arrayWithObjects:lineSortDescriptor, nil];
+                
+                for (array in [lines objectEnumerator])
+                    [array sortUsingDescriptors:lineSortDescriptors];
+                [pages makeObjectsPerformSelector:@selector(sortUsingDescriptors:)
+                                       withObject:[NSArray arrayWithObjects:ySortDescriptor, xSortDescriptor, nil]];
+                
+                rv = [self shouldKeepRunning];
+            }
+        }
+        
+        NSFreeMapTable(records);
+    }
+    
+    return rv;
+}
+
+- (BOOL)scanCharacter:(NSScanner *)scan ch:(unichar *)ch {
+    NSInteger location, length = [[scan string] length];
+    unichar character = 0;
+    BOOL success = NO;
+    for (location = [scan scanLocation]; success == NO && location < length; location++) {
+        character = [[scan string] characterAtIndex:location];
+        success = [[scan charactersToBeSkipped] characterIsMember:character] == NO;
+    }
+    if (success) {
+        if (ch != 0)
+            *ch = character;
+        [scan setScanLocation:location];
+    }
+    return success;
+}
+
+- (BOOL)pdfsyncFindFileLine:(NSInteger *)linePtr file:(NSString **)filePtr forLocation:(NSPoint)point inRect:(NSRect)rect pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex {
+    BOOL rv = NO;
+    if (pageIndex < [pages count]) {
+        
+        SKPDFSyncRecord *record = nil;
+        SKPDFSyncRecord *beforeRecord = nil;
+        SKPDFSyncRecord *afterRecord = nil;
+        NSMutableDictionary *atRecords = [NSMutableDictionary dictionary];
+        
+        for (record in [pages objectAtIndex:pageIndex]) {
+            if ([record line] == 0)
+                continue;
+            NSPoint p = [record point];
+            if (p.y > NSMaxY(rect)) {
+                beforeRecord = record;
+            } else if (p.y < NSMinY(rect)) {
+                afterRecord = record;
+                break;
+            } else if (p.x < NSMinX(rect)) {
+                beforeRecord = record;
+            } else if (p.x > NSMaxX(rect)) {
+                afterRecord = record;
+                break;
+            } else {
+                [atRecords setObject:record forKey:[NSNumber numberWithDouble:fabs(p.x - point.x)]];
+            }
+        }
+        
+        record = nil;
+        if ([atRecords count]) {
+            NSNumber *nearest = [[[atRecords allKeys] sortedArrayUsingSelector:@selector(compare:)] objectAtIndex:0];
+            record = [atRecords objectForKey:nearest];
+        } else if (beforeRecord && afterRecord) {
+            NSPoint beforePoint = [beforeRecord point];
+            NSPoint afterPoint = [afterRecord point];
+            if (beforePoint.y - point.y < point.y - afterPoint.y)
+                record = beforeRecord;
+            else if (beforePoint.y - point.y > point.y - afterPoint.y)
+                record = afterRecord;
+            else if (beforePoint.x - point.x < point.x - afterPoint.x)
+                record = beforeRecord;
+            else if (beforePoint.x - point.x > point.x - afterPoint.x)
+                record = afterRecord;
+            else
+                record = beforeRecord;
+        } else if (beforeRecord) {
+            record = beforeRecord;
+        } else if (afterRecord) {
+            record = afterRecord;
+        }
+        
+        if (record) {
+            *linePtr = [record line];
+            *filePtr = [record file];
+            rv = YES;
+        }
+    }
+    if (rv == NO)
+        NSLog(@"PDFSync was unable to find file and line.");
+    return rv;
+}
+
+- (BOOL)pdfsyncFindPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr forLine:(NSInteger)line inFile:(NSString *)file {
+    BOOL rv = NO;
+    NSArray *theLines = [lines objectForKey:file];
+    if (theLines) {
+        
+        SKPDFSyncRecord *record = nil;
+        SKPDFSyncRecord *beforeRecord = nil;
+        SKPDFSyncRecord *afterRecord = nil;
+        SKPDFSyncRecord *atRecord = nil;
+        
+        for (record in theLines) {
+            if ([record pageIndex] == NSNotFound)
+                continue;
+            NSInteger l = [record line];
+            if (l < line) {
+                beforeRecord = record;
+            } else if (l > line) {
+                afterRecord = record;
+                break;
+            } else {
+                atRecord = record;
+                break;
+            }
+        }
+        
+        if (atRecord) {
+            record = atRecord;
+        } else if (beforeRecord && afterRecord) {
+            NSInteger beforeLine = [beforeRecord line];
+            NSInteger afterLine = [afterRecord line];
+            if (beforeLine - line > line - afterLine)
+                record = afterRecord;
+            else
+                record = beforeRecord;
+        } else if (beforeRecord) {
+            record = beforeRecord;
+        } else if (afterRecord) {
+            record = afterRecord;
+        }
+        
+        if (record) {
+            *pageIndexPtr = [record pageIndex];
+            *pointPtr = [record point];
+            rv = YES;
+        }
+    }
+    if (rv == NO)
+        NSLog(@"PDFSync was unable to find location and page.");
+    return rv;
+}
+
+#pragma mark SyncTeX
+
+- (BOOL)loadSynctexFileForFile:(NSString *)theFileName {
+    BOOL rv = NO;
+    if (scanner)
+        synctex_scanner_free(scanner);
+    scanner = synctex_scanner_new_with_output_file([theFileName UTF8String], NULL, 1);
+    if (scanner) {
+        const char *fileRep = synctex_scanner_get_synctex(scanner);
+        [self setSyncFileName:[self sourceFileForFileName:[NSString stringWithUTF8String:fileRep] isTeX:NO removeQuotes:NO]];
+        if (filenames) {
+            NSResetMapTable(filenames);
+        } else {
+            NSPointerFunctions *keyPointerFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality];
+            [keyPointerFunctions setIsEqualFunction:&caseInsensitiveStringEqual];
+            [keyPointerFunctions setHashFunction:&caseInsensitiveStringHash];
+            NSPointerFunctions *valuePointerFunctions = [NSPointerFunctions pointerFunctionsWithOptions:NSPointerFunctionsMallocMemory | NSPointerFunctionsCStringPersonality | NSPointerFunctionsCopyIn];
+            filenames = [[NSMapTable alloc] initWithKeyPointerFunctions:keyPointerFunctions valuePointerFunctions:valuePointerFunctions capacity:0];
+        }
+        synctex_node_p node = synctex_scanner_input(scanner);
+        do {
+            if ((fileRep = synctex_scanner_get_name(scanner, synctex_node_tag(node)))) {
+                NSMapInsert(filenames, CFBridgingRetain([self sourceFileForFileName:[NSString stringWithUTF8String:fileRep] isTeX:YES removeQuotes:NO]), fileRep);
+            }
+        } while ((node = synctex_node_next(node)));
+        isPdfsync = NO;
+        rv = [self shouldKeepRunning];
+    }
+    return rv;
+}
+
+- (BOOL)synctexFindFileLine:(NSInteger *)linePtr file:(NSString **)filePtr forLocation:(NSPoint)point inRect:(NSRect)rect pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex {
+    BOOL rv = NO;
+    if (synctex_edit_query(scanner, (int)pageIndex + 1, point.x, NSMaxY(bounds) - point.y) > 0) {
+        synctex_node_p node;
+        const char *file;
+        while (rv == NO && (node = synctex_scanner_next_result(scanner))) {
+            if ((file = synctex_scanner_get_name(scanner, synctex_node_tag(node)))) {
+                *linePtr = MAX(synctex_node_line(node), 1) - 1;
+                *filePtr = [self sourceFileForFileName:[NSString stringWithUTF8String:file] isTeX:YES removeQuotes:NO];
+                rv = YES;
+            }
+        }
+    }
+    if (rv == NO)
+        NSLog(@"SyncTeX was unable to find file and line.");
+    return rv;
+}
+
+- (BOOL)synctexFindPage:(NSUInteger *)pageIndexPtr location:(NSPoint *)pointPtr forLine:(NSInteger)line inFile:(NSString *)file {
+    BOOL rv = NO;
+    char *filename = NSMapGet(filenames, CFBridgingRetain(file)) ?: NSMapGet(filenames, CFBridgingRetain([[file stringByResolvingSymlinksInPath] stringByStandardizingPath]));
+    if (filename == NULL) {
+        for (NSString *fn in filenames) {
+            if ([[fn lastPathComponent] caseInsensitiveCompare:[file lastPathComponent]] == NSOrderedSame) {
+                filename = NSMapGet(filenames, CFBridgingRetain(file));
+                break;
+            }
+        }
+        if (filename == NULL)
+            filename = (char *)[[file lastPathComponent] UTF8String];
+    }
+    if (synctex_display_query(scanner, filename, (int)line + 1, 0, -1) > 0) {
+        synctex_node_p node = synctex_scanner_next_result(scanner);
+        if (node) {
+            NSUInteger page = synctex_node_page(node);
+            *pageIndexPtr = MAX(page, 1ul) - 1;
+            *pointPtr = NSMakePoint(synctex_node_visible_h(node), synctex_node_visible_v(node));
+            rv = YES;
+        }
+    }
+    if (rv == NO)
+        NSLog(@"SyncTeX was unable to find location and page.");
+    return rv;
+}
+
+#pragma mark Generic
+
+- (BOOL)loadSyncFileIfNeeded {
+    NSString *theFileName = [self fileName];
+    BOOL rv = NO;
+    
+    if (theFileName) {
+        NSString *theSyncFileName = syncFileName;
+        
+        if (theSyncFileName && [fileManager fileExistsAtPath:theSyncFileName]) {
+            NSDate *modDate = [[fileManager attributesOfItemAtPath:theFileName error:NULL] fileModificationDate];
+            NSDate *currentModDate = self.lastModDate;
+        
+            if (currentModDate && [modDate compare:currentModDate] != NSOrderedDescending)
+                rv = YES;
+            else if (isPdfsync)
+                rv = [self loadPdfsyncFile:theSyncFileName];
+            else
+                rv = [self loadSynctexFileForFile:theFileName];
+        } else {
+            rv = [self loadSynctexFileForFile:theFileName];
+            if (rv == NO) {
+                theSyncFileName = [[theFileName stringByDeletingPathExtension] stringByAppendingPathExtension:SKPDFSynchronizerPdfsyncExtension];
+                if ([fileManager fileExistsAtPath:theSyncFileName])
+                    rv = [self loadPdfsyncFile:theSyncFileName];
+            }
+        }
+    }
+    if (rv == NO)
+        NSLog(@"Unable to find or load synctex or pdfsync file.");
+    return rv;
+}
+
+#pragma mark Queue
+
+- (dispatch_queue_t)queue {
+    if (queue == NULL)
+        queue = dispatch_queue_create("net.sourceforge.skim-app.queue.SKPDFSynchronizer", NULL);
+    return queue;
+}
+
+#pragma mark Finding API
+
+- (void)findFileAndLineForLocation:(NSPoint)point inRect:(NSRect)rect pageBounds:(NSRect)bounds atPageIndex:(NSUInteger)pageIndex {
+    dispatch_async([self queue], ^{
+        if ([self shouldKeepRunning] && [self loadSyncFileIfNeeded]) {
+            NSInteger foundLine = 0;
+            NSString *foundFile = nil;
+            BOOL success = NO;
+            
+            if (isPdfsync)
+                success = [self pdfsyncFindFileLine:&foundLine file:&foundFile forLocation:point inRect:rect pageBounds:bounds atPageIndex:pageIndex];
+            else
+                success = [self synctexFindFileLine:&foundLine file:&foundFile forLocation:point inRect:rect pageBounds:bounds atPageIndex:pageIndex];
+            
+            if (success && [self shouldKeepRunning]) {
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [delegate synchronizer:self foundLine:foundLine inFile:foundFile];
+                });
+            }
+        }
+    });
+}
+
+- (void)findPageAndLocationForLine:(NSInteger)line inFile:(NSString *)file options:(NSInteger)options {
+    if (file == nil)
+        file = [self defaultSourceFile];
+    dispatch_async([self queue], ^{
+        if (file && [self shouldKeepRunning] && [self loadSyncFileIfNeeded]) {
+            NSUInteger foundPageIndex = NSNotFound;
+            NSPoint foundPoint = NSZeroPoint;
+            NSInteger foundOptions = options;
+            BOOL success = NO;
+            NSString *fixedFile = [self sourceFileForFileName:file isTeX:YES removeQuotes:NO];
+            
+            if (isPdfsync)
+                success = [self pdfsyncFindPage:&foundPageIndex location:&foundPoint forLine:line inFile:fixedFile];
+            else
+                success = [self synctexFindPage:&foundPageIndex location:&foundPoint forLine:line inFile:fixedFile];
+            
+            if (success && [self shouldKeepRunning]) {
+                if (isPdfsync)
+                    foundOptions &= ~SKPDFSynchronizerFlippedMask;
+                else
+                    foundOptions |= SKPDFSynchronizerFlippedMask;
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [delegate synchronizer:self foundLocation:foundPoint atPageIndex:foundPageIndex options:foundOptions];
+                });
+            }
+        }
+    });
+}
+
+@end
+
+#pragma mark -
+
+#define STACK_BUFFER_SIZE 256
+
+static BOOL caseInsensitiveStringEqual(const void *item1, const void *item2, NSUInteger (*size)(const void *item)) {
+    return CFStringCompare(item1, item2, kCFCompareCaseInsensitive | kCFCompareNonliteral) == kCFCompareEqualTo;
+}
+
+static NSUInteger caseInsensitiveStringHash(const void *item, NSUInteger (*size)(const void *item)) {
+    if(item == NULL) return 0;
+    
+    NSUInteger hash = 0;
+    CFAllocatorRef allocator = CFGetAllocator(item);
+    CFIndex len = CFStringGetLength(item);
+    
+    // use a generous length, in case the lowercase changes the number of characters
+    UniChar *buffer, stackBuffer[STACK_BUFFER_SIZE];
+    if (len + 10 >= STACK_BUFFER_SIZE)
+        buffer = (UniChar *)CFAllocatorAllocate(allocator, (len + 10) * sizeof(UniChar), 0);
+    else
+        buffer = stackBuffer;
+    CFStringGetCharacters(item, CFRangeMake(0, len), buffer);
+    
+    // If we create the string with external characters, CFStringGetCharactersPtr is guaranteed to succeed; since we're going to call CFStringGetCharacters anyway in fastHash if CFStringGetCharactsPtr fails, let's do it now when we lowercase the string
+    CFMutableStringRef mutableString = CFStringCreateMutableWithExternalCharactersNoCopy(allocator, buffer, len, len + 10, (buffer != stackBuffer ? allocator : kCFAllocatorNull));
+    CFStringLowercase(mutableString, NULL);
+    hash = [(id)CFBridgingRelease(mutableString) hash];
+    // if we used the allocator, this should free the buffer for us
+    CFRelease(mutableString);
+    return hash;
+}

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro DMG-Bridging-Header.h

@@ -106,3 +106,5 @@
 #import "SKBookmark.h"
 
 #import "AutoSavePopController.h"
+//同步
+#import "synctex_parser.h"

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro Edition-Bridging-Header.h

@@ -102,3 +102,5 @@
 #import "SKBookmark.h"
 
 #import "AutoSavePopController.h"
+//同步
+#import "synctex_parser.h"

+ 2 - 0
PDF Office/PDF Master/PDF_Reader_Pro-Bridging-Header.h

@@ -102,3 +102,5 @@
 #import "SKBookmark.h"
 
 #import "AutoSavePopController.h"
+//同步
+#import "synctex_parser.h"

+ 266 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/entries

@@ -0,0 +1,266 @@
+10
+
+dir
+8186
+svn://svn.code.sf.net/p/skim-app/code/trunk/vendorsrc/jeromelaurens/synctex-parser
+svn://svn.code.sf.net/p/skim-app/code
+
+
+
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0fceea05-a30d-0410-8a8b-80ef821fb0a1
+
+synctex_parser.h
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+a8dd34c6a659db1f9659c2f5bc3254cf
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+15245
+
+synctex_parser_utils.h
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+a717f32965723c832ff2a880a43331a7
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+5315
+
+synctex_parser.m
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+d678ba133ccbc821632d3265f8a585bd
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+158347
+
+synctex_parser_readme.txt
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+b655e073c76584fba5a8595cbdedd5b4
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+6031
+
+synctex_parser_utils.m
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+ccf13e97baf7555e57b52bf1eb7a1356
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+16394
+
+synctex_parser_local.h
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+4c1b69fde38194c3731063958795014c
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1738
+
+synctex_parser_version.txt
+file
+
+
+
+
+2013-09-17T09:38:43.000000Z
+695ec0ee7352c033530309d0ad3418cb
+2011-10-12T18:40:24.747904Z
+7515
+hofman
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4
+

+ 346 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser.h.svn-base

@@ -0,0 +1,346 @@
+/* 
+Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the SyncTeX package.
+
+Latest Revision: Tue Jun 14 08:23:30 UTC 2011
+
+Version: 1.16
+
+See synctex_parser_readme.txt for more details
+
+License:
+--------
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
+*/
+
+#ifndef __SYNCTEX_PARSER__
+#   define __SYNCTEX_PARSER__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*  synctex_node_t is the type for all synctex nodes.
+ *  The synctex file is parsed into a tree of nodes, either sheet, boxes, math nodes... */
+typedef struct _synctex_node *  synctex_node_t;
+
+/*  The main synctex object is a scanner
+ *  Its implementation is considered private.
+ *  The basic workflow is
+ * - create a "synctex scanner" with the contents of a file
+ * - perform actions on that scanner like display or edit queries
+ * - free the scanner when the work is done
+ */
+typedef struct __synctex_scanner_t _synctex_scanner_t;
+typedef _synctex_scanner_t *  synctex_scanner_t;
+
+/*  This is the designated method to create a new synctex scanner object.
+ *  output is the pdf/dvi/xdv file associated to the synctex file.
+ *  If necessary, it can be the tex file that originated the synctex file
+ *  but this might cause problems if the \jobname has a custom value.
+ *  Despite this method can accept a relative path in practice,
+ *  you should only pass a full path name.
+ *  The path should be encoded by the underlying file system,
+ *  assuming that it is based on 8 bits characters, including UTF8,
+ *  not 16 bits nor 32 bits.
+ *  The last file extension is removed and replaced by the proper extension.
+ *  Then the private method _synctex_scanner_new_with_contents_of_file is called.
+ *  NULL is returned in case of an error or non existent file.
+ *  Once you have a scanner, use the synctex_display_query and synctex_edit_query below.
+ *	The new "build_directory" argument is available since version 1.5.
+ *	It is the directory where all the auxiliary stuff is created.
+ *	Sometimes, the synctex output file and the pdf, dvi or xdv files are not created in the same directory.
+ *	This is the case in MikTeX (I will include this into TeX Live).
+ *	This directory path can be nil, it will be ignored then.
+ *	It can be either absolute or relative to the directory of the output pdf (dvi or xdv) file.
+ *	If no synctex file is found in the same directory as the output file, then we try to find one in the build directory.
+ *  Please note that this new "build_directory" is provided as a convenient argument but should not be used.
+ *  In fact, this is implempented as a work around of a bug in MikTeX where the synctex file does not follow the pdf file.
+ *  The new "parse" argument is available since version 1.5. In general, use 1.
+ *  Use 0 only if you do not want to parse the content but just check the existence.
+ */
+synctex_scanner_t synctex_scanner_new_with_output_file(const char * output, const char * build_directory, int parse);
+
+/*  This is the designated method to delete a synctex scanner object.
+ *  Frees all the memory, you must call it when you are finished with the scanner.
+ */
+void synctex_scanner_free(synctex_scanner_t scanner);
+
+/*  Send this message to force the scanner to parse the contents of the synctex output file.
+ *  Nothing is performed if the file was already parsed.
+ *  In each query below, this message is sent, but if you need to access information more directly,
+ *  you must be sure that the parsing did occur.
+ *  Usage:
+ *		if((my_scanner = synctex_scanner_parse(my_scanner))) {
+ *			continue with my_scanner...
+ *		} else {
+ *			there was a problem
+ *		}
+ */
+synctex_scanner_t synctex_scanner_parse(synctex_scanner_t scanner);
+
+/*  The main entry points.
+ *  Given the file name, a line and a column number, synctex_display_query returns the number of nodes
+ *  satisfying the contrain. Use code like
+ *
+ *     if(synctex_display_query(scanner,name,line,column)>0) {
+ *         synctex_node_t node;
+ *         while((node = synctex_next_result(scanner))) {
+ *             // do something with node
+ *             ...
+ *         }
+ *     }
+ *
+ *  For example, one can
+ * - highlight each resulting node in the output, using synctex_node_h and synctex_node_v
+ * - highlight all the rectangles enclosing those nodes, using synctex_box_... functions
+ * - highlight just the character using that information
+ *
+ *  Given the page and the position in the page, synctex_edit_query returns the number of nodes
+ *  satisfying the contrain. Use code like
+ *
+ *     if(synctex_edit_query(scanner,page,h,v)>0) {
+ *         synctex_node_t node;
+ *         while(node = synctex_next_result(scanner)) {
+ *             // do something with node
+ *             ...
+ *         }
+ *     }
+ *
+ *  For example, one can
+ * - highlight each resulting line in the input,
+ * - highlight just the character using that information
+ *
+ *  page is 1 based
+ *  h and v are coordinates in 72 dpi unit, relative to the top left corner of the page.
+ *  If you make a new query, the result of the previous one is discarded.
+ *  If one of this function returns a non positive integer,
+ *  it means that an error occurred.
+ *
+ *  Both methods are conservative, in the sense that matching is weak.
+ *  If the exact column number is not found, there will be an answer with the whole line.
+ *
+ *  Sumatra-PDF, Skim, iTeXMac2 and Texworks are examples of open source software that use this library.
+ *  You can browse their code for a concrete implementation.
+ */
+int synctex_display_query(synctex_scanner_t scanner,const char *  name,int line,int column);
+int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v);
+synctex_node_t synctex_next_result(synctex_scanner_t scanner);
+
+/*  Display all the information contained in the scanner object.
+ *  If the records are too numerous, only the first ones are displayed.
+ *  This is mainly for informatinal purpose to help developers.
+ */
+void synctex_scanner_display(synctex_scanner_t scanner);
+
+/*  The x and y offset of the origin in TeX coordinates. The magnification
+   These are used by pdf viewers that want to display the real box size.
+   For example, getting the horizontal coordinates of a node would require
+   synctex_node_box_h(node)*synctex_scanner_magnification(scanner)+synctex_scanner_x_offset(scanner)
+   Getting its TeX width would simply require
+   synctex_node_box_width(node)*synctex_scanner_magnification(scanner)
+   but direct methods are available for that below.
+ */
+int synctex_scanner_x_offset(synctex_scanner_t scanner);
+int synctex_scanner_y_offset(synctex_scanner_t scanner);
+float synctex_scanner_magnification(synctex_scanner_t scanner);
+
+/*  Managing the input file names.
+ *  Given a tag, synctex_scanner_get_name will return the corresponding file name.
+ *  Conversely, given a file name, synctex_scanner_get_tag will retur, the corresponding tag.
+ *  The file name must be the very same as understood by TeX.
+ *  For example, if you \input myDir/foo.tex, the file name is myDir/foo.tex.
+ *  No automatic path expansion is performed.
+ *  Finally, synctex_scanner_input is the first input node of the scanner.
+ *  To browse all the input node, use a loop like
+ *
+ *     if((input_node = synctex_scanner_input(scanner))){
+ *         do {
+ *             blah
+ *         } while((input_node=synctex_node_sibling(input_node)));
+ *     }
+ *
+ *  The output is the name that was used to create the scanner.
+ *  The synctex is the real name of the synctex file,
+ *  it was obtained from output by setting the proper file extension.
+ */
+const char * synctex_scanner_get_name(synctex_scanner_t scanner,int tag);
+int synctex_scanner_get_tag(synctex_scanner_t scanner,const char * name);
+synctex_node_t synctex_scanner_input(synctex_scanner_t scanner);
+const char * synctex_scanner_get_output(synctex_scanner_t scanner);
+const char * synctex_scanner_get_synctex(synctex_scanner_t scanner);
+
+/*  Browsing the nodes
+ *  parent, child and sibling are standard names for tree nodes.
+ *  The parent is one level higher, the child is one level deeper,
+ *  and the sibling is at the same level.
+ *  The sheet of a node is the first ancestor, it is of type sheet.
+ *  A node and its sibling have the same parent.
+ *  A node is the parent of its child.
+ *  A node is either the child of its parent,
+ *  or belongs to the sibling chain of its parent's child.
+ *  The next node is either the child, the sibling or the parent's sibling,
+ *  unless the parent is a sheet.
+ *  This allows to navigate through all the nodes of a given sheet node:
+ *
+ *     synctex_node_t node = sheet;
+ *     while((node = synctex_node_next(node))) {
+ *         // do something with node
+ *     }
+ *
+ *  With synctex_sheet_content, you can retrieve the sheet node given the page.
+ *  The page is 1 based, according to TeX standards.
+ *  Conversely synctex_node_sheet allows to retrieve the sheet containing a given node.
+ */
+synctex_node_t synctex_node_parent(synctex_node_t node);
+synctex_node_t synctex_node_sheet(synctex_node_t node);
+synctex_node_t synctex_node_child(synctex_node_t node);
+synctex_node_t synctex_node_sibling(synctex_node_t node);
+synctex_node_t synctex_node_next(synctex_node_t node);
+synctex_node_t synctex_sheet_content(synctex_scanner_t scanner,int page);
+
+/*  These are the types of the synctex nodes */
+typedef enum {
+	synctex_node_type_error = 0,
+	synctex_node_type_input,
+	synctex_node_type_sheet,
+	synctex_node_type_vbox,
+	synctex_node_type_void_vbox,
+	synctex_node_type_hbox,
+	synctex_node_type_void_hbox,
+	synctex_node_type_kern,
+	synctex_node_type_glue,
+	synctex_node_type_math,
+	synctex_node_type_boundary,
+	synctex_node_number_of_types
+} synctex_node_type_t;
+
+/*  synctex_node_type gives the type of a given node,
+ *  synctex_node_isa gives the same information as a human readable text. */
+synctex_node_type_t synctex_node_type(synctex_node_t node);
+const char * synctex_node_isa(synctex_node_t node);
+
+/*  This is primarily used for debugging purpose.
+ *  The second one logs information for the node and recursively displays information for its next node */
+void synctex_node_log(synctex_node_t node);
+void synctex_node_display(synctex_node_t node);
+
+/*  Given a node, access to its tag, line and column.
+ *  The line and column numbers are 1 based.
+ *  The latter is not yet fully supported in TeX, the default implementation returns 0 which means the whole line.
+ *  When the tag is known, the scanner of the node will give the corresponding file name.
+ *  When the tag is known, the scanner of the node will give the name.
+ */
+int synctex_node_tag(synctex_node_t node);
+int synctex_node_line(synctex_node_t node);
+int synctex_node_column(synctex_node_t node);
+
+/*  This is the page where the node appears.
+ *  This is a 1 based index as given by TeX.
+ */
+int synctex_node_page(synctex_node_t node);
+
+/*  For quite all nodes, horizontal, vertical coordinates, and width.
+ *  These are expressed in TeX small points coordinates, with origin at the top left corner.
+ */
+int synctex_node_h(synctex_node_t node);
+int synctex_node_v(synctex_node_t node);
+int synctex_node_width(synctex_node_t node);
+
+/*  For all nodes, dimensions of the enclosing box.
+ *  These are expressed in TeX small points coordinates, with origin at the top left corner.
+ *  A box is enclosing itself.
+ */
+int synctex_node_box_h(synctex_node_t node);
+int synctex_node_box_v(synctex_node_t node);
+int synctex_node_box_width(synctex_node_t node);
+int synctex_node_box_height(synctex_node_t node);
+int synctex_node_box_depth(synctex_node_t node);
+
+/*  For quite all nodes, horizontal, vertical coordinates, and width.
+ *  The visible dimensions are bigger than real ones to compensate 0 width boxes
+ *  that do contain nodes.
+ *  These are expressed in page coordinates, with origin at the top left corner.
+ *  A box is enclosing itself.
+ */
+float synctex_node_visible_h(synctex_node_t node);
+float synctex_node_visible_v(synctex_node_t node);
+float synctex_node_visible_width(synctex_node_t node);
+/*  For all nodes, visible dimensions of the enclosing box.
+ *  A box is enclosing itself.
+ *  The visible dimensions are bigger than real ones to compensate 0 width boxes
+ *  that do contain nodes.
+ */
+float synctex_node_box_visible_h(synctex_node_t node);
+float synctex_node_box_visible_v(synctex_node_t node);
+float synctex_node_box_visible_width(synctex_node_t node);
+float synctex_node_box_visible_height(synctex_node_t node);
+float synctex_node_box_visible_depth(synctex_node_t node);
+
+/*  The main synctex updater object.
+ *  This object is used to append information to the synctex file.
+ *  Its implementation is considered private.
+ *  It is used by the synctex command line tool to take into account modifications
+ *  that could occur while postprocessing files by dvipdf like filters.
+ */
+typedef struct __synctex_updater_t _synctex_updater_t;
+typedef _synctex_updater_t * synctex_updater_t;
+
+/*  Designated initializer.
+ *  Once you are done with your whole job,
+ *  free the updater */
+synctex_updater_t synctex_updater_new_with_output_file(const char * output, const char * directory);
+
+/*  Use the next functions to append records to the synctex file,
+ *  no consistency tests made on the arguments */
+void synctex_updater_append_magnification(synctex_updater_t updater, char *  magnification);
+void synctex_updater_append_x_offset(synctex_updater_t updater, char *  x_offset);
+void synctex_updater_append_y_offset(synctex_updater_t updater, char *  y_offset);
+
+/*  You MUST free the updater, once everything is properly appended */
+void synctex_updater_free(synctex_updater_t updater);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

File diff suppressed because it is too large
+ 4249 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser.m.svn-base


+ 45 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_local.h.svn-base

@@ -0,0 +1,45 @@
+/* 
+Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the SyncTeX package.
+
+Latest Revision: Tue Jun 14 08:23:30 UTC 2011
+
+Version: 1.16
+
+See synctex_parser_readme.txt for more details
+
+License:
+--------
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+*/
+
+/* This local header file is for TEXLIVE, use your own header to fit your system */
+#   include <w2c/c-auto.h> /* for inline && HAVE_xxx */
+/*	No inlining for synctex tool in texlive. */
+#	define SYNCTEX_INLINE

+ 141 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_readme.txt.svn-base

@@ -0,0 +1,141 @@
+This file is part of the SyncTeX package.
+
+The Synchronization TeXnology named SyncTeX is a new feature
+of recent TeX engines designed by Jerome Laurens.
+It allows to synchronize between input and output, which means to
+navigate from the source document to the typeset material and vice versa.
+More informations on http://itexmac2.sourceforge.net/SyncTeX.html
+
+This package is mainly for developers, it mainly contains the following files:
+
+synctex_parser_readme.txt
+synctex_parser_version.txt
+synctex_parser_utils.c
+synctex_parser_utils.h
+synctex_parser_local.h
+synctex_parser.h
+synctex_parser.c
+
+The file you are reading contains more informations about the SyncTeX parser history.
+
+In order to support SyncTeX in a viewer, it is sufficient to include
+in the source the files synctex_parser.h and synctex_parser.c.
+The synctex parser usage is described in synctex_parser.h header file.
+
+The other files are used by tex engines or by the synctex command line utility:
+
+ChangeLog
+README.txt
+am
+man1
+man5
+synctex-common.h
+synctex-convert.sh
+synctex-e-mem.ch0
+synctex-e-mem.ch1
+synctex-e-rec.ch0
+synctex-e-rec.ch1
+synctex-etex.h
+synctex-mem.ch0
+synctex-mem.ch1
+synctex-mem.ch2
+synctex-pdf-rec.ch2
+synctex-pdftex.h
+synctex-rec.ch0
+synctex-rec.ch1
+synctex-rec.ch2
+synctex-tex.h
+synctex-xe-mem.ch2
+synctex-xe-rec.ch2
+synctex-xe-rec.ch3
+synctex-xetex.h
+synctex.c
+synctex.defines
+synctex.h
+synctex_main.c
+tests
+
+
+Version:
+--------
+This is version 1, which refers to the synctex output file format.
+The files are identified by a build number.
+In order to help developers to automatically manage the version and build numbers
+and download the parser only when necessary, the synctex_parser.version
+is an ASCII text file just containing the current version and build numbers.
+
+History:
+--------
+1.1: Thu Jul 17 09:28:13 UTC 2008
+- First official version available in TeXLive 2008 DVD.
+  Unfortunately, the backwards synchronization is not working properly mainly for ConTeXt users, see below.
+1.2: Tue Sep  2 10:28:32 UTC 2008
+- Correction for ConTeXt support in the edit query.
+  The previous method was assuming that TeX boxes do not overlap,
+  which is reasonable for LaTeX but not for ConTeXt.
+  This assumption is no longer considered.
+1.3: Fri Sep  5 09:39:57 UTC 2008
+- Local variable "read" renamed to "already_read" to avoid conflicts.
+- "inline" compiler directive renamed to "SYNCTEX_INLINE" for code support and maintenance
+- _synctex_error cannot be inlined due to variable arguments (thanks Christiaan Hofman)
+- Correction in the display query, extra boundary nodes are used for a more precise forwards synchronization
+1.4: Fri Sep 12 08:12:34 UTC 2008
+- For an unknown reason, the previous version was not the real 1.3 (as used in iTeXMac2 build 747).
+  As a consequence, a crash was observed.
+- Some typos are fixed.
+1.6: Mon Nov  3 20:20:02 UTC 2008
+- The bug that prevented synchronization with compressed files on windows has been fixed.
+- New interface to allow system specific customization.
+- Note that some APIs have changed.
+1.8: Mer  8 jul 2009 11:32:38 UTC
+Note that version 1.7 was delivered privately.
+- bug fix: synctex was causing a memory leak in pdftex and xetex, thus some processing speed degradation
+- bug fix: the synctex command line tool was broken when updating a .synctex file
+- enhancement: better accuracy of the synchronization process
+- enhancement: the pdf output file and the associated .synctex file no longer need to live in the same directory.
+               The new -d option of the synctex command line tool manages this situation.
+               This is handy when using something like tex -output-directory=DIR ...
+1.9: Wed Nov  4 11:52:35 UTC 2009
+- Various typo fixed
+- OutputDebugString replaced by OutputDebugStringA to deliberately disable unicode preprocessing
+- New conditional created because OutputDebugStringA is only available since Windows 2K professional
+1.10: Sun Jan  10 10:12:32 UTC 2010 
+- Bug fix in synctex_parser.c to solve a synchronization problem with amsmath's gather environment.
+  Concerns the synctex tool.
+1.11: Sun Jan  17 09:12:31 UTC 2010
+- Bug fix in synctex_parser.c, function synctex_node_box_visible_v: 'x' replaced by 'y'.
+  Only 3rd party tools are concerned.
+1.12: Mon Jul 19 21:52:10 UTC 2010
+- Bug fix in synctex_parser.c, function __synctex_open: the io_mode was modified even in case of a non zero return,
+causing a void .synctex.gz file to be created even if it was not expected. Reported by Marek Kasik concerning a bug on evince.
+1.13: Fri Mar 11 07:39:12 UTC 2011
+- Bug fix in synctex_parser.c, better synchronization as suggested by Jan Sundermeyer (near line 3388).
+- Stronger code design in synctex_parser_utils.c, function _synctex_get_name (really neutral behavior).
+  Only 3rd party tools are concerned.
+1.14: Fri Apr 15 19:10:57 UTC 2011
+- taking output_directory into account
+- Replaced FOPEN_WBIN_MODE by FOPEN_W_MODE when opening the text version of the .synctex file.
+- Merging with LuaTeX's version of synctex.c
+1.15: Fri Jun 10 14:10:17 UTC 2011
+This concerns the synctex command line tool and 3rd party developers.
+TeX and friends are not concerned by these changes.
+- Bug fixed in _synctex_get_io_mode_name, sometimes the wrong mode was returned
+- Support for LuaTeX convention of './' file prefixing
+1.16: Tue Jun 14 08:23:30 UTC 2011
+This concerns the synctex command line tool and 3rd party developers.
+TeX and friends are not concerned by these changes.
+- Better forward search (thanks Jose Alliste)
+- Support for LuaTeX convention of './' file prefixing now for everyone, not only for Windows
+
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Copyright (c) 2008-2011 jerome DOT laurens AT u-bourgogne DOT fr
+

+ 141 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_utils.h.svn-base

@@ -0,0 +1,141 @@
+/* 
+Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the SyncTeX package.
+
+Latest Revision: Tue Jun 14 08:23:30 UTC 2011
+
+Version: 1.16
+
+See synctex_parser_readme.txt for more details
+
+License:
+--------
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+*/
+
+/*  The utilities declared here are subject to conditional implementation.
+ *  All the operating system special stuff goes here.
+ *  The problem mainly comes from file name management: path separator, encoding...
+ */
+
+#	define synctex_bool_t int
+#	define synctex_YES -1
+#	define synctex_ADD_QUOTES -1
+#	define synctex_COMPRESS -1
+#	define synctex_NO 0
+#	define synctex_DONT_ADD_QUOTES 0
+#	define synctex_DONT_COMPRESS 0
+
+#ifndef __SYNCTEX_PARSER_UTILS__
+#   define __SYNCTEX_PARSER_UTILS__
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#	if _WIN32
+#		define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c || '\\' == c)
+#	else
+#		define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c)
+#	endif
+    
+#	if _WIN32
+#		define SYNCTEX_IS_DOT(c) ('.' == c)
+#	else
+#		define SYNCTEX_IS_DOT(c) ('.' == c)
+#	endif
+    
+/*  This custom malloc functions initializes to 0 the newly allocated memory.
+ *  There is no bzero function on windows. */
+void *_synctex_malloc(size_t size);
+
+/*  This is used to log some informational message to the standard error stream.
+ *  On Windows, the stderr stream is not exposed and another method is used.
+ *	The return value is the number of characters printed.	*/
+int _synctex_error(const char * reason,...);
+
+/*  strip the last extension of the given string, this string is modified!
+ *  This function depends on the OS because the path separator may differ.
+ *  This should be discussed more precisely. */
+void _synctex_strip_last_path_extension(char * string);
+
+/*  Compare two file names, windows is sometimes case insensitive...
+ *  The given strings may differ stricto sensu, but represent the same file name.
+ *  It might not be the real way of doing things.
+ *  The return value is an undefined non 0 value when the two file names are equivalent.
+ *  It is 0 otherwise. */
+synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs);
+
+/*	Description forthcoming.*/
+synctex_bool_t _synctex_path_is_absolute(const char * name);
+
+/*	Description forthcoming...*/
+const char * _synctex_last_path_component(const char * name);
+
+/*	If the core of the last path component of src is not already enclosed with double quotes ('"')
+ *  and contains a space character (' '), then a new buffer is created, the src is copied and quotes are added.
+ *	In all other cases, no destination buffer is created and the src is not copied.
+ *  0 on success, which means no error, something non 0 means error, mainly due to memory allocation failure, or bad parameter.
+ *  This is used to fix a bug in the first version of pdftex with synctex (1.40.9) for which names with spaces
+ *  were not managed in a standard way.
+ *  On success, the caller owns the buffer pointed to by dest_ref (is any) and
+ *  is responsible of freeing the memory when done.
+ *	The size argument is the size of the src buffer. On return the dest_ref points to a buffer sized size+2.*/
+int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size);
+
+/*  These are the possible extensions of the synctex file */
+extern const char * synctex_suffix;
+extern const char * synctex_suffix_gz;
+
+typedef unsigned int synctex_io_mode_t;
+
+typedef enum {
+	synctex_io_append_mask = 1,
+    synctex_io_gz_mask = synctex_io_append_mask<<1
+} synctex_io_mode_masks_t;
+
+typedef enum {
+	synctex_compress_mode_none = 0,
+	synctex_compress_mode_gz = 1
+} synctex_compress_mode_t;
+
+int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_io_mode_t * io_mode_ref);
+
+/*  returns the correct mode required by fopen and gzopen from the given io_mode */
+const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode);
+
+const char * synctex_ignore_leading_dot_slash(const char * name);
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 479 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_utils.m.svn-base

@@ -0,0 +1,479 @@
+/* 
+Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the SyncTeX package.
+
+Latest Revision: Tue Jun 14 08:23:30 UTC 2011
+
+Version: 1.16
+
+See synctex_parser_readme.txt for more details
+
+License:
+--------
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+*/
+
+/*  In this file, we find all the functions that may depend on the operating system. */
+
+#include "synctex_parser_utils.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <limits.h>
+#include <ctype.h>
+#include <string.h>
+
+#include <sys/stat.h>
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
+#define SYNCTEX_WINDOWS 1
+#endif
+
+#ifdef _WIN32_WINNT_WINXP
+#define SYNCTEX_RECENT_WINDOWS 1
+#endif
+
+#ifdef SYNCTEX_WINDOWS
+#include <windows.h>
+#endif
+
+void *_synctex_malloc(size_t size) {
+	void * ptr = malloc(size);
+	if(ptr) {
+/*  There used to be a switch to use bzero because it is more secure. JL */
+		memset(ptr,0, size);
+	}
+	return (void *)ptr;
+}
+
+int _synctex_error(const char * reason,...) {
+	va_list arg;
+	int result;
+	va_start (arg, reason);
+#	ifdef SYNCTEX_RECENT_WINDOWS
+	{/*	This code is contributed by William Blum.
+        As it does not work on some older computers,
+        the _WIN32 conditional here is replaced with a SYNCTEX_RECENT_WINDOWS one.
+        According to http://msdn.microsoft.com/en-us/library/aa363362(VS.85).aspx
+        Minimum supported client	Windows 2000 Professional
+        Minimum supported server	Windows 2000 Server
+        People running Windows 2K standard edition will not have OutputDebugStringA.
+        JL.*/
+		char *buff;
+		size_t len;
+		OutputDebugStringA("SyncTeX ERROR: ");
+		len = _vscprintf(reason, arg) + 1;
+		buff = (char*)malloc( len * sizeof(char) );
+		result = vsprintf(buff, reason, arg) +strlen("SyncTeX ERROR: ");
+		OutputDebugStringA(buff);
+		OutputDebugStringA("\n");
+		free(buff);
+	}
+#   else
+	result = fprintf(stderr,"SyncTeX ERROR: ");
+	result += vfprintf(stderr, reason, arg);
+	result += fprintf(stderr,"\n");
+#   endif
+	va_end (arg);
+	return result;
+}
+
+/*  strip the last extension of the given string, this string is modified! */
+void _synctex_strip_last_path_extension(char * string) {
+	if(NULL != string){
+		char * last_component = NULL;
+		char * last_extension = NULL;
+		char * next = NULL;
+		/*  first we find the last path component */
+		if(NULL == (last_component = strstr(string,"/"))){
+			last_component = string;
+		} else {
+			++last_component;
+			while((next = strstr(last_component,"/"))){
+				last_component = next+1;
+			}
+		}
+#       ifdef	SYNCTEX_WINDOWS
+		/*  On Windows, the '\' is also a path separator. */
+		while((next = strstr(last_component,"\\"))){
+			last_component = next+1;
+		}
+#       endif
+		/*  then we find the last path extension */
+		if((last_extension = strstr(last_component,"."))){
+			++last_extension;
+			while((next = strstr(last_extension,"."))){
+				last_extension = next+1;
+			}
+			--last_extension;/*  back to the "." */
+			if(last_extension>last_component){/*  filter out paths like ....my/dir/.hidden"*/
+				last_extension[0] = '\0';
+			}
+		}
+	}
+}
+
+const char * synctex_ignore_leading_dot_slash(const char * name)
+{
+    while(SYNCTEX_IS_DOT(*name) && SYNCTEX_IS_PATH_SEPARATOR(name[1])) {
+        name += 2;
+        while (SYNCTEX_IS_PATH_SEPARATOR(*name)) {
+            ++name;
+        }
+    }
+    return name;
+}
+
+/*  Compare two file names, windows is sometimes case insensitive... */
+synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs) {
+    /*  Remove the leading regex '(\./+)*' in both rhs and lhs */
+    lhs = synctex_ignore_leading_dot_slash(lhs);
+    rhs = synctex_ignore_leading_dot_slash(rhs);
+#	if SYNCTEX_WINDOWS
+    /*  On Windows, filename should be compared case insensitive.
+	 *  The characters '/' and '\' are both valid path separators.
+	 *  There will be a very serious problem concerning UTF8 because
+	 *  not all the characters must be toupper...
+	 *  I would like to have URL's instead of filenames. */
+next_character:
+	if(SYNCTEX_IS_PATH_SEPARATOR(*lhs)) {/*  lhs points to a path separator */
+		if(!SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  but not rhs */
+			return synctex_NO;
+		}
+	} else if(SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  rhs points to a path separator but not lhs */
+		return synctex_NO;
+	} else if(toupper(*lhs) != toupper(*rhs)){/*  uppercase do not match */
+		return synctex_NO;
+	} else if (!*lhs) {/*  lhs is at the end of the string */
+		return *rhs ? synctex_NO : synctex_YES;
+	} else if(!*rhs) {/*  rhs is at the end of the string but not lhs */
+		return synctex_NO;
+	}
+	++lhs;
+	++rhs;
+	goto next_character;
+#	else
+    return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO;
+#	endif
+}
+
+synctex_bool_t _synctex_path_is_absolute(const char * name) {
+	if(!strlen(name)) {
+		return synctex_NO;
+	}
+#	if SYNCTEX_WINDOWS
+	if(strlen(name)>2) {
+		return (name[1]==':' && SYNCTEX_IS_PATH_SEPARATOR(name[2]))?synctex_YES:synctex_NO;
+	}
+	return synctex_NO;
+#	else
+    return SYNCTEX_IS_PATH_SEPARATOR(name[0])?synctex_YES:synctex_NO;
+#	endif
+}
+
+/*  We do not take care of UTF-8 */
+const char * _synctex_last_path_component(const char * name) {
+	const char * c = name+strlen(name);
+	if(c>name) {
+		if(!SYNCTEX_IS_PATH_SEPARATOR(*c)) {
+			do {
+				--c;
+				if(SYNCTEX_IS_PATH_SEPARATOR(*c)) {
+					return c+1;
+				}
+			} while(c>name);
+		}
+		return c;/* the last path component is the void string*/
+	}
+	return c;
+}
+
+int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size) {
+  const char * lpc;
+  if(src && dest_ref) {
+#		define dest (*dest_ref)
+		dest = NULL;	/*	Default behavior: no change and sucess. */
+		lpc = _synctex_last_path_component(src);
+		if(strlen(lpc)) {
+			if(strchr(lpc,' ') && lpc[0]!='"' && lpc[strlen(lpc)-1]!='"') {
+				/*	We are in the situation where adding the quotes is allowed.	*/
+				/*	Time to add the quotes.	*/
+				/*  Consistency test: we must have dest+size>dest+strlen(dest)+2
+				 *	or equivalently: strlen(dest)+2<size (see below) */
+				if(strlen(src)<size) {
+					if((dest = (char *)malloc(size+2))) {
+						char * dpc = dest + (lpc-src);	/*	dpc is the last path component of dest.	*/
+						if(dest != strncpy(dest,src,size)) {
+							_synctex_error("!  _synctex_copy_with_quoting_last_path_component: Copy problem");
+							free(dest);
+							dest = NULL;/*  Don't forget to reinitialize. */
+							return -2;
+						}
+						memmove(dpc+1,dpc,strlen(dpc)+1);	/*	Also move the null terminating character. */
+						dpc[0]='"';
+						dpc[strlen(dpc)+1]='\0';/*	Consistency test */
+						dpc[strlen(dpc)]='"';
+						return 0;	/*	Success. */
+					}
+					return -1;	/*	Memory allocation error.	*/
+				}
+				_synctex_error("!  _synctex_copy_with_quoting_last_path_component: Internal inconsistency");
+				return -3;
+			}
+			return 0;	/*	Success. */
+		}
+		return 0;	/*	No last path component. */
+#		undef dest
+	}
+	return 1; /*  Bad parameter, this value is subject to changes. */
+}
+
+/*  The client is responsible of the management of the returned string, if any. */
+char * _synctex_merge_strings(const char * first,...);
+
+char * _synctex_merge_strings(const char * first,...) {
+	va_list arg;
+	size_t size = 0;
+	const char * temp;
+	/*   First retrieve the size necessary to store the merged string */
+	va_start (arg, first);
+	temp = first;
+	do {
+		size_t len = strlen(temp);
+		if(UINT_MAX-len<size) {
+			_synctex_error("!  _synctex_merge_strings: Capacity exceeded.");
+			return NULL;
+		}
+		size+=len;
+	} while( (temp = va_arg(arg, const char *)) != NULL);
+	va_end(arg);
+	if(size>0) {
+		char * result = NULL;
+		++size;
+		/*  Create the memory storage */
+		if(NULL!=(result = (char *)malloc(size))) {
+			char * dest = result;
+			va_start (arg, first);
+			temp = first;
+			do {
+				if((size = strlen(temp))>0) {
+					/*  There is something to merge */
+					if(dest != strncpy(dest,temp,size)) {
+						_synctex_error("!  _synctex_merge_strings: Copy problem");
+						free(result);
+						result = NULL;
+						return NULL;
+					}
+					dest += size;
+				}
+			} while( (temp = va_arg(arg, const char *)) != NULL);
+			va_end(arg);
+			dest[0]='\0';/*  Terminate the merged string */
+			return result;
+		}
+		_synctex_error("!  _synctex_merge_strings: Memory problem");
+		return NULL;
+	}
+	return NULL;	
+}
+
+/*  The purpose of _synctex_get_name is to find the name of the synctex file.
+ *  There is a list of possible filenames from which we return the most recent one and try to remove all the others.
+ *  With two runs of pdftex or xetex we are sure the the synctex file is really the most appropriate.
+ */
+int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_io_mode_t * io_mode_ref)
+{
+	if(output && synctex_name_ref && io_mode_ref) {
+		/*  If output is already absolute, we just have to manage the quotes and the compress mode */
+		size_t size = 0;
+        char * synctex_name = NULL;
+        synctex_io_mode_t io_mode = *io_mode_ref;
+		const char * base_name = _synctex_last_path_component(output); /*  do not free, output is the owner. base name of output*/
+		/*  Do we have a real base name ? */
+		if(strlen(base_name)>0) {
+			/*  Yes, we do. */
+			const char * temp = NULL;
+			char * core_name = NULL; /*  base name of output without path extension. */
+			char * dir_name = NULL; /*  dir name of output */
+			char * quoted_core_name = NULL;
+			char * basic_name = NULL;
+			char * gz_name = NULL;
+			char * quoted_name = NULL;
+			char * quoted_gz_name = NULL;
+			char * build_name = NULL;
+			char * build_gz_name = NULL;
+			char * build_quoted_name = NULL;
+			char * build_quoted_gz_name = NULL;
+			struct stat buf;
+			time_t the_time = 0;
+			/*  Create core_name: let temp point to the dot before the path extension of base_name;
+			 *  We start form the \0 terminating character and scan the string upward until we find a dot.
+			 *  The leading dot is not accepted. */
+			if((temp = strrchr(base_name,'.')) && (size = temp - base_name)>0) {
+				/*  There is a dot and it is not at the leading position    */
+				if(NULL == (core_name = (char *)malloc(size+1))) {
+					_synctex_error("!  _synctex_get_name: Memory problem 1");
+					return -1;
+				}
+				if(core_name != strncpy(core_name,base_name,size)) {
+					_synctex_error("!  _synctex_get_name: Copy problem 1");
+					free(core_name);
+					dir_name = NULL;
+					return -2;
+				}
+				core_name[size] = '\0';
+			} else {
+				/*  There is no path extension,
+				 *  Just make a copy of base_name */
+				core_name = _synctex_merge_strings(base_name);
+			}
+			/*  core_name is properly set up, owned by "self". */
+			/*  creating dir_name. */
+			size = strlen(output)-strlen(base_name);
+			if(size>0) {
+				/*  output contains more than one path component */
+				if(NULL == (dir_name = (char *)malloc(size+1))) {
+					_synctex_error("!  _synctex_get_name: Memory problem");
+					free(core_name);
+					dir_name = NULL;
+					return -1;
+				}
+				if(dir_name != strncpy(dir_name,output,size)) {
+					_synctex_error("!  _synctex_get_name: Copy problem");
+					free(dir_name);
+					dir_name = NULL;
+					free(core_name);
+					dir_name = NULL;
+					return -2;
+				}
+				dir_name[size] = '\0';
+			}
+			/*  dir_name is properly set up. It ends with a path separator, if non void. */
+			/*  creating quoted_core_name. */
+			if(strchr(core_name,' ')) {
+				quoted_core_name = _synctex_merge_strings("\"",core_name,"\"");
+			}
+			/*  quoted_core_name is properly set up. */
+			if(dir_name &&strlen(dir_name)>0) {
+				basic_name = _synctex_merge_strings(dir_name,core_name,synctex_suffix,NULL);
+				if(quoted_core_name && strlen(quoted_core_name)>0) {
+					quoted_name = _synctex_merge_strings(dir_name,quoted_core_name,synctex_suffix,NULL);
+				}
+			} else {
+				basic_name = _synctex_merge_strings(core_name,synctex_suffix,NULL);
+				if(quoted_core_name && strlen(quoted_core_name)>0) {
+					quoted_name = _synctex_merge_strings(quoted_core_name,synctex_suffix,NULL);
+				}
+			}
+			if(!_synctex_path_is_absolute(output) && build_directory && (size = strlen(build_directory))) {
+				temp = build_directory + size - 1;
+				if(_synctex_path_is_absolute(temp)) {
+					build_name = _synctex_merge_strings(build_directory,basic_name,NULL);
+					if(quoted_core_name && strlen(quoted_core_name)>0) {
+						build_quoted_name = _synctex_merge_strings(build_directory,quoted_name,NULL);
+					}
+				} else {
+					build_name = _synctex_merge_strings(build_directory,"/",basic_name,NULL);
+					if(quoted_core_name && strlen(quoted_core_name)>0) {
+						build_quoted_name = _synctex_merge_strings(build_directory,"/",quoted_name,NULL);
+					}
+				}
+			}
+			if(basic_name) {
+				gz_name = _synctex_merge_strings(basic_name,synctex_suffix_gz,NULL);
+			}
+			if(quoted_name) {
+				quoted_gz_name = _synctex_merge_strings(quoted_name,synctex_suffix_gz,NULL);
+			}
+			if(build_name) {
+				build_gz_name = _synctex_merge_strings(build_name,synctex_suffix_gz,NULL);
+			}
+			if(build_quoted_name) {
+				build_quoted_gz_name = _synctex_merge_strings(build_quoted_name,synctex_suffix_gz,NULL);
+			}
+			/*  All the others names are properly set up... */
+			/*  retain the most recently modified file */
+#			define TEST(FILENAME,COMPRESS_MODE) \
+			if(FILENAME) {\
+				if (stat(FILENAME, &buf)) { \
+					free(FILENAME);\
+					FILENAME = NULL;\
+				} else if (buf.st_mtime>the_time) { \
+                    the_time=buf.st_mtime; \
+                    synctex_name = FILENAME; \
+                    if (COMPRESS_MODE) { \
+                        io_mode |= synctex_io_gz_mask; \
+                    } else { \
+                        io_mode &= ~synctex_io_gz_mask; \
+                    } \
+				} \
+			}
+			TEST(basic_name,synctex_DONT_COMPRESS);
+			TEST(gz_name,synctex_COMPRESS);
+			TEST(quoted_name,synctex_DONT_COMPRESS);
+			TEST(quoted_gz_name,synctex_COMPRESS);
+			TEST(build_name,synctex_DONT_COMPRESS);
+			TEST(build_gz_name,synctex_COMPRESS);
+			TEST(build_quoted_name,synctex_DONT_COMPRESS);
+			TEST(build_quoted_gz_name,synctex_COMPRESS);
+#			undef TEST
+			/*  Free all the intermediate filenames, except the one that will be used as returned value. */
+#			define CLEAN_AND_REMOVE(FILENAME) \
+			if(FILENAME && (FILENAME!=synctex_name)) {\
+				remove(FILENAME);\
+				printf("synctex tool info: %s removed\n",FILENAME);\
+				free(FILENAME);\
+				FILENAME = NULL;\
+			}
+			CLEAN_AND_REMOVE(basic_name);
+			CLEAN_AND_REMOVE(gz_name);
+			CLEAN_AND_REMOVE(quoted_name);
+			CLEAN_AND_REMOVE(quoted_gz_name);
+			CLEAN_AND_REMOVE(build_name);
+			CLEAN_AND_REMOVE(build_gz_name);
+			CLEAN_AND_REMOVE(build_quoted_name);
+			CLEAN_AND_REMOVE(build_quoted_gz_name);
+#			undef CLEAN_AND_REMOVE
+            /* set up the returned values */
+            * synctex_name_ref = synctex_name;
+            * io_mode_ref = io_mode;
+			return 0;
+		}
+		return -1;/*  bad argument */
+	}
+	return -2;
+}
+
+const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode) {
+    static const char * synctex_io_modes[4] = {"r","rb","a","ab"}; 
+    unsigned idx = ((io_mode & synctex_io_gz_mask)?1:0) + ((io_mode & synctex_io_append_mask)?2:0);// bug pointed out by Jose Alliste
+    return synctex_io_modes[idx];
+}

+ 1 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/.svn/text-base/synctex_parser_version.txt.svn-base

@@ -0,0 +1 @@
+1.16

+ 429 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser.h

@@ -0,0 +1,429 @@
+/*
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the __SyncTeX__ package.
+ 
+ [//]: # (Latest Revision: Fri Jul 14 16:20:41 UTC 2017)
+ [//]: # (Version: 1.21)
+ 
+ See `synctex_parser_readme.md` for more details
+ 
+ ## License
+ 
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE
+ 
+ Except as contained in this notice, the name of the 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 from the copyright holder.
+ 
+ ## Acknowledgments:
+ 
+ The author received useful remarks from the __pdfTeX__ developers, especially Hahn The Thanh,
+ and significant help from __XeTeX__ developer Jonathan Kew.
+ 
+ ## Nota Bene:
+ 
+ If you include or use a significant part of the __SyncTeX__ package into a software,
+ I would appreciate to be listed as contributor and see "__SyncTeX__" highlighted.
+*/
+
+#ifndef __SYNCTEX_PARSER__
+#   define __SYNCTEX_PARSER__
+
+#include "synctex_version.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    
+    /*  The main synctex object is a scanner.
+     *  Its implementation is considered private.
+     *  The basic workflow is
+     *  -   create a "synctex scanner" with the contents of a file
+     *  -   perform actions on that scanner like
+        synctex_display_query or synctex_edit_query below.
+     *  -   perform actions on nodes returned by the scanner
+     *  - free the scanner when the work is done
+     */
+    typedef struct synctex_scanner_t synctex_scanner_s;
+    typedef synctex_scanner_s * synctex_scanner_p;
+    
+    /**
+     *  This is the designated method to create
+     *  a new synctex scanner object.
+     *  - argument output: the pdf/dvi/xdv file associated
+     *      to the synctex file.
+     *      If necessary, it can be the tex file that
+     *      originated the synctex file but this might cause
+     *      problems if the \jobname has a custom value.
+     *      Despite this method can accept a relative path
+     *      in practice, you should only pass full paths.
+     *      The path should be encoded by the underlying
+     *      file system, assuming that it is based on
+     *      8 bits characters, including UTF8,
+     *      not 16 bits nor 32 bits.
+     *      The last file extension is removed and
+     *      replaced by the proper extension,
+     *      either synctex or synctex.gz.
+     *  - argument build_directory: It is the directory where
+     *      all the auxiliary stuff is created.
+     *      If no synctex file is found in the same directory
+     *      as the output file, then we try to find one in
+     *      this build directory.
+     *      It is the directory where all the auxiliary
+     *      stuff is created. Sometimes, the synctex output
+     *      file and the pdf, dvi or xdv files are not 
+     *      created in the same location. See MikTeX.
+     *      This directory path can be NULL,
+     *      it will be ignored then.
+     *      It can be either absolute or relative to the
+     *      directory of the output pdf (dvi or xdv) file.
+     *      Please note that this new argument is provided
+     *      as a convenience but should not be used.
+     *      Available since version 1.5.
+     *  - argument parse: In general, use 1.
+     *      Use 0 only if you do not want to parse the
+     *      content but just check for existence.
+     *      Available since version 1.5
+     *   - resturn: a scanner. NULL is returned in case
+     *      of an error or non existent file.
+     */
+    synctex_scanner_p synctex_scanner_new_with_output_file(const char * output, const char * build_directory, int parse);
+    
+    /**
+     *  Designated method to delete a synctex scanner object,
+     *  including all its internal resources.
+     *  Frees all the memory, you must call it when you are finished with the scanner.
+     *  - argument scanner: a scanner.
+     *  - returns: an integer used for testing purposes.
+     */
+    int synctex_scanner_free(synctex_scanner_p scanner);
+    
+    /**
+     *  Send this message to force the scanner to
+     *  parse the contents of the synctex output file.
+     *  Nothing is performed if the file was already parsed.
+     *  In each query below, this message is sent,
+     *  but if you need to access information more directly,
+     *  you must ensure that the parsing did occur.
+     *  Usage:
+     *		if((my_scanner = synctex_scanner_parse(my_scanner))) {
+     *			continue with my_scanner...
+     *		} else {
+     *			there was a problem
+     *		}
+     *  - returns: the argument on success.
+     *      On failure, frees scanner and returns NULL.
+     */
+    synctex_scanner_p synctex_scanner_parse(synctex_scanner_p scanner);
+    
+    /*  synctex_node_p is the type for all synctex nodes.
+     *  Its implementation is considered private.
+     *  The synctex file is parsed into a tree of nodes, either sheet, form, boxes, math nodes... */
+    
+    typedef struct synctex_node_t synctex_node_s;
+    typedef synctex_node_s * synctex_node_p;
+    
+    /*  The main entry points.
+     *  Given the file name, a line and a column number, synctex_display_query returns the number of nodes
+     *  satisfying the contrain. Use code like
+     *
+     *      if(synctex_display_query(scanner,name,line,column,page_hint)>0) {
+     *         synctex_node_p node;
+     *         while((node = synctex_scanner_next_result(scanner))) {
+     *             // do something with node
+     *             ...
+     *         }
+     *     }
+     *
+     *  Please notice that since version 1.19,
+     *  there is a new argument page_hint.
+     *  The results in pages closer to page_hint are given first.
+     *  For example, one can
+     * - highlight each resulting node in the output, using synctex_node_visible_h and synctex_node_visible_v
+     * - highlight all the rectangles enclosing those nodes, using synctex_node_box_visible_... functions
+     * - highlight just the character using that information
+     *
+     *  Given the page and the position in the page, synctex_edit_query returns the number of nodes
+     *  satisfying the contrain. Use code like
+     *
+     *     if(synctex_edit_query(scanner,page,h,v)>0) {
+     *         synctex_node_p node;
+     *         while(node = synctex_scanner_next_result(scanner)) {
+     *             // do something with node
+     *             ...
+     *         }
+     *     }
+     *
+     *  For example, one can
+     * - highlight each resulting line in the input,
+     * - highlight just the character using that information
+     *
+     *  page is 1 based
+     *  h and v are coordinates in 72 dpi unit, relative to the top left corner of the page.
+     *  If you make a new query, the result of the previous one is discarded. If you need to make more than one query
+     *  in parallel, use the iterator API exposed in
+     *  the synctex_parser_private.h header.
+     *  If one of this function returns a negative integer,
+     *  it means that an error occurred.
+     *
+     *  Both methods are conservative, in the sense that matching is weak.
+     *  If the exact column number is not found, there will be an answer with the whole line.
+     *
+     *  Sumatra-PDF, Skim, iTeXMac2, TeXShop and Texworks are examples of open source software that use this library.
+     *  You can browse their code for a concrete implementation.
+     */
+    typedef long synctex_status_t;
+    /*  The page_hint argument is used to resolve ambiguities.
+     *  Whenever, different matches occur, the ones closest
+     *  to the page will be given first. Pass a negative number
+     *  when in doubt. Using pdf forms may lead to ambiguities.
+     */
+    synctex_status_t synctex_display_query(synctex_scanner_p scanner,const char *  name,int line,int column, int page_hint);
+    synctex_status_t synctex_edit_query(synctex_scanner_p scanner,int page,float h,float v);
+    synctex_node_p synctex_scanner_next_result(synctex_scanner_p scanner);
+    synctex_status_t synctex_scanner_reset_result(synctex_scanner_p scanner);
+    
+    /**
+     *  The horizontal and vertical location,
+     *  the width, height and depth of a box enclosing node.
+     *  All dimensions are given in page coordinates
+     *  as opposite to TeX coordinates.
+     *  The origin is at the top left corner of the page.
+     *  Code example for Qt5:
+     *  (from TeXworks source TWSynchronize.cpp)
+     *  QRectF nodeRect(synctex_node_box_visible_h(node),
+     *      synctex_node_box_visible_v(node) - 
+     *          synctex_node_box_visible_height(node),
+     *      synctex_node_box_visible_width(node),
+     *      synctex_node_box_visible_height(node) + 
+     *          synctex_node_box_visible_depth(node));
+     *  Code example for Cocoa:
+     *  NSRect bounds = [pdfPage
+     *      boundsForBox:kPDFDisplayBoxMediaBox];
+     *  NSRect nodeRect = NSMakeRect(
+     *      synctex_node_box_visible_h(node),
+     *      NSMaxY(bounds)-synctex_node_box_visible_v(node) +
+     *          synctex_node_box_visible_height(node),
+     *      synctex_node_box_visible_width(node),
+     *      synctex_node_box_visible_height(node) +
+     *          synctex_node_box_visible_depth(node)
+     *      );
+     *  The visible dimensions are bigger than real ones
+     *  to compensate 0 width boxes or nodes intentionnaly
+     *  put outside the box (using \kern for example).
+     *  - parameter node: a node.
+     *  - returns: a float.
+     *  - author: JL
+     */
+    float synctex_node_box_visible_h(synctex_node_p node);
+    float synctex_node_box_visible_v(synctex_node_p node);
+    float synctex_node_box_visible_width(synctex_node_p node);
+    float synctex_node_box_visible_height(synctex_node_p node);
+    float synctex_node_box_visible_depth(synctex_node_p node);
+
+    /**
+     *  For quite all nodes, horizontal and vertical coordinates, and width.
+     *  All dimensions are given in page coordinates
+     *  as opposite to TeX coordinates.
+     *  The origin is at the top left corner of the page.
+     *  The visible dimensions are bigger than real ones
+     *  to compensate 0 width boxes or nodes intentionnaly
+     *  put outside the box (using \kern for example).
+     *  All nodes have coordinates, but all nodes don't
+     *  have non null size. For example, math nodes
+     *  have no width according to TeX, and in that case
+     *  synctex_node_visible_width simply returns 0.
+     *  The same holds for kern nodes that do not have
+     *  height nor depth, etc...
+     */
+    float synctex_node_visible_h(synctex_node_p node);
+    float synctex_node_visible_v(synctex_node_p node);
+    float synctex_node_visible_width(synctex_node_p node);
+    float synctex_node_visible_height(synctex_node_p node);
+    float synctex_node_visible_depth(synctex_node_p node);
+
+    /**
+     *  Given a node, access to its tag, line and column.
+     *  The line and column numbers are 1 based.
+     *  The latter is not yet fully supported in TeX,
+     *  the default implementation returns 0
+     *  which means the whole line.
+     *  synctex_node_get_name returns the path of the
+     *  TeX source file that was used to create the node.
+     *  When the tag is known, the scanner of the node
+     *  will also give that same file name, see
+     *  synctex_scanner_get_name below.
+     *  For an hbox node, the mean line is the mean
+     *  of all the lines of the child nodes.
+     *  Sometimes, when synchronization form pdf to source
+     *  fails with the line, one should try with the
+     *  mean line.
+     */
+    int synctex_node_tag(synctex_node_p node);
+    int synctex_node_line(synctex_node_p node);
+    int synctex_node_mean_line(synctex_node_p node);
+    int synctex_node_column(synctex_node_p node);
+    const char * synctex_node_get_name(synctex_node_p node);
+    
+    /**
+     This is the page where the node appears.
+     *  This is a 1 based index as given by TeX.
+     */
+    int synctex_node_page(synctex_node_p node);
+
+    /**
+     *  Display all the information contained in the scanner.
+     *  If the records are too numerous, only the first ones are displayed.
+     *  This is mainly for informational purpose to help developers.
+     */
+    void synctex_scanner_display(synctex_scanner_p scanner);
+    
+    /*  Managing the input file names.
+     *  Given a tag, synctex_scanner_get_name will return the corresponding file name.
+     *  Conversely, given a file name, synctex_scanner_get_tag will return, the corresponding tag.
+     *  The file name must be the very same as understood by TeX.
+     *  For example, if you \input myDir/foo.tex, the file name is myDir/foo.tex.
+     *  No automatic path expansion is performed.
+     *  Finally, synctex_scanner_input is the first input node of the scanner.
+     *  To browse all the input node, use a loop like
+     *      ...
+     *      synctex_node_p = input_node;
+     *      ...
+     *      if((input_node = synctex_scanner_input(scanner))) {
+     *          do {
+     *              blah
+     *          } while((input_node=synctex_node_sibling(input_node)));
+     *     }
+     *
+     *  The output is the name that was used to create the scanner.
+     *  The synctex is the real name of the synctex file,
+     *  it was obtained from output by setting the proper file extension.
+     */
+    const char * synctex_scanner_get_name(synctex_scanner_p scanner,int tag);
+    
+    int synctex_scanner_get_tag(synctex_scanner_p scanner,const char * name);
+    
+    synctex_node_p synctex_scanner_input(synctex_scanner_p scanner);
+    synctex_node_p synctex_scanner_input_with_tag(synctex_scanner_p scanner,int tag);
+    const char * synctex_scanner_get_output(synctex_scanner_p scanner);
+    const char * synctex_scanner_get_synctex(synctex_scanner_p scanner);
+    
+    /*  The x and y offset of the origin in TeX coordinates. The magnification
+     These are used by pdf viewers that want to display the real box size.
+     For example, getting the horizontal coordinates of a node would require
+     synctex_node_box_h(node)*synctex_scanner_magnification(scanner)+synctex_scanner_x_offset(scanner)
+     Getting its TeX width would simply require
+     synctex_node_box_width(node)*synctex_scanner_magnification(scanner)
+     but direct methods are available for that below.
+     */
+    int synctex_scanner_x_offset(synctex_scanner_p scanner);
+    int synctex_scanner_y_offset(synctex_scanner_p scanner);
+    float synctex_scanner_magnification(synctex_scanner_p scanner);
+    
+    /**
+     *  ## Browsing the nodes
+     *  parent, child and sibling are standard names for tree nodes.
+     *  The parent is one level higher,
+     *  the child is one level deeper,
+     *  and the sibling is at the same level.
+     *  A node and its sibling have the same parent.
+     *  A node is the parent of its children.
+     *  A node is either the child of its parent,
+     *  or belongs to the sibling chain of its parent's child.
+     *  The sheet or form of a node is the topmost ancestor,
+     *  it is of type sheet or form.
+     *  The next node is either the child, the sibling or the parent's sibling,
+     *  unless the parent is a sheet, a form or NULL.
+     *  This allows to navigate through all the nodes of a given sheet node:
+     *
+     *     synctex_node_p node = sheet;
+     *     while((node = synctex_node_next(node))) {
+     *         // do something with node
+     *     }
+     *
+     *  With synctex_sheet_content and synctex_form_content,
+     *  you can retrieve the sheet node given the page
+     *  or form tag.
+     *  The page is 1 based, according to TeX standards.
+     *  Conversely synctex_node_parent_sheet or
+     *  synctex_node_parent_form allows to retrieve
+     *  the sheet or the form containing a given node.
+     *  Notice that a node is not contained in a sheet
+     *  and a form at the same time.
+     *  Some nodes are not contained in either (handles).
+     */
+    
+    synctex_node_p synctex_node_parent(synctex_node_p node);
+    synctex_node_p synctex_node_parent_sheet(synctex_node_p node);
+    synctex_node_p synctex_node_parent_form(synctex_node_p node);
+    synctex_node_p synctex_node_child(synctex_node_p node);
+    synctex_node_p synctex_node_last_child(synctex_node_p node);
+    synctex_node_p synctex_node_sibling(synctex_node_p node);
+    synctex_node_p synctex_node_last_sibling(synctex_node_p node);
+    synctex_node_p synctex_node_arg_sibling(synctex_node_p node);
+    synctex_node_p synctex_node_next(synctex_node_p node);
+    
+    /**
+     *  Top level entry points.
+     *  The scanner owns a list of sheet siblings and
+     *  a list of form siblings.
+     *  Sheets or forms have one child which is a box:
+     *  theie contents.
+     *  - argument page: 1 based sheet page number.
+     *  - argument tag: 1 based form tag number.
+     */
+    synctex_node_p synctex_sheet(synctex_scanner_p scanner,int page);
+    synctex_node_p synctex_sheet_content(synctex_scanner_p scanner,int page);
+    synctex_node_p synctex_form(synctex_scanner_p scanner,int tag);
+    synctex_node_p synctex_form_content(synctex_scanner_p scanner,int tag);
+    
+    /*  This is primarily used for debugging purpose.
+     *  The second one logs information for the node and recursively displays information for its next node */
+    void synctex_node_log(synctex_node_p node);
+    void synctex_node_display(synctex_node_p node);
+    
+    /*  For quite all nodes, horizontal, vertical coordinates, and width.
+     *  These are expressed in TeX small points coordinates, with origin at the top left corner.
+     */
+    int synctex_node_h(synctex_node_p node);
+    int synctex_node_v(synctex_node_p node);
+    int synctex_node_width(synctex_node_p node);
+    int synctex_node_height(synctex_node_p node);
+    int synctex_node_depth(synctex_node_p node);
+    
+    /*  For all nodes, dimensions of the enclosing box.
+     *  These are expressed in TeX small points coordinates, with origin at the top left corner.
+     *  A box is enclosing itself.
+     */
+    int synctex_node_box_h(synctex_node_p node);
+    int synctex_node_box_v(synctex_node_p node);
+    int synctex_node_box_width(synctex_node_p node);
+    int synctex_node_box_height(synctex_node_p node);
+    int synctex_node_box_depth(synctex_node_p node);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

File diff suppressed because it is too large
+ 8924 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser.m


+ 554 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_advanced.h

@@ -0,0 +1,554 @@
+/*
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the __SyncTeX__ package.
+ 
+ [//]: # (Latest Revision: Sun Oct 15 15:09:55 UTC 2017)
+ [//]: # (Version: 1.21)
+ 
+ See `synctex_parser_readme.md` for more details
+ 
+ ## License
+ 
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE
+ 
+ Except as contained in this notice, the name of the 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 from the copyright holder.
+ */
+
+#include "synctex_parser.h"
+#include "synctex_parser_utils.h"
+
+#ifndef __SYNCTEX_PARSER_PRIVATE__
+#   define __SYNCTEX_PARSER_PRIVATE__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+    /*  Reminder that the argument must not be NULL */
+    typedef synctex_node_p synctex_non_null_node_p;
+
+    /*  Each node of the tree, except the scanner itself belongs to a class.
+     *  The class object is just a struct declaring the owning scanner
+     *  This is a pointer to the scanner as root of the tree.
+     *  The type is used to identify the kind of node.
+     *  The class declares pointers to a creator and a destructor method.
+     *  The log and display fields are used to log and display the node.
+     *  display will also display the child, sibling and parent sibling.
+     *  parent, child and sibling are used to navigate the tree,
+     *  from TeX box hierarchy point of view.
+     *  The friend field points to a method which allows to navigate from friend to friend.
+     *  A friend is a node with very close tag and line numbers.
+     *  Finally, the info field point to a method giving the private node info offset.
+     */
+    
+    /**
+     *  These are the masks for the synctex node types.
+     *  int's are 32 bits at leats.
+     */
+    enum {
+        synctex_shift_root,
+        synctex_shift_no_root,
+        synctex_shift_void,
+        synctex_shift_no_void,
+        synctex_shift_box,
+        synctex_shift_no_box,
+        synctex_shift_proxy,
+        synctex_shift_no_proxy,
+        synctex_shift_h,
+        synctex_shift_v
+    };
+    enum {
+        synctex_mask_root      = 1,
+        synctex_mask_no_root   = synctex_mask_root<<1,
+        synctex_mask_void      = synctex_mask_no_root<<1,
+        synctex_mask_no_void   = synctex_mask_void<<1,
+        synctex_mask_box       = synctex_mask_no_void<<1,
+        synctex_mask_no_box    = synctex_mask_box<<1,
+        synctex_mask_proxy     = synctex_mask_no_box<<1,
+        synctex_mask_no_proxy  = synctex_mask_proxy<<1,
+        synctex_mask_h         = synctex_mask_no_proxy<<1,
+        synctex_mask_v         = synctex_mask_h<<1,
+    };
+    enum {
+        synctex_mask_non_void_hbox = synctex_mask_no_void
+        | synctex_mask_box
+        | synctex_mask_h,
+        synctex_mask_non_void_vbox = synctex_mask_no_void
+        | synctex_mask_box
+        | synctex_mask_v
+    };
+    typedef enum {
+        synctex_node_mask_sf =
+        synctex_mask_root
+        |synctex_mask_no_void
+        |synctex_mask_no_box
+        |synctex_mask_no_proxy,
+        synctex_node_mask_vbox =
+        synctex_mask_no_root
+        |synctex_mask_no_void
+        |synctex_mask_box
+        |synctex_mask_no_proxy
+        |synctex_mask_v,
+        synctex_node_mask_hbox =
+        synctex_mask_no_root
+        |synctex_mask_no_void
+        |synctex_mask_box
+        |synctex_mask_no_proxy
+        |synctex_mask_h,
+        synctex_node_mask_void_vbox =
+        synctex_mask_no_root
+        |synctex_mask_void
+        |synctex_mask_box
+        |synctex_mask_no_proxy
+        |synctex_mask_v,
+        synctex_node_mask_void_hbox =
+        synctex_mask_no_root
+        |synctex_mask_void
+        |synctex_mask_box
+        |synctex_mask_no_proxy
+        |synctex_mask_h,
+        synctex_node_mask_vbox_proxy =
+        synctex_mask_no_root
+        |synctex_mask_no_void
+        |synctex_mask_box
+        |synctex_mask_proxy
+        |synctex_mask_v,
+        synctex_node_mask_hbox_proxy =
+        synctex_mask_no_root
+        |synctex_mask_no_void
+        |synctex_mask_box
+        |synctex_mask_proxy
+        |synctex_mask_h,
+        synctex_node_mask_nvnn =
+        synctex_mask_no_root
+        |synctex_mask_void
+        |synctex_mask_no_box
+        |synctex_mask_no_proxy,
+        synctex_node_mask_input =
+        synctex_mask_root
+        |synctex_mask_void
+        |synctex_mask_no_box
+        |synctex_mask_no_proxy,
+        synctex_node_mask_proxy =
+        synctex_mask_no_root
+        |synctex_mask_void
+        |synctex_mask_no_box
+        |synctex_mask_proxy
+    } synctex_node_mask_t;
+
+    enum {
+        /* input */
+        synctex_tree_sibling_idx        =  0,
+        synctex_tree_s_input_max        =  1,
+        /* All */
+        synctex_tree_s_parent_idx       =  1,
+        synctex_tree_sp_child_idx       =  2,
+        synctex_tree_spc_friend_idx     =  3,
+        synctex_tree_spcf_last_idx      =  4,
+        synctex_tree_spcfl_vbox_max     =  5,
+        /* hbox supplement */
+        synctex_tree_spcfl_next_hbox_idx  =  5,
+        synctex_tree_spcfln_hbox_max      =  6,
+        /* hbox proxy supplement */
+        synctex_tree_spcfln_target_idx        =  6,
+        synctex_tree_spcflnt_proxy_hbox_max   =  7,
+        /* vbox proxy supplement */
+        synctex_tree_spcfl_target_idx         =  5,
+        synctex_tree_spcflt_proxy_vbox_max    =  6,
+        /*  spf supplement*/
+        synctex_tree_sp_friend_idx  =  2,
+        synctex_tree_spf_max        =  3,
+        /*  box boundary supplement */
+        synctex_tree_spf_arg_sibling_idx   =  3,
+        synctex_tree_spfa_max              =  4,
+        /*  proxy supplement */
+        synctex_tree_spf_target_idx    =  3,
+        synctex_tree_spft_proxy_max    =  4,
+        /*  last proxy supplement */
+        synctex_tree_spfa_target_idx      =  4,
+        synctex_tree_spfat_proxy_last_max =  5,
+        /* sheet supplement */
+        synctex_tree_s_child_idx        =  1,
+        synctex_tree_sc_next_hbox_idx   =  2,
+        synctex_tree_scn_sheet_max      =  3,
+        /* form supplement */
+        synctex_tree_sc_target_idx      =  2,
+        synctex_tree_sct_form_max       =  3,
+        /* spct */
+        synctex_tree_spc_target_idx     =  3,
+        synctex_tree_spct_handle_max    =  4,
+    };
+    
+    enum {
+        /* input */
+        synctex_data_input_tag_idx  =  0,
+        synctex_data_input_line_idx =  1,
+        synctex_data_input_name_idx =  2,
+        synctex_data_input_tln_max  =  3,
+        /* sheet */
+        synctex_data_sheet_page_idx =  0,
+        synctex_data_p_sheet_max    =  1,
+        /* form */
+        synctex_data_form_tag_idx   =  0,
+        synctex_data_t_form_max     =  1,
+        /* tlchv */
+        synctex_data_tag_idx        =  0,
+        synctex_data_line_idx       =  1,
+        synctex_data_column_idx     =  2,
+        synctex_data_h_idx          =  3,
+        synctex_data_v_idx          =  4,
+        synctex_data_tlchv_max      =  5,
+        /* tlchvw */
+        synctex_data_width_idx      =  5,
+        synctex_data_tlchvw_max     =  6,
+        /* box */
+        synctex_data_height_idx     =  6,
+        synctex_data_depth_idx      =  7,
+        synctex_data_box_max        =  8,
+        /* hbox supplement */
+        synctex_data_mean_line_idx  =  8,
+        synctex_data_weight_idx     =  9,
+        synctex_data_h_V_idx        = 10,
+        synctex_data_v_V_idx        = 11,
+        synctex_data_width_V_idx    = 12,
+        synctex_data_height_V_idx   = 13,
+        synctex_data_depth_V_idx    = 14,
+        synctex_data_hbox_max       = 15,
+        /* ref */
+        synctex_data_ref_tag_idx    =  0,
+        synctex_data_ref_h_idx      =  1,
+        synctex_data_ref_v_idx      =  2,
+        synctex_data_ref_thv_max    =  3,
+        /* proxy */
+        synctex_data_proxy_h_idx    =  0,
+        synctex_data_proxy_v_idx    =  1,
+        synctex_data_proxy_hv_max   =  2,
+        /* handle */
+        synctex_data_handle_w_idx   =  0,
+        synctex_data_handle_w_max   =  1,
+    };
+
+    /*  each synctex node has a class */
+    typedef struct synctex_class_t synctex_class_s;
+    typedef synctex_class_s * synctex_class_p;
+    
+    
+    /*  synctex_node_p is a pointer to a node
+     *  synctex_node_s is the target of the synctex_node_p pointer
+     *  It is a pseudo object oriented program.
+     *  class is a pointer to the class object the node belongs to.
+     *  implementation is meant to contain the private data of the node
+     *  basically, there are 2 kinds of information: navigation information and
+     *  synctex information. Both will depend on the type of the node,
+     *  thus different nodes will have different private data.
+     *  There is no inheritancy overhead.
+     */
+    typedef union {
+        synctex_node_p as_node;
+        int    as_integer;
+        char * as_string;
+        void * as_pointer;
+    } synctex_data_u;
+    typedef synctex_data_u * synctex_data_p;
+    
+#   if defined(SYNCTEX_USE_CHARINDEX)
+    typedef unsigned int synctex_charindex_t;
+    synctex_charindex_t synctex_node_charindex(synctex_node_p node);
+    typedef synctex_charindex_t synctex_lineindex_t;
+    synctex_lineindex_t synctex_node_lineindex(synctex_node_p node);
+    synctex_node_p synctex_scanner_handle(synctex_scanner_p scanner);
+#       define SYNCTEX_DECLARE_CHARINDEX \
+            synctex_charindex_t char_index;\
+            synctex_lineindex_t line_index;
+#       define SYNCTEX_DECLARE_CHAR_OFFSET \
+            synctex_charindex_t charindex_offset;
+#   else
+#       define SYNCTEX_DECLARE_CHARINDEX
+#       define SYNCTEX_DECLARE_CHAR_OFFSET
+#   endif
+    struct synctex_node_t {
+        SYNCTEX_DECLARE_CHARINDEX
+        synctex_class_p class_;
+#ifdef DEBUG
+        synctex_data_u data[22];
+#else
+        synctex_data_u data[1];
+#endif
+    };
+    
+    typedef synctex_node_p * synctex_node_r;
+    
+    typedef struct {
+        int h;
+        int v;
+    } synctex_point_s;
+    
+    typedef synctex_point_s * synctex_point_p;
+    
+    typedef struct {
+        synctex_point_s min;   /* top left */
+        synctex_point_s max;   /* bottom right */
+    } synctex_box_s;
+    
+    typedef synctex_box_s * synctex_box_p;
+    /**
+     *  These are the types of the synctex nodes.
+     *  No need to use them but the compiler needs them here.
+     *  There are 3 kinds of nodes.
+     *  - primary nodes
+     *  - proxies
+     *  - handles
+     *  Primary nodes are created at parse time
+     *  of the synctex file.
+     *  Proxies are used to support pdf forms.
+     *  The ref primary nodes are replaced by a tree
+     *  of proxy nodes which duplicate the tree of primary
+     *  nodes available in the refered form.
+     *  Roughly speaking, the primary nodes of the form
+     *  know what to display, the proxy nodes know where.
+     *  Handles are used in queries. They point to either
+     *  primary nodes or proxies.
+     */
+    typedef enum {
+        synctex_node_type_none = 0,
+        synctex_node_type_input,
+        synctex_node_type_sheet,
+        synctex_node_type_form,
+        synctex_node_type_ref,
+        synctex_node_type_vbox,
+        synctex_node_type_void_vbox,
+        synctex_node_type_hbox,
+        synctex_node_type_void_hbox,
+        synctex_node_type_kern,
+        synctex_node_type_glue,
+        synctex_node_type_rule,
+        synctex_node_type_math,
+        synctex_node_type_boundary,
+        synctex_node_type_box_bdry,
+        synctex_node_type_proxy,
+        synctex_node_type_proxy_last,
+        synctex_node_type_proxy_vbox,
+        synctex_node_type_proxy_hbox,
+        synctex_node_type_handle,
+        synctex_node_number_of_types
+    } synctex_node_type_t;
+    /*  synctex_node_type gives the type of a given node,
+     *  synctex_node_isa gives the same information as a human readable text. */
+    synctex_node_type_t synctex_node_type(synctex_node_p node);
+    const char * synctex_node_isa(synctex_node_p node);
+    
+    synctex_node_type_t synctex_node_target_type(synctex_node_p node);
+
+    synctex_node_type_t synctex_node_type(synctex_node_p node);
+    const char * synctex_node_isa(synctex_node_p node);
+    
+    void synctex_node_log(synctex_node_p node);
+    void synctex_node_display(synctex_node_p node);
+    
+    /*  Given a node, access to the location in the synctex file where it is defined.
+     */
+
+    int synctex_node_form_tag(synctex_node_p node);
+    
+    int synctex_node_weight(synctex_node_p node);
+    int synctex_node_child_count(synctex_node_p node);
+    
+    int synctex_node_h(synctex_node_p node);
+    int synctex_node_v(synctex_node_p node);
+    int synctex_node_width(synctex_node_p node);
+    
+    int synctex_node_box_h(synctex_node_p node);
+    int synctex_node_box_v(synctex_node_p node);
+    int synctex_node_box_width(synctex_node_p node);
+    int synctex_node_box_height(synctex_node_p node);
+    int synctex_node_box_depth(synctex_node_p node);
+    
+    int synctex_node_hbox_h(synctex_node_p node);
+    int synctex_node_hbox_v(synctex_node_p node);
+    int synctex_node_hbox_width(synctex_node_p node);
+    int synctex_node_hbox_height(synctex_node_p node);
+    int synctex_node_hbox_depth(synctex_node_p node);
+    
+    synctex_scanner_p synctex_scanner_new(void);
+    synctex_node_p synctex_node_new(synctex_scanner_p scanner,synctex_node_type_t type);
+
+    /**
+     *  Scanner display switcher getter.
+     *  If the switcher is 0, synctex_node_display is disabled.
+     *  If the switcher is <0, synctex_node_display has no limit.
+     *  If the switcher is >0, only the first switcher (as number) nodes are displayed.
+     *  - parameter: a scanner
+     *  - returns: an integer
+     */
+    int synctex_scanner_display_switcher(synctex_scanner_p scanR);
+    void synctex_scanner_set_display_switcher(synctex_scanner_p scanR, int switcher);
+
+    /**
+     *  Iterator is the structure used to traverse
+     *  the answer to client queries.
+     *  First answers are the best matches, according
+     *  to criteria explained below.
+     *  Next answers are not ordered.
+     *  Objects are handles to nodes in the synctex node tree starting at scanner.
+     */
+    typedef struct synctex_iterator_t synctex_iterator_s;
+    typedef synctex_iterator_s * synctex_iterator_p;
+
+    /**
+     *  Designated creator for a display query, id est,
+     *  forward navigation from source to output.
+     *  Returns NULL if the query has no answer.
+     *  Code example:
+     *      synctex_iterator_p iterator = NULL;
+     *      if ((iterator = synctex_iterator_new_display(...)) {
+     *      synctex_node_p node = NULL;
+     *      while((node = synctex_iterator_next_result(iterator))) {
+     *          do something with node...
+     *      }
+     */
+    synctex_iterator_p synctex_iterator_new_display(synctex_scanner_p scanner,const char *  name,int line,int column, int page_hint);
+    /**
+     *  Designated creator for an  edit query, id est,
+     *  backward navigation from output to source.
+     *  Code example:
+     *      synctex_iterator_p iterator = NULL;
+     *      if ((iterator = synctex_iterator_new_edit(...)) {
+     *      synctex_node_p node = NULL;
+     *      while((node = synctex_iterator_next_result(iterator))) {
+     *          do something with node...
+     *      }
+     */
+    synctex_iterator_p synctex_iterator_new_edit(synctex_scanner_p scanner,int page,float h,float v);
+    /**
+     *  Free all the resources.
+     *  - argument iterator: the object to free...
+     *  You should free the iterator before the scanner
+     *  owning the nodes it iterates with.
+     */
+    void synctex_iterator_free(synctex_iterator_p iterator);
+    /**
+     *  Wether the iterator actually points to an object.
+     *  - argument iterator: the object to iterate on...
+     */
+    synctex_bool_t synctex_iterator_has_next(synctex_iterator_p iterator);
+    /**
+     *  Returns the pointed object and advance the cursor
+     *  to the next object. Returns NULL and does nothing
+     *  if the end has already been reached.
+     *  - argument iterator: the object to iterate on...
+     */
+    synctex_node_p synctex_iterator_next_result(synctex_iterator_p iterator);
+    /**
+     *  Reset the cursor position to the first result.
+     *  - argument iterator: the object to iterate on...
+     */
+    int synctex_iterator_reset(synctex_iterator_p iterator);
+    /**
+     *  The number of objects left for traversal.
+     *  - argument iterator: the object to iterate on...
+     */
+    int synctex_iterator_count(synctex_iterator_p iterator);
+
+    /**
+     *  The target of the node, either a handle or a proxy.
+     */
+    synctex_node_p synctex_node_target(synctex_node_p node);
+    
+#ifndef SYNCTEX_NO_UPDATER
+    /*  The main synctex updater object.
+     *  This object is used to append information to the synctex file.
+     *  Its implementation is considered private.
+     *  It is used by the synctex command line tool to take into account modifications
+     *  that could occur while postprocessing files by dvipdf like filters.
+     */
+    typedef struct synctex_updater_t synctex_updater_s;
+    typedef synctex_updater_s * synctex_updater_p;
+    
+    /*  Designated initializer.
+     *  Once you are done with your whole job,
+     *  free the updater */
+    synctex_updater_p synctex_updater_new_with_output_file(const char * output, const char * directory);
+    
+    /*  Use the next functions to append records to the synctex file,
+     *  no consistency tests made on the arguments */
+    void synctex_updater_append_magnification(synctex_updater_p updater, char *  magnification);
+    void synctex_updater_append_x_offset(synctex_updater_p updater, char *  x_offset);
+    void synctex_updater_append_y_offset(synctex_updater_p updater, char *  y_offset);
+    
+    /*  You MUST free the updater, once everything is properly appended */
+    void synctex_updater_free(synctex_updater_p updater);
+#endif
+    
+#if defined(SYNCTEX_DEBUG)
+#   include "assert.h"
+#   define SYNCTEX_ASSERT assert
+#else
+#   define SYNCTEX_ASSERT(UNUSED)
+#endif
+
+#if defined(SYNCTEX_TESTING)
+#warning TESTING IS PROHIBITED
+#if __clang__
+#define __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
+_Pragma("clang diagnostic push") \
+_Pragma("clang diagnostic ignored \"-Wformat-extra-args\"")
+    
+#define __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS _Pragma("clang diagnostic pop")
+#else
+#define __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS
+#define __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS
+#endif
+    
+#   define SYNCTEX_TEST_BODY(counter, condition, desc, ...) \
+    do {				\
+        __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
+        if (!(condition)) {		\
+            ++counter;  \
+            printf("**** Test failed: %s\nfile %s\nfunction %s\nline %i\n",#condition,__FILE__,__FUNCTION__,__LINE__); \
+            printf((desc), ##__VA_ARGS__); \
+        }				\
+        __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
+    } while(0)
+        
+#   define SYNCTEX_TEST_PARAMETER(counter, condition) SYNCTEX_TEST_BODY(counter, (condition), "Invalid parameter not satisfying: %s", #condition)
+    
+    int synctex_test_input(synctex_scanner_p scanner);
+    int synctex_test_proxy(synctex_scanner_p scanner);
+    int synctex_test_tree(synctex_scanner_p scanner);
+    int synctex_test_page(synctex_scanner_p scanner);
+    int synctex_test_handle(synctex_scanner_p scanner);
+    int synctex_test_display_query(synctex_scanner_p scanner);
+    int synctex_test_charindex();
+    int synctex_test_sheet_1();
+    int synctex_test_sheet_2();
+    int synctex_test_sheet_3();
+    int synctex_test_form();
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 45 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_local.h

@@ -0,0 +1,45 @@
+/* 
+ Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the SyncTeX package.
+ 
+ Latest Revision: Sun Oct 15 15:09:55 UTC 2017
+ 
+ Version: 1.21
+ 
+ See synctex_parser_readme.txt for more details
+ 
+ License:
+ --------
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE
+ 
+ Except as contained in this notice, the name of the 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 from the copyright holder.
+ 
+ */
+
+/* This local header file is for TEXLIVE, use your own header to fit your system */
+#   include <w2c/c-auto.h> /* for inline && HAVE_xxx */
+/*	No inlining for synctex tool in texlive. */
+#	define SYNCTEX_INLINE

+ 204 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_readme.txt

@@ -0,0 +1,204 @@
+This file is part of the SyncTeX package.
+
+Please refer to synctex_parser_readme.md
+
+The Synchronization TeXnology named SyncTeX is a new feature
+of recent TeX engines designed by Jerome Laurens.
+It allows to synchronize between input and output, which means to
+navigate from the source document to the typeset material and vice versa.
+More informations on http://itexmac2.sourceforge.net/SyncTeX.html
+
+This package is mainly for developers, it mainly contains the following files:
+
+synctex_parser_readme.txt
+synctex_parser_version.txt
+synctex_parser_utils.c
+synctex_parser_utils.h
+synctex_parser_local.h
+synctex_parser_private.h
+synctex_parser.h
+synctex_parser.c
+
+The file you are reading contains more informations about the SyncTeX parser history.
+
+In order to support SyncTeX in a viewer, it is sufficient to include
+in the source the files synctex_parser.h and synctex_parser.c.
+The synctex parser usage is described in synctex_parser.h header file.
+
+The other files are used by tex engines or by the synctex command line utility:
+
+ChangeLog
+README.txt
+am
+man1
+man5
+synctex-common.h
+synctex-convert.sh
+synctex-e-mem.ch0
+synctex-e-mem.ch1
+synctex-e-rec.ch0
+synctex-e-rec.ch1
+synctex-etex.h
+synctex-mem.ch0
+synctex-mem.ch1
+synctex-mem.ch2
+synctex-pdf-rec.ch2
+synctex-pdftex.h
+synctex-rec.ch0
+synctex-rec.ch1
+synctex-rec.ch2
+synctex-tex.h
+synctex-xe-mem.ch2
+synctex-xe-rec.ch2
+synctex-xe-rec.ch3
+synctex-xetex.h
+synctex.c
+synctex.defines
+synctex.h
+synctex_main.c
+tests
+
+
+Version:
+--------
+This is version 1, which refers to the synctex output file format.
+The files are identified by a build number.
+In order to help developers to automatically manage the version and build numbers
+and download the parser only when necessary, the synctex_parser.version
+is an ASCII text file just containing the current version and build numbers.
+
+History:
+--------
+1.1: Thu Jul 17 09:28:13 UTC 2008
+- First official version available in TeXLive 2008 DVD.
+  Unfortunately, the backwards synchronization is not working properly mainly for ConTeXt users, see below.
+1.2: Tue Sep  2 10:28:32 UTC 2008
+- Correction for ConTeXt support in the edit query.
+  The previous method was assuming that TeX boxes do not overlap,
+  which is reasonable for LaTeX but not for ConTeXt.
+  This assumption is no longer considered.
+1.3: Fri Sep  5 09:39:57 UTC 2008
+- Local variable "read" renamed to "already_read" to avoid conflicts.
+- "inline" compiler directive renamed to "SYNCTEX_INLINE" for code support and maintenance
+- _synctex_error cannot be inlined due to variable arguments (thanks Christiaan Hofman)
+- Correction in the display query, extra boundary nodes are used for a more precise forwards synchronization
+1.4: Fri Sep 12 08:12:34 UTC 2008
+- For an unknown reason, the previous version was not the real 1.3 (as used in iTeXMac2 build 747).
+  As a consequence, a crash was observed.
+- Some typos are fixed.
+1.6: Mon Nov  3 20:20:02 UTC 2008
+- The bug that prevented synchronization with compressed files on windows has been fixed.
+- New interface to allow system specific customization.
+- Note that some APIs have changed.
+1.8: Mer  8 jul 2009 11:32:38 UTC
+Note that version 1.7 was delivered privately.
+- bug fix: synctex was causing a memory leak in pdftex and xetex, thus some processing speed degradation
+- bug fix: the synctex command line tool was broken when updating a .synctex file
+- enhancement: better accuracy of the synchronization process
+- enhancement: the pdf output file and the associated .synctex file no longer need to live in the same directory.
+               The new -d option of the synctex command line tool manages this situation.
+               This is handy when using something like tex -output-directory=DIR ...
+1.9: Wed Nov  4 11:52:35 UTC 2009
+- Various typo fixed
+- OutputDebugString replaced by OutputDebugStringA to deliberately disable unicode preprocessing
+- New conditional created because OutputDebugStringA is only available since Windows 2K professional
+1.10: Sun Jan  10 10:12:32 UTC 2010 
+- Bug fix in synctex_parser.c to solve a synchronization problem with amsmath's gather environment.
+  Concerns the synctex tool.
+1.11: Sun Jan  17 09:12:31 UTC 2010
+- Bug fix in synctex_parser.c, function synctex_node_box_visible_v: 'x' replaced by 'y'.
+  Only 3rd party tools are concerned.
+1.12: Mon Jul 19 21:52:10 UTC 2010
+- Bug fix in synctex_parser.c, function __synctex_open: the io_mode was modified even in case of a non zero return,
+causing a void .synctex.gz file to be created even if it was not expected. Reported by Marek Kasik concerning a bug on evince.
+1.13: Fri Mar 11 07:39:12 UTC 2011
+- Bug fix in synctex_parser.c, better synchronization as suggested by Jan Sundermeyer (near line 3388).
+- Stronger code design in synctex_parser_utils.c, function _synctex_get_name (really neutral behavior).
+  Only 3rd party tools are concerned.
+1.14: Fri Apr 15 19:10:57 UTC 2011
+- taking output_directory into account
+- Replaced FOPEN_WBIN_MODE by FOPEN_W_MODE when opening the text version of the .synctex file.
+- Merging with LuaTeX's version of synctex.c
+1.15: Fri Jun 10 14:10:17 UTC 2011
+This concerns the synctex command line tool and 3rd party developers.
+TeX and friends are not concerned by these changes.
+- Bug fixed in _synctex_get_io_mode_name, sometimes the wrong mode was returned
+- Support for LuaTeX convention of './' file prefixing
+1.16: Tue Jun 14 08:23:30 UTC 2011
+This concerns the synctex command line tool and 3rd party developers.
+TeX and friends are not concerned by these changes.
+- Better forward search (thanks Jose Alliste)
+- Support for LuaTeX convention of './' file prefixing now for everyone, not only for Windows
+1.17: Fri Oct 14 08:15:16 UTC 2011
+This concerns the synctex command line tool and 3rd party developers.
+TeX and friends are not concerned by these changes.
+- synctex_parser.c: cosmetic changes to enhance code readability 
+- Better forward synchronization.
+  The problem occurs for example with LaTeX \item command.
+  The fact is that this command creates nodes at parse time but these nodes are used only
+  after the text material of the \item is displayed on the page. The consequence is that sometimes,
+  forward synchronization spots an irrelevant point from the point of view of the editing process.
+  This was due to some very basic filtering policy, where a somehow arbitrary choice was made when
+  many different possibilities where offered for synchronisation.
+  Now, forward synchronization prefers nodes inside an hbox with as many acceptable spots as possible.
+  This is achieved with the notion of mean line and node weight.
+- Adding support for the new file naming convention with './'
+    + function synctex_ignore_leading_dot_slash_in_path replaces synctex_ignore_leading_dot_slash
+    + function _synctex_is_equivalent_file_name is more permissive
+  Previously, the function synctex_scanner_get_tag would give an answer only when
+  the given file name was EXACTLY one of the file names listed in the synctex file.
+  The we added some changes accepting for example 'foo.tex' instead of './foo.tex'.
+  Now we have an even looser policy for dealing with file names.
+  If the given file name does not match exactly one the file names of the synctex file,
+  then we try to match the base names. If there is only one match of the base names,
+  then it is taken as a match for the whole names.
+  The base name is defined as following:
+      ./foo => foo
+      /my///.////foo => foo
+      /foo => /foo
+      /my//.foo => /my//.foo
+1.17: Tue Mar 13 10:10:03 UTC 2012
+- minor changes, no version changes
+- syntax man pages are fixed as suggested by M. Shimata
+	see mail to tex-live@tug.org titled "syntax.5 has many warnings from groff" and "syntax.1 use invalid macro for mdoc"
+1.17: Tue Jan 14 09:55:00 UTC 2014
+- fixed a segfault, from Sebastian Ramacher
+1.17: Mon Aug 04
+- fixed a memory leak
+1.18: Thu Jun 25 11:36:05 UTC 2015
+- nested sheets now fully supported (does it make sense in TeX)
+- cosmetic changes: uniform indentation
+- suppression of warnings, mainly long/int ones. In short, zlib likes ints when size_t likes longs.
+- CLI synctex tool can build out of TeXLive (modulo appropriate options passed to the compiler)
+1.19: Thu Mar  9 21:26:27 UTC 2017
+- the nested sheets patch was not a good solution.
+  It has been moved from the parser to the engine.
+  See the synctex.c source file for detailed explanations.
+- there is a new synctex format specification.
+  We can see that a .synctex file can contain many times
+  the same vertical position because many objects belong
+  to the same line. When the options read -synctex=±2 or more,
+  a very basic compression algorithm is used:
+  if synctex is about write the same number then it writes
+  an = sign instead. This saves approximately 10% of the
+  synctex output file, either compressed or not.
+  The new synctex parser has been updated accordingly.
+  Actual tex frontend won't see any difference with the
+  TeX engines that include this new feature.
+  Frontends with the new parser won't see any difference
+  with the older TeX engines.
+  Frontends with the new parser will only see a difference
+  with new TeX engines if -synctex=±2 or more is used.
+
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Copyright (c) 2008-2014 jerome DOT laurens AT u-bourgogne DOT fr
+

+ 163 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_utils.h

@@ -0,0 +1,163 @@
+/* 
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the __SyncTeX__ package.
+ 
+ [//]: # (Latest Revision: Fri Jul 14 16:20:41 UTC 2017)
+ [//]: # (Version: 1.21)
+ 
+ See `synctex_parser_readme.md` for more details
+ 
+ ## License
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+*/
+
+#ifndef SYNCTEX_PARSER_UTILS_H
+#define SYNCTEX_PARSER_UTILS_H
+
+/*  The utilities declared here are subject to conditional implementation.
+ *  All the operating system special stuff goes here.
+ *  The problem mainly comes from file name management: path separator, encoding...
+ */
+
+#include "synctex_version.h"
+
+typedef int synctex_bool_t;
+#	define synctex_YES (0==0)
+#	define synctex_NO (0==1)
+
+#	define synctex_ADD_QUOTES -1
+#	define synctex_COMPRESS -1
+#	define synctex_DONT_ADD_QUOTES 0
+#	define synctex_DONT_COMPRESS 0
+
+#ifndef __SYNCTEX_PARSER_UTILS__
+#   define __SYNCTEX_PARSER_UTILS__
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#	if defined(_WIN32) || defined(__OS2__)
+#       define SYNCTEX_CASE_SENSITIVE_PATH 0
+#		define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c || '\\' == c)
+#	else
+#       define SYNCTEX_CASE_SENSITIVE_PATH 1
+#		define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c)
+#	endif
+    
+#	if defined(_WIN32) || defined(__OS2__)
+#		define SYNCTEX_IS_DOT(c) ('.' == c)
+#	else
+#		define SYNCTEX_IS_DOT(c) ('.' == c)
+#	endif
+    
+#	if SYNCTEX_CASE_SENSITIVE_PATH
+#		define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (left != right)
+#	else
+#		define SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(left,right) (toupper(left) != toupper(right))
+#	endif
+    
+/*  This custom malloc functions initializes to 0 the newly allocated memory.
+ *  There is no bzero function on windows. */
+void *_synctex_malloc(size_t size);
+
+/*  To balance _synctex_malloc.
+ *  ptr might be NULL.   */
+void _synctex_free(void * ptr);
+
+/*  This is used to log some informational message to the standard error stream.
+ *  On Windows, the stderr stream is not exposed and another method is used.
+ *	The return value is the number of characters printed.	*/
+    int _synctex_error(const char * reason,...);
+    int _synctex_debug(const char * reason,...);
+
+/*  strip the last extension of the given string, this string is modified!
+ *  This function depends on the OS because the path separator may differ.
+ *  This should be discussed more precisely. */
+void _synctex_strip_last_path_extension(char * string);
+
+/*  Compare two file names, windows is sometimes case insensitive...
+ *  The given strings may differ stricto sensu, but represent the same file name.
+ *  It might not be the real way of doing things.
+ *  The return value is an undefined non 0 value when the two file names are equivalent.
+ *  It is 0 otherwise. */
+synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs);
+
+/*	Description forthcoming.*/
+synctex_bool_t _synctex_path_is_absolute(const char * name);
+
+/*	Description forthcoming...*/
+const char * _synctex_last_path_component(const char * name);
+
+/*	Description forthcoming...*/
+const char * _synctex_base_name(const char *path);
+
+/*	If the core of the last path component of src is not already enclosed with double quotes ('"')
+ *  and contains a space character (' '), then a new buffer is created, the src is copied and quotes are added.
+ *	In all other cases, no destination buffer is created and the src is not copied.
+ *  0 on success, which means no error, something non 0 means error, mainly due to memory allocation failure, or bad parameter.
+ *  This is used to fix a bug in the first version of pdftex with synctex (1.40.9) for which names with spaces
+ *  were not managed in a standard way.
+ *  On success, the caller owns the buffer pointed to by dest_ref (is any) and
+ *  is responsible of freeing the memory when done.
+ *	The size argument is the size of the src buffer. On return the dest_ref points to a buffer sized size+2.*/
+int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size);
+
+/*  These are the possible extensions of the synctex file */
+extern const char * synctex_suffix;
+extern const char * synctex_suffix_gz;
+
+typedef unsigned int synctex_io_mode_t;
+
+typedef enum {
+	synctex_io_append_mask = 1,
+    synctex_io_gz_mask = synctex_io_append_mask<<1
+} synctex_io_mode_masks_t;
+
+typedef enum {
+	synctex_compress_mode_none = 0,
+	synctex_compress_mode_gz = 1
+} synctex_compress_mode_t;
+
+int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_io_mode_t * io_mode_ref);
+
+/*  returns the correct mode required by fopen and gzopen from the given io_mode */
+const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode);
+
+synctex_bool_t synctex_ignore_leading_dot_slash_in_path(const char ** name);
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+#endif /* SYNCTEX_PARSER_UTILS_H */

+ 570 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_utils.m

@@ -0,0 +1,570 @@
+/* 
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the __SyncTeX__ package.
+ 
+ [//]: # (Latest Revision: Fri Jul 14 16:20:41 UTC 2017)
+ [//]: # (Version: 1.21)
+ 
+ See `synctex_parser_readme.md` for more details
+ 
+ ## License
+ 
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE
+ 
+ Except as contained in this notice, the name of the 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 from the copyright holder.
+
+*/
+
+/*  In this file, we find all the functions that may depend on the operating system. */
+
+#include "synctex_parser_utils.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <limits.h>
+#include <ctype.h>
+#include <string.h>
+
+#include <sys/stat.h>
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__)
+#define SYNCTEX_WINDOWS 1
+#endif
+
+#if defined(__OS2__)
+#define SYNCTEX_OS2 1
+#endif
+
+#if defined(_WIN32)
+#define SYNCTEX_RECENT_WINDOWS 1
+#endif
+
+#ifdef SYNCTEX_WINDOWS
+#include <windows.h>
+#include <shlwapi.h> /* Use shlwapi.lib */
+#endif
+
+void *_synctex_malloc(size_t size) {
+    void * ptr = malloc(size);
+    if(ptr) {
+        memset(ptr,0, size);/* ensures null termination of strings */
+    }
+    return (void *)ptr;
+}
+
+void _synctex_free(void * ptr) {
+    if (ptr) {
+        free(ptr);
+    }
+}
+
+#if !defined(_WIN32)
+#   include <syslog.h>
+#endif
+
+static int _synctex_log(int level, const char * prompt, const char * reason,va_list arg) {
+	int result;
+#	ifdef SYNCTEX_RECENT_WINDOWS
+	{/*	This code is contributed by William Blum.
+        As it does not work on some older computers,
+        the _WIN32 conditional here is replaced with a SYNCTEX_RECENT_WINDOWS one.
+        According to http://msdn.microsoft.com/en-us/library/aa363362(VS.85).aspx
+        Minimum supported client	Windows 2000 Professional
+        Minimum supported server	Windows 2000 Server
+        People running Windows 2K standard edition will not have OutputDebugStringA.
+        JL.*/
+		char *buff;
+		size_t len;
+		OutputDebugStringA(prompt);
+		len = _vscprintf(reason, arg) + 1;
+		buff = (char*)malloc( len * sizeof(char) );
+		result = vsprintf(buff, reason, arg) +strlen(prompt);
+		OutputDebugStringA(buff);
+		OutputDebugStringA("\n");
+		free(buff);
+	}
+#   elif SYNCTEX_USE_SYSLOG
+    char * buffer1 = NULL;
+    char * buffer2 = NULL;
+    openlog ("SyncTeX", LOG_CONS | LOG_PID | LOG_PERROR | LOG_NDELAY, LOG_LOCAL0);
+    if (vasprintf(&buffer1,reason,arg)>=0
+        && asprintf(&buffer2,"%s%s",prompt, buffer1)>=0) {
+        syslog (level, "%s", buffer2);
+        result = (int)strlen(buffer2);
+    } else {
+        syslog (level, "%s",prompt);
+        vsyslog(level,reason,arg);
+        result = (int)strlen(prompt);
+    }
+    free(buffer1);
+    free(buffer2);
+    closelog();
+#   else
+    FILE * where = level == LOG_ERR? stderr: stdout;
+    result = fputs(prompt,where);
+    result += vfprintf(where, reason, arg);
+    result += fprintf(where,"\n");
+#   endif
+	return result;
+}
+
+int _synctex_error(const char * reason,...) {
+    va_list arg;
+    int result;
+    va_start (arg, reason);
+#if defined(SYNCTEX_RECENT_WINDOWS) /* LOG_ERR is not used */
+    result = _synctex_log(0, "! SyncTeX Error : ", reason, arg);
+#else
+    result = _synctex_log(LOG_ERR, "! SyncTeX Error : ", reason, arg);
+#endif
+    va_end (arg);
+    return result;
+}
+
+int _synctex_debug(const char * reason,...) {
+    va_list arg;
+    int result;
+    va_start (arg, reason);
+#if defined(SYNCTEX_RECENT_WINDOWS) /* LOG_DEBUG is not used */
+    result = _synctex_log(0, "! SyncTeX Error : ", reason, arg);
+#else
+    result = _synctex_log(LOG_DEBUG, "! SyncTeX Error : ", reason, arg);
+#endif
+    va_end (arg);
+    return result;
+}
+
+/*  strip the last extension of the given string, this string is modified! */
+void _synctex_strip_last_path_extension(char * string) {
+	if(NULL != string){
+		char * last_component = NULL;
+		char * last_extension = NULL;
+#       if defined(SYNCTEX_WINDOWS)
+		last_component = PathFindFileName(string);
+		last_extension = PathFindExtension(string);
+		if(last_extension == NULL)return;
+		if(last_component == NULL)last_component = string;
+		if(last_extension>last_component){/* filter out paths like "my/dir/.hidden" */
+			last_extension[0] = '\0';
+		}
+#       else
+		char * next = NULL;
+		/*  first we find the last path component */
+		if(NULL == (last_component = strstr(string,"/"))){
+			last_component = string;
+		} else {
+			++last_component;
+			while((next = strstr(last_component,"/"))){
+				last_component = next+1;
+			}
+		}
+#               if defined(SYNCTEX_OS2)
+		/*  On OS2, the '\' is also a path separator. */
+		while((next = strstr(last_component,"\\"))){
+			last_component = next+1;
+		}
+#               endif /* SYNCTEX_OS2 */
+		/*  then we find the last path extension */
+		if((last_extension = strstr(last_component,"."))){
+			++last_extension;
+			while((next = strstr(last_extension,"."))){
+				last_extension = next+1;
+			}
+			--last_extension;/*  back to the "." */
+			if(last_extension>last_component){/*  filter out paths like ....my/dir/.hidden"*/
+				last_extension[0] = '\0';
+			}
+		}
+#       endif /* SYNCTEX_WINDOWS */
+	}
+}
+
+synctex_bool_t synctex_ignore_leading_dot_slash_in_path(const char ** name_ref)
+{
+    if (SYNCTEX_IS_DOT((*name_ref)[0]) && SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[1])) {
+        do {
+            (*name_ref) += 2;
+            while (SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[0])) {
+                ++(*name_ref);
+            }
+        } while(SYNCTEX_IS_DOT((*name_ref)[0]) && SYNCTEX_IS_PATH_SEPARATOR((*name_ref)[1]));
+        return synctex_YES;
+    }
+    return synctex_NO;
+}
+
+/*  The base name is necessary to deal with the 2011 file naming convention...
+ *  path is a '\0' terminated string
+ *  The return value is the trailing part of the argument,
+ *  just following the first occurrence of the regexp pattern "[^|/|\].[\|/]+".*/
+const char * _synctex_base_name(const char *path) {
+    const char * ptr = path;
+    do {
+        if (synctex_ignore_leading_dot_slash_in_path(&ptr)) {
+            return ptr;
+        }
+        do {
+            if (!*(++ptr)) {
+                return path;
+            }
+        } while (!SYNCTEX_IS_PATH_SEPARATOR(*ptr));
+    } while (*(++ptr));
+    return path;
+}
+
+/*  Compare two file names, windows is sometimes case insensitive... */
+synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs) {
+    /*  Remove the leading regex '(\./+)*' in both rhs and lhs */
+    synctex_ignore_leading_dot_slash_in_path(&lhs);
+    synctex_ignore_leading_dot_slash_in_path(&rhs);
+next_character:
+	if (SYNCTEX_IS_PATH_SEPARATOR(*lhs)) {/*  lhs points to a path separator */
+		if (!SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  but not rhs */
+			return synctex_NO;
+		}
+        ++lhs;
+        ++rhs;
+        synctex_ignore_leading_dot_slash_in_path(&lhs);
+        synctex_ignore_leading_dot_slash_in_path(&rhs);
+        goto next_character;
+	} else if (SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  rhs points to a path separator but not lhs */
+		return synctex_NO;
+	} else if (SYNCTEX_ARE_PATH_CHARACTERS_EQUAL(*lhs,*rhs)){/*  uppercase do not match */
+		return synctex_NO;
+	} else if (!*lhs) {/*  lhs is at the end of the string */
+		return *rhs ? synctex_NO : synctex_YES;
+	} else if(!*rhs) {/*  rhs is at the end of the string but not lhs */
+		return synctex_NO;
+	}
+	++lhs;
+	++rhs;
+	goto next_character;
+}
+
+synctex_bool_t _synctex_path_is_absolute(const char * name) {
+	if(!strlen(name)) {
+		return synctex_NO;
+	}
+#	if defined(SYNCTEX_WINDOWS) || defined(SYNCTEX_OS2)
+	if(strlen(name)>2) {
+		return (name[1]==':' && SYNCTEX_IS_PATH_SEPARATOR(name[2]))?synctex_YES:synctex_NO;
+	}
+	return synctex_NO;
+#	else
+    return SYNCTEX_IS_PATH_SEPARATOR(name[0])?synctex_YES:synctex_NO;
+#	endif
+}
+
+/*  We do not take care of UTF-8 */
+const char * _synctex_last_path_component(const char * name) {
+	const char * c = name+strlen(name);
+	if(c>name) {
+		if(!SYNCTEX_IS_PATH_SEPARATOR(*c)) {
+			do {
+				--c;
+				if(SYNCTEX_IS_PATH_SEPARATOR(*c)) {
+					return c+1;
+				}
+			} while(c>name);
+		}
+		return c;/* the last path component is the void string*/
+	}
+	return c;
+}
+
+int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size) {
+  if(src && dest_ref) {
+      const char * lpc;
+#		define dest (*dest_ref)
+		dest = NULL;	/*	Default behavior: no change and sucess. */
+		lpc = _synctex_last_path_component(src);
+		if(strlen(lpc)) {
+			if(strchr(lpc,' ') && lpc[0]!='"' && lpc[strlen(lpc)-1]!='"') {
+				/*	We are in the situation where adding the quotes is allowed.	*/
+				/*	Time to add the quotes.	*/
+				/*  Consistency test: we must have dest+size>dest+strlen(dest)+2
+				 *	or equivalently: strlen(dest)+2<size (see below) */
+				if(strlen(src)<size) {
+					if((dest = (char *)malloc(size+2))) {
+						char * dpc = dest + (lpc-src);	/*	dpc is the last path component of dest.	*/
+						if(dest != strncpy(dest,src,size)) {
+							_synctex_error("!  _synctex_copy_with_quoting_last_path_component: Copy problem");
+							free(dest);
+							dest = NULL;/*  Don't forget to reinitialize. */
+							return -2;
+						}
+						memmove(dpc+1,dpc,strlen(dpc)+1);	/*	Also move the null terminating character. */
+						dpc[0]='"';
+						dpc[strlen(dpc)+1]='\0';/*	Consistency test */
+						dpc[strlen(dpc)]='"';
+						return 0;	/*	Success. */
+					}
+					return -1;	/*	Memory allocation error.	*/
+				}
+				_synctex_error("!  _synctex_copy_with_quoting_last_path_component: Internal inconsistency");
+				return -3;
+			}
+			return 0;	/*	Success. */
+		}
+		return 0;	/*	No last path component. */
+#		undef dest
+	}
+	return 1; /*  Bad parameter, this value is subject to changes. */
+}
+
+/*  The client is responsible of the management of the returned string, if any. */
+char * _synctex_merge_strings(const char * first,...);
+
+char * _synctex_merge_strings(const char * first,...) {
+	va_list arg;
+	size_t size = 0;
+	const char * temp;
+	/*   First retrieve the size necessary to store the merged string */
+	va_start (arg, first);
+	temp = first;
+	do {
+		size_t len = strlen(temp);
+		if(UINT_MAX-len<size) {
+			_synctex_error("!  _synctex_merge_strings: Capacity exceeded.");
+			return NULL;
+		}
+		size+=len;
+	} while( (temp = va_arg(arg, const char *)) != NULL);
+	va_end(arg);
+	if(size>0) {
+		char * result = NULL;
+		++size;
+		/*  Create the memory storage */
+		if(NULL!=(result = (char *)malloc(size))) {
+			char * dest = result;
+			va_start (arg, first);
+			temp = first;
+			do {
+				if((size = strlen(temp))>0) {
+					/*  There is something to merge */
+					if(dest != strncpy(dest,temp,size)) {
+						_synctex_error("!  _synctex_merge_strings: Copy problem");
+						free(result);
+						result = NULL;
+						return NULL;
+					}
+					dest += size;
+				}
+			} while( (temp = va_arg(arg, const char *)) != NULL);
+			va_end(arg);
+			dest[0]='\0';/*  Terminate the merged string */
+			return result;
+		}
+		_synctex_error("!  _synctex_merge_strings: Memory problem");
+		return NULL;
+	}
+	return NULL;	
+}
+
+/*  The purpose of _synctex_get_name is to find the name of the synctex file.
+ *  There is a list of possible filenames from which we return the most recent one and try to remove all the others.
+ *  With two runs of pdftex or xetex we are sure the the synctex file is really the most appropriate.
+ */
+int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_io_mode_t * io_mode_ref)
+{
+	if(output && synctex_name_ref && io_mode_ref) {
+		/*  If output is already absolute, we just have to manage the quotes and the compress mode */
+		size_t size = 0;
+        char * synctex_name = NULL;
+        synctex_io_mode_t io_mode = *io_mode_ref;
+		const char * base_name = _synctex_last_path_component(output); /*  do not free, output is the owner. base name of output*/
+		/*  Do we have a real base name ? */
+		if(strlen(base_name)>0) {
+			/*  Yes, we do. */
+			const char * temp = NULL;
+			char * core_name = NULL; /*  base name of output without path extension. */
+			char * dir_name = NULL; /*  dir name of output */
+			char * quoted_core_name = NULL;
+			char * basic_name = NULL;
+			char * gz_name = NULL;
+			char * quoted_name = NULL;
+			char * quoted_gz_name = NULL;
+			char * build_name = NULL;
+			char * build_gz_name = NULL;
+			char * build_quoted_name = NULL;
+			char * build_quoted_gz_name = NULL;
+			struct stat buf;
+			time_t the_time = 0;
+			/*  Create core_name: let temp point to the dot before the path extension of base_name;
+			 *  We start form the \0 terminating character and scan the string upward until we find a dot.
+			 *  The leading dot is not accepted. */
+			if((temp = strrchr(base_name,'.')) && (size = temp - base_name)>0) {
+				/*  There is a dot and it is not at the leading position    */
+				if(NULL == (core_name = (char *)malloc(size+1))) {
+					_synctex_error("!  _synctex_get_name: Memory problem 1");
+					return -1;
+				}
+				if(core_name != strncpy(core_name,base_name,size)) {
+					_synctex_error("!  _synctex_get_name: Copy problem 1");
+					free(core_name);
+					dir_name = NULL;
+					return -2;
+				}
+				core_name[size] = '\0';
+			} else {
+				/*  There is no path extension,
+				 *  Just make a copy of base_name */
+				core_name = _synctex_merge_strings(base_name);
+			}
+			/*  core_name is properly set up, owned by "self". */
+			/*  creating dir_name. */
+			size = strlen(output)-strlen(base_name);
+			if(size>0) {
+				/*  output contains more than one path component */
+				if(NULL == (dir_name = (char *)malloc(size+1))) {
+					_synctex_error("!  _synctex_get_name: Memory problem");
+					free(core_name);
+					return -1;
+				}
+				if(dir_name != strncpy(dir_name,output,size)) {
+					_synctex_error("!  _synctex_get_name: Copy problem");
+					free(dir_name);
+					dir_name = NULL;
+					free(core_name);
+					dir_name = NULL;
+					return -2;
+				}
+				dir_name[size] = '\0';
+			}
+			/*  dir_name is properly set up. It ends with a path separator, if non void. */
+			/*  creating quoted_core_name. */
+			if(strchr(core_name,' ')) {
+				quoted_core_name = _synctex_merge_strings("\"",core_name,"\"");
+			}
+			/*  quoted_core_name is properly set up. */
+			if(dir_name &&strlen(dir_name)>0) {
+				basic_name = _synctex_merge_strings(dir_name,core_name,synctex_suffix,NULL);
+				if(quoted_core_name && strlen(quoted_core_name)>0) {
+					quoted_name = _synctex_merge_strings(dir_name,quoted_core_name,synctex_suffix,NULL);
+				}
+			} else {
+				basic_name = _synctex_merge_strings(core_name,synctex_suffix,NULL);
+				if(quoted_core_name && strlen(quoted_core_name)>0) {
+					quoted_name = _synctex_merge_strings(quoted_core_name,synctex_suffix,NULL);
+				}
+			}
+			if(!_synctex_path_is_absolute(output) && build_directory && (size = strlen(build_directory))) {
+				temp = build_directory + size - 1;
+				if(_synctex_path_is_absolute(temp)) {
+					build_name = _synctex_merge_strings(build_directory,basic_name,NULL);
+					if(quoted_core_name && strlen(quoted_core_name)>0) {
+						build_quoted_name = _synctex_merge_strings(build_directory,quoted_name,NULL);
+					}
+				} else {
+					build_name = _synctex_merge_strings(build_directory,"/",basic_name,NULL);
+					if(quoted_core_name && strlen(quoted_core_name)>0) {
+						build_quoted_name = _synctex_merge_strings(build_directory,"/",quoted_name,NULL);
+					}
+				}
+			}
+			if(basic_name) {
+				gz_name = _synctex_merge_strings(basic_name,synctex_suffix_gz,NULL);
+			}
+			if(quoted_name) {
+				quoted_gz_name = _synctex_merge_strings(quoted_name,synctex_suffix_gz,NULL);
+			}
+			if(build_name) {
+				build_gz_name = _synctex_merge_strings(build_name,synctex_suffix_gz,NULL);
+			}
+			if(build_quoted_name) {
+				build_quoted_gz_name = _synctex_merge_strings(build_quoted_name,synctex_suffix_gz,NULL);
+			}
+			/*  All the others names are properly set up... */
+			/*  retain the most recently modified file */
+#			define TEST(FILENAME,COMPRESS_MODE) \
+			if(FILENAME) {\
+				if (stat(FILENAME, &buf)) { \
+					free(FILENAME);\
+					FILENAME = NULL;\
+				} else if (buf.st_mtime>the_time) { \
+                    the_time=buf.st_mtime; \
+                    synctex_name = FILENAME; \
+                    if (COMPRESS_MODE) { \
+                        io_mode |= synctex_io_gz_mask; \
+                    } else { \
+                        io_mode &= ~synctex_io_gz_mask; \
+                    } \
+				} \
+			}
+			TEST(basic_name,synctex_DONT_COMPRESS);
+			TEST(gz_name,synctex_COMPRESS);
+			TEST(quoted_name,synctex_DONT_COMPRESS);
+			TEST(quoted_gz_name,synctex_COMPRESS);
+			TEST(build_name,synctex_DONT_COMPRESS);
+			TEST(build_gz_name,synctex_COMPRESS);
+			TEST(build_quoted_name,synctex_DONT_COMPRESS);
+			TEST(build_quoted_gz_name,synctex_COMPRESS);
+#			undef TEST
+			/*  Free all the intermediate filenames, except the one that will be used as returned value. */
+#			define CLEAN_AND_REMOVE(FILENAME) \
+			if(FILENAME && (FILENAME!=synctex_name)) {\
+				remove(FILENAME);\
+				printf("synctex tool info: %s removed\n",FILENAME);\
+				free(FILENAME);\
+				FILENAME = NULL;\
+			}
+			CLEAN_AND_REMOVE(basic_name);
+			CLEAN_AND_REMOVE(gz_name);
+			CLEAN_AND_REMOVE(quoted_name);
+			CLEAN_AND_REMOVE(quoted_gz_name);
+			CLEAN_AND_REMOVE(build_name);
+			CLEAN_AND_REMOVE(build_gz_name);
+			CLEAN_AND_REMOVE(build_quoted_name);
+			CLEAN_AND_REMOVE(build_quoted_gz_name);
+#			undef CLEAN_AND_REMOVE
+            /* set up the returned values */
+            * synctex_name_ref = synctex_name;
+            /* synctex_name won't always end in .gz, even when compressed. */
+            FILE * F = fopen(synctex_name, "r");
+            if (F != NULL) {
+                if (!feof(F)
+                && 31 == fgetc(F)
+                && !feof(F)
+                && 139 == fgetc(F)) {
+                    io_mode = synctex_compress_mode_gz;
+                }
+                fclose(F);
+            }
+            * io_mode_ref = io_mode;
+			return 0;
+		}
+		return -1;/*  bad argument */
+	}
+	return -2;
+}
+
+const char * _synctex_get_io_mode_name(synctex_io_mode_t io_mode) {
+    static const char * synctex_io_modes[4] = {"r","rb","a","ab"}; 
+    unsigned index = ((io_mode & synctex_io_gz_mask)?1:0) + ((io_mode & synctex_io_append_mask)?2:0);// bug pointed out by Jose Alliste
+    return synctex_io_modes[index];
+}

+ 1 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_parser_version.txt

@@ -0,0 +1 @@
+1.21

+ 59 - 0
PDF Office/PDF Master/Third Pard Library/synctex-parser/synctex_version.h

@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the __SyncTeX__ package.
+
+[//]: # (Latest Revision: Fri Jul 14 16:20:41 UTC 2017)
+[//]: # (Version: 1.21)
+
+See `synctex_parser_readme.md` for more details
+
+## License
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the 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 from the copyright holder.
+
+## Acknowledgments:
+
+The author received useful remarks from the __pdfTeX__ developers, especially Hahn The Thanh,
+and significant help from __XeTeX__ developer Jonathan Kew.
+
+## Nota Bene:
+
+If you include or use a significant part of the __SyncTeX__ package into a software,
+I would appreciate to be listed as contributor and see "__SyncTeX__" highlighted.
+*/
+
+#ifndef __SYNCTEX_VERSION__
+#   define __SYNCTEX_VERSION__
+
+#   define SYNCTEX_VERSION_MAJOR 1
+
+#   define SYNCTEX_VERSION_STRING "1.21"
+
+#   define SYNCTEX_CLI_VERSION_STRING "1.5"
+
+#endif

+ 94 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -1602,6 +1602,30 @@
 		AD68783829A60FC0005B5210 /* KMLoginView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD68783729A60FC0005B5210 /* KMLoginView.xib */; };
 		AD68783929A60FC0005B5210 /* KMLoginView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD68783729A60FC0005B5210 /* KMLoginView.xib */; };
 		AD68783A29A60FC0005B5210 /* KMLoginView.xib in Resources */ = {isa = PBXBuildFile; fileRef = AD68783729A60FC0005B5210 /* KMLoginView.xib */; };
+		AD7D5C812B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C802B8ECD09006562CD /* KMPDFSynchronizer.swift */; };
+		AD7D5C822B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C802B8ECD09006562CD /* KMPDFSynchronizer.swift */; };
+		AD7D5C832B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C802B8ECD09006562CD /* KMPDFSynchronizer.swift */; };
+		AD7D5C852B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C842B8ECD83006562CD /* KMPDFSyncRecord.swift */; };
+		AD7D5C862B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C842B8ECD83006562CD /* KMPDFSyncRecord.swift */; };
+		AD7D5C872B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C842B8ECD83006562CD /* KMPDFSyncRecord.swift */; };
+		AD7D5C922B8F20FE006562CD /* synctex_parser_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C8B2B8F20FE006562CD /* synctex_parser_utils.m */; };
+		AD7D5C932B8F20FE006562CD /* synctex_parser_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C8B2B8F20FE006562CD /* synctex_parser_utils.m */; };
+		AD7D5C942B8F20FE006562CD /* synctex_parser_utils.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C8B2B8F20FE006562CD /* synctex_parser_utils.m */; };
+		AD7D5C952B8F20FE006562CD /* synctex_parser_version.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C8E2B8F20FE006562CD /* synctex_parser_version.txt */; };
+		AD7D5C962B8F20FE006562CD /* synctex_parser_version.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C8E2B8F20FE006562CD /* synctex_parser_version.txt */; };
+		AD7D5C972B8F20FE006562CD /* synctex_parser_version.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C8E2B8F20FE006562CD /* synctex_parser_version.txt */; };
+		AD7D5C982B8F20FE006562CD /* synctex_parser_readme.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C902B8F20FE006562CD /* synctex_parser_readme.txt */; };
+		AD7D5C992B8F20FE006562CD /* synctex_parser_readme.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C902B8F20FE006562CD /* synctex_parser_readme.txt */; };
+		AD7D5C9A2B8F20FE006562CD /* synctex_parser_readme.txt in Resources */ = {isa = PBXBuildFile; fileRef = AD7D5C902B8F20FE006562CD /* synctex_parser_readme.txt */; };
+		AD7D5C9B2B8F20FE006562CD /* synctex_parser.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C912B8F20FE006562CD /* synctex_parser.m */; };
+		AD7D5C9C2B8F20FE006562CD /* synctex_parser.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C912B8F20FE006562CD /* synctex_parser.m */; };
+		AD7D5C9D2B8F20FE006562CD /* synctex_parser.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C912B8F20FE006562CD /* synctex_parser.m */; };
+		AD7D5CA02B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C9F2B8F34EC006562CD /* SKPDFSynchronizer.m */; };
+		AD7D5CA12B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C9F2B8F34EC006562CD /* SKPDFSynchronizer.m */; };
+		AD7D5CA22B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5C9F2B8F34EC006562CD /* SKPDFSynchronizer.m */; };
+		AD7D5CA52B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5CA32B8F35D1006562CD /* SKPDFSyncRecord.m */; };
+		AD7D5CA62B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5CA32B8F35D1006562CD /* SKPDFSyncRecord.m */; };
+		AD7D5CA72B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7D5CA32B8F35D1006562CD /* SKPDFSyncRecord.m */; };
 		AD85D1822AEF46C2000F4D28 /* KMHomeNOFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD85D1812AEF46C2000F4D28 /* KMHomeNOFileView.swift */; };
 		AD85D1832AEF46C2000F4D28 /* KMHomeNOFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD85D1812AEF46C2000F4D28 /* KMHomeNOFileView.swift */; };
 		AD85D1842AEF46C2000F4D28 /* KMHomeNOFileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD85D1812AEF46C2000F4D28 /* KMHomeNOFileView.swift */; };
@@ -5756,6 +5780,21 @@
 		AD68782029A5FADC005B5210 /* KMLightMemberCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMLightMemberCache.swift; sourceTree = "<group>"; };
 		AD68783229A60FA7005B5210 /* KMLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMLoginView.swift; sourceTree = "<group>"; };
 		AD68783729A60FC0005B5210 /* KMLoginView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMLoginView.xib; sourceTree = "<group>"; };
+		AD7D5C802B8ECD09006562CD /* KMPDFSynchronizer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFSynchronizer.swift; sourceTree = "<group>"; };
+		AD7D5C842B8ECD83006562CD /* KMPDFSyncRecord.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFSyncRecord.swift; sourceTree = "<group>"; };
+		AD7D5C892B8F20FE006562CD /* synctex_parser_local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synctex_parser_local.h; sourceTree = "<group>"; };
+		AD7D5C8A2B8F20FE006562CD /* synctex_parser_advanced.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synctex_parser_advanced.h; sourceTree = "<group>"; };
+		AD7D5C8B2B8F20FE006562CD /* synctex_parser_utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = synctex_parser_utils.m; sourceTree = "<group>"; };
+		AD7D5C8C2B8F20FE006562CD /* synctex_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synctex_parser.h; sourceTree = "<group>"; };
+		AD7D5C8D2B8F20FE006562CD /* synctex_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synctex_version.h; sourceTree = "<group>"; };
+		AD7D5C8E2B8F20FE006562CD /* synctex_parser_version.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = synctex_parser_version.txt; sourceTree = "<group>"; };
+		AD7D5C8F2B8F20FE006562CD /* synctex_parser_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synctex_parser_utils.h; sourceTree = "<group>"; };
+		AD7D5C902B8F20FE006562CD /* synctex_parser_readme.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = synctex_parser_readme.txt; sourceTree = "<group>"; };
+		AD7D5C912B8F20FE006562CD /* synctex_parser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = synctex_parser.m; sourceTree = "<group>"; };
+		AD7D5C9E2B8F34EC006562CD /* SKPDFSynchronizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKPDFSynchronizer.h; sourceTree = "<group>"; };
+		AD7D5C9F2B8F34EC006562CD /* SKPDFSynchronizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKPDFSynchronizer.m; sourceTree = "<group>"; };
+		AD7D5CA32B8F35D1006562CD /* SKPDFSyncRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKPDFSyncRecord.m; sourceTree = "<group>"; };
+		AD7D5CA42B8F35D1006562CD /* SKPDFSyncRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKPDFSyncRecord.h; sourceTree = "<group>"; };
 		AD85D1812AEF46C2000F4D28 /* KMHomeNOFileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHomeNOFileView.swift; sourceTree = "<group>"; };
 		AD85D1862AEF46DF000F4D28 /* KMHomeNOFileView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHomeNOFileView.xib; sourceTree = "<group>"; };
 		AD85D19D2AEF927D000F4D28 /* KMQucikToolsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMQucikToolsModel.swift; sourceTree = "<group>"; };
@@ -7393,6 +7432,7 @@
 		89752DA22936ECD5003FF08E /* Third Pard Library */ = {
 			isa = PBXGroup;
 			children = (
+				AD7D5C882B8F20FE006562CD /* synctex-parser */,
 				BB328B662B565BEC00B382C6 /* iVersion */,
 				BB67EE042B54FFEF00573BF0 /* ASIHttpRequest */,
 				ADFCEB422B4FBA430001EBAF /* RemoteConfig  */,
@@ -8995,6 +9035,35 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		AD7D5C7F2B8ECC74006562CD /* Parsers */ = {
+			isa = PBXGroup;
+			children = (
+				AD7D5CA42B8F35D1006562CD /* SKPDFSyncRecord.h */,
+				AD7D5CA32B8F35D1006562CD /* SKPDFSyncRecord.m */,
+				AD7D5C9E2B8F34EC006562CD /* SKPDFSynchronizer.h */,
+				AD7D5C9F2B8F34EC006562CD /* SKPDFSynchronizer.m */,
+				AD7D5C802B8ECD09006562CD /* KMPDFSynchronizer.swift */,
+				AD7D5C842B8ECD83006562CD /* KMPDFSyncRecord.swift */,
+			);
+			path = Parsers;
+			sourceTree = "<group>";
+		};
+		AD7D5C882B8F20FE006562CD /* synctex-parser */ = {
+			isa = PBXGroup;
+			children = (
+				AD7D5C892B8F20FE006562CD /* synctex_parser_local.h */,
+				AD7D5C8A2B8F20FE006562CD /* synctex_parser_advanced.h */,
+				AD7D5C8B2B8F20FE006562CD /* synctex_parser_utils.m */,
+				AD7D5C8C2B8F20FE006562CD /* synctex_parser.h */,
+				AD7D5C8D2B8F20FE006562CD /* synctex_version.h */,
+				AD7D5C8E2B8F20FE006562CD /* synctex_parser_version.txt */,
+				AD7D5C8F2B8F20FE006562CD /* synctex_parser_utils.h */,
+				AD7D5C902B8F20FE006562CD /* synctex_parser_readme.txt */,
+				AD7D5C912B8F20FE006562CD /* synctex_parser.m */,
+			);
+			path = "synctex-parser";
+			sourceTree = "<group>";
+		};
 		AD85D1852AEF46C9000F4D28 /* NoFileView */ = {
 			isa = PBXGroup;
 			children = (
@@ -10972,6 +11041,7 @@
 		BB2C6A7128F2652500478A33 /* Class */ = {
 			isa = PBXGroup;
 			children = (
+				AD7D5C7F2B8ECC74006562CD /* Parsers */,
 				BB0FE01F2B734DD1001E0F88 /* AIInfo */,
 				ADFCEB582B4FBFC50001EBAF /* AD */,
 				ADFCEB2F2B4F77CC0001EBAF /* KMFileManager */,
@@ -13709,6 +13779,7 @@
 				BB49ED09293F461500C82CA2 /* KMConvertCSVWindowController.xib in Resources */,
 				9F1F82D5292F6D510092C4B4 /* KMPDFInsertPreviewViewController.xib in Resources */,
 				ADC63E4B2A49BEDD00854E02 /* KMSubscribeWaterMarkCollectionItem.xib in Resources */,
+				AD7D5C952B8F20FE006562CD /* synctex_parser_version.txt in Resources */,
 				BBE66D092B55467C009343FA /* repeatTrialAlert_icon.png in Resources */,
 				BBD922332B50D61200DB9585 /* KMRateWindowController.xib in Resources */,
 				BB1E7F2C2B4FE2C6002D9785 /* GuideInfoImages.xcassets in Resources */,
@@ -13783,6 +13854,7 @@
 				BB1B0AE92B4FC6E900889528 /* KMFunctionGuideMultiController.xib in Resources */,
 				9F8810982B56877C00F69815 /* KMAnnotationChoiceWidgetOptionsViewController.xib in Resources */,
 				ADDF83472B391A5C00A81A4E /* DSignatureCreateInfoViewController.xib in Resources */,
+				AD7D5C982B8F20FE006562CD /* synctex_parser_readme.txt in Resources */,
 				AD0FA4FE29A8DD8700EDEB50 /* KMRegisterSuccessView.xib in Resources */,
 				9F0CB49229683DEE00007028 /* KMPropertiesPanelLineSubVC.xib in Resources */,
 				BBE9D09B2AF0CEEB002E83CE /* KMBatchOperateCompressViewController.xib in Resources */,
@@ -14087,6 +14159,7 @@
 				89E4E6F02963D1B7002DBA6F /* KMColorPickerViewController.xib in Resources */,
 				ADE86AEA2B0AF50B00414DFA /* KMCompareCoveringSettingWindowController.xib in Resources */,
 				BB4BD9D02909026500A66A65 /* KMRightSideViewController.xib in Resources */,
+				AD7D5C962B8F20FE006562CD /* synctex_parser_version.txt in Resources */,
 				ADB2D6F3294741720029D2B3 /* KMPrintPaperSetView.xib in Resources */,
 				BB7F7C0129AA586900A3E4E7 /* signAdd.png in Resources */,
 				BB6DD81029347F77001F0544 /* KMSecureEncryptWindowController.xib in Resources */,
@@ -14196,6 +14269,7 @@
 				BBA2109129ACBFDB00E6B346 /* nosign.pdf in Resources */,
 				ADD1B6AF2941E97F00C3FFF7 /* KMPrintWindowController.xib in Resources */,
 				9FA607E228FD4C9F00B46586 /* KMHomePopViewController.xib in Resources */,
+				AD7D5C992B8F20FE006562CD /* synctex_parser_readme.txt in Resources */,
 				ADD1B6DC2946BE1700C3FFF7 /* KMPrintChoosePageSizeView.xib in Resources */,
 				BBD922412B50D6D600DB9585 /* rate_pic_free.pdf in Resources */,
 				BBA19F3329ADAC81001A285A /* signPicture_hover.pdf in Resources */,
@@ -14737,6 +14811,7 @@
 				AD199DE32B200FB000D56FEE /* KMPrintPosterView.xib in Resources */,
 				9F8539DC294318D600DF644E /* TabsImage.xcassets in Resources */,
 				BBE66D0B2B55467C009343FA /* repeatTrialAlert_icon.png in Resources */,
+				AD7D5C972B8F20FE006562CD /* synctex_parser_version.txt in Resources */,
 				BBD922352B50D61200DB9585 /* KMRateWindowController.xib in Resources */,
 				BB1E7F2E2B4FE2C6002D9785 /* GuideInfoImages.xcassets in Resources */,
 				BBC745EF295F067B0072C2ED /* KMCropSettingWindowController.xib in Resources */,
@@ -14811,6 +14886,7 @@
 				9F88109A2B56877C00F69815 /* KMAnnotationChoiceWidgetOptionsViewController.xib in Resources */,
 				BB99ACD4292E2AEF0048AFD9 /* KMMergeCollectionViewItem.xib in Resources */,
 				ADDF83492B391A5C00A81A4E /* DSignatureCreateInfoViewController.xib in Resources */,
+				AD7D5C9A2B8F20FE006562CD /* synctex_parser_readme.txt in Resources */,
 				BB4F7E872B0C4E820077EC8C /* KMNoteFilterCollevtionViewItem.xib in Resources */,
 				BB5BE4F32B060EB500D51BF2 /* KMLanguageViewController.xib in Resources */,
 				BB8810902B4F7C4100AFA63E /* KMVerificationExpiredViewController.xib in Resources */,
@@ -15091,6 +15167,7 @@
 				ADDF83382B391A5C00A81A4E /* CPDFSignatureAnnotation+PDFListView.m in Sources */,
 				BB853C8A2AF8BC7D009C20C1 /* KMBatchAddPasswordOperation.swift in Sources */,
 				9F0CB5112986565700007028 /* KMDesignToken+BorderRadius.swift in Sources */,
+				AD7D5CA02B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */,
 				9F81ADC629B9B12C002251F4 /* NSButton+DesignToken.swift in Sources */,
 				BBEC00C7295C319400A26C98 /* KMBatesManager.swift in Sources */,
 				BB147020299DC0D100784A6A /* OIDServiceDiscovery.m in Sources */,
@@ -15134,6 +15211,7 @@
 				ADF9ED2F29A8507400C4A943 /* KMAccountInfoView.swift in Sources */,
 				9FDD0FAE29534FDC000C4DAD /* KMCompLight.swift in Sources */,
 				AD055EC42B8846EB0035F824 /* SKOutlineView.m in Sources */,
+				AD7D5CA52B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */,
 				9F1F82F229373D6E0092C4B4 /* String+KMExtensions.swift in Sources */,
 				BB897236294B38DC0045787C /* KMWatermarkAdjectivePropertyBaseController.swift in Sources */,
 				AD85D19E2AEF927D000F4D28 /* KMQucikToolsModel.swift in Sources */,
@@ -15300,6 +15378,7 @@
 				BBB612AD2AF4B9E4000F3724 /* KMWatermarkCollectionViewItem.swift in Sources */,
 				BB1B0AF82B4FC6E900889528 /* KMOpenFileFunctionView.swift in Sources */,
 				BB03D6982B0221FF008C9976 /* NSImage+KMExtension.swift in Sources */,
+				AD7D5C922B8F20FE006562CD /* synctex_parser_utils.m in Sources */,
 				BB1BFF5D2AE9F1FF003EB179 /* KMBatchOperateBaseWindowController.swift in Sources */,
 				F36AD77729642FE80015AD53 /* CPDFListView+UndoManager.m in Sources */,
 				9FF816EE2AFA5D840087EFC5 /* KMTableDataManager.swift in Sources */,
@@ -15692,6 +15771,7 @@
 				9FF0D0532B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */,
 				BBCE57182A72723600508EFC /* NSResponder+KMExtension.swift in Sources */,
 				ADE3C19F29A3894900793B13 /* KMSearchTableRowView.swift in Sources */,
+				AD7D5C852B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */,
 				9F1F82C3292F113A0092C4B4 /* KMHomeDragView.swift in Sources */,
 				9F080B14298CFDB300FC27DA /* KMTextImageButtonVC.swift in Sources */,
 				BBB14A5F297929BD00936EDB /* KMRedactPageRangeWindowController.swift in Sources */,
@@ -15935,6 +16015,7 @@
 				BB146FE4299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				9F1FE50D29407B2B00E952CA /* KMUploadFilePanel.swift in Sources */,
 				9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
+				AD7D5C812B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */,
 				BBE9D09F2AF0D10F002E83CE /* KMSlider.swift in Sources */,
 				9F0CB4BD2977C06300007028 /* KMPropertiesPanelColorSubVC.swift in Sources */,
 				AD1CA4192A061CE10070541F /* KMAnnotationScreenTypeViewItem.swift in Sources */,
@@ -16063,6 +16144,7 @@
 				BB04FD0C2B206F3600D80F7B /* KMPlanViewController.swift in Sources */,
 				BB49ECED293F3B0D00C82CA2 /* KMConvertOCRSettingItemView.swift in Sources */,
 				BB65A0542AF8B90F003A27A0 /* KMDisplayPreferences.swift in Sources */,
+				AD7D5C9B2B8F20FE006562CD /* synctex_parser.m in Sources */,
 				9F0CB49729683E1000007028 /* KMPropertiesPanelTextSubVC.swift in Sources */,
 				BB3D970A2B2FEAC8007094C8 /* KMPDFRedactViewController.swift in Sources */,
 				BB1B0ACE2B4FC6E900889528 /* KMFunctionGuideMultiController.swift in Sources */,
@@ -16126,6 +16208,7 @@
 			files = (
 				BB6719FE2AD2CE1B003D44D5 /* CPDFSquareAnnotation+PDFListView.swift in Sources */,
 				BB147018299DC0D100784A6A /* OIDGrantTypes.m in Sources */,
+				AD7D5CA62B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */,
 				BB3D971B2B3060B5007094C8 /* KMPDFAnnotationRedactConfig.swift in Sources */,
 				BB8B9A022B355EFB00A066EC /* KMLeftSideViewController+Outline.swift in Sources */,
 				BBA9222C2B4E96450061057A /* KMPurchaseCompareWindowController.m in Sources */,
@@ -16247,6 +16330,7 @@
 				899700E028F3A9F2009AF911 /* KMHomeWindowController.swift in Sources */,
 				AD59993F2AD7E88600412F8B /* KMStampManager.swift in Sources */,
 				BBFEF7282B3A78EC00C28AC0 /* KMSystemToolMenu.swift in Sources */,
+				AD7D5C9C2B8F20FE006562CD /* synctex_parser.m in Sources */,
 				9F53D5502AD677A000CCF9D8 /* CPDFListViewConfig.swift in Sources */,
 				BBF729B02B1962C900576AC5 /* KMRemoveHeaderFooterQueue.swift in Sources */,
 				BB8F4548295A9CDC0037EA22 /* KMHeaderFooterListController.swift in Sources */,
@@ -16451,6 +16535,7 @@
 				AD3A3588294C11ED00D72802 /* KMPrintPreviewPresenter.swift in Sources */,
 				BB49ED1A293F4D4E00C82CA2 /* KMConvertCSVSettingView.swift in Sources */,
 				9FCFEC7D2AC579F600EAD2CB /* CPDFListSignatureAnnotation.swift in Sources */,
+				AD7D5C862B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */,
 				AD1D48092AFB18DA007AC1F0 /* KMCompressWIndowControllerNew.swift in Sources */,
 				ADE3C1C229A4C13700793B13 /* KMPrintAccessoryController_OC.m in Sources */,
 				89752E1A2941FD48003FF08E /* KMSearchCellView.swift in Sources */,
@@ -16985,6 +17070,7 @@
 				BBB7B48E2A0384E100B58A5A /* NSCollectionViewItem+KMExtension.swift in Sources */,
 				9FCFEC852AD0EF6700EAD2CB /* KMCustomButtonPopMenuViewController.swift in Sources */,
 				BBA8B7A42935CD740097D183 /* KMRemovePasswordAlertWindowController.swift in Sources */,
+				AD7D5C932B8F20FE006562CD /* synctex_parser_utils.m in Sources */,
 				BB4EEF4D2976544F003A3537 /* KMRedactAligementView.swift in Sources */,
 				BBF811F22B0763930074874F /* PDFConvertObject.swift in Sources */,
 				9F1FE4FA29406E4700E952CA /* CTTabStripView.m in Sources */,
@@ -17093,6 +17179,7 @@
 				BB6CA4CD298BB0D000A13864 /* KMPreferenceWindowController.swift in Sources */,
 				ADB5E51A2A3711CB007110A8 /* KMSubscribeWaterMarkView.swift in Sources */,
 				BB8F456E295AC1220037EA22 /* KMHeaderFooterAdjectiveModel.swift in Sources */,
+				AD7D5C822B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */,
 				F3599174292B62F5000D25DE /* CStringConstants.m in Sources */,
 				BBC8A7692B05EB8000FA9377 /* KMThumbnailTableviewCell.swift in Sources */,
 				BB6D2DA82B674A6300624C24 /* CPDFOutline+KMExtension.swift in Sources */,
@@ -17203,6 +17290,7 @@
 				9F0CB526298656BA00007028 /* KMDesignToken+BorderWidth.swift in Sources */,
 				BB2EDF6B296ECE17003BCF58 /* KMPageEditInsertTypeItemView.swift in Sources */,
 				9F3D818829A0A9A60087B5AD /* KMDesignButton.swift in Sources */,
+				AD7D5CA12B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */,
 				BB14703C299DC0D200784A6A /* OIDErrorUtilities.m in Sources */,
 				BB49ECEA293F32A400C82CA2 /* KMConvertWordSettingView.swift in Sources */,
 				9F02016B2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */,
@@ -17493,6 +17581,7 @@
 				AD0257412A8601CD00EAD5D5 /* KMAppleLoginManager.swift in Sources */,
 				BB003037298D356E002DD1A0 /* KMPreferenceMarkupColorView.swift in Sources */,
 				BB1969CF2B2833DA00922736 /* KMProgressWindowController.swift in Sources */,
+				AD7D5C942B8F20FE006562CD /* synctex_parser_utils.m in Sources */,
 				BBD7FE062A1323F000F96075 /* KMCustomTableRowView.swift in Sources */,
 				9F0CB4C6298625F400007028 /* NSColor+KMExtensions.swift in Sources */,
 				BBC745F4295F0DD00072C2ED /* KMCropSettingPageSizeView.swift in Sources */,
@@ -17888,6 +17977,7 @@
 				BBB9B327299A5D6D004F3235 /* GTMKeychain_macOS.m in Sources */,
 				9F0CB5072986561E00007028 /* KMDesignToken+BorderRight.swift in Sources */,
 				9F1F82CC292F6CF90092C4B4 /* KMPDFInsertPageWindow.swift in Sources */,
+				AD7D5C872B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */,
 				BB4EEF2F29763EE7003A3537 /* KMRedactBaseWindowController.swift in Sources */,
 				BB00301F298CB799002DD1A0 /* KMPreferenceManager.swift in Sources */,
 				BB89727B294DFD1E0045787C /* KMWatermarkTextView.swift in Sources */,
@@ -17938,6 +18028,7 @@
 				ADDF83282B391A5C00A81A4E /* CPDFDigtalView.m in Sources */,
 				9FDCD81F2B6CDEFE00E22166 /* KMAnnotationChoiceWidgeOptionsTextField.swift in Sources */,
 				BBB9B330299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization.m in Sources */,
+				AD7D5CA22B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */,
 				BB146FBC299DC0D100784A6A /* GTLRBase64.m in Sources */,
 				F34BF928295303E8002C25A2 /* NSCursor+PDFListView.m in Sources */,
 				8942F7FA2926089200389627 /* KMSignatureViewController.swift in Sources */,
@@ -18072,6 +18163,7 @@
 				BB8F457C295AFB330037EA22 /* KMHeaderFooterFontInfoView.swift in Sources */,
 				ADDF83A32B391A5D00A81A4E /* DSignatureFileListViewController.swift in Sources */,
 				AD68782329A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
+				AD7D5C832B8ECD09006562CD /* KMPDFSynchronizer.swift in Sources */,
 				BB8F4584295B0F900037EA22 /* KMHeaderFooterMarginInfoView.swift in Sources */,
 				BB49ED17293F489500C82CA2 /* KMConvertImageSettingView.swift in Sources */,
 				899700EA28F3E4D3009AF911 /* MainWindowController.swift in Sources */,
@@ -18178,6 +18270,7 @@
 				8942F7BD29222C7E00389627 /* KMBookCellView.swift in Sources */,
 				9F1FE4C229406E4700E952CA /* NSWindow+CTThemed.m in Sources */,
 				BB147001299DC0D100784A6A /* OIDRedirectHTTPHandler.m in Sources */,
+				AD7D5C9D2B8F20FE006562CD /* synctex_parser.m in Sources */,
 				89E4E6EE2963D1B7002DBA6F /* KMColorPickerViewController.m in Sources */,
 				BBEC00A6295BD42D00A26C98 /* KMHeaderFooterPageInfoView.swift in Sources */,
 				BBC348552958465C008D2CD1 /* KMBackgroundFilePropertyInfoController.swift in Sources */,
@@ -18189,6 +18282,7 @@
 				BB276A522B0376B400AB5578 /* KMBatchOperateRemoveHeaderFooterViewController.swift in Sources */,
 				BB8F4551295A9FA50037EA22 /* KMCreateHeaderFooterController.swift in Sources */,
 				ADDF834F2B391A5C00A81A4E /* DSignatureCertifyDetailViewController.swift in Sources */,
+				AD7D5CA72B8F35D1006562CD /* SKPDFSyncRecord.m in Sources */,
 				BBFE6E5A2930724B00142C01 /* KMMergePageModel.swift in Sources */,
 				9F1FE50429406E4700E952CA /* CTTabStripModelOrderController.m in Sources */,
 				AD61B7AD2A9DC6F600D346C1 /* KMResourceDownloadManager.swift in Sources */,