home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / mstdict.h < prev    next >
C/C++ Source or Header  |  1992-02-15  |  6KB  |  190 lines

  1. /***********************************************************************
  2.  *
  3.  *    Dictionary Support Module Definitions.
  4.  *
  5.  ***********************************************************************/
  6.  
  7. /***********************************************************************
  8.  *
  9.  * Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  10.  * Written by Steve Byrne.
  11.  *
  12.  * This file is part of GNU Smalltalk.
  13.  *
  14.  * GNU Smalltalk is free software; you can redistribute it and/or modify it
  15.  * under the terms of the GNU General Public License as published by the Free
  16.  * Software Foundation; either version 1, or (at your option) any later 
  17.  * version.
  18.  * 
  19.  * GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  20.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  21.  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  22.  * more details.
  23.  * 
  24.  * You should have received a copy of the GNU General Public License along with
  25.  * GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  26.  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  27.  *
  28.  ***********************************************************************/
  29.  
  30.  
  31. /*
  32.  *    Change Log
  33.  * ============================================================================
  34.  * Author      Date       Change 
  35.  * sbyrne    13 Jan 89      Created.
  36.  *
  37.  */
  38.  
  39.  
  40. #ifndef __MSTDICT__
  41. #define __MSTDICT__
  42.  
  43. /* ### YUK YUK YUK -- I hate to do this, but ... I need access to this
  44.    structure for the binary save/restore code and I'd rather not have to
  45.    write a bunch of accessors just to get on the air.  Fix this asap. */
  46.  
  47. typedef struct InstanceSpecStruct {
  48. #ifdef BIG_ENDIAN
  49.   unsigned    intMark            : 1;
  50.   unsigned    isPointers         : 1;
  51.   unsigned    isWords            : 1;
  52.   unsigned    isIndexable        : 1;
  53.   unsigned    numFixedFields        : 28;
  54. #else
  55.   unsigned    numFixedFields        : 28;
  56.   unsigned    isIndexable        : 1;
  57.   unsigned    isWords            : 1;
  58.   unsigned    isPointers         : 1;
  59.   unsigned    intMark            : 1;
  60. #endif
  61. } InstanceSpec;
  62.  
  63. /* Note the use of inheritance in C structure definitions here */
  64. #define BEHAVIOR_HEADER \
  65.   OBJ_HEADER; \
  66.   OOP        superClass; \
  67.   OOP        subClasses; \
  68.   OOP        methodDictionary; \
  69.   InstanceSpec    instanceSpec
  70.  
  71. typedef struct BehaviorStruct {
  72.   BEHAVIOR_HEADER;
  73. } *Behavior;
  74.  
  75. #define CLASS_DESCRIPTION_HEADER \
  76.   BEHAVIOR_HEADER; \
  77.   OOP        name; \
  78.   OOP        comment; \
  79.   OOP        instanceVariables; \
  80.   OOP        category
  81.  
  82. #define cObjectAnonType        fromInt(-1)
  83. #define cObjectCharType        fromInt(0)
  84. #define cObjectUnsignedCharType    fromInt(1)
  85. #define cObjectShortType    fromInt(2)
  86. #define cObjectUnsignedShortType fromInt(3)
  87. #define cObjectLongType        fromInt(4)
  88. #define cObjectUnsignedLongType    fromInt(5)
  89. #define cObjectFloatType    fromInt(6)
  90. #define cObjectDoubleType    fromInt(7)
  91. #define cObjectStringType    fromInt(8)
  92.  
  93.  
  94. typedef struct ClassDescriptionStruct {
  95.   CLASS_DESCRIPTION_HEADER;
  96. } *ClassDescription;
  97.  
  98.  
  99. typedef struct ClassStruct {
  100.   CLASS_DESCRIPTION_HEADER;
  101.   OOP        classVariables;    /* dictionary of varName, storage */
  102.   OOP        sharedPools;
  103. } *Class;
  104.  
  105. typedef struct MetaclassStruct {
  106.   CLASS_DESCRIPTION_HEADER;
  107.   OOP        instanceClass;
  108. } *Metaclass;
  109.  
  110. typedef struct CObjectStruct {
  111.   OBJ_HEADER;
  112.   voidPtr    addr;
  113.   OOP        type;
  114. } *CObject;
  115.  
  116. typedef struct CTypeStruct {
  117.   OBJ_HEADER;
  118.   OOP        subType;
  119.   OOP        baseType;
  120.   OOP        numElements;
  121. } *CType;
  122.  
  123. extern OOP        objectClass, magnitudeClass, charClass, timeClass,
  124.             dateClass,
  125.             numberClass, floatClass, integerClass, lookupKeyClass,
  126.             associationClass, linkClass, processClass,
  127.             symLinkClass, collectionClass,
  128.             sequenceableCollectionClass, linkedListClass,
  129.             semaphoreClass,
  130.             arrayedCollectionClass,    arrayClass, stringClass,
  131.             symbolClass, byteArrayClass, compiledMethodClass,
  132.             intervalClass, orderedCollectionClass,
  133.             sortedCollectionClass, bagClass, mappedCollectionClass,
  134.             setClass, dictionaryClass, 
  135.             systemDictionaryClass,
  136.             identityDictionaryClass, undefinedObjectClass,
  137.             booleanClass, falseClass, trueClass, 
  138.             processorSchedulerClass, delayClass, sharedQueueClass,
  139.             behaviorClass,
  140.             classDescriptionClass, classClass, metaclassClass,
  141.             smalltalkDictionary, messageClass, methodContextClass,
  142.             blockContextClass,
  143.             streamClass, positionableStreamClass, readStreamClass,
  144.             writeStreamClass, readWriteStreamClass, cObjectClass,
  145.             fileStreamClass, memoryClass,
  146.             byteMemoryClass, wordMemoryClass, randomClass,
  147.             cFuncDescriptorClass, tokenStreamClass,
  148.             methodInfoClass, fileSegmentClass,
  149.               processorOOP, cTypeClass;
  150.  
  151. extern OOP        associationNew(), dictionaryNew(), associationValue(),
  152.             superClass(), validClassMethodDictionary(),
  153.             classVariableDictionary(), findSharedPoolVariable(),
  154.             dictionaryAt(), dictionaryAtPut(), dictionaryAdd(),
  155.             arrayAt(), floatNew(), arrayNew(), stringNew(),
  156.             indexOOP(), instVarAt(), indexStringOOP(),
  157.             classMethodDictionary(), findClass(),
  158.             dictionaryAssociationAt(), findClassMethod(),
  159.             messageNewArgs(), messageSelector(), messageArgs(),
  160.               getClassSymbol(), dictionaryCopy(),
  161.             instanceVariableArray(), sharedPoolDictionary(),
  162.             instantiateOOPWith(), metaclassInstance(),
  163.             cObjectNew(), cObjectNewTyped(), cObjectSubtype(),
  164.               allocCObject(), cTypeNew(), newString();
  165.  
  166. extern Object        newInstanceWith(), newInstance(), instantiate(),
  167.               instantiateWith();
  168.  
  169. extern int        numIndexableFields(), dictionarySize(),
  170.             oopFixedFields();
  171.  
  172. extern Boolean        isIndexable(), isAKindOf(), checkIndexableBoundsOf(),
  173.               checkBoundsOf(), instVarAtPut(), indexOOPPut(),
  174.             isPointers(), isAClass(), isAMetaclass(), 
  175.             classIsPointers();
  176.  
  177. extern Byte        *stringOOPChars(), *toCString(), *toByteArray();
  178.  
  179. extern void        indexStringOOPPut(),
  180.             printAssocationKey(), printOOPConstructor(),
  181.             addClassSymbol(), initDictionary(), initSTDIOObjects(),
  182.             setOOPString(), setCObjectValue(), setComment(),
  183.             setOOPBytes(), nilFill();
  184. extern voidPtr        cObjectValue();
  185.  
  186. extern double        floatOOPValue();
  187. extern void        arrayAtPut();
  188.  
  189. #endif /* __MSTDICT__ */
  190.