Changeset 436 for trunk/ICeCoffEE


Ignore:
Timestamp:
03/05/08 03:01:09 (17 years ago)
Author:
Nicholas Riley
Message:

Use @try/@catch/@finally rather than macro-based exceptions

Location:
trunk/ICeCoffEE/ICeCoffEE
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEE.m

    r435 r436  
    153153    Handle h = NULL;
    154154   
    155     NS_DURING
     155    @try {
    156156        h = NewHandle(len);
    157157        if (h == NULL)
     
    174174        err = ICCF_DoURLAction(ICCF_GetInst(), hint, *h, selStart, selEnd, action);
    175175        ICCF_OSErrCAssert(err, @"ICCF_DoURLAction");
    176        
    177     NS_HANDLER
     176    } @finally {
    178177        DisposeHandle(h);
    179178        [urlString release];
    180         [localException raise];
    181     NS_ENDHANDLER
    182        
    183     DisposeHandle(h);
    184     [urlString release];
     179    }
    185180
    186181    return (err == noErr);
     
    213208    NSColor *insertionPointColor = [self insertionPointColor];
    214209
    215     NS_DURING
    216 
     210    @try {
    217211        NSString *s = [[self textStorage] string]; // according to the class documentation, sending 'string' is guaranteed to be O(1)
    218212        unsigned length = [s length];
     
    260254            }
    261255        }
    262 
    263     NS_HANDLER
    264         ICCF_HandleException(localException, triggeringEvent);
    265     NS_ENDHANDLER
     256    } @catch (NSException *e) {
     257        ICCF_HandleException(e, triggeringEvent);
     258    }
    266259
    267260    ICCF_StopIC();
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEParser.m

    r388 r436  
    7373    NSCAssert(selEnd == [string length], @"Internal error: URL string is wrong length");
    7474   
    75     NS_DURING
     75    @try {
    7676        if ([[NSCharacterSet characterSetWithCharactersInString: @";,."] characterIsMember:
    7777            [string characterAtIndex: selEnd - 1]]) {
     
    106106        range->length = selEnd - selStart;
    107107        range->location += selStart;
    108     NS_HANDLER
     108    } @finally {
    109109        free(urlData);
    110         [localException raise];
    111     NS_ENDHANDLER
    112    
    113     free(urlData);
     110    }
    114111}
    115112
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEETTView.m

    r388 r436  
    4040void ICCF_LaunchURLFromTTView(ICeCoffEETTView *self, NSEvent *triggeringEvent, NSRange range) {
    4141   
    42     NS_DURING
    43 
     42    @try {
    4443        NSString *s = [self string];
    4544        unsigned length = [s length];
     
    7372            ICCF_discardNextMouseUp = YES;
    7473        }
    75        
    76     NS_HANDLER
    77         ICCF_HandleException(localException, triggeringEvent);
    78     NS_ENDHANDLER
     74    } @catch (NSException *e) {
     75        ICCF_HandleException(e, triggeringEvent);
     76    }
    7977   
    8078    ICCF_StopIC();
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEETerminal.m

    r388 r436  
    293293    NSRange range, delimiterRange;
    294294
    295     NS_DURING
    296 
     295    @try {
    297296        TermStorage *storage = [(TermController *)[self valueForKey: @"controller"] storage];
    298297
     
    404403            }
    405404        }
    406     NS_HANDLER
    407         ICCF_HandleException(localException, ICCF_downEvent);
    408     NS_ENDHANDLER
     405    } @catch (NSException *e) {
     406        ICCF_HandleException(e, ICCF_downEvent);
     407    }
    409408
    410409    ICCF_StopIC();
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEWebKit.m

    r388 r436  
    7171            return;
    7272
    73         NS_DURING
     73        @try {
    7474            NSPoint viewClickPt = [self convertPoint: downPt fromView: nil];
    7575            NSDictionary *elementDict = [(WebHTMLView *)self elementAtPoint: viewClickPt];
     
    7979            if ([elementDict objectForKey: @"WebElementLinkURL"] != nil) {
    8080                ICLog(@"got a link");
    81                 NS_VOIDRETURN; // don't activate on links
     81                return; // don't activate on links
    8282            }
    8383            if (selectedString == nil || [selectedString length] == 0) {
    8484                ICLog(@"no selected string");
    85                 NS_VOIDRETURN;
     85                return;
    8686            }
    8787            ICCF_StartIC();
     
    110110                }
    111111            }
    112         NS_HANDLER
    113             ICCF_HandleException(localException, downEvent);
    114         NS_ENDHANDLER
     112        } @catch (NSException *e) {
     113            ICCF_HandleException(e, downEvent);
     114        } @finally {
     115            [downEvent release]; downEvent = nil;
     116        }
    115117
    116         [downEvent release]; downEvent = nil;
    117118        ICCF_StopIC();
    118119    }       
Note: See TracChangeset for help on using the changeset viewer.