ANTLRUniqueIDMap.h revision 324c4644fee44b9898524c09511bd33c3f12e2df
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ANTLRUniqueIDMap.h 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ANTLR 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Created by Alan Condit on 7/7/10. 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// [The "BSD licence"] 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2010 Alan Condit 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// All rights reserved. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Redistribution and use in source and binary forms, with or without 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// modification, are permitted provided that the following conditions 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// are met: 13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// 1. Redistributions of source code must retain the above copyright 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer. 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 2. Redistributions in binary form must reproduce the above copyright 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// notice, this list of conditions and the following disclaimer in the 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// documentation and/or other materials provided with the distribution. 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 3. The name of the author may not be used to endorse or promote products 19a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// derived from this software without specific prior written permission. 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import <Cocoa/Cocoa.h> 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import "ANTLRPtrBuffer.h" 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import "ANTLRNodeMapElement.h" 355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define SUCCESS 0 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define FAILURE -1 385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define HASHSIZE 101 39a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#define HBUFSIZE 0x2000 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)@interface ANTLRUniqueIDMap : ANTLRPtrBuffer { 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) NSInteger lastHash; 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@property (getter=getLastHash, setter=setLastHash) NSInteger lastHash; 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)+ (id)newANTLRUniqueIDMap; 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)+ (id)newANTLRUniqueIDMapWithLen:(NSInteger)aHashSize; 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (id)init; 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (id)initWithLen:(NSInteger)cnt; 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)dealloc; 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Instance Methods 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (NSInteger)count; 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (NSInteger)size; 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* clear -- reinitialize the maplist array */ 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void) clear; 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)deleteANTLRUniqueIDMap:(ANTLRNodeMapElement *)np; 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)delete_chain:(ANTLRNodeMapElement *)np; 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (id)getNode:(id<ANTLRTree>)aNode; 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)putID:(id)anID Node:(id<ANTLRTree>)aNode; 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@end 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)