ftp.nice.ch/pub/next/unix/text/Webster.a5.s.tar.gz#/Webster/Library/Includes/WebsterVolume.h

This is WebsterVolume.h in view mode; [Download] [Up]

// Hey ! emacs, it is an -*- objective-c -*- file

/*

    Webster Access, a program to use NeXT online Webster dictionary.
    Copyright (C) 1994 Benoit Grange, ben@fizz.fdn.org

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#import <appkit/appkit.h>
#import <store/IXStoreFile.h>
#import <btree/IXBTree.h>
#import <btree/IXBTreeCursor.h>

#import "WebsterExceptions.h"

// Types
typedef unsigned long websterKey;

typedef void (*websterTranslationFunction)(const void* data, int length,
					   const char* word, NXStream** outstream, int);

typedef struct {
  char*			modeName;		// Name of the websterMode
  websterTranslationFunction translationFunc;	// Function called to translate to this representation
  int			select;			// One more value
} websterMode;

@class WebsterWord;

@interface WebsterVolume:Object
{
  IXBTree*		headwordsBTree;		// BTree containing the words of the volume
  IXBTreeCursor* 	headwordsCursor;
  IXBTree*		entriesBTree;		// BTree containing the defs of the words
  IXBTreeCursor*	entriesCursor;
  websterMode*		websterModes;		// The NULL terminated array of websterModes this volume knows
@public
  char*			fileName;
}

// Use this method before initializing any WebsterVolume
// If your codebook file is not in the standard location
// "/NextLibrary/References/Webster-Dictionary/codebook"
+ (void)setCodebookFileName: (const char*) fileName;

// Just returns the copyright string for the library
+ (const char*)libraryCopyrightString;

// Just return the copyright string for the volume
// This string is statically written in the library and
// does not depend of the database in use
+ (const char*)volumeCopyrightString;

// Just to catch bad usage, do NOT call - init
- init;

// This method should not be called directly,
// Instead, use the same method from an inherited object
- initFromFile: (const char*) fileName;

// Use this method to define a word from a dictionary
// Or a thesaurus, returns nil if the word does not exist
- (WebsterWord*) defineWord: (const char*) word;

// Internal
- (WebsterWord*) defineWord: (const char*) word useCursor: (IXBTreeCursor*) cursor;

// Same as define word, see "find by reference" in Webster
// May not be implemented for all volumes
- defineByReference: (const char*) word;

// Give the first letters of a word, it will provide
// a list of words (of the dictionary) that start by them.
// The list contains WebsterWords that must be freed after use.
// May not be implemented for all volumes.
- (List*) completeWord: (const char*) word maxCount: (int) max;
// This version use the default maxCount of 256
- (List*) completeWord: (const char*) word;

// Wildcard matches
// Will be implemented Real Soon Now (C)...
- (List*) wildcardWord: (const char*) word;

// Check if the volume knows how to produce this websterMode
- (BOOL) canOutputDefinitionsAs: (const char*) mode;

// Internal
- (websterMode*) getModeEntry: (const char*) mode;

- (IXBTreeCursor*) getEntriesCursor;

@end

@interface WebsterDictionary:WebsterVolume
{
  IXBTree*		referenceBTree;		// BTree containing the words of the volume
  IXBTreeCursor* 	referenceCursor;	// organised by reference.
}

// Overriden
- initFromFile: (const char*) fileName;

@end

@interface WebsterThesaurus:WebsterVolume
{
}

// Overriden
- initFromFile: (const char*) fileName;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.