ftp.nice.ch/pub/next/graphics/convertors/Convert_PICT.NIHS.bs.tar.gz#/Convert_PICT/Source/shared.subproj/common.h

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

/***********************************************************************
Common header code for Convert programs
Copyright (C) 1993 David John Burrowes

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 1, 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.

The author, David John Burrowes, can be reached at:
	davidjohn@kira.net.netcom.com
	David John Burrowes
	1926 Ivy #10
	San Mateo, CA 94403-1367
***********************************************************************/

/*
====================================================================
This file declares several data types that varoious applications may wish to use.
	This is $Revision: 1.3 $ of this file
	It was last modified by $Author: death $ on $Date: 93/04/04 23:45:35 $
Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
$Log:	common.h,v $
 * Revision 1.3  93/04/04  23:45:35  death
 * Sun Apr  4 23:45:34 PDT 1993
 * 
 * Revision 1.2  93/01/10  15:09:00  death
 * Sun Jan 10 15:09:00 PST 1993
 * 
 * Revision 1.1  92/07/26  13:57:07  death
 * Initial revision
 * 
 * Revision 1.1  92/02/09  18:41:40  death
 * Initial revision
 * 
====================================================================
*/

//
//	92.11.08		djb		Added NSmajor and NSMinor flags, since there don't seem to
//						be any in the NS headers (probably I'm not looking in the
//						right place).  This isn't the right place for them, but...
//
#define	NSmajor		3
#define	NSminor		0

#define	DoNS3DragNDrop 1

#import <objc/objc.h>

//
//	Draft 1 of standard types.  I can see this is a small step towards making everything an
//	object. But, we'll see how we like what we have.  I'm a bit bothered by Cstring, for now,
//	but...
//
// 	Integer should be the largest available signed intergral number on the system.
//	It is capitalized and fully spelled to help distnguish from normal int's in C.
//	Naturally, PositiveInteger is it's unsigned counterpart.  Note that PositiveInteger,
//	despite it's name, does include 0! =)
//
typedef 	long int	Integer;
typedef	unsigned long int	PositiveInteger;
//
//	92.06.21 djb	added 'Real' type.
//
typedef	double	Real;
//
//	Character is used to represent a letter, digit, or symbol on the local system.  It makes no
//	pretenses at being able to deal with an ideographic, or potentially even a sylabic writing
//	system.  In general, it should not be used as a number  (C's char type is a signed thing, so
//	CString, below, does NOT refer to an array of Character. =(  )
//
typedef	unsigned char	Character;
//
//	Cstring is a special case, since one just ends up using pointers to chars frequently.
//	roCString is a read only cstring.  I could have made rocstring as char const *, but
//	it seemed more appropriate to make the name refer to read-only (constant) data,
//	rather than pointer.
//	How about fixedCString for those that are char const *??
//
typedef	char*	CString;
typedef	const char*	roCString;
//
//	id is all well and good, but let's be a bit more general and readable.  So, we define
//	Instance to be a reference to an object
//	NOTE: Seems I can't call it Object bcause there is already a class called Object (oops).
//	Naming it thus Instance.  Since id/object/instance is the default type in Objective C,
//	one really won't need to use the name all that often.
//
typedef 	id	Instance;
//
//	Pointer is a reference to an untyped pointer.
//
typedef	void*	Pointer;
//
//	Boolean is, of course, a type for storing true or false values.  no others (undefined, etc)
//
typedef	BOOL	Boolean;
//
//	GenericType is used to store any of the preceeding types.
//
typedef union
{
	Integer		integer;
	PositiveInteger	positiveinteger;
	Character	character;
	CString		cstring;
	Instance		instance;
	Pointer		pointer;
	Boolean		boolean;
}
GenericType;
//
//	DataType is used to store any of the primary data types here, like GenericType, but
//	also to record which type is stored, and thus allow for some type checking by the
//	programmer.
//
typedef struct
{
	GenericType	data;
	Integer		type;
}
DataType;
//
//	Now, define some values that correspond to thse types...
//
//	(Ahh, for C++'s ability to define constants...)
//
#define	CARRIAGERETURN		0x0D
#define	LINEFEED				0x0A
#define	NEWLINE				0x0A
#define	TAB						0x09
//#define	NULL					0x00	/* already defined, I believe */
#define	ESCAPE					0x1B
#define	NullCharacter			0x00
//
//	Cstring definitions
//
#define	NullCString	((CString) 0x00)
#define	EndOfCString	((char) 0x00)
//
//	Object definitions
//	(nil is defined as part of Objective c.  note the case! Nil is a nil Class structure).
//
#define	NullInstance	((Instance) nil)
//
//	Pointer definitions
//
#define	NullPointer	0x00
//
//	Boolean definitions.
//
//#define	YES		/* Defined by Objective C.  uncomment if this changes or this moves*/
//#define	NO		/* Defined by Objective C.  uncomment if this changes or this moves*/
#define	True	YES
#define	False	NO
//
//	Define constants for use in the DataType struct
//
#define	TYPE_NONE				0
#define	TYPE_INTEGER			1
#define	TYPE_POSITIVEINTEGER	2
#define	TYPE_CHARACTER		3
#define	TYPE_CSTRING			4
#define	TYPE_INSTANCE		5
#define	TYPE_POINTER			6
#define	TYPE_BOOLEAN			7

//
//	Define some types. 
//	These can all be considered as special cases of PositiveInteger, below.
//	92.08.02	Added signed versions, for those cases where one needs specific sized
//			signed integers.
//
typedef	unsigned char		Byte;
typedef	char				SignedByte;
typedef	unsigned char		bits8;
typedef	char				Signed8Bits;
typedef	unsigned short int	bits16;
typedef	short int				Signed16Bits;
typedef	unsigned int			bits32;
typedef	 int					Signed32Bits;
typedef	Byte*				ByteString;
typedef	const Byte*			ConstByteString;
typedef	Integer				ErrorCode;

#define	NullByteString	((ByteString) 0x00)

//	92.05.25	djb	Added a ConstCString.  The name is misleading in that it suggests the
//	data, not the pointer, is constant.  But, its what comes to mind first, andI'm using this
//	far and away more frequently than any other const construct...
//
typedef	char const *	ConstCString;

//
//	Prototypes
//
Boolean	EvenUnsignedNum (PositiveInteger);
CString	NewCString(PositiveInteger);
void	FreeCString(CString theString);
ByteString	NewByteString(PositiveInteger);
void	FreeByteString(ByteString theString);
Pointer	NewPointer(PositiveInteger length);
void	FreePointer(Pointer thePointer);

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