ftp.nice.ch/pub/next/science/mathematics/MathArray.0.30.s.tar.gz#/MathArray-0.30/MathArrayPrivate.h

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

/*
    MathArrayPrivate - Handles mathematical operations on arrays of numbers
    
    private definitions for MathArray.
    
    Copyright (C) 1995, Adam Fedor
    
    MathArrayPrivate.h,v 1.7 1995/08/13 04:39:04 adam Exp
*/

#ifndef __MathArrayPrivate_INCLUDE
#define __MathArrayPrivate_INCLUDE

#include "MathArray/MaskedException.h"
#include "MathArray/MathArray.h"
#include "MathArray/NSObjectExtra.h"

/* Get some information from the precision */
#define MATH_SIGNED(prec)		(prec & 0x0f00)

/* Set to non-zero for some types of math errors */
extern int ma_fpe_errno;

/* Convenient functions for determining the size of the arrays */
extern unsigned long array_sizeof_elements(const char *type);
extern unsigned long array_aligned_sizeof_elements(const char *type);
extern unsigned long array_num_elements(unsigned dimensions, 
	const unsigned* size);
extern unsigned long array_num_bytes(unsigned dimensions, const unsigned* size,
	const char *type);

/* Convienent functions for stepping through the array */
extern ordered_index_t ordered_index(unsigned dimension, NSData* size, 
		unsigned *index);
extern ordered_index_t inverted_ordered_index(unsigned dimension, NSData* size, 
		unsigned *index);
extern unsigned* start_index_from_range(unsigned dimension, NSRange *range,
		unsigned *buf);
extern int increment_index_in_range(unsigned dimension, 
		NSRange *range, unsigned *index, unsigned step);

/* Standard Exceptions */
#define MA_RAISE_FPE	\
	[MaskedException raise:MAFloatingPointException \
		format:@"A floating point error occured during a mathematical computation"];
#define MA_RAISE_PARAMETER	\
	[NSException raise:MAParameterException \
		format:@"The specified data doesn't match the specified parameters"];
#define MA_RAISE_ARRAY_MISMATCH	\
	[NSException raise:MAArrayMismatchException \
		format:@"The size of the given arrays do no match"];
#define MA_RAISE_RANGE	\
	[NSException raise:MARangeException \
		format:@"The specified range exceeds the array limits"];
#define MA_RAISE_CAST	\
	[NSException raise:MACastException \
		format:@"Cannot cast to the required type for the operation"];
#define MA_RAISE_PERFORM	\
	[NSException raise:MAPerformException \
		format:@"Cannot perform the specified operation on data"];

#define MA_RAISE_ILLEGAL	\
	[NSException raise:MAPerformException \
		format:@"Illegal operation on this type of data."];

#define MA_RAISE_MALLOC \
        [NSException raise:NSMallocException \
            format:@"No memory left to allocate"]; \

#define MA_CHECK_MALLOC(ptr) \
        if (!ptr) {MA_RAISE_MALLOC}


@interface MathArray (Private)
+ (Class)classForObjCType:(const char *)theType;
- (void)_updateLazyArray;
+ (void)_startMath;
+ (void)_finishMath;
@end

#ifdef NEXT_FOUNDATION
static NSRange
NSMakeRange (float location, float length)
{
  NSRange range;
  range.location = location;
  range.length = length;
  return range;
}
#endif

#endif /* __MathArrayPrivate_INCLUDE */

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