diff --git a/ChangeLog b/ChangeLog index 593b60f..f71ab57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,43 @@ 2005-02-20 David Ayers * EOAccess/EOAccessFault.m: Include NSThread.h. + + * EOControl/EOPriv.h/m: Split into... + * EOControl/EOPrivat.h/m: ... and ... + * EOAccess/EOPrivat.h/m: ... files. + * EOAccess/EOAdaptorChannel.m: Include new privat header. + * EOAccess/EOAttribute.m, EOAccess/EODatabase.m, + * EOAccess/EODatabaseChannel.m, EOAccess/EOEntity.m, + * EOAccess/EORelationship.m, EOAccess/EOSQLExpression.m, + * EOAccess/EOSQLQualifier.m, EOAccess/EOUtilities.m: Ditto. + (+initialize): Call new private function. + * EOAccess/EODatabaseContext.m: Ditto. + (EODatabaseContext_snapshotForGlobalIDWithImpPtr) + (EODatabaseContext_globalIDForObjectWithImpPtr): Move to + EOPrivate.m. + * EOAccess/EODatabaseContextPriv.h: + (EODatabaseContext_snapshotForGlobalIDWithImpPtr) + (EODatabaseContext_globalIDForObjectWithImpPtr): Move to + EOPrivate.h. + * EOAccess/GNUmakefile: Compile EOPrivate.m. + + * EOControl/EOClassDescription.m, EOControl/EOGenericRecord.m + * EOControl/EOKeyGlobalID.m, EOControl/EOKeyValueCoding.m + * EOControl/EOKeyValueQualifier.m, EOControl/EONSAddOns.m + * EOControl/EOSortOrdering.m: Include new private header. + * EOControl/EOEditingContext.h/m: Ditto. + (EOEditingContext_objectForGlobalIDWithImpPtr) + (EOEditingContext_recordObjectGlobalIDWithImpPtr): Move to + EOPrivate.h/m. + * EOControl/EOMutableKnownKeyDictionary.h/m: Include new private + header. + (EOMKKD_objectForKeyWithImpPtr, EOMKKD_setObjectForKeyWithImpPtr) + (EOMKKD_removeObjectForKeyWithImpPtr, EOMKKD_hasKeyWithImpPtr) + (EOMKKD_indexForKeyWithImpPtr) + (EOMKKDInitializer_indexForKeyWithImpPtr): Move to EOPrivate.m + * EOControl/EOFault.m: (+isFault:): Update comment. + * EOControl/GNUmakefile: Build EOPrivate.m instead of EOPriv.m. + Do not install private header. 2005-02-19 David Ayers diff --git a/EOAccess/EOAdaptorChannel.m b/EOAccess/EOAdaptorChannel.m index 91513bd..d96d913 100644 --- a/EOAccess/EOAdaptorChannel.m +++ b/EOAccess/EOAdaptorChannel.m @@ -53,7 +53,6 @@ RCS_ID("$Id$") #include #endif -#include #include #include #include @@ -67,6 +66,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOEntityPriv.h" diff --git a/EOAccess/EOAttribute.m b/EOAccess/EOAttribute.m index a20128b..998a2fb 100644 --- a/EOAccess/EOAttribute.m +++ b/EOAccess/EOAttribute.m @@ -66,7 +66,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include @@ -77,6 +76,7 @@ RCS_ID("$Id$") #include +#include "EOPrivate.h" #include "EOEntityPriv.h" #include "EOAttributePriv.h" @@ -90,7 +90,7 @@ RCS_ID("$Id$") { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); } } diff --git a/EOAccess/EODatabase.m b/EOAccess/EODatabase.m index c42a405..900ba38 100644 --- a/EOAccess/EODatabase.m +++ b/EOAccess/EODatabase.m @@ -57,7 +57,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include @@ -66,6 +65,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" /* TODO Controllare il resultCache, ad ogni forget/invalidate deve essere @@ -90,7 +90,7 @@ static NSMutableArray *databaseInstances; { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); // THREAD databaseInstances = [NSMutableArray new]; diff --git a/EOAccess/EODatabaseChannel.m b/EOAccess/EODatabaseChannel.m index b2ad7e4..4a28f1e 100644 --- a/EOAccess/EODatabaseChannel.m +++ b/EOAccess/EODatabaseChannel.m @@ -63,7 +63,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include @@ -80,6 +79,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOEntityPriv.h" #include "EODatabaseContextPriv.h" #include "EODatabaseChannelPriv.h" @@ -92,7 +92,7 @@ RCS_ID("$Id$") if (!initialized) { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(_registerDatabaseChannel:) diff --git a/EOAccess/EODatabaseContext.m b/EOAccess/EODatabaseContext.m index 5d3e8a1..6b3954c 100644 --- a/EOAccess/EODatabaseContext.m +++ b/EOAccess/EODatabaseContext.m @@ -71,7 +71,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include #include @@ -96,6 +95,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOEntityPriv.h" #include "EOAccessFaultPriv.h" #include "EODatabaseContextPriv.h" @@ -132,7 +132,7 @@ static Class _contextClass = Nil; { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); _contextClass = GDL2EODatabaseContextClass; @@ -7393,50 +7393,3 @@ If the object has been just inserted, the dictionary is empty. } @end - -NSDictionary* EODatabaseContext_snapshotForGlobalIDWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,EOGlobalID* gid) -{ - if (dbContext) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(dbContext)==GDL2EODatabaseContextClass - && GDL2EODatabaseContext_snapshotForGlobalIDIMP) - imp=GDL2EODatabaseContext_snapshotForGlobalIDIMP; - else - imp=[dbContext methodForSelector:GDL2_snapshotForGlobalIDSEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(dbContext,GDL2_snapshotForGlobalIDSEL,gid); - } - else - return nil; -}; - -EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,id object) -{ - if (dbContext) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(dbContext)==GDL2EODatabaseContextClass - && GDL2EODatabaseContext__globalIDForObjectIMP) - imp=GDL2EODatabaseContext__globalIDForObjectIMP; - else - imp=[dbContext methodForSelector:GDL2__globalIDForObjectSEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(dbContext,GDL2__globalIDForObjectSEL,object); - } - else - return nil; -}; - diff --git a/EOAccess/EODatabaseContextPriv.h b/EOAccess/EODatabaseContextPriv.h index 65a6bc2..7982b5e 100644 --- a/EOAccess/EODatabaseContextPriv.h +++ b/EOAccess/EODatabaseContextPriv.h @@ -73,7 +73,4 @@ @end -GDL2ACCESS_EXPORT NSDictionary* EODatabaseContext_snapshotForGlobalIDWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,EOGlobalID* gid); -GDL2ACCESS_EXPORT EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,id object); - #endif /* __EODatabaseContextPriv_h__ */ diff --git a/EOAccess/EOEntity.m b/EOAccess/EOEntity.m index 4359d61..75e53af 100644 --- a/EOAccess/EOEntity.m +++ b/EOAccess/EOEntity.m @@ -70,7 +70,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include #include @@ -83,6 +82,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOEntityPriv.h" #include "EOAttributePriv.h" @@ -106,7 +106,7 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); }; }; diff --git a/EOAccess/EOPrivate.h b/EOAccess/EOPrivate.h new file mode 100644 index 0000000..63fb2cd --- /dev/null +++ b/EOAccess/EOPrivate.h @@ -0,0 +1,54 @@ +/* -*-objc-*- + EOPrivat.h + + Copyright (C) 2005 Free Software Foundation, Inc. + + Author: Manuel Guesdon + Date: Jan 2005 + + This file is part of the GNUstep Database Library. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __EOAccess_EOPrivat_h__ +#define __EOAccess_EOPrivat_h__ + +#include "EODefines.h" +#include "../EOControl/EOPrivate.h" + +@class EODatabaseContext; + +// ==== Classes ==== +GDL2ACCESS_EXPORT Class GDL2EODatabaseContextClass; +GDL2ACCESS_EXPORT Class GDL2EOAttributeClass; + +// ==== Selectors ===== +GDL2ACCESS_EXPORT SEL GDL2_snapshotForGlobalIDSEL; +GDL2ACCESS_EXPORT SEL GDL2__globalIDForObjectSEL; + +// ==== IMPs ==== +GDL2ACCESS_EXPORT IMP GDL2EODatabaseContext_snapshotForGlobalIDIMP; +GDL2ACCESS_EXPORT IMP GDL2EODatabaseContext__globalIDForObjectIMP; + +// ==== Init Method ==== +GDL2ACCESS_EXPORT void GDL2_EOAccessPrivateInit(); + +// ==== EODatabaseContext ==== +GDL2ACCESS_EXPORT NSDictionary* EODatabaseContext_snapshotForGlobalIDWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,EOGlobalID* gid); +GDL2ACCESS_EXPORT EOGlobalID* EODatabaseContext_globalIDForObjectWithImpPtr(EODatabaseContext* dbContext,IMP* impPtr,id object); + +#endif /* __EOAccess_EOPrivat_h__ */ diff --git a/EOAccess/EORelationship.m b/EOAccess/EORelationship.m index 31450f9..2daaf54 100644 --- a/EOAccess/EORelationship.m +++ b/EOAccess/EORelationship.m @@ -54,7 +54,6 @@ RCS_ID("$Id$") #endif #include -#include #include #include #include @@ -67,6 +66,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOAttributePriv.h" #include "EOEntityPriv.h" diff --git a/EOAccess/EOSQLExpression.m b/EOAccess/EOSQLExpression.m index 952519c..1a93948 100644 --- a/EOAccess/EOSQLExpression.m +++ b/EOAccess/EOSQLExpression.m @@ -63,7 +63,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include @@ -78,6 +77,7 @@ RCS_ID("$Id$") #include #include +#include "EOPrivate.h" #include "EOEntityPriv.h" #include "EOAttributePriv.h" #include "EOSQLExpressionPriv.h" @@ -100,7 +100,7 @@ NSString *EOBindVariableColumnKey = @"EOBindVariableColumnKey"; static BOOL initialized=NO; if (!initialized) { - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); }; }; diff --git a/EOAccess/EOSQLQualifier.m b/EOAccess/EOSQLQualifier.m index 3f57d96..489cbf9 100644 --- a/EOAccess/EOSQLQualifier.m +++ b/EOAccess/EOSQLQualifier.m @@ -65,8 +65,8 @@ RCS_ID("$Id$") #include #include #include -#include +#include "EOPrivate.h" #include "EOEntityPriv.h" @implementation EOSQLQualifier @@ -272,7 +272,7 @@ RCS_ID("$Id$") { initialized=YES; - GDL2PrivInit(); + GDL2_EOAccessPrivateInit(); }; }; diff --git a/EOAccess/EOUtilities.m b/EOAccess/EOUtilities.m index 47f840e..c37784b 100644 --- a/EOAccess/EOUtilities.m +++ b/EOAccess/EOUtilities.m @@ -57,7 +57,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include @@ -74,6 +73,7 @@ RCS_ID("$Id$") #include +#include "EOPrivate.h" static NSString *EOMoreThanOneException = @"EOMoreThanOneException"; static NSString *NSObjectNotAvailableException = @"NSObjectNotAvailableException"; diff --git a/EOAccess/GNUmakefile b/EOAccess/GNUmakefile index 45f4815..2423792 100644 --- a/EOAccess/GNUmakefile +++ b/EOAccess/GNUmakefile @@ -57,7 +57,8 @@ EODatabaseChannel.m \ EODatabaseContext.m \ EOAccessFault.m \ EODatabaseDataSource.m \ -EOUtilities.m +EOUtilities.m \ +EOPrivate.m libgnustep-db2_HEADER_FILES_DIR = . libgnustep-db2_HEADER_FILES_INSTALL_DIR = /EOAccess diff --git a/EOControl/EOClassDescription.m b/EOControl/EOClassDescription.m index f5c7be3..0e9dd12 100644 --- a/EOControl/EOClassDescription.m +++ b/EOControl/EOClassDescription.m @@ -68,9 +68,10 @@ RCS_ID("$Id$") #include #include #include -#include #include +#include "EOPrivate.h" + // NOTE: (stephane@sente.ch) Should we subclass NSClassDescription? /* diff --git a/EOControl/EOEditingContext.h b/EOControl/EOEditingContext.h index a8ee9a3..e76c592 100644 --- a/EOControl/EOEditingContext.h +++ b/EOControl/EOEditingContext.h @@ -365,8 +365,4 @@ shouldContinueFetchingWithCurrentObjectCount: (unsigned)count @end -// Private -GDL2CONTROL_EXPORT id EOEditingContext_objectForGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,EOGlobalID* gid); -EOGlobalID* EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object); -GDL2CONTROL_EXPORT id EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object,EOGlobalID* gid); #endif diff --git a/EOControl/EOEditingContext.m b/EOControl/EOEditingContext.m index f48830b..95e2b8c 100644 --- a/EOControl/EOEditingContext.m +++ b/EOControl/EOEditingContext.m @@ -54,7 +54,8 @@ RCS_ID("$Id$") #include #include #include -#include + +#include "EOPrivate.h" @class EOEntityClassDescription; @@ -3802,82 +3803,3 @@ static BOOL usesContextRelativeEncoding = NO; NSDeallocateObject (self); } @end - -id -EOEditingContext_objectForGlobalIDWithImpPtr(EOEditingContext *edContext, - IMP *impPtr, - EOGlobalID *gid) -{ - if (edContext) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(edContext)==GDL2EOEditingContextClass - && GDL2EOEditingContext_objectForGlobalIDIMP) - imp=GDL2EOEditingContext_objectForGlobalIDIMP; - else - imp=[edContext methodForSelector:GDL2_objectForGlobalIDSEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(edContext,GDL2_objectForGlobalIDSEL,gid); - } - else - return nil; -}; - -EOGlobalID * -EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext *edContext, - IMP *impPtr, - id object) -{ - if (edContext) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(edContext)==GDL2EOEditingContextClass - && GDL2EOEditingContext_globalIDForObjectIMP) - imp=GDL2EOEditingContext_globalIDForObjectIMP; - else - imp=[edContext methodForSelector:GDL2_globalIDForObjectSEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(edContext,GDL2_globalIDForObjectSEL,object); - } - else - return nil; -}; - -id -EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext *edContext, - IMP *impPtr, - id object, - EOGlobalID *gid) -{ - if (edContext) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(edContext)==GDL2EOEditingContextClass - && GDL2EOEditingContext_recordObjectGlobalIDIMP) - imp=GDL2EOEditingContext_recordObjectGlobalIDIMP; - else - imp=[edContext methodForSelector:GDL2_recordObjectGlobalIDSEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(edContext,GDL2_recordObjectGlobalIDSEL,object,gid); - } - else - return nil; -}; diff --git a/EOControl/EOFault.m b/EOControl/EOFault.m index 12e44de..d17db8d 100644 --- a/EOControl/EOFault.m +++ b/EOControl/EOFault.m @@ -172,7 +172,7 @@ static Class EOFaultClass = NULL; + (BOOL)isFault: (id)object { - //See also EOControl/EOPriv.h + //See also EOPrivat.h // NSDebugFLLog(@"gsdb",@"object=%p",object); if (object == nil) diff --git a/EOControl/EOGenericRecord.m b/EOControl/EOGenericRecord.m index ed70875..da02cef 100644 --- a/EOControl/EOGenericRecord.m +++ b/EOControl/EOGenericRecord.m @@ -63,7 +63,6 @@ RCS_ID("$Id$") #include #include #include -#include #include #include #include @@ -74,6 +73,8 @@ RCS_ID("$Id$") #include +#include "EOPrivate.h" + @interface NSObject (EOCalculateSize) - (unsigned int)eoGetSize; @end diff --git a/EOControl/EOKeyGlobalID.m b/EOControl/EOKeyGlobalID.m index 22e2ec6..95559fd 100644 --- a/EOControl/EOKeyGlobalID.m +++ b/EOControl/EOKeyGlobalID.m @@ -53,7 +53,8 @@ RCS_ID("$Id$") #include #include #include -#include + +#include "EOPrivate.h" @implementation EOKeyGlobalID diff --git a/EOControl/EOKeyValueCoding.m b/EOControl/EOKeyValueCoding.m index 5e6eed3..0e3f8c3 100644 --- a/EOControl/EOKeyValueCoding.m +++ b/EOControl/EOKeyValueCoding.m @@ -68,10 +68,11 @@ RCS_ID("$Id$") #include #include #include -#include #include +#include "EOPrivate.h" + static BOOL strictWO; static BOOL initialized=NO; diff --git a/EOControl/EOKeyValueQualifier.m b/EOControl/EOKeyValueQualifier.m index dbe5841..c3dfdd9 100644 --- a/EOControl/EOKeyValueQualifier.m +++ b/EOControl/EOKeyValueQualifier.m @@ -61,7 +61,8 @@ RCS_ID("$Id$") #include #include #include -#include + +#include "EOPrivate.h" /* This declaration is needed by the compiler to state that diff --git a/EOControl/EOMutableKnownKeyDictionary.h b/EOControl/EOMutableKnownKeyDictionary.h index 7af4b55..d56baa8 100644 --- a/EOControl/EOMutableKnownKeyDictionary.h +++ b/EOControl/EOMutableKnownKeyDictionary.h @@ -171,13 +171,4 @@ @end -/** mkkkd can be a NSMutableKnownKey or another kind of dictionary **/ -GDL2CONTROL_EXPORT id EOMKKD_objectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key); -GDL2CONTROL_EXPORT void EOMKKD_setObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,id anObject,NSString* key); -GDL2CONTROL_EXPORT void EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key); -GDL2CONTROL_EXPORT BOOL EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,GDL2IMP_BOOL* impPtr,NSString* key); - -GDL2CONTROL_EXPORT unsigned int EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key); -GDL2CONTROL_EXPORT unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key); - #endif diff --git a/EOControl/EOMutableKnownKeyDictionary.m b/EOControl/EOMutableKnownKeyDictionary.m index 303a9c4..7f1e2d0 100644 --- a/EOControl/EOMutableKnownKeyDictionary.m +++ b/EOControl/EOMutableKnownKeyDictionary.m @@ -53,11 +53,11 @@ RCS_ID("$Id$") #include #endif -#include #include #include #include +#include "EOPrivate.h" @implementation EOMKKDInitializer @@ -1006,137 +1006,3 @@ RCS_ID("$Id$") } @end - -id EOMKKD_objectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key) -{ - if (mkkd) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkd)==GDL2MKKDClass - && GDL2MKKD_objectForKeyIMP) - imp=GDL2MKKD_objectForKeyIMP; - else - imp=[mkkd methodForSelector:GDL2_objectForKeySEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(mkkd,GDL2_objectForKeySEL,key); - } - else - return nil; -}; - -void EOMKKD_setObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,id anObject,NSString* key) -{ - if (mkkd) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkd)==GDL2MKKDClass - && GDL2MKKD_setObjectForKeyIMP) - imp=GDL2MKKD_setObjectForKeyIMP; - else - imp=[mkkd methodForSelector:GDL2_setObjectForKeySEL]; - if (impPtr) - *impPtr=imp; - } - (*imp)(mkkd,GDL2_setObjectForKeySEL,anObject,key); - }; -}; - -void EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key) -{ - if (mkkd) - { - IMP imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkd)==GDL2MKKDClass - && GDL2MKKD_removeObjectForKeyIMP) - imp=GDL2MKKD_removeObjectForKeyIMP; - else - imp=[mkkd methodForSelector:GDL2_removeObjectForKeySEL]; - if (impPtr) - *impPtr=imp; - } - (*imp)(mkkd,GDL2_removeObjectForKeySEL,key); - }; -}; - -BOOL EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,GDL2IMP_BOOL* impPtr,NSString* key) -{ - if (mkkd) - { - GDL2IMP_BOOL imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkd)==GDL2MKKDClass - && GDL2MKKD_hasKeyIMP) - imp=GDL2MKKD_hasKeyIMP; - else - imp=(GDL2IMP_BOOL)[mkkd methodForSelector:GDL2_hasKeySEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(mkkd,GDL2_hasKeySEL,key); - } - else - return NO; -}; - -unsigned int EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key) -{ - if (mkkd) - { - GDL2IMP_UINT imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkd)==GDL2MKKDClass - && GDL2MKKD_indexForKeyIMP) - imp=GDL2MKKD_indexForKeyIMP; - else - imp=(GDL2IMP_UINT)[mkkd methodForSelector:GDL2_indexForKeySEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(mkkd,GDL2_indexForKeySEL,key); - } - else - return 0; -}; - -unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key) -{ - if (mkkdInit) - { - GDL2IMP_UINT imp=NULL; - if (impPtr) - imp=*impPtr; - if (!imp) - { - if (GSObjCClass(mkkdInit)==GDL2EOMKKDInitializerClass - && GDL2EOMKKDInitializer_indexForKeyIMP) - imp=GDL2EOMKKDInitializer_indexForKeyIMP; - else - imp=(GDL2IMP_UINT)[mkkdInit methodForSelector:GDL2_indexForKeySEL]; - if (impPtr) - *impPtr=imp; - } - return (*imp)(mkkdInit,GDL2_indexForKeySEL,key); - } - else - return 0; -}; diff --git a/EOControl/EONSAddOns.m b/EOControl/EONSAddOns.m index d9dfde8..7130c28 100644 --- a/EOControl/EONSAddOns.m +++ b/EOControl/EONSAddOns.m @@ -59,10 +59,12 @@ RCS_ID("$Id$") #include #include -#include #include +#include "EOPrivate.h" + + static NSRecursiveLock *local_lock = nil; static BOOL GSStrictWO451Flag = NO; diff --git a/EOControl/EOPriv.h b/EOControl/EOPrivate.h similarity index 90% rename from EOControl/EOPriv.h rename to EOControl/EOPrivate.h index c4d03c4..bcfb8cc 100644 --- a/EOControl/EOPriv.h +++ b/EOControl/EOPrivate.h @@ -1,5 +1,5 @@ /* -*-objc-*- - EOPriv.h + EOPrivate.h Copyright (C) 2005 Free Software Foundation, Inc. @@ -24,13 +24,17 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __EOPriv_h__ -#define __EOPriv_h__ +#ifndef __EOControl_EOPrivate_h__ +#define __EOControl_EOPrivate_h__ -#include +#include "EODefines.h" @class NSNumber; @class EONull; +@class EOMutableKnownKeyDictionary; +@class EOMKKDInitializer; +@class EOEditingContext; +@class EOGlobalID; typedef unsigned int (*GDL2IMP_UINT)(id, SEL, ...); typedef BOOL (*GDL2IMP_BOOL)(id, SEL, ...); @@ -51,9 +55,7 @@ GDL2CONTROL_EXPORT Class GDL2NSDataClass; GDL2CONTROL_EXPORT Class GDL2EOFaultClass; GDL2CONTROL_EXPORT Class GDL2MKKDClass; GDL2CONTROL_EXPORT Class GDL2EOMKKDInitializerClass; -GDL2CONTROL_EXPORT Class GDL2EODatabaseContextClass; GDL2CONTROL_EXPORT Class GDL2EOEditingContextClass; -GDL2CONTROL_EXPORT Class GDL2EOAttributeClass; // ==== Selectors ==== GDL2CONTROL_EXPORT SEL GDL2_newSEL; @@ -89,12 +91,9 @@ GDL2CONTROL_EXPORT SEL GDL2_takeValueForKeySEL; GDL2CONTROL_EXPORT SEL GDL2_validateValueForKeySEL; // ---- GDL2 Selectors ---- -GDL2CONTROL_EXPORT SEL GDL2_snapshotForGlobalIDSEL; -GDL2CONTROL_EXPORT SEL GDL2_snapshotForGlobalIDSEL; GDL2CONTROL_EXPORT SEL GDL2_recordObjectGlobalIDSEL; GDL2CONTROL_EXPORT SEL GDL2_objectForGlobalIDSEL; GDL2CONTROL_EXPORT SEL GDL2_globalIDForObjectSEL; -GDL2CONTROL_EXPORT SEL GDL2__globalIDForObjectSEL; // ---- Dictionary Selectors ---- GDL2CONTROL_EXPORT SEL GDL2_objectForKeySEL; @@ -129,14 +128,10 @@ GDL2CONTROL_EXPORT GDL2IMP_BOOL GDL2MKKD_hasKeyIMP; GDL2CONTROL_EXPORT GDL2IMP_UINT GDL2MKKD_indexForKeyIMP; GDL2CONTROL_EXPORT GDL2IMP_UINT GDL2EOMKKDInitializer_indexForKeyIMP; -GDL2CONTROL_EXPORT IMP GDL2EODatabaseContext_snapshotForGlobalIDIMP; - GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_recordObjectGlobalIDIMP; GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_objectForGlobalIDIMP; GDL2CONTROL_EXPORT IMP GDL2EOEditingContext_globalIDForObjectIMP; -GDL2CONTROL_EXPORT IMP GDL2EODatabaseContext__globalIDForObjectIMP; - GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayWithCapacityIMP; GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayWithArrayIMP; GDL2CONTROL_EXPORT IMP GDL2NSMutableArray_arrayIMP; @@ -426,5 +421,22 @@ static inline BOOL GDL2RespondsToSelectorWithImpPtr(id object,GDL2IMP_BOOL* impP return NO; }; -#endif /* __EOPriv_h__ */ +// ==== EOMultipleKnownKeyDictionary ==== + +/** mkkkd can be a NSMutableKnownKey or another kind of dictionary **/ +GDL2CONTROL_EXPORT id EOMKKD_objectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key); +GDL2CONTROL_EXPORT void EOMKKD_setObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,id anObject,NSString* key); +GDL2CONTROL_EXPORT void EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd,IMP* impPtr,NSString* key); +GDL2CONTROL_EXPORT BOOL EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd,GDL2IMP_BOOL* impPtr,NSString* key); + +GDL2CONTROL_EXPORT unsigned int EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd,GDL2IMP_UINT* impPtr,NSString* key); +GDL2CONTROL_EXPORT unsigned int EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit,GDL2IMP_UINT* impPtr,NSString* key); + +// ==== EOEditingContext ==== + +GDL2CONTROL_EXPORT id EOEditingContext_objectForGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,EOGlobalID* gid); +EOGlobalID* EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object); +GDL2CONTROL_EXPORT id EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext* edContext,IMP* impPtr,id object,EOGlobalID* gid); + +#endif /* __EOControl_EOPrivate_h__ */ diff --git a/EOControl/EOPriv.m b/EOControl/EOPrivate.m similarity index 64% rename from EOControl/EOPriv.m rename to EOControl/EOPrivate.m index db2cb96..1d961c6 100644 --- a/EOControl/EOPriv.m +++ b/EOControl/EOPrivate.m @@ -1,5 +1,5 @@ /** - EOPriv.m EOPriv: various definitions + EOPrivate.m EOPrivate: various definitions Copyright (C) 2005 Free Software Foundation, Inc. @@ -41,10 +41,11 @@ RCS_ID("$Id$") #include #endif -#include +#include #include #include -#include + +#include "EOPrivate.h" // ==== Classes ==== Class GDL2NSArrayClass=Nil; @@ -61,9 +62,7 @@ Class GDL2NSDataClass=Nil; Class GDL2EOFaultClass=Nil; Class GDL2MKKDClass=Nil; Class GDL2EOMKKDInitializerClass=Nil; -Class GDL2EODatabaseContextClass=Nil; Class GDL2EOEditingContextClass=Nil; -Class GDL2EOAttributeClass=Nil; // ==== Selectors ==== SEL GDL2_newSEL=NULL; @@ -99,11 +98,9 @@ SEL GDL2_takeValueForKeySEL=NULL; SEL GDL2_validateValueForKeySEL=NULL; // ---- GDL2 Selectors ---- -SEL GDL2_snapshotForGlobalIDSEL=NULL; SEL GDL2_recordObjectGlobalIDSEL=NULL; SEL GDL2_objectForGlobalIDSEL=NULL; SEL GDL2_globalIDForObjectSEL=NULL; -SEL GDL2__globalIDForObjectSEL=NULL; // ---- Dictionary Selectors ---- SEL GDL2_objectForKeySEL=NULL; @@ -138,13 +135,10 @@ GDL2IMP_BOOL GDL2MKKD_hasKeyIMP=NULL; GDL2IMP_UINT GDL2MKKD_indexForKeyIMP=NULL; GDL2IMP_UINT GDL2EOMKKDInitializer_indexForKeyIMP=NULL; -IMP GDL2EODatabaseContext_snapshotForGlobalIDIMP=NULL; IMP GDL2EOEditingContext_recordObjectGlobalIDIMP=NULL; IMP GDL2EOEditingContext_objectForGlobalIDIMP=NULL; IMP GDL2EOEditingContext_globalIDForObjectIMP=NULL; -IMP GDL2EODatabaseContext__globalIDForObjectIMP=NULL; - IMP GDL2NSMutableArray_arrayWithCapacityIMP=NULL; IMP GDL2NSMutableArray_arrayWithArrayIMP=NULL; IMP GDL2NSMutableArray_arrayIMP=NULL; @@ -179,9 +173,7 @@ void GDL2PrivInit() GDL2EOFaultClass = [EOFault class]; GDL2MKKDClass = [EOMutableKnownKeyDictionary class]; GDL2EOMKKDInitializerClass = [EOMKKDInitializer class]; - GDL2EODatabaseContextClass = [EODatabaseContext class]; GDL2EOEditingContextClass = [EOEditingContext class]; - GDL2EOAttributeClass = [EOAttribute class]; // ==== Selectors ==== GDL2_newSEL=@selector(new); @@ -217,12 +209,9 @@ void GDL2PrivInit() GDL2_validateValueForKeySEL=@selector(validateValue:forKey:); // ---- GDL2 Selectors ---- - GDL2_snapshotForGlobalIDSEL=@selector(snapshotForGlobalID:); - GDL2_snapshotForGlobalIDSEL=@selector(snapshotForGlobalID:); GDL2_recordObjectGlobalIDSEL=@selector(recordObject:globalID:); GDL2_objectForGlobalIDSEL=@selector(objectForGlobalID:); GDL2_globalIDForObjectSEL=@selector(globalIDForObject:); - GDL2__globalIDForObjectSEL=@selector(_globalIDForObject:); // ---- Dictionary Selectors ---- GDL2_objectForKeySEL=@selector(objectForKey:); @@ -275,14 +264,10 @@ void GDL2PrivInit() GDL2MKKD_indexForKeyIMP=(GDL2IMP_UINT)[GDL2MKKDClass instanceMethodForSelector:GDL2_indexForKeySEL]; GDL2EOMKKDInitializer_indexForKeyIMP=(GDL2IMP_UINT)[GDL2EOMKKDInitializerClass instanceMethodForSelector:GDL2_indexForKeySEL]; - GDL2EODatabaseContext_snapshotForGlobalIDIMP=[GDL2EODatabaseContextClass instanceMethodForSelector:GDL2_snapshotForGlobalIDSEL]; - GDL2EOEditingContext_recordObjectGlobalIDIMP==[GDL2EOEditingContextClass instanceMethodForSelector:GDL2_recordObjectGlobalIDSEL]; GDL2EOEditingContext_objectForGlobalIDIMP=[GDL2EOEditingContextClass instanceMethodForSelector:GDL2_objectForGlobalIDSEL]; GDL2EOEditingContext_globalIDForObjectIMP=[GDL2EOEditingContextClass instanceMethodForSelector:GDL2_globalIDForObjectSEL]; - GDL2EODatabaseContext__globalIDForObjectIMP=[GDL2EODatabaseContextClass instanceMethodForSelector:GDL2__globalIDForObjectSEL]; - GDL2NSMutableArray_arrayWithCapacityIMP=[GDL2NSMutableArrayClass methodForSelector:GDL2_arrayWithCapacitySEL]; @@ -306,3 +291,239 @@ void GDL2PrivInit() }; } + +/* EOMultipleKnownKeyDictionary */ + +id +EOMKKD_objectForKeyWithImpPtr(NSDictionary* mkkd, + IMP* impPtr, + NSString* key) +{ + if (mkkd) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkd)==GDL2MKKDClass + && GDL2MKKD_objectForKeyIMP) + imp=GDL2MKKD_objectForKeyIMP; + else + imp=[mkkd methodForSelector:GDL2_objectForKeySEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(mkkd,GDL2_objectForKeySEL,key); + } + else + return nil; +}; + +void +EOMKKD_setObjectForKeyWithImpPtr(NSDictionary* mkkd, + IMP* impPtr, + id anObject, + NSString* key) +{ + if (mkkd) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkd)==GDL2MKKDClass + && GDL2MKKD_setObjectForKeyIMP) + imp=GDL2MKKD_setObjectForKeyIMP; + else + imp=[mkkd methodForSelector:GDL2_setObjectForKeySEL]; + if (impPtr) + *impPtr=imp; + } + (*imp)(mkkd,GDL2_setObjectForKeySEL,anObject,key); + }; +}; + +void +EOMKKD_removeObjectForKeyWithImpPtr(NSDictionary* mkkd, + IMP* impPtr, + NSString* key) +{ + if (mkkd) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkd)==GDL2MKKDClass + && GDL2MKKD_removeObjectForKeyIMP) + imp=GDL2MKKD_removeObjectForKeyIMP; + else + imp=[mkkd methodForSelector:GDL2_removeObjectForKeySEL]; + if (impPtr) + *impPtr=imp; + } + (*imp)(mkkd,GDL2_removeObjectForKeySEL,key); + }; +}; + +BOOL +EOMKKD_hasKeyWithImpPtr(NSDictionary* mkkd, + GDL2IMP_BOOL* impPtr, + NSString* key) +{ + if (mkkd) + { + GDL2IMP_BOOL imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkd)==GDL2MKKDClass + && GDL2MKKD_hasKeyIMP) + imp=GDL2MKKD_hasKeyIMP; + else + imp=(GDL2IMP_BOOL)[mkkd methodForSelector:GDL2_hasKeySEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(mkkd,GDL2_hasKeySEL,key); + } + else + return NO; +}; + +unsigned int +EOMKKD_indexForKeyWithImpPtr(EOMutableKnownKeyDictionary* mkkd, + GDL2IMP_UINT* impPtr, + NSString* key) +{ + if (mkkd) + { + GDL2IMP_UINT imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkd)==GDL2MKKDClass + && GDL2MKKD_indexForKeyIMP) + imp=GDL2MKKD_indexForKeyIMP; + else + imp=(GDL2IMP_UINT)[mkkd methodForSelector:GDL2_indexForKeySEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(mkkd,GDL2_indexForKeySEL,key); + } + else + return 0; +}; + +unsigned int +EOMKKDInitializer_indexForKeyWithImpPtr(EOMKKDInitializer* mkkdInit, + GDL2IMP_UINT* impPtr, + NSString* key) +{ + if (mkkdInit) + { + GDL2IMP_UINT imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(mkkdInit)==GDL2EOMKKDInitializerClass + && GDL2EOMKKDInitializer_indexForKeyIMP) + imp=GDL2EOMKKDInitializer_indexForKeyIMP; + else + imp=(GDL2IMP_UINT)[mkkdInit methodForSelector:GDL2_indexForKeySEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(mkkdInit,GDL2_indexForKeySEL,key); + } + else + return 0; +}; + +/* EOEditingContext */ + +id +EOEditingContext_objectForGlobalIDWithImpPtr(EOEditingContext *edContext, + IMP *impPtr, + EOGlobalID *gid) +{ + if (edContext) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(edContext)==GDL2EOEditingContextClass + && GDL2EOEditingContext_objectForGlobalIDIMP) + imp=GDL2EOEditingContext_objectForGlobalIDIMP; + else + imp=[edContext methodForSelector:GDL2_objectForGlobalIDSEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(edContext,GDL2_objectForGlobalIDSEL,gid); + } + else + return nil; +}; + +EOGlobalID * +EOEditingContext_globalIDForObjectWithImpPtr(EOEditingContext *edContext, + IMP *impPtr, + id object) +{ + if (edContext) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(edContext)==GDL2EOEditingContextClass + && GDL2EOEditingContext_globalIDForObjectIMP) + imp=GDL2EOEditingContext_globalIDForObjectIMP; + else + imp=[edContext methodForSelector:GDL2_globalIDForObjectSEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(edContext,GDL2_globalIDForObjectSEL,object); + } + else + return nil; +}; + +id +EOEditingContext_recordObjectGlobalIDWithImpPtr(EOEditingContext *edContext, + IMP *impPtr, + id object, + EOGlobalID *gid) +{ + if (edContext) + { + IMP imp=NULL; + if (impPtr) + imp=*impPtr; + if (!imp) + { + if (GSObjCClass(edContext)==GDL2EOEditingContextClass + && GDL2EOEditingContext_recordObjectGlobalIDIMP) + imp=GDL2EOEditingContext_recordObjectGlobalIDIMP; + else + imp=[edContext methodForSelector:GDL2_recordObjectGlobalIDSEL]; + if (impPtr) + *impPtr=imp; + } + return (*imp)(edContext,GDL2_recordObjectGlobalIDSEL,object,gid); + } + else + return nil; +}; diff --git a/EOControl/EOSortOrdering.m b/EOControl/EOSortOrdering.m index 513d798..2857986 100644 --- a/EOControl/EOSortOrdering.m +++ b/EOControl/EOSortOrdering.m @@ -52,7 +52,8 @@ RCS_ID("$Id$") #include #include #include -#include + +#include "EOPrivate.h" @implementation EOSortOrdering diff --git a/EOControl/GNUmakefile b/EOControl/GNUmakefile index 5fb1856..215416e 100644 --- a/EOControl/GNUmakefile +++ b/EOControl/GNUmakefile @@ -66,7 +66,7 @@ EONSAddOns.m \ EOCheapArray.m \ EOArrayDataSource.m \ EODebug.m \ -EOPriv.m +EOPrivate.m libgnustep-db2control_HEADER_FILES_DIR = . libgnustep-db2control_HEADER_FILES_INSTALL_DIR = /EOControl @@ -94,8 +94,7 @@ EODebug.h \ EONSAddOns.h \ EODefines.h \ EODeprecated.h \ -EOControl.h \ -EOPriv.h +EOControl.h DOCUMENT_NAME = EOControl EOControl_AUTOGSDOC_HEADERS = $(libgnustep-db2control_HEADER_FILES)