git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

HexFiend/HFByteSlice.m

      1 //
      2 //  HFByteSlice.m
      3 //  HexFiend_2
      4 //
      5 //  Copyright 2007 ridiculous_fish. All rights reserved.
      6 //
      7 
      8 #import <HexFiend/HFByteSlice.h>
      9 
     10 
     11 @implementation HFByteSlice
     12 
     13 - (instancetype)init {
     14     if ([self class] == [HFByteSlice class]) {
     15         [NSException raise:NSInvalidArgumentException format:@"init sent to HFByteArray, but HFByteArray is an abstract class.  Instantiate one of its subclasses instead."];
     16     }
     17     return [super init];
     18 }
     19 
     20 - (unsigned long long)length { UNIMPLEMENTED(); }
     21 
     22 - (void)copyBytes:(unsigned char*)dst range:(HFRange)range { USE(dst); USE(range); UNIMPLEMENTED_VOID(); }
     23 
     24 - (HFByteSlice *)subsliceWithRange:(HFRange)range { USE(range); UNIMPLEMENTED(); }
     25 
     26 - (void)constructNewByteSlicesAboutRange:(HFRange)range first:(HFByteSlice **)first second:(HFByteSlice **)second {
     27     const unsigned long long length = [self length];
     28     
     29     //clip the range to our extent
     30     range.location = llmin(range.location, length);
     31     range.length = llmin(range.length, length - range.location);
     32     
     33     HFRange firstRange = {0, range.location};
     34     HFRange secondRange = {range.location + range.length, [self length] - (range.location + range.length)};
     35     
     36     if (first) {
     37         if (firstRange.length > 0)
     38             *first = [self subsliceWithRange:firstRange];
     39         else
     40             *first = nil;
     41     }
     42     
     43     if (second) {
     44         if (secondRange.length > 0)
     45             *second = [self subsliceWithRange:secondRange];
     46         else
     47             *second = nil;
     48     }
     49 }
     50 
     51 - (HFByteSlice *)byteSliceByAppendingSlice:(HFByteSlice *)slice {
     52     USE(slice);
     53     return nil;
     54 }
     55 
     56 - (HFByteRangeAttributeArray *)attributesForBytesInRange:(HFRange)range {
     57     USE(range);
     58     return nil;
     59 }
     60 
     61 - (BOOL)isSourcedFromFile {
     62     return NO;
     63 }
     64 
     65 - (HFRange)sourceRangeForFile:(HFFileReference *)reference {
     66     USE(reference);
     67     return HFRangeMake(ULLONG_MAX, ULLONG_MAX);
     68 }
     69 
     70 - (id)retain {
     71     HFAtomicIncrement(&retainCount, NO);
     72     return self;
     73 }
     74 
     75 - (oneway void)release {
     76     if (HFAtomicDecrement(&retainCount, NO) == (NSUInteger)(-1)) {
     77         [self dealloc];
     78     }
     79 }
     80 
     81 - (NSUInteger)retainCount {
     82     return 1 + retainCount;
     83 }
     84 
     85 @end

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.