9090///
9191/// The higher-level APIs will automatically ensure that `BitstreamWriter.data`
9292/// is valid. Once serialization has completed, simply emit this data to a file.
93- @available ( * , deprecated, message: " moved to swift-driver " )
9493public final class BitstreamWriter {
9594 /// The buffer of data being written to.
9695 private( set) public var data : [ UInt8 ]
@@ -160,7 +159,6 @@ public final class BitstreamWriter {
160159
161160extension BitstreamWriter {
162161 /// Writes the provided UInt32 to the data stream directly.
163- @available ( * , deprecated, message: " moved to swift-driver " )
164162 public func write( _ int: UInt32 ) {
165163 let index = data. count
166164
@@ -179,7 +177,6 @@ extension BitstreamWriter {
179177 /// - int: The integer containing the bits you'd like to write
180178 /// - width: The number of low-bits of the integer you're writing to the
181179 /// buffer
182- @available ( * , deprecated, message: " moved to swift-driver " )
183180 public func writeVBR< IntType> ( _ int: IntType , width: UInt8 )
184181 where IntType: UnsignedInteger & ExpressibleByIntegerLiteral
185182 {
@@ -202,7 +199,6 @@ extension BitstreamWriter {
202199 /// - int: The integer containing the bits you'd like to write
203200 /// - width: The number of low-bits of the integer you're writing to the
204201 /// buffer
205- @available ( * , deprecated, message: " moved to swift-driver " )
206202 public func write< IntType> ( _ int: IntType , width: UInt8 )
207203 where IntType: UnsignedInteger & ExpressibleByIntegerLiteral
208204 {
@@ -249,7 +245,6 @@ extension BitstreamWriter {
249245 currentBit = ( currentBit + width) & 31
250246 }
251247
252- @available ( * , deprecated, message: " moved to swift-driver " )
253248 public func alignIfNeeded( ) {
254249 guard currentBit > 0 else { return }
255250 write ( currentValue)
@@ -259,13 +254,11 @@ extension BitstreamWriter {
259254 }
260255
261256 /// Writes a Bool as a 1-bit integer value.
262- @available ( * , deprecated, message: " moved to swift-driver " )
263257 public func write( _ bool: Bool ) {
264258 write ( bool ? 1 as UInt : 0 , width: 1 )
265259 }
266260
267261 /// Writes the provided BitCode Abbrev operand to the stream.
268- @available ( * , deprecated, message: " moved to swift-driver " )
269262 public func write( _ abbrevOp: Bitstream . Abbreviation . Operand ) {
270263 write ( abbrevOp. isLiteral) // the Literal bit.
271264 switch abbrevOp {
@@ -295,21 +288,18 @@ extension BitstreamWriter {
295288 }
296289
297290 /// Writes the specified abbreviaion value to the stream, as a 32-bit quantity.
298- @available ( * , deprecated, message: " moved to swift-driver " )
299291 public func writeCode( _ code: Bitstream . AbbreviationID ) {
300292 writeCode ( code. rawValue)
301293 }
302294
303295 /// Writes the specified Code value to the stream, as a 32-bit quantity.
304- @available ( * , deprecated, message: " moved to swift-driver " )
305296 public func writeCode< IntType> ( _ code: IntType )
306297 where IntType: UnsignedInteger & ExpressibleByIntegerLiteral
307298 {
308299 write ( code, width: codeBitWidth)
309300 }
310301
311302 /// Writes an ASCII character to the stream, as an 8-bit ascii value.
312- @available ( * , deprecated, message: " moved to swift-driver " )
313303 public func writeASCII( _ character: Character ) {
314304 precondition ( character. unicodeScalars. count == 1 , " character is not ASCII " )
315305 let c = UInt8 ( ascii: character. unicodeScalars. first!)
@@ -322,7 +312,6 @@ extension BitstreamWriter {
322312extension BitstreamWriter {
323313 /// Defines an abbreviation and returns the unique identifier for that
324314 /// abbreviation.
325- @available ( * , deprecated, message: " moved to swift-driver " )
326315 public func defineAbbreviation( _ abbrev: Bitstream . Abbreviation ) -> Bitstream . AbbreviationID {
327316 encodeAbbreviation ( abbrev)
328317 currentAbbreviations. append ( abbrev)
@@ -332,7 +321,6 @@ extension BitstreamWriter {
332321 }
333322
334323 /// Encodes the definition of an abbreviation to the stream.
335- @available ( * , deprecated, message: " moved to swift-driver " )
336324 private func encodeAbbreviation( _ abbrev: Bitstream . Abbreviation ) {
337325 writeCode ( . defineAbbreviation)
338326 writeVBR ( UInt ( abbrev. operands. count) , width: 5 )
@@ -345,7 +333,6 @@ extension BitstreamWriter {
345333// MARK: Writing Records
346334
347335extension BitstreamWriter {
348- @available ( * , deprecated, message: " moved to swift-driver " )
349336 public struct RecordBuffer {
350337 private( set) var values = [ UInt32] ( )
351338
@@ -389,7 +376,6 @@ extension BitstreamWriter {
389376 }
390377
391378 /// Writes an unabbreviated record to the stream.
392- @available ( * , deprecated, message: " moved to swift-driver " )
393379 public func writeRecord< CodeType> ( _ code: CodeType , _ composeRecord: ( inout RecordBuffer ) -> Void )
394380 where CodeType: RawRepresentable , CodeType. RawValue == UInt8
395381 {
@@ -406,7 +392,6 @@ extension BitstreamWriter {
406392 /// Writes a record with the provided abbreviation ID and record contents.
407393 /// Optionally, emits the provided blob if the abbreviation referenced
408394 /// by that ID requires it.
409- @available ( * , deprecated, message: " moved to swift-driver " )
410395 public func writeRecord(
411396 _ abbrevID: Bitstream . AbbreviationID ,
412397 _ composeRecord: ( inout RecordBuffer ) -> Void ,
@@ -470,14 +455,12 @@ extension BitstreamWriter {
470455 /// '0' .. '9' --- 52 .. 61
471456 /// '.' --- 62
472457 /// '_' --- 63
473- @available ( * , deprecated, message: " moved to swift-driver " )
474458 private static let char6Map =
475459 Array ( zip ( " abcdefghijklmnopqrstuvwxyz " +
476460 " ABCDEFGHIJKLMNOPQRSTUVWXYZ " +
477461 " 0123456789._ " , ( 0 as UInt ) ... ) )
478462
479463 /// Writes a char6-encoded value.
480- @available ( * , deprecated, message: " moved to swift-driver " )
481464 public func writeChar6< IntType> ( _ value: IntType )
482465 where IntType: UnsignedInteger & ExpressibleByIntegerLiteral
483466 {
@@ -489,7 +472,6 @@ extension BitstreamWriter {
489472 }
490473
491474 /// Writes a value with the provided abbreviation encoding.
492- @available ( * , deprecated, message: " moved to swift-driver " )
493475 public func writeAbbrevField( _ op: Bitstream . Abbreviation . Operand , value: UInt32 ) {
494476 switch op {
495477 case . literal( let literalValue) :
@@ -510,7 +492,6 @@ extension BitstreamWriter {
510492
511493 /// Writes a block, beginning with the provided block code and the
512494 /// abbreviation width
513- @available ( * , deprecated, message: " moved to swift-driver " )
514495 public func writeBlock(
515496 _ blockID: Bitstream . BlockID ,
516497 newAbbrevWidth: UInt8 ? = nil ,
@@ -521,7 +502,6 @@ extension BitstreamWriter {
521502 endBlock ( )
522503 }
523504
524- @available ( * , deprecated, message: " moved to swift-driver " )
525505 public func writeBlob< S> ( _ bytes: S , includeSize: Bool = true )
526506 where S: Collection , S. Element == UInt8
527507 {
@@ -547,7 +527,6 @@ extension BitstreamWriter {
547527
548528 /// Writes the blockinfo block and allows emitting abbreviations
549529 /// and records in it.
550- @available ( * , deprecated, message: " moved to swift-driver " )
551530 public func writeBlockInfoBlock( emitRecords: ( ) -> Void ) {
552531 writeBlock ( . blockInfo, newAbbrevWidth: 2 ) {
553532 currentBlockID = nil
@@ -566,7 +545,6 @@ extension BitstreamWriter {
566545 /// - blockID: The ID of the block to emit.
567546 /// - abbreviationBitWidth: The width of the largest abbreviation ID in this block.
568547 /// - defineSubBlock: A closure that is called to define the contents of the new block.
569- @available ( * , deprecated, message: " moved to swift-driver " )
570548 public func withSubBlock(
571549 _ blockID: Bitstream . BlockID ,
572550 abbreviationBitWidth: UInt8 ? = nil ,
@@ -588,7 +566,6 @@ extension BitstreamWriter {
588566 /// - Parameters:
589567 /// - blockID: The ID of the block to emit.
590568 /// - abbreviationBitWidth: The width of the largest abbreviation ID in this block.
591- @available ( * , deprecated, message: " moved to swift-driver " )
592569 public func enterSubblock(
593570 _ blockID: Bitstream . BlockID ,
594571 abbreviationBitWidth: UInt8 ? = nil
@@ -622,7 +599,6 @@ extension BitstreamWriter {
622599 }
623600
624601 /// Marks the end of a new block record.
625- @available ( * , deprecated, message: " moved to swift-driver " )
626602 public func endBlock( ) {
627603 guard let block = blockScope. popLast ( ) else {
628604 fatalError ( " endBlock() called with no block registered " )
@@ -645,7 +621,6 @@ extension BitstreamWriter {
645621
646622 /// Defines an abbreviation within the blockinfo block for the provided
647623 /// block ID.
648- @available ( * , deprecated, message: " moved to swift-driver " )
649624 public func defineBlockInfoAbbreviation(
650625 _ blockID: Bitstream . BlockID ,
651626 _ abbrev: Bitstream . Abbreviation
@@ -659,7 +634,6 @@ extension BitstreamWriter {
659634 }
660635
661636
662- @available ( * , deprecated, message: " moved to swift-driver " )
663637 private func overwriteBytes( _ int: UInt32 , byteIndex: Int ) {
664638 let i = int. littleEndian
665639 data. withUnsafeMutableBytes { ptr in
@@ -669,15 +643,13 @@ extension BitstreamWriter {
669643
670644 /// Gets the BlockInfo for the provided ID or creates it if it hasn't been
671645 /// created already.
672- @available ( * , deprecated, message: " moved to swift-driver " )
673646 private func getOrCreateBlockInfo( _ id: UInt8 ) -> BlockInfo {
674647 if let blockInfo = blockInfoRecords [ id] { return blockInfo }
675648 let info = BlockInfo ( )
676649 blockInfoRecords [ id] = info
677650 return info
678651 }
679652
680- @available ( * , deprecated, message: " moved to swift-driver " )
681653 private func `switch`( to blockID: Bitstream . BlockID ) {
682654 if currentBlockID == blockID { return }
683655 writeRecord ( Bitstream . BlockInfoCode. setBID) {
0 commit comments