diff --git a/Sources/_StringProcessing/Engine/Processor.swift b/Sources/_StringProcessing/Engine/Processor.swift index 0350a37db..cc0fa2734 100644 --- a/Sources/_StringProcessing/Engine/Processor.swift +++ b/Sources/_StringProcessing/Engine/Processor.swift @@ -25,7 +25,7 @@ struct Controller { } } -struct Processor { +struct Processor: ~Copyable { typealias Input = String typealias Element = Input.Element diff --git a/Sources/_StringProcessing/Engine/Tracing.swift b/Sources/_StringProcessing/Engine/Tracing.swift index b0ce67555..cc30e117b 100644 --- a/Sources/_StringProcessing/Engine/Tracing.swift +++ b/Sources/_StringProcessing/Engine/Tracing.swift @@ -11,7 +11,7 @@ // TODO: Remove this protocol (and/or reuse it for something like a FastProcessor) -extension Processor: TracedProcessor { +extension Processor /*: TracedProcessor*/ { var cycleCount: Int { metrics.cycleCount } var isTracingEnabled: Bool { metrics.isTracingEnabled } diff --git a/Sources/_StringProcessing/Utility/Protocols.swift b/Sources/_StringProcessing/Utility/Protocols.swift index 24ffbcf70..b8fcc4f4f 100644 --- a/Sources/_StringProcessing/Utility/Protocols.swift +++ b/Sources/_StringProcessing/Utility/Protocols.swift @@ -17,30 +17,30 @@ protocol InstructionProtocol { var operandPC: InstructionAddress? { get } } -protocol ProcessorProtocol { - associatedtype Input: Collection - associatedtype Instruction: InstructionProtocol - associatedtype SavePoint = () - associatedtype Registers = () - - var cycleCount: Int { get } - var input: Input { get } - - var currentPosition: Input.Index { get } - var currentPC: InstructionAddress { get } - - var instructions: InstructionList { get } - - var isAcceptState: Bool { get } - var isFailState: Bool { get } - - // Provide to get call stack formatting, default empty - var callStack: Array { get } - - // Provide to get save point formatting, default empty - var savePoints: Array { get } - - // Provide to get register formatting, default empty - var registers: Registers { get } -} +//protocol ProcessorProtocol: ~Copyable { +// associatedtype Input: Collection +// associatedtype Instruction: InstructionProtocol +// associatedtype SavePoint = () +// associatedtype Registers = () +// +// var cycleCount: Int { get } +// var input: Input { get } +// +// var currentPosition: Input.Index { get } +// var currentPC: InstructionAddress { get } +// +// var instructions: InstructionList { get } +// +// var isAcceptState: Bool { get } +// var isFailState: Bool { get } +// +// // Provide to get call stack formatting, default empty +// var callStack: Array { get } +// +// // Provide to get save point formatting, default empty +// var savePoints: Array { get } +// +// // Provide to get register formatting, default empty +// var registers: Registers { get } +//} diff --git a/Sources/_StringProcessing/Utility/Traced.swift b/Sources/_StringProcessing/Utility/Traced.swift index 198564fe1..fa04568cf 100644 --- a/Sources/_StringProcessing/Utility/Traced.swift +++ b/Sources/_StringProcessing/Utility/Traced.swift @@ -12,21 +12,21 @@ // TODO: Place shared formatting and trace infrastructure here -protocol Traced { - var isTracingEnabled: Bool { get } -} - -protocol TracedProcessor: ProcessorProtocol, Traced { - // Empty defaulted - func formatCallStack() -> String // empty default - func formatSavePoints() -> String // empty default - func formatRegisters() -> String // empty default - - // Non-empty defaulted - func formatTrace() -> String - func formatInput() -> String - func formatInstructionWindow(windowSize: Int) -> String -} +//protocol Traced { +// var isTracingEnabled: Bool { get } +//} +// +//protocol TracedProcessor: ProcessorProtocol, Traced { +// // Empty defaulted +// func formatCallStack() -> String // empty default +// func formatSavePoints() -> String // empty default +// func formatRegisters() -> String // empty default +// +// // Non-empty defaulted +// func formatTrace() -> String +// func formatInput() -> String +// func formatInstructionWindow(windowSize: Int) -> String +//} func lineNumber(_ i: Int) -> String { "[\(i)]" @@ -34,18 +34,18 @@ func lineNumber(_ i: Int) -> String { func lineNumber(_ pc: InstructionAddress) -> String { lineNumber(pc.rawValue) } - -extension TracedProcessor where Registers: Collection{ - func formatRegisters() -> String { - typealias E = () - if !registers.isEmpty { - return "\(registers)\n" - } - return "" - } -} - -extension TracedProcessor { +// +//extension Processor { +// func formatRegisters() -> String { +// typealias E = () +// if !registers.isEmpty { +// return "\(registers)\n" +// } +// return "" +// } +//} + +extension Processor { func printTrace() { print(formatTrace()) } func trace() { @@ -60,16 +60,16 @@ extension TracedProcessor { return "" } - func formatSavePoints() -> String { - if !savePoints.isEmpty { - var result = "save points:\n" - for point in savePoints { - result += " \(point)\n" - } - return result - } - return "" - } +// func formatSavePoints() -> String { +// if !savePoints.isEmpty { +// var result = "save points:\n" +// for point in savePoints { +// result += " \(point)\n" +// } +// return result +// } +// return "" +// } func formatRegisters() -> String { typealias E = ()