<commit_before>//
//  EventStream.swift
//  Witness
//
//  Created by <NAME> on 23/09/15.
//  Copyright © 2015 Invisible Pixel. All rights reserved.
//

import Foundation

/**
* The type of event stream to be used. For more information, please refer to the File System Events Programming Guide: https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html#//apple_ref/doc/uid/TP40005289-CH4-SW6
*/

public enum StreamType {
    case HostBased // default
    case DiskBased
}

class EventStream {
    let paths: [String]

    // use explicitly unwrapped optional so we can pass self as context to stream
    private var stream: FSEventStreamRef!
    private let changeHandler: FileEventHandler
    
    init(paths: [String], type: StreamType = .HostBased, flags: EventStreamCreateFlags = .None, latency: NSTimeInterval = 1.0, deviceToWatch: dev_t = 0, changeHandler: FileEventHandler) {
        self.paths = paths
        self.changeHandler = changeHandler
        
        func callBack (stream: ConstFSEventStreamRef, clientCallbackInfo: UnsafeMutablePointer<Void>, numEvents: Int, eventPaths: UnsafeMutablePointer<Void>, eventFlags: UnsafePointer<FSEventStreamEventFlags>, eventIDs: UnsafePointer<FSEventStreamEventId>) -> Void {
            let eventStream = unsafeBitCast(clientCallbackInfo, EventStream.self)
            let paths = unsafeBitCast(eventPaths, NSArray.self)<commit_msg>Removed default flags and latency values in EventStream<commit_after>//
//  EventStream.swift
//  Witness
//
//  Created by <NAME> on 23/09/15.
//  Copyright © 2015 Invisible Pixel. All rights reserved.
//

import Foundation

/**
* The type of event stream to be used. For more information, please refer to the File System Events Programming Guide: https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/UsingtheFSEventsFramework/UsingtheFSEventsFramework.html#//apple_ref/doc/uid/TP40005289-CH4-SW6
*/

public enum StreamType {
    case HostBased // default
    case DiskBased
}

class EventStream {
    let paths: [String]

    // use explicitly unwrapped optional so we can pass self as context to stream
    private var stream: FSEventStreamRef!
    private let changeHandler: FileEventHandler
    
    init(paths: [String], type: StreamType = .HostBased, flags: EventStreamCreateFlags, latency: NSTimeInterval, deviceToWatch: dev_t = 0, changeHandler: FileEventHandler) {
        self.paths = paths
        self.changeHandler = changeHandler
        
        func callBack (stream: ConstFSEventStreamRef, clientCallbackInfo: UnsafeMutablePointer<Void>, numEvents: Int, eventPaths: UnsafeMutablePointer<Void>, eventFlags: UnsafePointer<FSEventStreamEventFlags>, eventIDs: UnsafePointer<FSEventStreamEventId>) -> Void {
            let eventStream = unsafeBitCast(clientCallbackInfo, EventStream.self)
            let paths = unsafeBitCast(eventPaths, NSArray.self)
{'fraction_non_alphanumeric': 0.08657718120805369, 'fraction_numerical': 0.01476510067114094, 'mean_word_length': 4.052542372881356, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5867797', 'n_tokens_mistral': 885, 'n_tokens_neox': 825, 'n_words': 236}