ftp.nice.ch/pub/next/developer/languages/smalltalk/smalltalk.1.2.alpha5.s.tar.gz#/smalltalk-1.2.alpha5/lib/dict.h

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

/***********************************************************************
 *
 *	Dictionary Support Module Definitions.
 *
 *	$Revision: 1.3 $
 *	$Date: 1995/07/18 06:25:59 $
 *	$Author: sbb $
 *
 ***********************************************************************/

/***********************************************************************
 *
 * Copyright (C) 1990, 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
 * Written by Steve Byrne.
 *
 * This file is part of GNU Smalltalk.
 *
 * GNU Smalltalk 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.
 * 
 * GNU Smalltalk 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
 * GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
 *
 ***********************************************************************/


/*
 *    Change Log
 * ============================================================================
 * Author      Date       Change 
 * sbb	     23 Jun 95	  switched to GST guard prefix
 *
 * sbb	     30 May 95	  Replaced objectClass with mst_objectClass to avoid
 *			  conflicts with X.  Boolean => mst_Boolean. Object =>
 *			  mst_Object.
 *
 * sbb	     20 Jan 95	  Added 64 bit support.
 *
 * sbb	      2 Jan 95	  Switched to the new CType model.
 *
 * sbb	     21 Aug 94	  switched to low order bit for int flagging.
 *
 * sbyrne    13 Jan 89	  Created.
 *
 */


#ifndef __GSTDICT__
#define __GSTDICT__

/* ### YUK YUK YUK -- I hate to do this, but ... I need access to this
   structure for the binary save/restore code and I'd rather not have to
   write a bunch of accessors just to get on the air.  Fix this asap. */

/*
   3                   2                   1 
 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    # fixed fields                                   |p|w|F|f|1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/

typedef struct InstanceSpecStruct {
#ifdef WORDS_BIGENDIAN
#ifdef LONG_PAD_BIT_FIELDS
  unsigned	dummy			: 32; /* unused */
#endif
  unsigned	numFixedFields		: 27;
  unsigned	isPointers 		: 1;
  unsigned	isWords			: 1;
  unsigned	isIndexable		: 1;
  unsigned	hasFinalize		: 1;
  unsigned	intMark			: 1; /* must be low order bit */
#else
  unsigned	intMark			: 1; /* must be low order bit */
  unsigned	hasFinalize		: 1;
  unsigned	isIndexable		: 1;
  unsigned	isWords			: 1;
  unsigned	isPointers 		: 1;
  unsigned	numFixedFields		: 27;
#ifdef LONG_PAD_BIT_FIELDS
  unsigned	dummy			: 32; /* unused */
#endif
#endif
} InstanceSpec;

/* Note the use of structural inheritance in C structure definitions here */
#define BEHAVIOR_HEADER \
  OBJ_HEADER; \
  OOP		superClass; \
  OOP		subClasses; \
  OOP		methodDictionary; \
  InstanceSpec	instanceSpec

typedef struct BehaviorStruct {
  BEHAVIOR_HEADER;
} *Behavior;

#define CLASS_DESCRIPTION_HEADER \
  BEHAVIOR_HEADER; \
  OOP		name; \
  OOP		comment; \
  OOP		instanceVariables; \
  OOP		category

#define cObjectAnonType		fromInt(-1)
#define cObjectCharType		fromInt(0)
#define cObjectUnsignedCharType	fromInt(1)
#define cObjectShortType	fromInt(2)
#define cObjectUnsignedShortType fromInt(3)
#define cObjectLongType		fromInt(4)
#define cObjectUnsignedLongType	fromInt(5)
#define cObjectFloatType	fromInt(6)
#define cObjectDoubleType	fromInt(7)
#define cObjectStringType	fromInt(8)


typedef struct ClassDescriptionStruct {
  CLASS_DESCRIPTION_HEADER;
} *ClassDescription;


typedef struct ClassStruct {
  CLASS_DESCRIPTION_HEADER;
  OOP		classVariables;	/* dictionary of varName, storage */
  OOP		sharedPools;
} *Class;

typedef struct MetaclassStruct {
  CLASS_DESCRIPTION_HEADER;
  OOP		instanceClass;
} *Metaclass;

typedef struct CObjectStruct {
  OBJ_HEADER;
  voidPtr	addr;
  OOP		type;
} *CObject;

typedef struct CTypeStruct {
  OBJ_HEADER;
  OOP		cObjectType;	/* the CObject subclass to use when
				   instantiating this type */
} *CType;

extern OOP		mst_objectClass, magnitudeClass, charClass, timeClass,
			dateClass,
			numberClass, floatClass, integerClass, lookupKeyClass,
			associationClass, linkClass, processClass,
			symLinkClass, collectionClass,
			sequenceableCollectionClass, linkedListClass,
			semaphoreClass,
			arrayedCollectionClass,	arrayClass, stringClass,
			symbolClass, byteArrayClass, compiledMethodClass,
			intervalClass, orderedCollectionClass,
			sortedCollectionClass, bagClass, mappedCollectionClass,
			setClass, dictionaryClass, 
			systemDictionaryClass,
			identityDictionaryClass, undefinedObjectClass,
			booleanClass, falseClass, trueClass, 
			processorSchedulerClass, delayClass, sharedQueueClass,
			behaviorClass,
			classDescriptionClass, classClass, metaclassClass,
			smalltalkDictionary, messageClass, methodContextClass,
			blockContextClass,
			streamClass, positionableStreamClass, readStreamClass,
			writeStreamClass, readWriteStreamClass, cObjectClass,
			fileStreamClass, memoryClass,
			byteMemoryClass, wordMemoryClass, randomClass,
			cFuncDescriptorClass, tokenStreamClass,
			methodInfoClass, fileSegmentClass,
  			processorOOP, cTypeClass;

extern OOP		associationNew(), dictionaryNew(), associationValue(),
			superClass(), validClassMethodDictionary(),
			classVariableDictionary(), findSharedPoolVariable(),
			dictionaryAt(), dictionaryAtPut(), dictionaryAdd(),
			arrayAt(), floatNew(), arrayNew(), stringNew(),
			indexOOP(), instVarAt(), indexStringOOP(),
			classMethodDictionary(), findClass(),
			dictionaryAssociationAt(), findClassMethod(),
			messageNewArgs(), messageSelector(), messageArgs(),
  			getClassSymbol(), dictionaryCopy(),
			instanceVariableArray(), sharedPoolDictionary(),
			instantiateOOPWith(), metaclassInstance(),
			cObjectNew(), cObjectNewTyped(), cObjectSubtype(),
  			allocCObject(), cTypeNew(), newString(),
  			byteArrayNew(), countedStringNew(),
			identityDictionaryAtPut();

extern mst_Object	newInstanceWith(), newInstance(), instantiate(),
  			instantiateWith();

extern int		numIndexableFields(), dictionarySize(),
			oopFixedFields(), oopSizeBytes();

extern mst_Boolean	isIndexable(), isAKindOf(), checkIndexableBoundsOf(),
  			checkBoundsOf(), instVarAtPut(), indexOOPPut(),
			isPointers(), isAClass(), isAMetaclass(), 
			classIsPointers();

extern Byte		*stringOOPChars(), *toCString(), *toByteArray();

extern void		indexStringOOPPut(),
			printAssocationKey(), printOOPConstructor(),
			addClassSymbol(), initDictionary(), initSTDIOObjects(),
			setOOPString(), setCObjectValue(), setComment(),
			setOOPBytes(), nilFill(), freeCObject(),
			setAssociationValue(), printAssociationKey();
extern voidPtr		cObjectValue();

extern double		floatOOPValue();
extern void		arrayAtPut();

extern void		dictInit(); /* ### TEMP HACK ### */

#endif /* __GSTDICT__ */

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