diff --git a/ChangeLog b/ChangeLog index 61a02ef..fc99eec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,76 @@ +2002-08-04 Manuel Guesdon + * GSWeb.framework/GSWEmbeddedObject.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWGenericContainer.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWDirectActionRequestHandler.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWDynamicURLString.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWBindingNameAssociation.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWComponentDefinition.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWComponentRequestHandler.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWConstantValueAssociation.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWDisplayGroup.h/.m + o ivar names changes to conform to coding standards + o include for TCSimpleDB/ + * GSWeb.framework/GSWKeyValueAssociation.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWParam.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWRequestHandler.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWResourceRequestHandler.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/NSString+Trimming.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWStats.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/NSNonBlockingFileHandle.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/NSString+HTML.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWStatisticsStore.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWHTMLURLValuedElement.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWApplication.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWBundle.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWDeployedBundle.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWTemplateParserXML.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWHTMLParserExt.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWMultiKeyDictionary.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWProjectBundle.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWTemplateParser.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWPageDefElement.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWUtils.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWeb.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWWOCompatibility.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWQuickTime.h + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWTemplateParserANTLR.h/.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWDebug.m + o ivar names changes to conform to coding standards + * GSWeb.framework/GSWComponent.m + o NSAsserts + 2002-07-28 Manuel Guesdon * GSWeb.framework/WebObjects: o added WebObjects headers (suggested by David Wetzel ) diff --git a/GSWeb.framework/GSWApplication.h b/GSWeb.framework/GSWApplication.h index 931ce08..79fcb87 100644 --- a/GSWeb.framework/GSWApplication.h +++ b/GSWeb.framework/GSWApplication.h @@ -1,11 +1,16 @@ -/* GSWApplication.h - GSWeb: Class GSWApplication - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWApplication.h - GSWeb: Class GSWApplication + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,20 +24,21 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ #ifndef _GSWApplication_h__ #define _GSWApplication_h__ -extern void GSWApplicationSetDebugSetOption(NSString* opt_); +extern void GSWApplicationSetDebugSetOption(NSString* opt); extern int WOApplicationMain(NSString* applicationClassName, int argc, const char *argv[]); extern int GSWApplicationMain(NSString* applicationClassName, - int argc, - const char *argv[]); + int argc, + const char *argv[]); extern NSString* globalApplicationClassName; extern int GSWebNamingConv;//GSWNAMES_INDEX or WONAMES_INDEX #define GSWebNamingConvInversed (GSWebNamingConv==GSWNAMES_INDEX ? WONAMES_INDEX : GSWNAMES_INDEX) @@ -42,56 +48,56 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication : NSObject { - NSArray* adaptors; - GSWSessionStore* sessionStore; - GSWMultiKeyDictionary* componentDefinitionCache; - NSTimeInterval timeOut; - NSTimer* timer; + NSArray* _adaptors; + GSWSessionStore* _sessionStore; + GSWMultiKeyDictionary* _componentDefinitionCache; + NSTimeInterval _timeOut; + NSTimer* _timer; // GSWContext* context; // being deprecated - GSWStatisticsStore* statisticsStore; - GSWResourceManager* resourceManager; - NSDistantObject* remoteMonitor; - NSConnection* remoteMonitorConnection; - NSString* instanceNumber; - NSMutableDictionary* requestHandlers; - GSWRequestHandler* defaultRequestHandler; + GSWStatisticsStore* _statisticsStore; + GSWResourceManager* _resourceManager; + NSDistantObject* _remoteMonitor; + NSConnection* _remoteMonitorConnection; + NSString* _instanceNumber; + NSMutableDictionary* _requestHandlers; + GSWRequestHandler* _defaultRequestHandler; @public //TODO-NOW REMOVE - NSRecursiveLock* selfLock; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; - objc_thread_t selfLock_thread_id; + int _selfLockn; + objc_thread_t _selfLock_thread_id; #endif - NSLock* globalLock; + NSLock* _globalLock; #ifndef NDEBUG - int globalLockn; - objc_thread_t globalLock_thread_id; + int _globalLockn; + objc_thread_t _globalLock_thread_id; #endif - NSAutoreleasePool* globalAutoreleasePool; - unsigned pageCacheSize; - unsigned permanentPageCacheSize; - int activeSessionsCount; - int minimumActiveSessionsCount; - BOOL pageRecreationEnabled; - BOOL pageRefreshOnBacktrackEnabled; - BOOL terminating; - BOOL dynamicLoadingEnabled; - BOOL printsHTMLParserDiagnostics; - BOOL refusingNewSessions; - BOOL shouldDieWhenRefusing; - BOOL refusingNewClients; - BOOL refuseThisRequest; - BOOL isMultiThreaded; - BOOL isMTProtected; - BOOL timedRunLoop; - BOOL isTracingEnabled; - BOOL isTracingAssignmentsEnabled; - BOOL isTracingObjectiveCMessagesEnabled; - BOOL isTracingScriptedMessagesEnabled; - BOOL isTracingStatementsEnabled; - NSRunLoop* currentRunLoop; - NSDate* runLoopDate; - NSTimer* initialTimer; - NSLock* activeSessionsCountLock; + NSAutoreleasePool* _globalAutoreleasePool; + unsigned _pageCacheSize; + unsigned _permanentPageCacheSize; + int _activeSessionsCount; + int _minimumActiveSessionsCount; + BOOL _pageRecreationEnabled; + BOOL _pageRefreshOnBacktrackEnabled; + BOOL _terminating; + BOOL _dynamicLoadingEnabled; + BOOL _printsHTMLParserDiagnostics; + BOOL _refusingNewSessions; + BOOL _shouldDieWhenRefusing; + BOOL _refusingNewClients; + BOOL _refuseThisRequest; + BOOL _isMultiThreaded; + BOOL _isMTProtected; + BOOL _timedRunLoop; + BOOL _isTracingEnabled; + BOOL _isTracingAssignmentsEnabled; + BOOL _isTracingObjectiveCMessagesEnabled; + BOOL _isTracingScriptedMessagesEnabled; + BOOL _isTracingStatementsEnabled; + NSRunLoop* _currentRunLoop; + NSDate* _runLoopDate; + NSTimer* _initialTimer; + NSLock* _activeSessionsCountLock; } -(void)dealloc; @@ -117,8 +123,8 @@ extern BOOL WOStrictFlag; -(void)setPageRefreshOnBacktrackEnabled:(BOOL)flag; -(void)registerRequestHandlers; --(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)_userDefault; --(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)_userDefault; +-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefault; +-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault; -(void)unlock; -(void)lock; -(void)unlockRequestHandling; @@ -149,22 +155,22 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication (GSWApplicationD) --(GSWComponentDefinition*)componentDefinitionWithName:(NSString*)_name - languages:(NSArray*)_languages; --(GSWComponentDefinition*)lockedComponentDefinitionWithName:(NSString*)_name - languages:(NSArray*)_languages; --(GSWComponentDefinition*)lockedLoadComponentDefinitionWithName:(NSString*)_name - language:(NSString*)_language; +-(GSWComponentDefinition*)componentDefinitionWithName:(NSString*)aName + languages:(NSArray*)languages; +-(GSWComponentDefinition*)lockedComponentDefinitionWithName:(NSString*)aName + languages:(NSArray*)languages; +-(GSWComponentDefinition*)lockedLoadComponentDefinitionWithName:(NSString*)aName + language:(NSString*)language; -(NSArray*)lockedComponentBearingFrameworks; --(NSArray*)lockedInitComponentBearingFrameworksFromBundleArray:(NSArray*)_bundles; +-(NSArray*)lockedInitComponentBearingFrameworksFromBundleArray:(NSArray*)bundles; @end //==================================================================== @interface GSWApplication (GSWApplicationE) -(void)_discountTerminatedSession; --(void)_finishInitializingSession:(GSWSession*)_session; --(GSWSession*)_initializeSessionInContext:(GSWContext*)context_; +-(void)_finishInitializingSession:(GSWSession*)aSession; +-(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext; -(int)lockedDecrementActiveSessionCount; -(int)lockedIncrementActiveSessionCount; -(int)_activeSessionsCount; @@ -173,7 +179,7 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication (GSWApplicationF) --(void)_setContext:(GSWContext*)context_; +-(void)_setContext:(GSWContext*)aContext; // Internal Use only -(GSWContext*)_context; @end @@ -198,11 +204,11 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication (GSWApplicationJ) --(id)_newLocationForRequest:(GSWRequest*)_request; --(void)_connectionDidDie:(id)_unknown; +-(id)_newLocationForRequest:(GSWRequest*)aRequest; +-(void)_connectionDidDie:(id)unknown; -(BOOL)_shouldKill; --(void)_setShouldKill:(BOOL)_flag; --(void)_synchronizeInstanceSettingsWithMonitor:(id)_monitor; +-(void)_setShouldKill:(BOOL)flag; +-(void)_synchronizeInstanceSettingsWithMonitor:(id)aMonitor; -(BOOL)_setupForMonitoring; -(id)_remoteMonitor; -(NSString*)_monitorHost; @@ -219,8 +225,8 @@ extern BOOL WOStrictFlag; @interface GSWApplication (GSWAdaptorManagement) -(NSArray*)adaptors; --(GSWAdaptor*)adaptorWithName:(NSString*)name_ - arguments:(NSDictionary*)someArguments; +-(GSWAdaptor*)adaptorWithName:(NSString*)aName + arguments:(NSDictionary*)someArguments; @end @@ -228,55 +234,55 @@ extern BOOL WOStrictFlag; @interface GSWApplication (GSWCacheManagement) -(BOOL)isCachingEnabled; --(void)setCachingEnabled:(BOOL)flag_; +-(void)setCachingEnabled:(BOOL)flag; @end //==================================================================== @interface GSWApplication (GSWSessionManagement) -(GSWSessionStore*)sessionStore; --(void)setSessionStore:(GSWSessionStore*)sessionStore_; +-(void)setSessionStore:(GSWSessionStore*)sessionStore; --(GSWSession*)createSessionForRequest:(GSWRequest*)_request; --(GSWSession*)_createSessionForRequest:(GSWRequest*)_request; +-(GSWSession*)createSessionForRequest:(GSWRequest*)aRequest; +-(GSWSession*)_createSessionForRequest:(GSWRequest*)aRequest; -(Class)_sessionClass; --(GSWSession*)restoreSessionWithID:(NSString*)_sessionID - inContext:(GSWContext*)context_; --(GSWSession*)_restoreSessionWithID:(NSString*)_sessionID - inContext:(GSWContext*)context_; --(void)saveSessionForContext:(GSWContext*)context_; --(void)_saveSessionForContext:(GSWContext*)context_; +-(GSWSession*)restoreSessionWithID:(NSString*)aSessionID + inContext:(GSWContext*)aContext; +-(GSWSession*)_restoreSessionWithID:(NSString*)aSessionID + inContext:(GSWContext*)aContext; +-(void)saveSessionForContext:(GSWContext*)aContext; +-(void)_saveSessionForContext:(GSWContext*)aContext; @end //==================================================================== @interface GSWApplication (GSWPageManagement) -(unsigned int)pageCacheSize; --(void)setPageCacheSize:(unsigned int)size_; +-(void)setPageCacheSize:(unsigned int)aSize; -(unsigned)permanentPageCacheSize; --(void)setPermanentPageCacheSize:(unsigned)size_; +-(void)setPermanentPageCacheSize:(unsigned)aSize; -(BOOL)isPageRefreshOnBacktrackEnabled; --(void)setPageRefreshOnBacktrackEnabled:(BOOL)_flag; --(GSWComponent*)pageWithName:(NSString*)name_ - forRequest:(GSWRequest*)request_; --(GSWComponent*)pageWithName:(NSString*)name_ - inContext:(GSWContext*)context_; +-(void)setPageRefreshOnBacktrackEnabled:(BOOL)flag; +-(GSWComponent*)pageWithName:(NSString*)aName + forRequest:(GSWRequest*)aRequest; +-(GSWComponent*)pageWithName:(NSString*)aName + inContext:(GSWContext*)aContext; -(NSString*)defaultPageName;//NDFN --(GSWComponent*)_pageWithName:(NSString*)name_ - inContext:(GSWContext*)context_; +-(GSWComponent*)_pageWithName:(NSString*)aName + inContext:(GSWContext*)aContext; @end //==================================================================== @interface GSWApplication (GSWElementCreation) --(GSWElement*)dynamicElementWithName:(NSString *)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ - languages:(NSArray*)languages_; --(GSWElement*)lockedDynamicElementWithName:(NSString *)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ - languages:(NSArray*)languages_; +-(GSWElement*)dynamicElementWithName:(NSString *)aName + associations:(NSDictionary*)someAssociations + template:(GSWElement*)templateElement + languages:(NSArray*)languages; +-(GSWElement*)lockedDynamicElementWithName:(NSString*)aName + associations:(NSDictionary*)someAssociations + template:(GSWElement*)templateElement + languages:(NSArray*)languages; @end //==================================================================== @@ -285,13 +291,13 @@ extern BOOL WOStrictFlag; -(void)threadWillExit;//NDFN -(void)run; -(BOOL)runOnce; --(void)setTimeOut:(NSTimeInterval)timeInterval_; +-(void)setTimeOut:(NSTimeInterval)aTimeInterval; -(NSTimeInterval)timeOut; -(void)terminate; -(BOOL)isTerminating; --(void)_scheduleApplicationTimerForTimeInterval:(NSTimeInterval)timeInterval_; --(void)addTimer:(NSTimer*)timer_;//NDFN +-(void)_scheduleApplicationTimerForTimeInterval:(NSTimeInterval)aTimeInterval; +-(void)addTimer:(NSTimer*)aTimer;//NDFN -(void)cancelInitialTimer; -(void)handleInitialTimer; -(void)_setNextCollectionCount:(int)_count; @@ -302,111 +308,111 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication (GSWRequestHandling) --(GSWResponse*)dispatchRequest:(GSWRequest*)request_; +-(GSWResponse*)dispatchRequest:(GSWRequest*)aRequest; -(void)awake; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; +-(void)takeValuesFromRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; -(void)sleep; @end //==================================================================== @interface GSWApplication (GSWErrorHandling) --(GSWResponse*)handleException:(NSException*)exception_ - inContext:(GSWContext*)context_; --(GSWResponse*)_handleException:(NSException*)exception_ - inContext:(GSWContext*)context_; --(GSWResponse*)handlePageRestorationErrorInContext:(GSWContext*)context_; --(GSWResponse*)_handlePageRestorationErrorInContext:(GSWContext*)context_; --(GSWResponse*)handleSessionCreationErrorInContext:(GSWContext*)context_; --(GSWResponse*)_handleSessionCreationErrorInContext:(GSWContext*)context_; --(GSWResponse*)handleSessionRestorationErrorInContext:(GSWContext*)context_; --(GSWResponse*)_handleSessionRestorationErrorInContext:(GSWContext*)context_; +-(GSWResponse*)handleException:(NSException*)exception + inContext:(GSWContext*)aContext; +-(GSWResponse*)_handleException:(NSException*)exception + inContext:(GSWContext*)aContext; +-(GSWResponse*)handlePageRestorationErrorInContext:(GSWContext*)aContext; +-(GSWResponse*)_handlePageRestorationErrorInContext:(GSWContext*)aContext; +-(GSWResponse*)handleSessionCreationErrorInContext:(GSWContext*)aContext; +-(GSWResponse*)_handleSessionCreationErrorInContext:(GSWContext*)aContext; +-(GSWResponse*)handleSessionRestorationErrorInContext:(GSWContext*)aContext; +-(GSWResponse*)_handleSessionRestorationErrorInContext:(GSWContext*)aContext; @end //==================================================================== @interface GSWApplication (GSWConveniences) -+(void)_setApplication:(GSWApplication*)_application; ++(void)_setApplication:(GSWApplication*)application; +(GSWApplication*)application; @end //==================================================================== @interface GSWApplication (GSWHTMLTemplateParsingDebugging) -(BOOL)printsHTMLParserDiagnostics; --(void)setPrintsHTMLParserDiagnostics:(BOOL)flag_; +-(void)setPrintsHTMLParserDiagnostics:(BOOL)flag; @end //==================================================================== @interface GSWApplication (GSWScriptedObjectSupport) --(Class)scriptedClassWithPath:(NSString*)path_; --(Class)scriptedClassWithPath:(NSString*)path_ - encoding:(NSStringEncoding)encoding_; --(Class)_classWithScriptedClassName:(NSString*)_name - languages:(NSArray*)_languages; --(void)_setClassFromNameResolutionEnabled:(BOOL)_flag; +-(Class)scriptedClassWithPath:(NSString*)path; +-(Class)scriptedClassWithPath:(NSString*)path + encoding:(NSStringEncoding)encoding; +-(Class)_classWithScriptedClassName:(NSString*)aName + languages:(NSArray*)languages; +-(void)_setClassFromNameResolutionEnabled:(BOOL)flag; @end //==================================================================== @interface GSWApplication (GSWLibrarySupport) --(Class)libraryClassWithPath:(NSString*)path_;//NDFN +-(Class)libraryClassWithPath:(NSString*)path;//NDFN @end //==================================================================== @interface GSWApplication (GSWDebugging) --(void)debugWithString:(NSString*)_string; --(void)debugWithFormat:(NSString*)_format - arguments:(va_list)someArgumentsu; --(void)debugWithFormat:(NSString*)formatString_,...; -+(void)debugWithFormat:(NSString*)formatString_,...; --(void)logWithFormat:(NSString*)format_,...; -+(void)logWithFormat:(NSString*)format_,...; +-(void)debugWithString:(NSString*)string; +-(void)debugWithFormat:(NSString*)format + arguments:(va_list)someArgumentsu; +-(void)debugWithFormat:(NSString*)formatString,...; ++(void)debugWithFormat:(NSString*)formatString,...; +-(void)logWithFormat:(NSString*)aFormat,...; ++(void)logWithFormat:(NSString*)aFormat,...; -(void)logWithFormat:(NSString*)formatString_ - arguments:(va_list)arguments_; --(void)logErrorWithFormat:(NSString*)format_,...; -+(void)logErrorWithFormat:(NSString*)format_,...; --(void)logErrorWithFormat:(NSString*)formatString_ - arguments:(va_list)arguments_; --(void)trace:(BOOL)flag_; --(void)traceAssignments:(BOOL)flag_; --(void)traceObjectiveCMessages:(BOOL)flag_; --(void)traceScriptedMessages:(BOOL)flag_; --(void)traceStatements:(BOOL)flag_; -+(void)logTakeValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_; -+(void)logSetValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_; + arguments:(va_list)arguments; +-(void)logErrorWithFormat:(NSString*)aFormat,...; ++(void)logErrorWithFormat:(NSString*)aFormat,...; +-(void)logErrorWithFormat:(NSString*)formatString + arguments:(va_list)arguments; +-(void)trace:(BOOL)flag; +-(void)traceAssignments:(BOOL)flag; +-(void)traceObjectiveCMessages:(BOOL)flag; +-(void)traceScriptedMessages:(BOOL)flag; +-(void)traceStatements:(BOOL)flag; ++(void)logTakeValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)anAssociationDescription + value:(id)aValue; ++(void)logSetValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)anAssociationDescription + value:(id)aValue; --(void)logTakeValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_; +-(void)logTakeValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)anAssociationDescription + value:(id)aValue; --(void)logSetValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_; +-(void)logSetValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)anAssociationDescription + value:(id)aValue; +(void)logSynchronizeComponentToParentForValue:(id)value_ - association:(GSWAssociation*)association_ - inComponent:(NSObject*)component_; -+(void)logSynchronizeParentToComponentForValue:(id)value_ - association:(GSWAssociation*)association_ - inComponent:(NSObject*)component_; + association:(GSWAssociation*)anAssociation + inComponent:(NSObject*)aComponent; ++(void)logSynchronizeParentToComponentForValue:(id)aValue + association:(GSWAssociation*)anAssociation + inComponent:(NSObject*)aComponent; --(void)_setTracingAspect:(id)_unknwon - enabled:(BOOL)_enabled; +-(void)_setTracingAspect:(id)unknwon + enabled:(BOOL)enabled; @end //==================================================================== @@ -414,24 +420,24 @@ extern BOOL WOStrictFlag; //Same as GSWDebugging but it print messages on stdout AND call GSWDebugging methods @interface GSWApplication (GSWDebuggingStatus) --(void)statusDebugWithString:(NSString*)string_; --(void)statusDebugWithFormat:(NSString*)format_ - arguments:(va_list)arguments_; --(void)statusDebugWithFormat:(NSString*)format_,...; -+(void)statusDebugWithFormat:(NSString*)format_,...; --(void)statusLogWithFormat:(NSString*)format_,...; -+(void)statusLogWithFormat:(NSString*)format_,...; --(void)statusLogWithFormat:(NSString*)format_ - arguments:(va_list)arguments_; --(void)statusLogErrorWithFormat:(NSString*)format_,...; -+(void)statusLogErrorWithFormat:(NSString*)format_,...; --(void)statusLogErrorWithFormat:(NSString*)format_ - arguments:(va_list)arguments_; +-(void)statusDebugWithString:(NSString*)aString; +-(void)statusDebugWithFormat:(NSString*)aFormat + arguments:(va_list)arguments; +-(void)statusDebugWithFormat:(NSString*)aFormat,...; ++(void)statusDebugWithFormat:(NSString*)aFormat,...; +-(void)statusLogWithFormat:(NSString*)aFormat,...; ++(void)statusLogWithFormat:(NSString*)aFormat,...; +-(void)statusLogWithFormat:(NSString*)aFormat + arguments:(va_list)arguments; +-(void)statusLogErrorWithFormat:(NSString*)aFormat,...; ++(void)statusLogErrorWithFormat:(NSString*)aFormat,...; +-(void)statusLogErrorWithFormat:(NSString*)aFormat + arguments:(va_list)arguments; @end //==================================================================== @interface GSWApplication (GSWStatisticsSupport) --(void)setStatisticsStore:(GSWStatisticsStore*)statisticsStore_; +-(void)setStatisticsStore:(GSWStatisticsStore*)statisticsStore; -(NSDictionary*)statistics;//bycopy -(GSWStatisticsStore*)statisticsStore; @end @@ -441,16 +447,16 @@ extern BOOL WOStrictFlag; -(BOOL)monitoringEnabled; -(int)activeSessionsCount; -(int)minimumActiveSessionsCount; --(void)setMinimumActiveSessionsCount:(int)count_; +-(void)setMinimumActiveSessionsCount:(int)aCount; -(BOOL)isRefusingNewSessions; -(void)refuseNewSessions:(BOOL)flag; --(void)logToMonitorWithFormat:(NSString*)format_; --(void)terminateAfterTimeInterval:(NSTimeInterval)timeInterval_; +-(void)logToMonitorWithFormat:(NSString*)aFormat; +-(void)terminateAfterTimeInterval:(NSTimeInterval)aTimeInterval; @end //==================================================================== @interface GSWApplication (GSWResourceManagerSupport) --(void)setResourceManager:(GSWResourceManager*)resourceManager_; +-(void)setResourceManager:(GSWResourceManager*)resourceManager; -(GSWResourceManager*)resourceManager; @end @@ -458,76 +464,76 @@ extern BOOL WOStrictFlag; @interface GSWApplication (RequestDispatching) -(GSWRequestHandler*)defaultRequestHandler; --(void)setDefaultRequestHandler:(GSWRequestHandler*)handler_; +-(void)setDefaultRequestHandler:(GSWRequestHandler*)handler; --(void)registerRequestHandler:(GSWRequestHandler*)handler_ - forKey:(NSString*)key_; +-(void)registerRequestHandler:(GSWRequestHandler*)handler + forKey:(NSString*)aKey; --(void)removeRequestHandlerForKey:(NSString*)requestHandlerKey_; +-(void)removeRequestHandlerForKey:(NSString*)requestHandlerKey; -(NSArray*)registeredRequestHandlerKeys; --(GSWRequestHandler*)requestHandlerForKey:(NSString*)key_; +-(GSWRequestHandler*)requestHandlerForKey:(NSString*)aKey; --(GSWRequestHandler*)handlerForRequest:(GSWRequest*)request_; +-(GSWRequestHandler*)handlerForRequest:(GSWRequest*)aRequest; @end //==================================================================== @interface GSWApplication (UserDefaults) +(NSArray*)loadFrameworks; -+(void)setLoadFrameworks:(NSArray*)frameworks_; ++(void)setLoadFrameworks:(NSArray*)frameworks; +(BOOL)isDebuggingEnabled; -+(void)setDebuggingEnabled:(BOOL)flag_; ++(void)setDebuggingEnabled:(BOOL)flag; +(BOOL)isStatusDebuggingEnabled;//NDFN -+(void)setStatusDebuggingEnabled:(BOOL)flag_;//NDFN ++(void)setStatusDebuggingEnabled:(BOOL)flag;//NDFN +(BOOL)autoOpenInBrowser; -+(void)setAutoOpenInBrowser:(BOOL)flag_; ++(void)setAutoOpenInBrowser:(BOOL)flag; +(BOOL)isDirectConnectEnabled; -+(void)setDirectConnectEnabled:(BOOL)flag_; ++(void)setDirectConnectEnabled:(BOOL)flag; +(NSString*)cgiAdaptorURL; -+(void)setCGIAdaptorURL:(NSString*)url_; ++(void)setCGIAdaptorURL:(NSString*)url; +(BOOL)isCachingEnabled; -+(void)setCachingEnabled:(BOOL)flag_; ++(void)setCachingEnabled:(BOOL)flag; +(NSString*)applicationBaseURL; -+(void)setApplicationBaseURL:(NSString*)baseURL_; ++(void)setApplicationBaseURL:(NSString*)baseURL; +(NSString*)frameworksBaseURL; -+(void)setFrameworksBaseURL:(NSString*)baseURL_; ++(void)setFrameworksBaseURL:(NSString*)baseURL; +(NSString*)recordingPath; -+(void)setRecordingPath:(NSString*)path_; ++(void)setRecordingPath:(NSString*)path; +(NSArray*)projectSearchPath; -+(void)setProjectSearchPath:(NSArray*)pathArray_; ++(void)setProjectSearchPath:(NSArray*)pathArray; +(BOOL)isMonitorEnabled; -+(void)setMonitorEnabled:(BOOL)flag_; ++(void)setMonitorEnabled:(BOOL)flag; +(NSString*)monitorHost; -+(void)setMonitorHost:(NSString*)hostName_; ++(void)setMonitorHost:(NSString*)hostName; +(NSString*)SMTPHost; -+(void)setSMTPHost:(NSString*)hostName_; ++(void)setSMTPHost:(NSString*)hostName; +(NSString*)adaptor; -+(void)setAdaptor:(NSString*)adaptorName_; ++(void)setAdaptor:(NSString*)adaptorName; +(id)port; -+(void)setPort:(id)port_; ++(void)setPort:(id)port; +(id)host; -+(void)setHost:(id)host_; ++(void)setHost:(id)host; +(id)listenQueueSize; -+(void)setListenQueueSize:(id)listenQueueSize_; ++(void)setListenQueueSize:(id)aSize; +(id)workerThreadCount; -+(void)setWorkerThreadCount:(id)workerThreadCount_; ++(void)setWorkerThreadCount:(id)workerThreadCount; +(NSArray*)additionalAdaptors; +(void)setAdditionalAdaptors:(NSArray*)adaptorList; +(BOOL)includeCommentsInResponses; -+(void)setIncludeCommentsInResponses:(BOOL)flag_; ++(void)setIncludeCommentsInResponses:(BOOL)flag; +(NSString*)componentRequestHandlerKey; -+(void)setComponentRequestHandlerKey:(NSString*)key_; ++(void)setComponentRequestHandlerKey:(NSString*)aKey; +(NSString*)directActionRequestHandlerKey; -+(void)setDirectActionRequestHandlerKey:(NSString*)key_; ++(void)setDirectActionRequestHandlerKey:(NSString*)aKey; +(NSString*)resourceRequestHandlerKey; -+(void)setResourceRequestHandlerKey:(NSString*)key_; -+(void)setSessionTimeOut:(NSNumber*)timeOut_; ++(void)setResourceRequestHandlerKey:(NSString*)aKey; ++(void)setSessionTimeOut:(NSNumber*)aTimeOut; +(NSNumber*)sessionTimeOut; -+(void)setSessionTimeOutValue:(NSTimeInterval)timeOutValue_; ++(void)setSessionTimeOutValue:(NSTimeInterval)aTimeOutValue; +(NSTimeInterval)sessionTimeOutValue; +(NSString*)debugSetConfigFilePath;//NDFN -+(void)setDebugSetConfigFilePath:(NSString*)debugSetConfigFilePath_;//NDFN ++(void)setDebugSetConfigFilePath:(NSString*)debugSetConfigFilePath;//NDFN +(NSString*)saveResponsesPath;//NDFN +(void)setSaveResponsesPath:(NSString*)saveResponsesPath;//NDFN @end @@ -560,9 +566,9 @@ extern BOOL WOStrictFlag; @interface GSWApplication (GSWApplicationClassD) +(int)_garbageCollectionRepeatCount; +(BOOL)_lockDefaultEditingContext; -+(void)_setLockDefaultEditingContext:(BOOL)_flag; ++(void)_setLockDefaultEditingContext:(BOOL)flag; +(id)_allowsConcurrentRequestHandling; -+(void)_setAllowsConcurrentRequestHandling:(id)_unknown; ++(void)_setAllowsConcurrentRequestHandling:(id)unknown; @end @@ -578,50 +584,50 @@ extern BOOL WOStrictFlag; //==================================================================== @interface GSWApplication (NDFN) //NDFN --(id)propListWithResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; -+(BOOL)createUnknownComponentClasses:(NSArray*)classes_ - superClassName:(NSString*)superClassName_; -+(void)addDynCreateClassName:(NSString*)className_ - superClassName:(NSString*)superClassName_; +-(id)propListWithResourceNamed:(NSString*)aName + ofType:(NSString*)aType + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; ++(BOOL)createUnknownComponentClasses:(NSArray*)classes + superClassName:(NSString*)aSuperClassName; ++(void)addDynCreateClassName:(NSString*)aClassName + superClassName:(NSString*)aSuperClassName; //NDFN --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSString*)pathForResourceNamed:(NSString*)aName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; //NDFN --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; //NDFN --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_; +-(NSString*)urlForResourceNamed:(NSString*)aName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages + request:(GSWRequest*)aRequest; //NDFN -(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - withDefaultValue:(NSString*)defaultValue_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; + inTableNamed:(NSString*)aTableName + withDefaultValue:(NSString*)defaultValue + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; //NDFN --(NSDictionary*)stringsTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSDictionary*)stringsTableNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_; +-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages; //NDFN -(NSArray*)filterLanguages:(NSArray*)languages; @end //==================================================================== /* @interface GSWApplication (GSWDeprecatedAPI) --(GSWComponent*)pageWithName:(NSString*)name_; //OldFN +-(GSWComponent*)pageWithName:(NSString*)aName; //OldFN -(void)savePage:(GSWComponent*)page_; -(GSWSession*)session; -(GSWContext*)context; @@ -635,15 +641,15 @@ extern BOOL WOStrictFlag; -(GSWResponse*)handleException:(NSException*)exception_; -(GSWComponent*)restorePageForContextID:(NSString*)contextID_; --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_; --(NSString*)urlForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_; +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType; +-(NSString*)urlForResourceNamed:(NSString*)aName + ofType:(NSString*)aType; -(NSString*)stringForKey:(NSString*)key_ inTableNamed:(NSString*)table_ withDefaultValue:(NSString*)defaultValue_; --(GSWResponse*)handleRequest:(GSWRequest*)request_; --(GSWDynamicElement*)dynamicElementWithName:(NSString*)name_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest; +-(GSWDynamicElement*)dynamicElementWithName:(NSString*)aName associations:(NSDictionary*)associations_ template:(GSWElement*)templateElement_; //OldFN @end diff --git a/GSWeb.framework/GSWApplication.m b/GSWeb.framework/GSWApplication.m index a20f20f..c040cbd 100644 --- a/GSWeb.framework/GSWApplication.m +++ b/GSWeb.framework/GSWApplication.m @@ -1,4 +1,5 @@ /** GSWApplication.m - GSWeb: Class GSWApplication + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon @@ -61,110 +62,110 @@ BOOL WOStrictFlag=NO; #ifndef NDEBUG void GSWApplicationDebugSetChange() { - static NSString* _prevStateString=nil; - NSProcessInfo* _processInfo=[NSProcessInfo processInfo]; - NSMutableSet* _debugSet=[_processInfo debugSet]; - NSString* _debugSetConfigFilePath=nil; - NSString* _newStateString=nil; - BOOL _change=NO; - _debugSetConfigFilePath=[GSWApplication debugSetConfigFilePath]; - NSDebugFLog(@"_debugSetConfigFilePath=%@",_debugSetConfigFilePath); - _newStateString=[NSString stringWithContentsOfFile:[GSWApplication debugSetConfigFilePath]]; - NSDebugFLog(@"_debugSet=%@",_debugSet); - NSDebugFLog(@"_newStateString=%@",_newStateString); - if (_newStateString) - _change=![_newStateString isEqualToString:_prevStateString]; - else if (_prevStateString) - _change=![_prevStateString isEqualToString:_newStateString]; - NSDebugFLog(@"_change=%d",_change); - - if (_change) - { - NSArray* _pList=[_newStateString propertyList]; - [_debugSet removeAllObjects]; - if (_pList && [_pList isKindOfClass:[NSArray class]]) - { - int _count=[_pList count]; - int i=0; - for(i=0;i<_count;i++) - { - [_debugSet addObject:[_pList objectAtIndex:i]]; - }; - NSLog(@"_debugSet=%@",_debugSet); - }; - ASSIGN(_prevStateString,_newStateString); - }; + static NSString* prevStateString=nil; + NSProcessInfo* processInfo=[NSProcessInfo processInfo]; + NSMutableSet* debugSet=[processInfo debugSet]; + NSString* debugSetConfigFilePath=nil; + NSString* newStateString=nil; + BOOL change=NO; + debugSetConfigFilePath=[GSWApplication debugSetConfigFilePath]; + NSDebugFLog(@"debugSetConfigFilePath=%@",debugSetConfigFilePath); + newStateString=[NSString stringWithContentsOfFile:[GSWApplication debugSetConfigFilePath]]; + NSDebugFLog(@"debugSet=%@",debugSet); + NSDebugFLog(@"newStateString=%@",newStateString); + if (newStateString) + change=![newStateString isEqualToString:prevStateString]; + else if (prevStateString) + change=![prevStateString isEqualToString:newStateString]; + NSDebugFLog(@"change=%d",change); + + if (change) + { + NSArray* pList=[newStateString propertyList]; + [debugSet removeAllObjects]; + if (pList && [pList isKindOfClass:[NSArray class]]) + { + int count=[pList count]; + int i=0; + for(i=0;i=0) - { - NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; - if (defaults) - { - NSDictionary* _args=[defaults volatileDomainForName:NSArgumentDomain]; - if (_args && [_args count]>0) - { - NSMutableDictionary* _newArgs=[NSMutableDictionary dictionary]; - NSEnumerator* _enum=nil; - NSString* _key=nil; - id _value=nil; - _enum=[_args keyEnumerator]; - while ((_key = [_enum nextObject])) - { - _value=[_args objectForKey:_key]; - if ([_key hasPrefix:@"-GSW"]) - _key = [_key substringFromIndex:1]; - [_newArgs setObject:_value - forKey:_key]; - }; - [defaults setVolatileDomain:_newArgs - forName:NSArgumentDomain]; - }; - }; - if (!localDynCreateClassNames) - localDynCreateClassNames=[NSMutableDictionary new]; - if (!globalAppDefaultOptions) - { - NSDictionary* _defaultsOptions=nil; - globalAppDefaultOptions=[[GSWApplication bundleInfo] objectForKey:@"defaults"]; - NSDebugFLLog(@"options",@"globalAppDefaultOptions=%@",globalAppDefaultOptions); + { + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + if (defaults) + { + NSDictionary* args=[defaults volatileDomainForName:NSArgumentDomain]; + if (args && [args count]>0) + { + NSMutableDictionary* newArgs=[NSMutableDictionary dictionary]; + NSEnumerator* argEnum=nil; + NSString* argKey=nil; + id argValue=nil; + argEnum=[args keyEnumerator]; + while ((argKey = [argEnum nextObject])) + { + argValue=[args objectForKey:argKey]; + if ([argKey hasPrefix:@"-GSW"]) + argKey = [argKey substringFromIndex:1]; + [newArgs setObject:argValue + forKey:argKey]; + }; + [defaults setVolatileDomain:newArgs + forName:NSArgumentDomain]; + }; + }; + if (!localDynCreateClassNames) + localDynCreateClassNames=[NSMutableDictionary new]; + if (!globalAppDefaultOptions) + { + NSDictionary* defaultsOptions=nil; + globalAppDefaultOptions=[[GSWApplication bundleInfo] objectForKey:@"defaults"]; + NSDebugFLLog(@"options",@"globalAppDefaultOptions=%@",globalAppDefaultOptions); - NSDebugFLLog(@"options",@"GSWebNamingConv=%d",GSWebNamingConv); - NSCAssert1((GSWebNamingConv==WONAMES_INDEX || GSWebNamingConv==GSWNAMES_INDEX), - @"GSWebNamingConv=%d",GSWebNamingConv); + NSDebugFLLog(@"options",@"GSWebNamingConv=%d",GSWebNamingConv); + NSCAssert1((GSWebNamingConv==WONAMES_INDEX || GSWebNamingConv==GSWNAMES_INDEX), + @"GSWebNamingConv=%d",GSWebNamingConv); + + NSDebugFLLog(@"options",@"GSWClassName_DefaultAdaptor -> %@", + GSWClassName_DefaultAdaptor[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_Adaptor -> %@", + GSWOPT_Adaptor[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_AdditionalAdaptors -> %@", + GSWOPT_AdditionalAdaptors[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_ApplicationBaseURL_WO -> %@", + GSWOPTVALUE_ApplicationBaseURL_WO); + NSDebugFLLog(@"options",@"GSWOPTVALUE_ApplicationBaseURL_GSWEB -> %@", + GSWOPTVALUE_ApplicationBaseURL_GSWEB); + NSDebugFLLog(@"options",@"GSWOPT_ApplicationBaseURL -> %@", + GSWOPT_ApplicationBaseURL[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_AutoOpenInBrowser -> %@", + GSWOPTVALUE_AutoOpenInBrowser); + NSDebugFLLog(@"options",@"GSWOPT_AutoOpenInBrowser -> %@", + GSWOPT_AutoOpenInBrowser[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_CGIAdaptorURL_WO -> %@", + GSWOPTVALUE_CGIAdaptorURL_WO); + NSDebugFLLog(@"options",@"GSWOPTVALUE_CGIAdaptorURL_GSWEB -> %@", + GSWOPTVALUE_CGIAdaptorURL_GSWEB); + NSDebugFLLog(@"options",@"GSWOPT_CGIAdaptorURL -> %@", + GSWOPT_CGIAdaptorURL[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_CachingEnabled -> %@", + GSWOPTVALUE_CachingEnabled); + NSDebugFLLog(@"options",@"GSWOPT_CachingEnabled -> %@", + GSWOPT_CachingEnabled[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWComponentRequestHandlerKey -> %@", + GSWComponentRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_ComponentRequestHandlerKey -> %@", + GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_DebuggingEnabled -> %@", + GSWOPTVALUE_DebuggingEnabled); + NSDebugFLLog(@"options",@"GSWOPT_DebuggingEnabled -> %@", + GSWOPT_DebuggingEnabled[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_StatusDebuggingEnabled -> %@", + GSWOPTVALUE_StatusDebuggingEnabled); + NSDebugFLLog(@"options",@"GSWOPT_StatusDebuggingEnabled -> %@", + GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWDirectActionRequestHandlerKey -> %@", + GSWDirectActionRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_DirectActionRequestHandlerKey -> %@", + GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_DirectConnectEnabled -> %@", + GSWOPTVALUE_DirectConnectEnabled); + NSDebugFLLog(@"options",@"GSWOPT_DirectConnectEnabled -> %@", + GSWOPT_DirectConnectEnabled[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_FrameworksBaseURL -> %@", + GSWOPTVALUE_FrameworksBaseURL); + NSDebugFLLog(@"options",@"GSWOPT_FrameworksBaseURL -> %@", + GSWOPT_FrameworksBaseURL[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_IncludeCommentsInResponse -> %@", + GSWOPTVALUE_IncludeCommentsInResponse); + NSDebugFLLog(@"options",@"GSWOPT_IncludeCommentsInResponse -> %@", + GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_ListenQueueSize -> %@", + GSWOPTVALUE_ListenQueueSize); + NSDebugFLLog(@"options",@"GSWOPT_ListenQueueSize -> %@", + GSWOPT_ListenQueueSize[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_LoadFrameworks -> %@", + GSWOPT_LoadFrameworks[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_MonitorEnabled -> %@", + GSWOPTVALUE_MonitorEnabled); + NSDebugFLLog(@"options",@"GSWOPT_MonitorEnabled -> %@", + GSWOPT_MonitorEnabled[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_MonitorHost -> %@", + GSWOPTVALUE_MonitorHost); + NSDebugFLLog(@"options",@"GSWOPT_MonitorHost -> %@", + GSWOPT_MonitorHost[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_Port -> %@", + GSWOPTVALUE_Port); + NSDebugFLLog(@"options",@"GSWOPT_Port -> %@", + GSWOPT_Port[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWResourceRequestHandlerKey -> %@", + GSWResourceRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPT_ResourceRequestHandlerKey -> %@", + GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_SMTPHost -> %@", + GSWOPTVALUE_SMTPHost); + NSDebugFLLog(@"options",@"GSWOPT_SMTPHost -> %@", + GSWOPT_SMTPHost[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_SessionTimeOut -> %@", + GSWOPTVALUE_SessionTimeOut); + NSDebugFLLog(@"options",@"GSWOPT_SessionTimeOut -> %@", + GSWOPT_SessionTimeOut[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWClassName_DefaultAdaptor -> %@", - GSWClassName_DefaultAdaptor[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_Adaptor -> %@", - GSWOPT_Adaptor[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_AdditionalAdaptors -> %@", - GSWOPT_AdditionalAdaptors[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_ApplicationBaseURL_WO -> %@", - GSWOPTVALUE_ApplicationBaseURL_WO); - NSDebugFLLog(@"options",@"GSWOPTVALUE_ApplicationBaseURL_GSWEB -> %@", - GSWOPTVALUE_ApplicationBaseURL_GSWEB); - NSDebugFLLog(@"options",@"GSWOPT_ApplicationBaseURL -> %@", - GSWOPT_ApplicationBaseURL[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_AutoOpenInBrowser -> %@", - GSWOPTVALUE_AutoOpenInBrowser); - NSDebugFLLog(@"options",@"GSWOPT_AutoOpenInBrowser -> %@", - GSWOPT_AutoOpenInBrowser[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_CGIAdaptorURL_WO -> %@", - GSWOPTVALUE_CGIAdaptorURL_WO); - NSDebugFLLog(@"options",@"GSWOPTVALUE_CGIAdaptorURL_GSWEB -> %@", - GSWOPTVALUE_CGIAdaptorURL_GSWEB); - NSDebugFLLog(@"options",@"GSWOPT_CGIAdaptorURL -> %@", - GSWOPT_CGIAdaptorURL[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_CachingEnabled -> %@", - GSWOPTVALUE_CachingEnabled); - NSDebugFLLog(@"options",@"GSWOPT_CachingEnabled -> %@", - GSWOPT_CachingEnabled[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWComponentRequestHandlerKey -> %@", - GSWComponentRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_ComponentRequestHandlerKey -> %@", - GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_DebuggingEnabled -> %@", - GSWOPTVALUE_DebuggingEnabled); - NSDebugFLLog(@"options",@"GSWOPT_DebuggingEnabled -> %@", - GSWOPT_DebuggingEnabled[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_StatusDebuggingEnabled -> %@", - GSWOPTVALUE_StatusDebuggingEnabled); - NSDebugFLLog(@"options",@"GSWOPT_StatusDebuggingEnabled -> %@", - GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWDirectActionRequestHandlerKey -> %@", - GSWDirectActionRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_DirectActionRequestHandlerKey -> %@", - GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_DirectConnectEnabled -> %@", - GSWOPTVALUE_DirectConnectEnabled); - NSDebugFLLog(@"options",@"GSWOPT_DirectConnectEnabled -> %@", - GSWOPT_DirectConnectEnabled[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_FrameworksBaseURL -> %@", - GSWOPTVALUE_FrameworksBaseURL); - NSDebugFLLog(@"options",@"GSWOPT_FrameworksBaseURL -> %@", - GSWOPT_FrameworksBaseURL[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_IncludeCommentsInResponse -> %@", - GSWOPTVALUE_IncludeCommentsInResponse); - NSDebugFLLog(@"options",@"GSWOPT_IncludeCommentsInResponse -> %@", - GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_ListenQueueSize -> %@", - GSWOPTVALUE_ListenQueueSize); - NSDebugFLLog(@"options",@"GSWOPT_ListenQueueSize -> %@", - GSWOPT_ListenQueueSize[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_LoadFrameworks -> %@", - GSWOPT_LoadFrameworks[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_MonitorEnabled -> %@", - GSWOPTVALUE_MonitorEnabled); - NSDebugFLLog(@"options",@"GSWOPT_MonitorEnabled -> %@", - GSWOPT_MonitorEnabled[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_MonitorHost -> %@", - GSWOPTVALUE_MonitorHost); - NSDebugFLLog(@"options",@"GSWOPT_MonitorHost -> %@", - GSWOPT_MonitorHost[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_Port -> %@", - GSWOPTVALUE_Port); - NSDebugFLLog(@"options",@"GSWOPT_Port -> %@", - GSWOPT_Port[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWResourceRequestHandlerKey -> %@", - GSWResourceRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPT_ResourceRequestHandlerKey -> %@", - GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_SMTPHost -> %@", - GSWOPTVALUE_SMTPHost); - NSDebugFLLog(@"options",@"GSWOPT_SMTPHost -> %@", - GSWOPT_SMTPHost[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_SessionTimeOut -> %@", - GSWOPTVALUE_SessionTimeOut); - NSDebugFLLog(@"options",@"GSWOPT_SessionTimeOut -> %@", - GSWOPT_SessionTimeOut[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_WorkerThreadCount -> %@", + GSWOPTVALUE_WorkerThreadCount); + NSDebugFLLog(@"options",@"GSWOPT_WorkerThreadCount -> %@", + GSWOPT_WorkerThreadCount[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_WorkerThreadCount -> %@", - GSWOPTVALUE_WorkerThreadCount); - NSDebugFLLog(@"options",@"GSWOPT_WorkerThreadCount -> %@", - GSWOPT_WorkerThreadCount[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_MultiThreadEnabled -> %@", + GSWOPTVALUE_MultiThreadEnabled); + NSDebugFLLog(@"options",@"GSWOPT_MultiThreadEnabled -> %@", + GSWOPT_MultiThreadEnabled); - NSDebugFLLog(@"options",@"GSWOPTVALUE_MultiThreadEnabled -> %@", - GSWOPTVALUE_MultiThreadEnabled); - NSDebugFLLog(@"options",@"GSWOPT_MultiThreadEnabled -> %@", - GSWOPT_MultiThreadEnabled); + NSDebugFLLog(@"options",@"GSWOPT_AdaptorHost -> %@", + GSWOPT_AdaptorHost[GSWebNamingConv]); + NSDebugFLLog(@"options",@"GSWOPTVALUE_AdaptorHost -> %@", + GSWOPTVALUE_AdaptorHost); + NSDebugFLLog(@"options",@"GSWOPTVALUE_SaveResponsesPath -> %@", + GSWOPTVALUE_SaveResponsesPath); - NSDebugFLLog(@"options",@"GSWOPT_AdaptorHost -> %@", - GSWOPT_AdaptorHost[GSWebNamingConv]); - NSDebugFLLog(@"options",@"GSWOPTVALUE_AdaptorHost -> %@", - GSWOPTVALUE_AdaptorHost); - NSDebugFLLog(@"options",@"GSWOPTVALUE_SaveResponsesPath -> %@", - GSWOPTVALUE_SaveResponsesPath); - - _defaultsOptions = - [NSDictionary dictionaryWithObjectsAndKeys: - GSWClassName_DefaultAdaptor[GSWebNamingConv], GSWOPT_Adaptor[GSWebNamingConv], - [NSArray array], GSWOPT_AdditionalAdaptors[GSWebNamingConv], - (GSWebNamingConv==WONAMES_INDEX ? GSWOPTVALUE_ApplicationBaseURL_WO : GSWOPTVALUE_ApplicationBaseURL_GSWEB), - GSWOPT_ApplicationBaseURL[GSWebNamingConv], - GSWOPTVALUE_AutoOpenInBrowser, GSWOPT_AutoOpenInBrowser[GSWebNamingConv], - (GSWebNamingConv==WONAMES_INDEX ? GSWOPTVALUE_CGIAdaptorURL_WO : GSWOPTVALUE_CGIAdaptorURL_GSWEB), - GSWOPT_CGIAdaptorURL[GSWebNamingConv], - GSWOPTVALUE_CachingEnabled, GSWOPT_CachingEnabled[GSWebNamingConv], - GSWComponentRequestHandlerKey[GSWebNamingConv], GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv], - GSWOPTVALUE_DebuggingEnabled, GSWOPT_DebuggingEnabled[GSWebNamingConv], - GSWOPTVALUE_StatusDebuggingEnabled, GSWOPT_StatusDebuggingEnabled[GSWebNamingConv], - GSWDirectActionRequestHandlerKey[GSWebNamingConv],GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv], - GSWOPTVALUE_DirectConnectEnabled, GSWOPT_DirectConnectEnabled[GSWebNamingConv], - GSWOPTVALUE_FrameworksBaseURL, GSWOPT_FrameworksBaseURL[GSWebNamingConv], - GSWOPTVALUE_IncludeCommentsInResponse, GSWOPT_IncludeCommentsInResponse[GSWebNamingConv], - GSWOPTVALUE_ListenQueueSize, GSWOPT_ListenQueueSize[GSWebNamingConv], - [NSArray array], GSWOPT_LoadFrameworks[GSWebNamingConv], - GSWOPTVALUE_MonitorEnabled, GSWOPT_MonitorEnabled[GSWebNamingConv], - GSWOPTVALUE_MonitorHost, GSWOPT_MonitorHost[GSWebNamingConv], - GSWOPTVALUE_Port, GSWOPT_Port[GSWebNamingConv], - GSWResourceRequestHandlerKey[GSWebNamingConv], GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv], - GSWOPTVALUE_SMTPHost, GSWOPT_SMTPHost[GSWebNamingConv], - GSWOPTVALUE_SessionTimeOut, GSWOPT_SessionTimeOut[GSWebNamingConv], - GSWOPTVALUE_WorkerThreadCount, GSWOPT_WorkerThreadCount[GSWebNamingConv], - GSWOPTVALUE_MultiThreadEnabled, GSWOPT_MultiThreadEnabled, - GSWOPTVALUE_AdaptorHost, GSWOPT_AdaptorHost[GSWebNamingConv], - GSWOPTVALUE_SaveResponsesPath, GSWOPT_SaveResponsesPath[GSWebNamingConv], - nil, nil]; - NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions); - globalAppDefaultOptions=[NSDictionary dictionaryWithDictionary:globalAppDefaultOptions - andDefaultEntriesFromDictionary:_defaultsOptions]; - NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions); - }; - [defaults registerDefaults:globalAppDefaultOptions]; - - _args=[_processInfo arguments]; - { - int i=0; - int _count=[_args count]; - NSString* _opt=nil; - NSString* _debugOpt=nil; - for(i=0;i<_count;i++) - { - _debugOpt=nil; - _opt=[_args objectAtIndex:i]; - if ([_opt hasPrefix:@"--GSWebDebug="]) - _debugOpt=[_opt stringWithoutPrefix:@"--GSWebDebug="]; - else if ([_opt hasPrefix:@"-GSWebDebug="]) - _debugOpt=[_opt stringWithoutPrefix:@"-GSWebDebug="]; - else if ([_opt hasPrefix:@"GSWebDebug="]) - _debugOpt=[_opt stringWithoutPrefix:@"GSWebDebug="]; - if (_debugOpt) - GSWApplicationSetDebugSetOption(_debugOpt); - }; - }; - //TODO - if (_applicationClassName && [_applicationClassName length]>0) - ASSIGNCOPY(globalApplicationClassName,_applicationClassName); - GSWApplicationDebugSetChange(); - applicationClass=[GSWApplication _applicationClass]; - if (!applicationClass) - { - NSCAssert(NO,@"!applicationClass"); - //TODO error - result=-1; - }; - }; + defaultsOptions = + [NSDictionary dictionaryWithObjectsAndKeys: + GSWClassName_DefaultAdaptor[GSWebNamingConv], GSWOPT_Adaptor[GSWebNamingConv], + [NSArray array], GSWOPT_AdditionalAdaptors[GSWebNamingConv], + (GSWebNamingConv==WONAMES_INDEX ? GSWOPTVALUE_ApplicationBaseURL_WO : GSWOPTVALUE_ApplicationBaseURL_GSWEB), + GSWOPT_ApplicationBaseURL[GSWebNamingConv], + GSWOPTVALUE_AutoOpenInBrowser, GSWOPT_AutoOpenInBrowser[GSWebNamingConv], + (GSWebNamingConv==WONAMES_INDEX ? GSWOPTVALUE_CGIAdaptorURL_WO : GSWOPTVALUE_CGIAdaptorURL_GSWEB), + GSWOPT_CGIAdaptorURL[GSWebNamingConv], + GSWOPTVALUE_CachingEnabled, GSWOPT_CachingEnabled[GSWebNamingConv], + GSWComponentRequestHandlerKey[GSWebNamingConv], GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv], + GSWOPTVALUE_DebuggingEnabled, GSWOPT_DebuggingEnabled[GSWebNamingConv], + GSWOPTVALUE_StatusDebuggingEnabled, GSWOPT_StatusDebuggingEnabled[GSWebNamingConv], + GSWDirectActionRequestHandlerKey[GSWebNamingConv],GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv], + GSWOPTVALUE_DirectConnectEnabled, GSWOPT_DirectConnectEnabled[GSWebNamingConv], + GSWOPTVALUE_FrameworksBaseURL, GSWOPT_FrameworksBaseURL[GSWebNamingConv], + GSWOPTVALUE_IncludeCommentsInResponse, GSWOPT_IncludeCommentsInResponse[GSWebNamingConv], + GSWOPTVALUE_ListenQueueSize, GSWOPT_ListenQueueSize[GSWebNamingConv], + [NSArray array], GSWOPT_LoadFrameworks[GSWebNamingConv], + GSWOPTVALUE_MonitorEnabled, GSWOPT_MonitorEnabled[GSWebNamingConv], + GSWOPTVALUE_MonitorHost, GSWOPT_MonitorHost[GSWebNamingConv], + GSWOPTVALUE_Port, GSWOPT_Port[GSWebNamingConv], + GSWResourceRequestHandlerKey[GSWebNamingConv], GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv], + GSWOPTVALUE_SMTPHost, GSWOPT_SMTPHost[GSWebNamingConv], + GSWOPTVALUE_SessionTimeOut, GSWOPT_SessionTimeOut[GSWebNamingConv], + GSWOPTVALUE_WorkerThreadCount, GSWOPT_WorkerThreadCount[GSWebNamingConv], + GSWOPTVALUE_MultiThreadEnabled, GSWOPT_MultiThreadEnabled, + GSWOPTVALUE_AdaptorHost, GSWOPT_AdaptorHost[GSWebNamingConv], + GSWOPTVALUE_SaveResponsesPath, GSWOPT_SaveResponsesPath[GSWebNamingConv], + nil, nil]; + NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions); + globalAppDefaultOptions=[NSDictionary dictionaryWithDictionary:globalAppDefaultOptions + andDefaultEntriesFromDictionary:defaultsOptions]; + NSDebugFLLog(@"options",@"_globalAppDefaultOptions=%@",globalAppDefaultOptions); + }; + [defaults registerDefaults:globalAppDefaultOptions]; + + args=[processInfo arguments]; + { + int i=0; + int count=[args count]; + NSString* opt=nil; + NSString* debugOpt=nil; + for(i=0;i=0) - { - NSArray* _frameworks=[applicationClass loadFrameworks]; - NSDebugFLog(@"LOAD Frameworks _frameworks=%@",_frameworks); - if (_frameworks) - { - NSBundle* _bundle=nil; - int i=0; - BOOL _loadResult=NO; - NSString* GNUstepRoot=[[[NSProcessInfo processInfo]environment]objectForKey:@"GNUSTEP_SYSTEM_ROOT"]; - NSDebugFLLog(@"bundles",@"GNUstepRoot=%@",GNUstepRoot); -// NSDebugFLLog(@"bundles",@"[[NSProcessInfo processInfo]environment]=%@",[[NSProcessInfo processInfo]environment]); - NSDebugFLLog(@"bundles",@"[NSProcessInfo processInfo]=%@",[NSProcessInfo processInfo]); - for(i=0;i<[_frameworks count];i++) - { - NSString* _bundlePath=[_frameworks objectAtIndex:i]; - NSDebugFLLog(@"bundles",@"_bundlePath=%@",_bundlePath); - //TODO - NSDebugFLLog(@"bundles",@"GSFrameworkPSuffix=%@",GSFrameworkPSuffix); - _bundlePath=[NSString stringWithFormat:@"%@/Library/Frameworks/%@%@",GNUstepRoot,_bundlePath,GSFrameworkPSuffix]; - NSDebugFLLog(@"bundles",@"_bundlePath=%@",_bundlePath); - _bundle=[NSBundle bundleWithPath:_bundlePath]; - NSDebugFLLog(@"bundles",@"_bundle=%@",_bundle); - _loadResult=[_bundle load]; - NSDebugFLog(@"_bundlePath %@ _loadResult=%s",_bundlePath,(_loadResult ? "YES" : "NO")); - if (!_loadResult) - { - result=-1; - ExceptionRaise(@"GSWApplication",@"Can't load framework %@", - _bundlePath); - }; - }; - }; - NSDebugFLLog(@"bundles",@"[NSBundle allBundles]=%@",[NSBundle allBundles]); - NSDebugFLLog(@"bundles",@"[NSBundle allFrameworks]=%@",[NSBundle allFrameworks]); - }; + { + NSArray* frameworks=[applicationClass loadFrameworks]; + NSDebugFLog(@"LOAD Frameworks frameworks=%@",frameworks); + if (frameworks) + { + NSBundle* bundle=nil; + int i=0; + BOOL loadResult=NO; + NSString* GNUstepRoot=[[[NSProcessInfo processInfo]environment] + objectForKey:@"GNUSTEP_SYSTEM_ROOT"]; + NSDebugFLLog(@"bundles",@"GNUstepRoot=%@",GNUstepRoot); + // NSDebugFLLog(@"bundles",@"[[NSProcessInfo processInfo]environment]=%@",[[NSProcessInfo processInfo]environment]); + NSDebugFLLog(@"bundles",@"[NSProcessInfo processInfo]=%@", + [NSProcessInfo processInfo]); + for(i=0;i<[frameworks count];i++) + { + NSString* bundlePath=[frameworks objectAtIndex:i]; + NSDebugFLLog(@"bundles",@"bundlePath=%@",bundlePath); + //TODO + NSDebugFLLog(@"bundles",@"GSFrameworkPSuffix=%@",GSFrameworkPSuffix); + bundlePath=[NSString stringWithFormat:@"%@/Library/Frameworks/%@%@",GNUstepRoot,bundlePath,GSFrameworkPSuffix]; + NSDebugFLLog(@"bundles",@"bundlePath=%@",bundlePath); + bundle=[NSBundle bundleWithPath:bundlePath]; + NSDebugFLLog(@"bundles",@"bundle=%@",bundle); + loadResult=[bundle load]; + NSDebugFLog(@"_bundlePath %@ loadResult=%s",bundlePath,(loadResult ? "YES" : "NO")); + if (!loadResult) + { + result=-1; + ExceptionRaise(@"GSWApplication",@"Can't load framework %@", + bundlePath); + }; + }; + }; + NSDebugFLLog(@"bundles",@"[NSBundle allBundles]=%@",[NSBundle allBundles]); + NSDebugFLLog(@"bundles",@"[NSBundle allFrameworks]=%@",[NSBundle allFrameworks]); + }; if (result>=0) - { - NS_DURING - { - id _app=[applicationClass new]; - if (_app) - result=1; - else - result=-1; - }; - // Make sure we pass all exceptions back to the requestor. - NS_HANDLER - { - NSLog(@"Can't create Application (Class:%@)- %@ %@ Name:%@ Reason:%@\n", - applicationClass, - localException, - [localException description], - [localException name], - [localException reason]); - result=-1; - } - NS_ENDHANDLER; - }; + { + NS_DURING + { + id app=[applicationClass new]; + if (app) + result=1; + else + result=-1; + }; + // Make sure we pass all exceptions back to the requestor. + NS_HANDLER + { + NSLog(@"Can't create Application (Class:%@)- %@ %@ Name:%@ Reason:%@\n", + applicationClass, + localException, + [localException description], + [localException name], + [localException reason]); + result=-1; + } + NS_ENDHANDLER; + }; NSDebugLog(@"result=%d",result); printf("result=%d\n",result); if (result>=0 && GSWApp) - { - [GSWApp _setPool:[NSAutoreleasePool new]]; - [GSWApp run]; - DESTROY(GSWApp); - }; + { + [GSWApp _setPool:[NSAutoreleasePool new]]; + [GSWApp run]; + DESTROY(GSWApp); + }; DESTROY(appAutoreleasePool); return result; }; @@ -486,15 +493,15 @@ int GSWApplicationMain(NSString* applicationClassName, +(void)initialize { if (self==[GSWApplication class]) - { -//Moved In GSWApplicationMainReal - }; + { + //Moved In GSWApplicationMainReal + }; }; //-------------------------------------------------------------------- - (void)_setPool:(NSAutoreleasePool *)pool { - globalAutoreleasePool = pool; + _globalAutoreleasePool = pool; } //-------------------------------------------------------------------- @@ -519,64 +526,65 @@ int GSWApplicationMain(NSString* applicationClassName, -(id)init { - NSUserDefaults* _standardUserDefaults=nil; + NSUserDefaults* standardUserDefaults=nil; LOGObjectFnStart(); - self=[super init]; - timeOut=2*60*60; -// context=nil;//deprecated - selfLock=[NSRecursiveLock new]; - globalLock=[NSLock new]; - pageCacheSize=30; - permanentPageCacheSize=30; - pageRecreationEnabled=YES; - pageRefreshOnBacktrackEnabled=YES; - refusingNewSessions = NO; - minimumActiveSessionsCount = 0; // 0 is default - dynamicLoadingEnabled=YES; - printsHTMLParserDiagnostics=YES; - [[self class] _setApplication:self]; - [self _touchPrincipalClasses]; - _standardUserDefaults=[NSUserDefaults standardUserDefaults]; - NSDebugMLLog(@"options",@"_standardUserDefaults=%@",_standardUserDefaults); - [self _initAdaptorsWithUserDefaults:_standardUserDefaults]; //TODOV - sessionStore=[GSWServerSessionStore new]; - //call isMonitorEnabled + if ((self=[super init])) + { + _timeOut=2*60*60; + // context=nil;//deprecated + _selfLock=[NSRecursiveLock new]; + _globalLock=[NSLock new]; + _pageCacheSize=30; + _permanentPageCacheSize=30; + _pageRecreationEnabled=YES; + _pageRefreshOnBacktrackEnabled=YES; + _refusingNewSessions = NO; + _minimumActiveSessionsCount = 0; // 0 is default + _dynamicLoadingEnabled=YES; + _printsHTMLParserDiagnostics=YES; + [[self class] _setApplication:self]; + [self _touchPrincipalClasses]; + standardUserDefaults=[NSUserDefaults standardUserDefaults]; + NSDebugMLLog(@"options",@"standardUserDefaults=%@",standardUserDefaults); + [self _initAdaptorsWithUserDefaults:standardUserDefaults]; //TODOV + _sessionStore=[GSWServerSessionStore new]; + //call isMonitorEnabled -/*???? - NSBundle* _mainBundle=[NSBundle mainBundle]; - NSArray* _allFrameworks=[_mainBundle allFrameworks]; - int _frameworkN=0; - for(_frameworkN=0;_frameworkN<[_allFrameworks count];_frameworkN++) + /*???? + NSBundle* _mainBundle=[NSBundle mainBundle]; + NSArray* _allFrameworks=[_mainBundle allFrameworks]; + int _frameworkN=0; + for(_frameworkN=0;_frameworkN<[_allFrameworks count];_frameworkN++) { - NSString* _bundlePath=[[_allFrameworks objectAtIndex:_frameworkN] bundlePath]; - //TODO what ??? + NSString* _bundlePath=[[_allFrameworks objectAtIndex:_frameworkN] bundlePath]; + //TODO what ??? }; -*/ - //call adaptorsDispatchRequestsConcurrently - activeSessionsCountLock=[NSLock new]; - componentDefinitionCache=[GSWMultiKeyDictionary new]; - [self setResourceManager:[[GSWResourceManager new]autorelease]]; - [self setStatisticsStore:[[GSWStatisticsStore new]autorelease]]; - if ([[self class]isMonitorEnabled]) + */ + //call adaptorsDispatchRequestsConcurrently + _activeSessionsCountLock=[NSLock new]; + _componentDefinitionCache=[GSWMultiKeyDictionary new]; + [self setResourceManager:[[GSWResourceManager new]autorelease]]; + [self setStatisticsStore:[[GSWStatisticsStore new]autorelease]]; + if ([[self class]isMonitorEnabled]) { NSDebugMLLog0(@"application",@"init: call self _setupForMonitoring"); [self _setupForMonitoring]; }; - NSDebugMLLog0(@"application",@"init: call appGSWBundle initializeObject:..."); - [[GSWResourceManager _applicationGSWBundle] initializeObject:self - fromArchiveNamed:@"Application"]; - [self setPrintsHTMLParserDiagnostics:NO]; - //call recordingPath - NSDebugMLLog0(@"application",@"init: call self registerRequestHandlers"); - [self registerRequestHandlers]; - [self _validateAPI]; - NSDebugMLLog0(@"application",@"init: addObserver"); - [[NSNotificationCenter defaultCenter]addObserver:self - selector:@selector(_sessionDidTimeOutNotification:) - name:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv] - object:nil]; - NSDebugMLLog0(@"application",@"init: addObserver called"); - + NSDebugMLLog0(@"application",@"init: call appGSWBundle initializeObject:..."); + [[GSWResourceManager _applicationGSWBundle] initializeObject:self + fromArchiveNamed:@"Application"]; + [self setPrintsHTMLParserDiagnostics:NO]; + //call recordingPath + NSDebugMLLog0(@"application",@"init: call self registerRequestHandlers"); + [self registerRequestHandlers]; + [self _validateAPI]; + NSDebugMLLog0(@"application",@"init: addObserver"); + [[NSNotificationCenter defaultCenter]addObserver:self + selector:@selector(_sessionDidTimeOutNotification:) + name:GSWNotification__SessionDidTimeOutNotification[GSWebNamingConv] + object:nil]; + NSDebugMLLog0(@"application",@"init: addObserver called"); + }; LOGObjectFnStop(); return self; }; @@ -585,28 +593,28 @@ int GSWApplicationMain(NSString* applicationClassName, -(void)dealloc { GSWLogMemC("Dealloc GSWApplication"); - DESTROY(adaptors); - DESTROY(sessionStore); - DESTROY(componentDefinitionCache); - DESTROY(timer); -// DESTROY(context);//deprecated - DESTROY(statisticsStore); - DESTROY(resourceManager); - DESTROY(remoteMonitor); - DESTROY(remoteMonitorConnection); - DESTROY(instanceNumber); - DESTROY(requestHandlers); - DESTROY(defaultRequestHandler); + DESTROY(_adaptors); + DESTROY(_sessionStore); + DESTROY(_componentDefinitionCache); + DESTROY(_timer); +// DESTROY(_context);//deprecated + DESTROY(_statisticsStore); + DESTROY(_resourceManager); + DESTROY(_remoteMonitor); + DESTROY(_remoteMonitorConnection); + DESTROY(_instanceNumber); + DESTROY(_requestHandlers); + DESTROY(_defaultRequestHandler); GSWLogMemC("Dealloc GSWApplication: selfLock"); - DESTROY(selfLock); + DESTROY(_selfLock); GSWLogMemC("Dealloc GSWApplication: globalLock"); - DESTROY(globalLock); + DESTROY(_globalLock); GSWLogMemC("Dealloc GSWApplication: globalAutoreleasePool"); - DESTROY(globalAutoreleasePool); - DESTROY(currentRunLoop); - DESTROY(runLoopDate); - DESTROY(initialTimer); - DESTROY(activeSessionsCountLock); + DESTROY(_globalAutoreleasePool); + DESTROY(_currentRunLoop); + DESTROY(_runLoopDate); + DESTROY(_initialTimer); + DESTROY(_activeSessionsCountLock); if (GSWApp == self) GSWApp = nil; @@ -620,26 +628,26 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSString*)description { //OK - NSString* _dscr=nil; + NSString* dscr=nil; [self lock]; - _dscr=[NSString stringWithFormat: - @"<%s %p - name=%@ adaptors=%@ sessionStore=%@ pageCacheSize=%d permanentPageCacheSize=%d pageRecreationEnabled=%s pageRefreshOnBacktrackEnabled=%s componentDefinitionCache=%@ caching=%s terminating=%s timeOut=%f dynamicLoadingEnabled=%s>", - object_get_class_name(self), - (void*)self, - [self name], - [[self adaptors] description], - [[self sessionStore] description], - [self pageCacheSize], - [self permanentPageCacheSize], - [self _isPageRecreationEnabled] ? "YES" : "NO", - [self isPageRefreshOnBacktrackEnabled] ? "YES" : "NO", - [componentDefinitionCache description], - [self isCachingEnabled] ? "YES" : "NO", - [self isTerminating] ? "YES" : "NO", - [self timeOut], - [self _isDynamicLoadingEnabled] ? "YES" : "NO"]; + dscr=[NSString stringWithFormat: + @"<%s %p - name=%@ adaptors=%@ sessionStore=%@ pageCacheSize=%d permanentPageCacheSize=%d pageRecreationEnabled=%s pageRefreshOnBacktrackEnabled=%s componentDefinitionCache=%@ caching=%s terminating=%s timeOut=%f dynamicLoadingEnabled=%s>", + object_get_class_name(self), + (void*)self, + [self name], + [[self adaptors] description], + [[self sessionStore] description], + [self pageCacheSize], + [self permanentPageCacheSize], + [self _isPageRecreationEnabled] ? "YES" : "NO", + [self isPageRefreshOnBacktrackEnabled] ? "YES" : "NO", + [_componentDefinitionCache description], + [self isCachingEnabled] ? "YES" : "NO", + [self isTerminating] ? "YES" : "NO", + [self timeOut], + [self _isDynamicLoadingEnabled] ? "YES" : "NO"]; [self unlock]; - return _dscr; + return dscr; }; //-------------------------------------------------------------------- @@ -654,12 +662,12 @@ int GSWApplicationMain(NSString* applicationClassName, -(BOOL)adaptorsDispatchRequestsConcurrently { //TODO: use isMultiThreaded ? - BOOL _adaptorsDispatchRequestsConcurrently=NO; + BOOL adaptorsDispatchRequestsConcurrently=NO; int i=0; - int _adaptorsCount=[adaptors count]; - for(i=0;!_adaptorsDispatchRequestsConcurrently && i<_adaptorsCount;i++) - _adaptorsDispatchRequestsConcurrently=[[adaptors objectAtIndex:i]dispatchesRequestsConcurrently]; - return _adaptorsDispatchRequestsConcurrently; + int adaptorsCount=[_adaptors count]; + for(i=0;!adaptorsDispatchRequestsConcurrently && i0) - { - if (globalLock_thread_id!=objc_thread_id()) - { - NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); - }; - }; - */ - NS_DURING - { - NSDebugLockMLog(@"GLOBALLOCK lock ThreadID=%p\n",(void*)objc_thread_id()); - //TODO-NOW TmpLockBeforeDate(globalLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); - [globalLock lock]; - NSDebugLockMLog(@"GLOBALLOCK locked ThreadID=%p\n",(void*)objc_thread_id()); + { + /* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", + globalLockn,(void*) + globalLock_thread_id, + (void*)objc_thread_id()); + if (globalLockn>0) + { + if (globalLock_thread_id!=objc_thread_id()) + { + NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); + }; + }; + */ + NS_DURING + { + NSDebugLockMLog(@"GLOBALLOCK lock ThreadID=%p\n",(void*)objc_thread_id()); + //TODO-NOW TmpLockBeforeDate(globalLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + [_globalLock lock]; + NSDebugLockMLog(@"GLOBALLOCK locked ThreadID=%p\n",(void*)objc_thread_id()); #ifndef NDEBUG - globalLockn++; - globalLock_thread_id=objc_thread_id(); + _globalLockn++; + _globalLock_thread_id=objc_thread_id(); #endif -/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", - globalLockn, - (void*)globalLock_thread_id, - (void*)objc_thread_id());*/ - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"globalLock tmplockBeforeDate"); - LOGException(@"%@ (%@)",localException,[localException reason]); - [localException raise]; - }; - NS_ENDHANDLER; - }; + /* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", + globalLockn, + (void*)globalLock_thread_id, + (void*)objc_thread_id());*/ + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"globalLock tmplockBeforeDate"); + LOGException(@"%@ (%@)",localException,[localException reason]); + [localException raise]; + }; + NS_ENDHANDLER; + }; LOGObjectFnStop(); }; @@ -729,45 +738,46 @@ int GSWApplicationMain(NSString* applicationClassName, //OK LOGObjectFnStart(); if (![self isConcurrentRequestHandlingEnabled]) - { - NS_DURING - { - /* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", - globalLockn, - (void*)globalLock_thread_id, - (void*)objc_thread_id());*/ - if (globalLockn>0) - { - if (globalLock_thread_id!=objc_thread_id()) - { - NSDebugMLLog0(@"application",@"PROBLEM: owner!=thread id"); - }; - }; - NSDebugLockMLog(@"GLOBALLOCK unlock ThreadID=%p\n",(void*)objc_thread_id()); - TmpUnlock(globalLock); - NSDebugLockMLog(@"GLOBALLOCK unlocked ThreadID=%p\n",(void*)objc_thread_id()); + { + NS_DURING + { + /* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", + globalLockn, + (void*)globalLock_thread_id, + (void*)objc_thread_id());*/ + if (_globalLockn>0) + { + if (_globalLock_thread_id!=objc_thread_id()) + { + NSDebugMLLog0(@"application",@"PROBLEM: owner!=thread id"); + }; + }; + NSDebugLockMLog(@"GLOBALLOCK unlock ThreadID=%p\n",(void*)objc_thread_id()); + TmpUnlock(_globalLock); + NSDebugLockMLog(@"GLOBALLOCK unlocked ThreadID=%p\n",(void*)objc_thread_id()); #ifndef NDEBUG - globalLockn--; - if (globalLockn==0) - globalLock_thread_id=NULL; + _globalLockn--; + if (_globalLockn==0) + _globalLock_thread_id=NULL; #endif -/* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", - globalLockn, - (void*)globalLock_thread_id, - (void*)objc_thread_id());*/ - } - NS_HANDLER - { - NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", - globalLockn, - (void*)globalLock_thread_id, - (void*)objc_thread_id()); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"globalLock tmpunlock"); - LOGException(@"%@ (%@)",localException,[localException reason]); - [localException raise]; - }; - NS_ENDHANDLER; - }; + /* NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", + globalLockn, + (void*)globalLock_thread_id, + (void*)objc_thread_id());*/ + } + NS_HANDLER + { + NSDebugMLLog(@"application",@"globalLockn=%d globalLock_thread_id=%p objc_thread_id()=%p", + _globalLockn, + (void*)_globalLock_thread_id, + (void*)objc_thread_id()); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"globalLock tmpunlock"); + LOGException(@"%@ (%@)",localException,[localException reason]); + [localException raise]; + }; + NS_ENDHANDLER; + }; LOGObjectFnStop(); }; @@ -778,44 +788,45 @@ int GSWApplicationMain(NSString* applicationClassName, //call adaptorsDispatchRequestsConcurrently //OK LOGObjectFnStart(); -/* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id()); - if (selfLockn>0) - { - if (selfLock_thread_id!=objc_thread_id()) - { - NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); - }; - }; -*/ + /* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", + selfLockn, + (void*)selfLock_thread_id, + (void*)objc_thread_id()); + if (selfLockn>0) + { + if (selfLock_thread_id!=objc_thread_id()) + { + NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); + }; + }; + */ NS_DURING - { -/* printf("SELFLOCK lock ThreadID=%p\n",(void*)objc_thread_id()); - TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); - printf("SELFLOCK locked ThreadID=%p\n",(void*)objc_thread_id()); -#ifndef NDEBUG - selfLockn++; - selfLock_thread_id=objc_thread_id(); + { + /* printf("SELFLOCK lock ThreadID=%p\n",(void*)objc_thread_id()); + TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + printf("SELFLOCK locked ThreadID=%p\n",(void*)objc_thread_id()); + #ifndef NDEBUG + selfLockn++; + selfLock_thread_id=objc_thread_id(); #endif - NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - selfLockn, - (void*)selfLock_thread_id, +NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", +selfLockn, +(void*)selfLock_thread_id, (void*)objc_thread_id()); -*/ - [selfLock lock];//NEW + */ + [_selfLock lock];//NEW #ifndef NDEBUG - selfLockn++; - selfLock_thread_id=objc_thread_id(); + _selfLockn++; + _selfLock_thread_id=objc_thread_id(); #endif - } + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"selfLock tmplockBeforeDate"); - LOGException(@"%@ (%@)",localException,[localException reason]); - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"selfLock tmplockBeforeDate"); + LOGException(@"%@ (%@)",localException,[localException reason]); + [localException raise]; + }; NS_ENDHANDLER; LOGObjectFnStop(); }; @@ -827,28 +838,28 @@ int GSWApplicationMain(NSString* applicationClassName, //call adaptorsDispatchRequestsConcurrently //OK LOGObjectFnStart(); -/* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id()); - if (selfLockn>0) - { - if (selfLock_thread_id!=objc_thread_id()) - { - NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); - }; - }; -*/ + /* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", + selfLockn, + (void*)selfLock_thread_id, + (void*)objc_thread_id()); + if (selfLockn>0) + { + if (selfLock_thread_id!=objc_thread_id()) + { + NSDebugMLLog(@"application",@"PROBLEM: owner!=thread id"); + }; + }; + */ NS_DURING { NSDebugLockMLog(@"SELFLOCK unlock ThreadID=%p\n",(void*)objc_thread_id()); // TmpUnlock(selfLock); - [selfLock unlock];//NEW + [_selfLock unlock];//NEW NSDebugLockMLog(@"SELFLOCK unlocked ThreadID=%p\n",(void*)objc_thread_id()); #ifndef NDEBUG - selfLockn--; - if (selfLockn==0) - selfLock_thread_id=NULL; + _selfLockn--; + if (_selfLockn==0) + _selfLock_thread_id=NULL; #endif /* NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", selfLockn, @@ -859,10 +870,11 @@ int GSWApplicationMain(NSString* applicationClassName, NS_HANDLER { NSDebugMLLog(@"application",@"selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - selfLockn, - (void*)selfLock_thread_id, + _selfLockn, + (void*)_selfLock_thread_id, (void*)objc_thread_id()); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"selfLock tmpunlock"); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"selfLock tmpunlock"); LOGException(@"%@ (%@)",localException,[localException reason]); [localException raise]; }; @@ -887,28 +899,28 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSString*)name { - NSString* _name=nil; - NSProcessInfo* _processInfo=nil; - NSString* _processName=nil; + NSString* name=nil; + NSProcessInfo* processInfo=nil; + NSString* processName=nil; LOGObjectFnStart(); //TODO /* if (applicationName) return applicationName; else {*/ - _processInfo=[NSProcessInfo processInfo]; - _processName=[_processInfo processName]; - NSDebugMLLog(@"application",@"_cmd:%p",_cmd); - NSDebugMLLog(@"application",@"_processInfo:%@",_processInfo); - NSDebugMLLog(@"application",@"_processName:%@",_processName); - _processName=[_processName lastPathComponent]; - if ([_processName hasSuffix:GSWApplicationPSuffix[GSWebNamingConv]]) - _name=[_processName stringWithoutSuffix:GSWApplicationPSuffix[GSWebNamingConv]]; - else - _name=_processName; - NSDebugMLLog(@"application",@"_name:%@ %p",_name,_name); -// }; - return _name; + processInfo=[NSProcessInfo processInfo]; + processName=[processInfo processName]; + NSDebugMLLog(@"application",@"_cmd:%p",_cmd); + NSDebugMLLog(@"application",@"processInfo:%@",processInfo); + NSDebugMLLog(@"application",@"processName:%@",processName); + processName=[processName lastPathComponent]; + if ([processName hasSuffix:GSWApplicationPSuffix[GSWebNamingConv]]) + name=[processName stringWithoutSuffix:GSWApplicationPSuffix[GSWebNamingConv]]; + else + name=processName; + NSDebugMLLog(@"application",@"_name:%@ %p",name,name); + // }; + return name; LOGObjectFnStop(); }; @@ -925,7 +937,7 @@ int GSWApplicationMain(NSString* applicationClassName, -(void)setPageRefreshOnBacktrackEnabled:(BOOL)flag { LOGObjectFnStart(); - pageRefreshOnBacktrackEnabled=flag; + _pageRefreshOnBacktrackEnabled=flag; LOGObjectFnStop(); }; @@ -934,117 +946,117 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSString*)path { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); NSDebugMLLog(@"bundles",@"[GSWResourceManager _applicationGSWBundle]:%@",[GSWResourceManager _applicationGSWBundle]); - _path=[[GSWResourceManager _applicationGSWBundle] path]; //return : H:\Wotests\ObjCTest3 - NSDebugMLLog(@"application",@"_path:%@",_path); + path=[[GSWResourceManager _applicationGSWBundle] path]; //return : H:\Wotests\ObjCTest3 + NSDebugMLLog(@"application",@"path:%@",path); LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- //baseURL -(NSString*)baseURL { - NSString* _baseURL=nil; + NSString* baseURL=nil; LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnStart(); - _baseURL=[GSWURLPrefix[GSWebNamingConv] stringByAppendingString:[self name]]; + baseURL=[GSWURLPrefix[GSWebNamingConv] stringByAppendingString:[self name]]; LOGObjectFnStop(); - return _baseURL; + return baseURL; }; //-------------------------------------------------------------------- -(void)registerRequestHandlers { //OK - NSString* _componentRequestHandlerKey=nil; - NSString* _resourceRequestHandlerKey=nil; - NSString* _directActionRequestHandlerKey=nil; - GSWRequestHandler* _componentRequestHandler=nil; - GSWResourceRequestHandler* _resourceRequestHandler=nil; - GSWDirectActionRequestHandler* _directActionRequestHandler=nil; + NSString* componentRequestHandlerKey=nil; + NSString* resourceRequestHandlerKey=nil; + NSString* directActionRequestHandlerKey=nil; + GSWRequestHandler* componentRequestHandler=nil; + GSWResourceRequestHandler* resourceRequestHandler=nil; + GSWDirectActionRequestHandler* directActionRequestHandler=nil; LOGObjectFnStart(); - _componentRequestHandler=[[self class] _componentRequestHandler]; - _componentRequestHandlerKey=[[self class] componentRequestHandlerKey]; - NSDebugMLLog(@"application",@"_componentRequestHandlerKey:%@",_componentRequestHandlerKey); + componentRequestHandler=[[self class] _componentRequestHandler]; + componentRequestHandlerKey=[[self class] componentRequestHandlerKey]; + NSDebugMLLog(@"application",@"componentRequestHandlerKey:%@",componentRequestHandlerKey); - _resourceRequestHandler=[GSWResourceRequestHandler handler]; - _resourceRequestHandlerKey=[[self class] resourceRequestHandlerKey]; - NSDebugMLLog(@"application",@"_resourceRequestHandlerKey:%@",_resourceRequestHandlerKey); + resourceRequestHandler=(GSWResourceRequestHandler*)[GSWResourceRequestHandler handler]; + resourceRequestHandlerKey=[[self class] resourceRequestHandlerKey]; + NSDebugMLLog(@"application",@"resourceRequestHandlerKey:%@",resourceRequestHandlerKey); - _directActionRequestHandler=[GSWDirectActionRequestHandler handler]; - _directActionRequestHandlerKey=[[self class] directActionRequestHandlerKey]; - NSDebugMLLog(@"application",@"_directActionRequestHandlerKey:%@",_directActionRequestHandlerKey); + directActionRequestHandler=(GSWDirectActionRequestHandler*)[GSWDirectActionRequestHandler handler]; + directActionRequestHandlerKey=[[self class] directActionRequestHandlerKey]; + NSDebugMLLog(@"application",@"directActionRequestHandlerKey:%@",directActionRequestHandlerKey); - [self registerRequestHandler:_componentRequestHandler - forKey:_componentRequestHandlerKey]; - [self registerRequestHandler:_resourceRequestHandler - forKey:_resourceRequestHandlerKey]; - [self registerRequestHandler:_directActionRequestHandler - forKey:_directActionRequestHandlerKey]; - [self registerRequestHandler:_directActionRequestHandler - forKey: GSWDirectActionRequestHandlerKey[GSWebNamingConvInversed]]; - NSDebugMLLog(@"application",@"requestHandlers:%@",requestHandlers); - [self setDefaultRequestHandler:_componentRequestHandler]; + [self registerRequestHandler:componentRequestHandler + forKey:componentRequestHandlerKey]; + [self registerRequestHandler:resourceRequestHandler + forKey:resourceRequestHandlerKey]; + [self registerRequestHandler:directActionRequestHandler + forKey:directActionRequestHandlerKey]; + [self registerRequestHandler:directActionRequestHandler + forKey:GSWDirectActionRequestHandlerKey[GSWebNamingConvInversed]]; + NSDebugMLLog(@"application",@"_requestHandlers:%@",_requestHandlers); + [self setDefaultRequestHandler:componentRequestHandler]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)_userDefaults +-(void)_initAdaptorsWithUserDefaults:(NSUserDefaults*)userDefaults { - GSWAdaptor* _adaptor=nil; - NSDictionary* _args=nil; + GSWAdaptor* adaptor=nil; + NSDictionary* args=nil; LOGObjectFnStart(); - NSDebugMLLog(@"options",@"_userDefault=%@",_userDefaults); - _args=[self _argsDictionaryWithUserDefaults:_userDefaults]; - NSDebugMLLog(@"options",@"_args=%@",_args); - _adaptor=[self adaptorWithName:[_userDefaults objectForKey:GSWOPT_Adaptor[GSWebNamingConv]] - arguments:_args]; - if (adaptors) - ASSIGN(adaptors,[adaptors arrayByAddingObject:_adaptor]); + NSDebugMLLog(@"options",@"userDefault=%@",userDefaults); + args=[self _argsDictionaryWithUserDefaults:userDefaults]; + NSDebugMLLog(@"options",@"args=%@",args); + adaptor=[self adaptorWithName:[userDefaults objectForKey:GSWOPT_Adaptor[GSWebNamingConv]] + arguments:args]; + if (_adaptors) + ASSIGN(_adaptors,[_adaptors arrayByAddingObject:adaptor]); else - ASSIGN(adaptors,[NSArray arrayWithObject:_adaptor]); + ASSIGN(_adaptors,[NSArray arrayWithObject:adaptor]); LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)_userDefault +-(NSDictionary*)_argsDictionaryWithUserDefaults:(NSUserDefaults*)userDefault { //VERIFY //OK - NSNumber* _port=nil; - NSString* _host=nil; - NSString* _adaptor=nil; - NSNumber* _workerThreadCount=nil; - NSNumber* _listenQueueSize=nil; - NSMutableDictionary* _argsDict=nil; + NSNumber* port=nil; + NSString* host=nil; + NSString* adaptor=nil; + NSNumber* workerThreadCount=nil; + NSNumber* listenQueueSize=nil; + NSMutableDictionary* argsDict=nil; LOGObjectFnStart(); - _port=[[self class] port]; - _host=[[self class] host]; - _adaptor=[[self class] adaptor]; - _workerThreadCount=[[self class] workerThreadCount]; - _listenQueueSize=[[self class] listenQueueSize]; - _argsDict=[NSMutableDictionary dictionary]; - [_argsDict addEntriesFromDictionary:[_userDefault dictionaryRepresentation]]; - if (_port) - [_argsDict setObject:_port - forKey:GSWOPT_Port[GSWebNamingConv]]; - if (_host) - [_argsDict setObject:_host - forKey:GSWOPT_Host[GSWebNamingConv]]; - if (_adaptor) - [_argsDict setObject:_adaptor - forKey:GSWOPT_Adaptor[GSWebNamingConv]]; - if (_workerThreadCount) - [_argsDict setObject:_workerThreadCount - forKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; - if (_listenQueueSize) - [_argsDict setObject:_listenQueueSize - forKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; + port=[[self class] port]; + host=[[self class] host]; + adaptor=(NSString*)[[self class] adaptor]; + workerThreadCount=[[self class] workerThreadCount]; + listenQueueSize=[[self class] listenQueueSize]; + argsDict=(NSMutableDictionary*)[NSMutableDictionary dictionary]; + [argsDict addEntriesFromDictionary:[userDefault dictionaryRepresentation]]; + if (port) + [argsDict setObject:port + forKey:GSWOPT_Port[GSWebNamingConv]]; + if (host) + [argsDict setObject:host + forKey:GSWOPT_Host[GSWebNamingConv]]; + if (adaptor) + [argsDict setObject:adaptor + forKey:GSWOPT_Adaptor[GSWebNamingConv]]; + if (workerThreadCount) + [argsDict setObject:workerThreadCount + forKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; + if (listenQueueSize) + [argsDict setObject:listenQueueSize + forKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; LOGObjectFnStop(); - return _argsDict; + return argsDict; }; @end @@ -1068,12 +1080,12 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- -(NSString*)_directConnectURL { - NSString* _directConnectURL=nil; - NSString* _cgiAdaptorURL=[[self class]cgiAdaptorURL]; //return http://brahma.sbuilders.com/cgi/GSWeb.exe - NSArray* _adaptor=[self adaptors]; + NSString* directConnectURL=nil; + NSString* cgiAdaptorURL=[[self class]cgiAdaptorURL]; //return http://titi.toto.com/cgi/GSWeb.exe + NSArray* adaptor=[self adaptors]; //(call name) LOGObjectFnNotImplemented(); //TODOFN - return _directConnectURL; //return http://brahma.sbuilders.com:1436/cgi/GSWeb.exe/ObjCTest3 + return directConnectURL; //return http://titi.toto.com:1436/cgi/GSWeb.exe/ObjCTest3 }; //-------------------------------------------------------------------- @@ -1098,35 +1110,33 @@ int GSWApplicationMain(NSString* applicationClassName, -(void)_resetCache { //OK - NSEnumerator* _enum=nil; - id _object=nil; + NSEnumerator* anEnum=nil; + id object=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { - NSDebugMLLog(@"application",@"componentDefinitionCache=%@",componentDefinitionCache); - _enum=[componentDefinitionCache objectEnumerator]; - while ((_object = [_enum nextObject])) - { - NSDebugMLLog(@"application",@"_object=%@",_object); - if (_object!=GSNotFoundMarker && ![_object isCachingEnabled]) - { - [_object _clearCache]; - }; - }; - if (![self isCachingEnabled]) - { - [[GSWResourceManager _applicationGSWBundle] clearCache]; - }; - } + { + NSDebugMLLog(@"application",@"componentDefinitionCache=%@",_componentDefinitionCache); + anEnum=[_componentDefinitionCache objectEnumerator]; + while ((object = [anEnum nextObject])) + { + NSDebugMLLog(@"application",@"object=%@",object); + if (object!=GSNotFoundMarker && ![object isCachingEnabled]) + [object _clearCache]; + }; + if (![self isCachingEnabled]) + { + [[GSWResourceManager _applicationGSWBundle] clearCache]; + }; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In clearCache"); - LOGException(@"%@ (%@)",localException,[localException reason]); - [self unlock]; - [localException raise]; - //TODO - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In clearCache"); + LOGException(@"%@ (%@)",localException,[localException reason]); + [self unlock]; + [localException raise]; + //TODO + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -1137,246 +1147,247 @@ int GSWApplicationMain(NSString* applicationClassName, //==================================================================== @implementation GSWApplication (GSWApplicationD) --(GSWComponentDefinition*)componentDefinitionWithName:(NSString*)name_ - languages:(NSArray*)languages_ +-(GSWComponentDefinition*)componentDefinitionWithName:(NSString*)aName + languages:(NSArray*)languages { //OK - GSWComponentDefinition* _componentDefinition=nil; + GSWComponentDefinition* componentDefinition=nil; LOGObjectFnStart(); - NSDebugMLLog(@"info",@"name_=%@",name_); + NSDebugMLLog(@"info",@"aName=%@",aName); [self lock]; NS_DURING - { - _componentDefinition=[self lockedComponentDefinitionWithName:name_ - languages:languages_]; - } + { + componentDefinition=[self lockedComponentDefinitionWithName:aName + languages:languages]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedComponentDefinitionWithName"); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedComponentDefinitionWithName"); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _componentDefinition; + return componentDefinition; }; --(GSWComponentDefinition*)lockedComponentDefinitionWithName:(NSString*)_name - languages:(NSArray*)_languages +-(GSWComponentDefinition*)lockedComponentDefinitionWithName:(NSString*)aName + languages:(NSArray*)languages { //OK BOOL isCachedComponent=NO; - GSWComponentDefinition* _componentDefinition=nil; - NSString* _language=nil; + GSWComponentDefinition* componentDefinition=nil; + NSString* language=nil; int iLanguage=0; LOGObjectFnStart(); - NSDebugMLLog(@"application",@"_Name %p=%@",_name,_name); - for(iLanguage=0;iLanguage<[_languages count] && !_componentDefinition;iLanguage++) + NSDebugMLLog(@"application",@"aName %p=%@",aName,aName); + for(iLanguage=0;iLanguage<[languages count] && !componentDefinition;iLanguage++) { - _language=[_languages objectAtIndex:iLanguage]; - if (_language) + language=[languages objectAtIndex:iLanguage]; + if (language) { - NSDebugMLLog(@"gswcomponents",@"trying _language=%@",_language); + NSDebugMLLog(@"gswcomponents",@"trying language=%@",language); NSDebugMLLog(@"gswcomponents",@"[self isCachingEnabled]=%s",([self isCachingEnabled] ? "YES" : "NO")); if ([self isCachingEnabled]) { - _componentDefinition=[componentDefinitionCache objectForKeys:_name,_language,nil]; - if (_componentDefinition==(GSWComponentDefinition*)GSNotFoundMarker) - _componentDefinition=nil; - else if (_componentDefinition) + componentDefinition=[_componentDefinitionCache objectForKeys:aName,language,nil]; + if (componentDefinition==(GSWComponentDefinition*)GSNotFoundMarker) + componentDefinition=nil; + else if (componentDefinition) isCachedComponent=YES; }; - if (!_componentDefinition) + if (!componentDefinition) { - _componentDefinition=[self lockedLoadComponentDefinitionWithName:_name - language:_language]; + componentDefinition=[self lockedLoadComponentDefinitionWithName:aName + language:language]; if ([self isCachingEnabled]) { - if (_componentDefinition) - [componentDefinitionCache setObject:_componentDefinition - forKeys:_name,_language,nil]; + if (componentDefinition) + [_componentDefinitionCache setObject:componentDefinition + forKeys:aName,language,nil]; else - [componentDefinitionCache setObject:GSNotFoundMarker - forKeys:_name,_language,nil]; + [_componentDefinitionCache setObject:GSNotFoundMarker + forKeys:aName,language,nil]; }; }; }; }; - if (!_componentDefinition) + if (!componentDefinition) { - _language=nil; + language=nil; NSDebugMLLog0(@"application",@"trying no language"); NSDebugMLLog(@"gswcomponents",@"[self isCachingEnabled]=%s",([self isCachingEnabled] ? "YES" : "NO")); if ([self isCachingEnabled]) { - _componentDefinition=[componentDefinitionCache objectForKeys:_name,nil]; - if (_componentDefinition==(GSWComponentDefinition*)GSNotFoundMarker) - _componentDefinition=nil; - else if (_componentDefinition) + componentDefinition=[_componentDefinitionCache objectForKeys:aName,nil]; + if (componentDefinition==(GSWComponentDefinition*)GSNotFoundMarker) + componentDefinition=nil; + else if (componentDefinition) isCachedComponent=YES; }; - NSDebugMLLog(@"gswcomponents",@"D componentDefinition for %@ %s cached",_name,(_componentDefinition ? "" : "NOT")); - if (!_componentDefinition) + NSDebugMLLog(@"gswcomponents",@"D componentDefinition for %@ %s cached",aName,(componentDefinition ? "" : "NOT")); + if (!componentDefinition) { - _componentDefinition=[self lockedLoadComponentDefinitionWithName:_name - language:_language]; + componentDefinition=[self lockedLoadComponentDefinitionWithName:aName + language:language]; if ([self isCachingEnabled]) { - if (_componentDefinition) - [componentDefinitionCache setObject:_componentDefinition - forKeys:_name,nil]; + if (componentDefinition) + [_componentDefinitionCache setObject:componentDefinition + forKeys:aName,nil]; else - [componentDefinitionCache setObject:GSNotFoundMarker - forKeys:_name,nil]; + [_componentDefinitionCache setObject:GSNotFoundMarker + forKeys:aName,nil]; }; }; }; - if (!_componentDefinition) + if (!componentDefinition) { ExceptionRaise(@"GSWApplication", @"Unable to create component definition for %@ for languages: %@ (no componentDefinition).", - _name, - _languages); + aName, + languages); }; - if (_componentDefinition) + if (componentDefinition) { [self statusDebugWithFormat:@"Component %@ %s language %@ (%sCached)", - _name, - (_language ? "" : "no"), - (_language ? _language : @""), + aName, + (language ? "" : "no"), + (language ? language : @""), (isCachedComponent ? "" : "Not ")]; }; NSDebugMLLog(@"application",@"%s componentDefinition (%p) for %@ class=%@ %s", - (_componentDefinition ? "FOUND" : "NOTFOUND"), - _componentDefinition, - _name, - (_componentDefinition ? [[_componentDefinition class] description]: @""), - (_componentDefinition ? (isCachedComponent ? "(Cached)" : "(Not Cached)") : "")); + (componentDefinition ? "FOUND" : "NOTFOUND"), + componentDefinition, + aName, + (componentDefinition ? [[componentDefinition class] description]: @""), + (componentDefinition ? (isCachedComponent ? "(Cached)" : "(Not Cached)") : "")); LOGObjectFnStop(); - return _componentDefinition; + return componentDefinition; }; //-------------------------------------------------------------------- --(GSWComponentDefinition*)lockedLoadComponentDefinitionWithName:(NSString*)_name - language:(NSString*)_language +-(GSWComponentDefinition*)lockedLoadComponentDefinitionWithName:(NSString*)aName + language:(NSString*)language { - GSWComponentDefinition* _componentDefinition=nil; - GSWResourceManager* _resourceManager=nil; - NSString* _frameworkName=nil; - NSString* _resourceName=nil; - NSString* _htmlResourceName=nil; - NSString* _path=nil; - NSString* _url=nil; + GSWComponentDefinition* componentDefinition=nil; + GSWResourceManager* resourceManager=nil; + NSString* frameworkName=nil; + NSString* resourceName=nil; + NSString* htmlResourceName=nil; + NSString* path=nil; + NSString* url=nil; int iName=0; LOGObjectFnStart(); - NSDebugMLLog(@"gswcomponents",@"_Name=%@",_name); - for(iName=0;!_path && iName<2;iName++) + NSDebugMLLog(@"gswcomponents",@"aName=%@",aName); + for(iName=0;!path && iName<2;iName++) { - _resourceName=[_name stringByAppendingString:GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; - _htmlResourceName=[_name stringByAppendingString:GSWComponentTemplatePSuffix]; - NSDebugMLLog(@"gswcomponents",@"_resourceName=%@",_resourceName); - _resourceManager=[self resourceManager]; - _path=[_resourceManager pathForResourceNamed:_resourceName - inFramework:nil - language:_language]; - NSDebugMLLog(@"application",@"_path=%@",_path); - if (!_path) + resourceName=[aName stringByAppendingString:GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; + htmlResourceName=[aName stringByAppendingString:GSWComponentTemplatePSuffix]; + NSDebugMLLog(@"gswcomponents",@"resourceName=%@",resourceName); + resourceManager=[self resourceManager]; + path=[resourceManager pathForResourceNamed:resourceName + inFramework:nil + language:language]; + NSDebugMLLog(@"application",@"path=%@",path); + if (!path) { - NSArray* _frameworks=[self lockedComponentBearingFrameworks]; - NSBundle* _framework=nil; - int _frameworkN=0; - for(_frameworkN=0;_frameworkN<[_frameworks count] && !_path;_frameworkN++) + NSArray* frameworks=[self lockedComponentBearingFrameworks]; + NSBundle* framework=nil; + int frameworkN=0; + for(frameworkN=0;frameworkN<[frameworks count] && !path;frameworkN++) { - _framework=[_frameworks objectAtIndex:_frameworkN]; - NSDebugMLLog(@"gswcomponents",@"TRY _framework=%@",_framework); - _path=[_resourceManager pathForResourceNamed:_resourceName - inFramework:[_framework bundleName] - language:_language]; - if (!_path) + framework=[frameworks objectAtIndex:frameworkN]; + NSDebugMLLog(@"gswcomponents",@"TRY framework=%@",framework); + path=[resourceManager pathForResourceNamed:resourceName + inFramework:[framework bundleName] + language:language]; + if (!path) { - _path=[_resourceManager pathForResourceNamed:_htmlResourceName - inFramework:[_framework bundleName] - language:_language]; + path=[resourceManager pathForResourceNamed:htmlResourceName + inFramework:[framework bundleName] + language:language]; }; - if (_path) + if (path) { - NSDebugMLLog(@"gswcomponents",@"framework=%@ class=%@",_framework,[_framework class]); - NSDebugMLLog(@"gswcomponents",@"framework bundlePath=%@",[_framework bundlePath]); - _frameworkName=[_framework bundlePath]; - NSDebugMLLog(@"gswcomponents",@"_frameworkName=%@",_frameworkName); - _frameworkName=[_frameworkName lastPathComponent]; - NSDebugMLLog(@"gswcomponents",@"_frameworkName=%@",_frameworkName); - _frameworkName=[_frameworkName stringByDeletingPathExtension]; - NSDebugMLLog(@"gswcomponents",@"_frameworkName=%@",_frameworkName); + NSDebugMLLog(@"gswcomponents",@"framework=%@ class=%@",framework,[framework class]); + NSDebugMLLog(@"gswcomponents",@"framework bundlePath=%@",[framework bundlePath]); + frameworkName=[framework bundlePath]; + NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",frameworkName); + frameworkName=[frameworkName lastPathComponent]; + NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",frameworkName); + frameworkName=[frameworkName stringByDeletingPathExtension]; + NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",frameworkName); }; }; - NSDebugMLLog(@"application",@"_path=%@",_path); + NSDebugMLLog(@"application",@"path=%@",path); }; }; - if (_path) + if (path) { - _url=[_resourceManager urlForResourceNamed:_resourceName - inFramework:_frameworkName //NEW - languages:(_language ? [NSArray arrayWithObject:_language] : nil) - request:nil]; - NSDebugMLLog(@"gswcomponents",@"_url=%@",_url); - NSDebugMLLog(@"gswcomponents",@"_frameworkName=%@",_frameworkName); - NSDebugMLog(!@"Component %@ Found at=%@",_name,_path); - _componentDefinition=[[[GSWComponentDefinition alloc] initWithName:_name - path:_path - baseURL:_url - frameworkName:_frameworkName] autorelease]; + url=[resourceManager urlForResourceNamed:resourceName + inFramework:frameworkName //NEW + languages:(language ? [NSArray arrayWithObject:language] : nil) + request:nil]; + NSDebugMLLog(@"gswcomponents",@"url=%@",url); + NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",frameworkName); + NSDebugMLog(!@"Component %@ Found at=%@",aName,path); + componentDefinition=[[[GSWComponentDefinition alloc] initWithName:aName + path:path + baseURL:url + frameworkName:frameworkName] autorelease]; }; LOGObjectFnStop(); - return _componentDefinition; + return componentDefinition; }; //-------------------------------------------------------------------- -(NSArray*)lockedComponentBearingFrameworks { //OK - NSArray* _array=nil; - NSArray* _allFrameworks=nil; + NSArray* array=nil; + NSArray* allFrameworks=nil; LOGObjectFnStart(); - _allFrameworks=[NSBundle allFrameworks]; + allFrameworks=[NSBundle allFrameworks]; // NSDebugMLLog(@"gswcomponents",@"_allFrameworks=%@",_allFrameworks); - _array=[self lockedInitComponentBearingFrameworksFromBundleArray:_allFrameworks]; - NSDebugMLLog(@"gswcomponents",@"_array=%@",_array); + array=[self lockedInitComponentBearingFrameworksFromBundleArray:allFrameworks]; + NSDebugMLLog(@"gswcomponents",@"array=%@",array); LOGObjectFnStop(); - return _array; + return array; }; //-------------------------------------------------------------------- --(NSArray*)lockedInitComponentBearingFrameworksFromBundleArray:(NSArray*)_bundles +-(NSArray*)lockedInitComponentBearingFrameworksFromBundleArray:(NSArray*)bundles { - NSMutableArray* _array=nil; + NSMutableArray* array=nil; int i=0; - NSBundle* _bundle=nil; - NSDictionary* _bundleInfo=nil; - id _hasGSWComponents=nil; + NSBundle* bundle=nil; + NSDictionary* bundleInfo=nil; + id hasGSWComponents=nil; LOGObjectFnStart(); - _array=[NSMutableArray array]; - for(i=0;i<[_bundles count];i++) - { - _bundle=[_bundles objectAtIndex:i]; -// NSDebugMLLog(@"gswcomponents",@"_bundle=%@",_bundle); - _bundleInfo=[_bundle infoDictionary]; -// NSDebugMLLog(@"gswcomponents",@"_bundleInfo=%@",_bundleInfo); - _hasGSWComponents=[_bundleInfo objectForKey:@"HasGSWComponents"]; -// NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents=%@",_hasGSWComponents); -// NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents class=%@",[_hasGSWComponents class]); - if (boolValueFor(_hasGSWComponents)) - { - [_array addObject:_bundle]; - NSDebugMLLog(@"gswcomponents",@"Add %@",[_bundle bundleName]); - }; - }; -// NSDebugMLLog(@"gswcomponents",@"_array=%@",_array); + array=[NSMutableArray array]; + for(i=0;i<[bundles count];i++) + { + bundle=[bundles objectAtIndex:i]; + // NSDebugMLLog(@"gswcomponents",@"_bundle=%@",_bundle); + bundleInfo=[bundle infoDictionary]; + // NSDebugMLLog(@"gswcomponents",@"_bundleInfo=%@",_bundleInfo); + hasGSWComponents=[bundleInfo objectForKey:@"HasGSWComponents"]; + // NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents=%@",_hasGSWComponents); + // NSDebugMLLog(@"gswcomponents",@"_hasGSWComponents class=%@",[_hasGSWComponents class]); + if (boolValueFor(hasGSWComponents)) + { + [array addObject:bundle]; + NSDebugMLLog(@"gswcomponents",@"Add %@",[bundle bundleName]); + }; + }; + // NSDebugMLLog(@"gswcomponents",@"_array=%@",_array); LOGObjectFnStop(); - return _array; + return array; }; @@ -1392,114 +1403,117 @@ int GSWApplicationMain(NSString* applicationClassName, LOGObjectFnStart(); [self lock]; //TODO mettre le lock ailleur NS_DURING - { - [self lockedDecrementActiveSessionCount]; -/* - if ([self isRefusingNewSessions]) - { - //TODO - }; -*/ - } + { + [self lockedDecrementActiveSessionCount]; + /* + if ([self isRefusingNewSessions]) + { + //TODO + }; + */ + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedDecrementActiveSessionCount..."); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedDecrementActiveSessionCount..."); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_finishInitializingSession:(GSWSession*)_session +-(void)_finishInitializingSession:(GSWSession*)aSession { //OK LOGObjectFnStart(); [self lock]; NS_DURING - { - [[GSWResourceManager _applicationGSWBundle] initializeObject:_session - fromArchiveNamed:@"Session"]; - } + { + [[GSWResourceManager _applicationGSWBundle] initializeObject:aSession + fromArchiveNamed:@"Session"]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In initializeObject:fromArchiveNamed:"); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In initializeObject:fromArchiveNamed:"); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(GSWSession*)_initializeSessionInContext:(GSWContext*)context_ +-(GSWSession*)_initializeSessionInContext:(GSWContext*)aContext { //OK - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { -/* - if ([self isRefusingNewSessions]) - { - //TODO erreur ? - NSDebugMLLog0(@"application",@"isRefusingNewSessions!"); - } - else -*/ -// { - [self lockedIncrementActiveSessionCount]; - _session=[self createSessionForRequest:[context_ request]]; - NSDebugMLLog(@"sessions",@"_session:%@",_session); - NSDebugMLLog(@"sessions",@"_session ID:%@",[_session sessionID]); - [context_ _setSession:_session]; - [_session awakeInContext:context_]; -// }; - } + { + /* + if ([self isRefusingNewSessions]) + { + //TODO erreur ? + NSDebugMLLog0(@"application",@"isRefusingNewSessions!"); + } + else + */ + // { + [self lockedIncrementActiveSessionCount]; + session=[self createSessionForRequest:[aContext request]]; + NSDebugMLLog(@"sessions",@"session:%@",session); + NSDebugMLLog(@"sessions",@"session ID:%@",[session sessionID]); + [aContext _setSession:session]; + [session awakeInContext:aContext]; + // }; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedIncrementActiveSessionCount..."); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedIncrementActiveSessionCount..."); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _session; + return session; }; //-------------------------------------------------------------------- -(int)lockedDecrementActiveSessionCount { LOGObjectFnStart(); - activeSessionsCount--; + _activeSessionsCount--; LOGObjectFnStop(); - return activeSessionsCount; + return _activeSessionsCount; }; //-------------------------------------------------------------------- -(int)lockedIncrementActiveSessionCount { LOGObjectFnStart(); - activeSessionsCount++; + _activeSessionsCount++; LOGObjectFnStop(); - return activeSessionsCount; + return _activeSessionsCount; }; //-------------------------------------------------------------------- -(int)_activeSessionsCount { - return activeSessionsCount; + return _activeSessionsCount; }; @end @@ -1508,19 +1522,19 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWApplicationF) //-------------------------------------------------------------------- --(void)_setContext:(GSWContext*)context_ +-(void)_setContext:(GSWContext*)aContext { - NSMutableDictionary* _threadDictionary=nil; + NSMutableDictionary* threadDictionary=nil; LOGObjectFnStart(); - _threadDictionary=GSCurrentThreadDictionary(); - if (context_) - [_threadDictionary setObject:context_ - forKey:GSWThreadKey_Context]; + threadDictionary=GSCurrentThreadDictionary(); + if (aContext) + [threadDictionary setObject:aContext + forKey:GSWThreadKey_Context]; else - [_threadDictionary removeObjectForKey:GSWThreadKey_Context]; + [threadDictionary removeObjectForKey:GSWThreadKey_Context]; // ASSIGN(context,_context); - NSDebugMLLog(@"application",@"context:%p",(void*)context_); - NSDebugMLLog(@"application",@"context retain count:%p",[context_ retainCount]); + NSDebugMLLog(@"application",@"context:%p",(void*)aContext); + NSDebugMLLog(@"application",@"context retain count:%p",[aContext retainCount]); LOGObjectFnStop(); }; @@ -1528,14 +1542,14 @@ int GSWApplicationMain(NSString* applicationClassName, // Internal Use only -(GSWContext*)_context { - GSWContext* _context=nil; - NSMutableDictionary* _threadDictionary=nil; + GSWContext* context=nil; + NSMutableDictionary* threadDictionary=nil; LOGObjectFnStart(); - _threadDictionary=GSCurrentThreadDictionary(); - _context=[_threadDictionary objectForKey:GSWThreadKey_Context]; - NSDebugMLLog(@"application",@"context:%p",(void*)_context); + threadDictionary=GSCurrentThreadDictionary(); + context=[threadDictionary objectForKey:GSWThreadKey_Context]; + NSDebugMLLog(@"application",@"context:%p",(void*)context); LOGObjectFnStop(); - return _context; + return context; }; @end @@ -1546,13 +1560,13 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- -(BOOL)_isDynamicLoadingEnabled { - return dynamicLoadingEnabled; + return _dynamicLoadingEnabled; }; //-------------------------------------------------------------------- -(void)_disableDynamicLoading { - dynamicLoadingEnabled=NO; + _dynamicLoadingEnabled=NO; }; @end @@ -1563,34 +1577,34 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- -(BOOL)_isPageRecreationEnabled { - return pageRecreationEnabled; + return _pageRecreationEnabled; }; //-------------------------------------------------------------------- -(void)_touchPrincipalClasses { - NSArray* _allFrameworks=nil; - int _frameworkN=0; + NSArray* allFrameworks=nil; + int frameworkN=0; LOGObjectFnStart(); [self lock]; NS_DURING - { - //???? - _allFrameworks=[NSBundle allFrameworks]; - for(_frameworkN=0;_frameworkN<[_allFrameworks count];_frameworkN++) - { - NSDictionary* _infoDictionary=[[_allFrameworks objectAtIndex:_frameworkN] infoDictionary]; - //TODO what ??? - }; - } + { + //???? + allFrameworks=[NSBundle allFrameworks]; + for(frameworkN=0;frameworkN<[allFrameworks count];frameworkN++) + { + NSDictionary* infoDictionary=[[allFrameworks objectAtIndex:frameworkN] infoDictionary]; + //TODO what ??? + }; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@""); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@""); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -1602,7 +1616,7 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWApplicationJ) //-------------------------------------------------------------------- --(id)_newLocationForRequest:(GSWRequest*)_request +-(id)_newLocationForRequest:(GSWRequest*)aRequest { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -1610,7 +1624,7 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //appellé quand le moteur est fermé --(void)_connectionDidDie:(id)_unknown +-(void)_connectionDidDie:(id)unknown { LOGObjectFnNotImplemented(); //TODOFN }; @@ -1624,7 +1638,7 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //TODO return (Vv9@0:4c8) --(void)_setShouldKill:(BOOL)_flag +-(void)_setShouldKill:(BOOL)flag { LOGObjectFnNotImplemented(); //TODOFN }; @@ -1639,37 +1653,37 @@ int GSWApplicationMain(NSString* applicationClassName, -(BOOL)_setupForMonitoring { //OK - id _remoteMonitor=nil; - NSString* _monitorApplicationName=nil; - NSNumber* _port=nil; + id remoteMonitor=nil; + NSString* monitorApplicationName=nil; + NSNumber* port=nil; LOGObjectFnStart(); - _monitorApplicationName=[self _monitorApplicationName]; - _port=[[self class]port]; - _remoteMonitor=[self _remoteMonitor]; + monitorApplicationName=[self _monitorApplicationName]; + port=[[self class]port]; + remoteMonitor=[self _remoteMonitor]; LOGObjectFnStop(); - return (_remoteMonitor!=nil); + return (remoteMonitor!=nil); }; //-------------------------------------------------------------------- -(id)_remoteMonitor { LOGObjectFnStart(); - if (!remoteMonitor) - { - NSString* _monitorHost=[self _monitorHost]; - NSNumber* _workerThreadCount=[[self class]workerThreadCount]; - id _proxy=nil; - NSDebugFLLog(@"monitor",@"monitorHost=%@",_monitorHost); - NSDebugFLLog(@"monitor",@"workerThreadCount=%@",_workerThreadCount); - [NSDistantObject setDebug:YES]; - remoteMonitorConnection = [NSConnection connectionWithRegisteredName:GSWMonitorServiceName - host:_monitorHost]; - _proxy=[remoteMonitorConnection rootProxy]; - remoteMonitor=[_proxy targetForProxy]; - [self _synchronizeInstanceSettingsWithMonitor:remoteMonitor]; - }; + if (!_remoteMonitor) + { + NSString* monitorHost=[self _monitorHost]; + NSNumber* workerThreadCount=[[self class]workerThreadCount]; + id proxy=nil; + NSDebugFLLog(@"monitor",@"monitorHost=%@",monitorHost); + NSDebugFLLog(@"monitor",@"workerThreadCount=%@",workerThreadCount); + [NSDistantObject setDebug:YES]; + _remoteMonitorConnection = [NSConnection connectionWithRegisteredName:GSWMonitorServiceName + host:monitorHost]; + proxy=[_remoteMonitorConnection rootProxy]; + _remoteMonitor=[proxy targetForProxy]; + [self _synchronizeInstanceSettingsWithMonitor:_remoteMonitor]; + }; LOGObjectFnStop(); - return remoteMonitor; + return _remoteMonitor; }; //-------------------------------------------------------------------- @@ -1681,12 +1695,12 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- -(NSString*)_monitorApplicationName { - NSString* _name=[self name]; - NSNumber* _port=[[self class]port]; - NSString* _monitorApplicationName=[NSString stringWithFormat:@"%@-%@", - _name, - _port]; - return _monitorApplicationName; + NSString* name=[self name]; + NSNumber* port=[[self class]port]; + NSString* monitorApplicationName=[NSString stringWithFormat:@"%@-%@", + name, + port]; + return monitorApplicationName; }; //-------------------------------------------------------------------- @@ -1718,7 +1732,7 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSArray*)adaptors { - return adaptors; + return _adaptors; }; //-------------------------------------------------------------------- @@ -1787,55 +1801,56 @@ int GSWApplicationMain(NSString* applicationClassName, //sessionStore -(GSWSessionStore*)sessionStore { - return sessionStore; + return _sessionStore; }; //-------------------------------------------------------------------- //setSessionStore: --(void)setSessionStore:(GSWSessionStore*)sessionStore_ +-(void)setSessionStore:(GSWSessionStore*)sessionStore { - ASSIGN(sessionStore,sessionStore_); + ASSIGN(_sessionStore,sessionStore); }; //-------------------------------------------------------------------- --(void)saveSessionForContext:(GSWContext*)context_ +-(void)saveSessionForContext:(GSWContext*)aContext { - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); - _session=[context_ existingSession]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - if (_session) - { - [self _saveSessionForContext:context_]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - NSDebugMLLog(@"sessions",@"sessionStore=%@",sessionStore); - }; + session=[aContext existingSession]; + NSDebugMLLog(@"sessions",@"session=%@",session); + if (session) + { + [self _saveSessionForContext:aContext]; + NSDebugMLLog(@"sessions",@"session=%@",session); + NSDebugMLLog(@"sessions",@"sessionStore=%@",_sessionStore); + }; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_saveSessionForContext:(GSWContext*)context_ +-(void)_saveSessionForContext:(GSWContext*)aContext { //OK - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); - _session=[context_ existingSession]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - if (_session) + session=[aContext existingSession]; + NSDebugMLLog(@"sessions",@"session=%@",session); + if (session) { NS_DURING { - [_session sleepInContext:context_]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - [sessionStore checkInSessionForContext:context_]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - [context_ _setSession:nil]; - NSDebugMLLog(@"sessions",@"_session=%@",_session); - NSDebugMLLog(@"sessions",@"sessionStore=%@",sessionStore); + [session sleepInContext:aContext]; + NSDebugMLLog(@"sessions",@"session=%@",session); + [_sessionStore checkInSessionForContext:aContext]; + NSDebugMLLog(@"sessions",@"session=%@",session); + [aContext _setSession:nil]; + NSDebugMLLog(@"sessions",@"session=%@",session); + NSDebugMLLog(@"sessions",@"sessionStore=%@",_sessionStore); } NS_HANDLER { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _saveSessionForContext:"); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _saveSessionForContext:"); LOGException(@"%@ (%@)",localException,[localException reason]); [localException raise]; } @@ -1845,64 +1860,64 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- --(GSWSession*)restoreSessionWithID:(NSString*)sessionID_ - inContext:(GSWContext*)context_ +-(GSWSession*)restoreSessionWithID:(NSString*)sessionID + inContext:(GSWContext*)aContext { - GSWSession* _session=nil; + GSWSession* session=nil; //OK LOGObjectFnStart(); - [context_ _setRequestSessionID:sessionID_]; - NSDebugMLLog(@"sessions",@"sessionID_=%@",sessionID_); - NSDebugMLLog(@"sessions",@"sessionStore=%@",sessionStore); - _session=[self _restoreSessionWithID:sessionID_ - inContext:context_]; - [context_ _setRequestSessionID:nil]; //ATTN: pass nil for unkwon reason - NSDebugMLLog(@"sessions",@"_session=%@",_session); + [aContext _setRequestSessionID:sessionID]; + NSDebugMLLog(@"sessions",@"sessionID=%@",sessionID); + NSDebugMLLog(@"sessions",@"_sessionStore=%@",_sessionStore); + session=[self _restoreSessionWithID:sessionID + inContext:aContext]; + [aContext _setRequestSessionID:nil]; //ATTN: pass nil for unkwon reason + NSDebugMLLog(@"sessions",@"session=%@",session); LOGObjectFnStop(); - return _session; + return session; }; //-------------------------------------------------------------------- --(GSWSession*)_restoreSessionWithID:(NSString*)sessionID_ - inContext:(GSWContext*)context_ +-(GSWSession*)_restoreSessionWithID:(NSString*)sessionID + inContext:(GSWContext*)aContext { //OK - GSWRequest* _request=nil; - GSWSession* _session=nil; + GSWRequest* request=nil; + GSWSession* session=nil; LOGObjectFnStart(); - NSDebugMLLog(@"sessions",@"context_=%@",context_); - _request=[context_ request]; - NSDebugMLLog(@"sessions",@"_request=%@",_request); - NSDebugMLLog(@"sessions",@"sessionID_=%@",sessionID_); - NSDebugMLLog(@"sessions",@"sessionStore=%@",sessionStore); - _session=[sessionStore checkOutSessionWithID:sessionID_ - request:_request]; - [context_ _setSession:_session];//even if nil :-) - [_session awakeInContext:context_];//even if nil :-) - NSDebugMLLog(@"sessions",@"_session=%@",_session); + NSDebugMLLog(@"sessions",@"aContext=%@",aContext); + request=[aContext request]; + NSDebugMLLog(@"sessions",@"request=%@",request); + NSDebugMLLog(@"sessions",@"sessionID_=%@",sessionID); + NSDebugMLLog(@"sessions",@"sessionStore=%@",_sessionStore); + session=[_sessionStore checkOutSessionWithID:sessionID + request:request]; + [aContext _setSession:session];//even if nil :-) + [session awakeInContext:aContext];//even if nil :-) + NSDebugMLLog(@"sessions",@"session=%@",session); LOGObjectFnStop(); - return _session; + return session; }; //-------------------------------------------------------------------- -(Class)_sessionClass { //OK - Class _sessionClass=nil; + Class sessionClass=nil; LOGObjectFnStart(); -/* [[GSWResourceManager _applicationGSWBundle] lock]; - [[GSWResourceManager _applicationGSWBundle] unlock]; -*/ - _sessionClass=[[GSWResourceManager _applicationGSWBundle] scriptedClassWithName:GSWClassName_Session - superclassName:GSWClassName_Session]; - if (!_sessionClass) - _sessionClass=NSClassFromString(GSWClassName_Session); + /* [[GSWResourceManager _applicationGSWBundle] lock]; + [[GSWResourceManager _applicationGSWBundle] unlock]; + */ + sessionClass=[[GSWResourceManager _applicationGSWBundle] scriptedClassWithName:GSWClassName_Session + superclassName:GSWClassName_Session]; + if (!sessionClass) + sessionClass=NSClassFromString(GSWClassName_Session); /* //Search Compiled Class "Session" (subclass of GSWsession) - _gswsessionClass=NSClassFromString(); - _sessionClass=NSClassFromString(GSWClassName_Session); + gswsessionClass=NSClassFromString(); + sessionClass=NSClassFromString(GSWClassName_Session); //If not found, search for library "Session" in application .gswa directory if (!_sessionClass) @@ -1919,20 +1934,20 @@ int GSWApplicationMain(NSString* applicationClassName, }; //If not found, search for scripted "Session" in application .gswa directory - if (!_sessionClass) + if (!sessionClass) { //TODO }; //If not found, search for scripted "Session" in a session.gsws file - if (!_sessionClass) + if (!sessionClass) { //TODO }; - if (!_sessionClass) + if (!sessionClass) { - _sessionClass=_gswsessionClass; + sessionClass=_gswsessionClass; } else { @@ -1945,56 +1960,57 @@ int GSWApplicationMain(NSString* applicationClassName, NSDebugMLLog(@"application",@"_sessionClass:%@",_sessionClass); */ LOGObjectFnStop(); - return _sessionClass; + return sessionClass; }; //-------------------------------------------------------------------- --(GSWSession*)createSessionForRequest:(GSWRequest*)request_ +-(GSWSession*)createSessionForRequest:(GSWRequest*)aRequest { //OK - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); - _session=[self _createSessionForRequest:request_]; - NSDebugMLLog(@"sessions",@"_session:%@",_session); + session=[self _createSessionForRequest:aRequest]; + NSDebugMLLog(@"sessions",@"session:%@",session); LOGObjectFnStop(); - return _session; + return session; }; //-------------------------------------------------------------------- --(GSWSession*)_createSessionForRequest:(GSWRequest*)request_ +-(GSWSession*)_createSessionForRequest:(GSWRequest*)aRequest { //OK - Class _sessionClass=Nil; - GSWSession* _session=nil; + Class sessionClass=Nil; + GSWSession* session=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { - _sessionClass=[self _sessionClass]; - NSDebugMLLog(@"sessions",@"_sessionClass:%@",_sessionClass); - } + { + sessionClass=[self _sessionClass]; + NSDebugMLLog(@"sessions",@"sessionClass:%@",sessionClass); + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _sessionClass"); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _sessionClass"); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; - if (!_sessionClass) - { - //TODO erreur - NSDebugMLLog0(@"application",@"No Session Class"); - } + if (!sessionClass) + { + //TODO erreur + NSDebugMLLog0(@"application",@"No Session Class"); + } else - { - _session=[[_sessionClass new]autorelease]; - }; - NSDebugMLLog(@"sessions",@"_session:%@",_session); + { + session=[[sessionClass new]autorelease]; + }; + NSDebugMLLog(@"sessions",@"session:%@",session); LOGObjectFnStop(); - return _session; + return session; }; @end @@ -2005,9 +2021,9 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //setPageCacheSize: --(void)setPageCacheSize:(unsigned int)size_ +-(void)setPageCacheSize:(unsigned int)size { - pageCacheSize = size_; + _pageCacheSize = size; }; //-------------------------------------------------------------------- @@ -2015,17 +2031,17 @@ int GSWApplicationMain(NSString* applicationClassName, -(unsigned int)pageCacheSize { - return pageCacheSize; + return _pageCacheSize; }; //-------------------------------------------------------------------- -(unsigned)permanentPageCacheSize; { - return permanentPageCacheSize; + return _permanentPageCacheSize; }; //-------------------------------------------------------------------- --(void)setPermanentPageCacheSize:(unsigned)size_ +-(void)setPermanentPageCacheSize:(unsigned)size { LOGObjectFnNotImplemented(); //TODOFN }; @@ -2035,37 +2051,37 @@ int GSWApplicationMain(NSString* applicationClassName, -(BOOL)isPageRefreshOnBacktrackEnabled { - return pageRefreshOnBacktrackEnabled; + return _pageRefreshOnBacktrackEnabled; }; //-------------------------------------------------------------------- --(void)setPageRefreshOnBacktrackEnabled:(BOOL)_flag +-(void)setPageRefreshOnBacktrackEnabled:(BOOL)flag { [self lock]; - pageRefreshOnBacktrackEnabled=_flag; + _pageRefreshOnBacktrackEnabled=flag; [self unlock]; }; //-------------------------------------------------------------------- --(GSWComponent*)pageWithName:(NSString*)name_ - forRequest:(GSWRequest*)request_ +-(GSWComponent*)pageWithName:(NSString*)aName + forRequest:(GSWRequest*)aRequest { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(GSWComponent*)pageWithName:(NSString*)name_ - inContext:(GSWContext*)context_ +-(GSWComponent*)pageWithName:(NSString*)aName + inContext:(GSWContext*)aContext { //OK - GSWComponent* _component=nil; + GSWComponent* component=nil; LOGObjectFnStart(); - NSAssert(context_,@"No Context"); - _component=[self _pageWithName:name_ - inContext:context_]; + NSAssert(aContext,@"No Context"); + component=[self _pageWithName:aName + inContext:aContext]; LOGObjectFnStop(); - return _component; + return component; }; //-------------------------------------------------------------------- @@ -2076,34 +2092,35 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- --(GSWComponent*)_pageWithName:(NSString*)name_ - inContext:(GSWContext*)context_ +-(GSWComponent*)_pageWithName:(NSString*)aName + inContext:(GSWContext*)aContext { //OK - GSWComponent* _component=nil; - GSWComponentDefinition* _componentDefinition=nil; - NSArray* _languages=nil; + GSWComponent* component=nil; + GSWComponentDefinition* componentDefinition=nil; + NSArray* languages=nil; LOGObjectFnStart(); - NSDebugMLLog(@"info",@"name_ %p=%@",name_,name_); - NSAssert(context_,@"No Context"); + NSDebugMLLog(@"info",@"aName %p=%@",aName,aName); + NSAssert(aContext,@"No Context"); [self lock]; NS_DURING { - if ([name_ length]<=0) - name_=[self defaultPageName];//NDFN - if ([name_ length]<=0) - name_=GSWMainPageName; - _languages=[context_ languages]; - _componentDefinition=[self lockedComponentDefinitionWithName:name_ - languages:_languages]; - NSDebugMLLog(@"info",@"_componentDefinition %p=%@ (%@)", - _componentDefinition, - _componentDefinition, - [_componentDefinition class]); + if ([aName length]<=0) + aName=[self defaultPageName];//NDFN + if ([aName length]<=0) + aName=GSWMainPageName; + languages=[aContext languages]; + componentDefinition=[self lockedComponentDefinitionWithName:aName + languages:languages]; + NSDebugMLLog(@"info",@"componentDefinition %p=%@ (%@)", + componentDefinition, + componentDefinition, + [componentDefinition class]); } NS_HANDLER { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedComponentDefinitionWithName:"); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedComponentDefinitionWithName:"); LOGException(@"exception=%@",localException); //TODO [self unlock]; @@ -2112,23 +2129,24 @@ int GSWApplicationMain(NSString* applicationClassName, NS_ENDHANDLER; NS_DURING { - if (!_componentDefinition) + if (!componentDefinition) { //TODO - NSDebugMLLog0(@"info",@"GSWApplication _pageWithName no _componentDefinition"); + NSDebugMLLog0(@"info",@"GSWApplication _pageWithName no componentDefinition"); } else { - NSAssert(context_,@"No Context"); - _component=[_componentDefinition componentInstanceInContext:context_]; - NSAssert(context_,@"No Context"); - [_component awakeInContext:context_]; - [_component _setIsPage:YES]; + NSAssert(aContext,@"No Context"); + component=[componentDefinition componentInstanceInContext:aContext]; + NSAssert(aContext,@"No Context"); + [component awakeInContext:aContext]; + [component _setIsPage:YES]; }; } NS_HANDLER { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In componentInstanceInContext:"); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In componentInstanceInContext:"); LOGException(@"exception=%@",localException); //TODO [self unlock]; @@ -2137,7 +2155,7 @@ int GSWApplicationMain(NSString* applicationClassName, NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _component; + return component; }; @end @@ -2145,75 +2163,76 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWElementCreation) //-------------------------------------------------------------------- --(GSWElement*)dynamicElementWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ - languages:(NSArray*)languages_ +-(GSWElement*)dynamicElementWithName:(NSString*)aName + associations:(NSDictionary*)someAssociations + template:(GSWElement*)templateElement + languages:(NSArray*)languages { - GSWElement* _element=nil; + GSWElement* element=nil; [self lock]; NS_DURING - { - _element=[self lockedDynamicElementWithName:name_ - associations:associations_ - template:templateElement_ - languages:languages_]; - } + { + element=[self lockedDynamicElementWithName:aName + associations:someAssociations + template:templateElement + languages:languages]; + } NS_HANDLER - { - [self unlock]; - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedDynamicElementWithName:associations:template:languages:"); - [localException raise]; - }; + { + [self unlock]; + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedDynamicElementWithName:associations:template:languages:"); + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; - return _element; + return element; }; //-------------------------------------------------------------------- --(GSWElement*)lockedDynamicElementWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ - languages:(NSArray*)languages_ +-(GSWElement*)lockedDynamicElementWithName:(NSString*)aName + associations:(NSDictionary*)someAssociations + template:(GSWElement*)templateElement + languages:(NSArray*)languages { - GSWElement* _element=nil; - Class _elementClass=nil; + GSWElement* element=nil; + Class elementClass=nil; //lock bundle //unlock bundle - if ([associations_ isAssociationDebugEnabledInComponent:nil]) - [associations_ associationsSetDebugEnabled]; - _elementClass=NSClassFromString(name_); - NSDebugMLLog(@"info",@"_elementClass %p:%@",_elementClass,_elementClass); - NSDebugMLLog(@"info",@"_elementClass superClass:%@",[_elementClass superClass]); - if (_elementClass && !ClassIsKindOfClass(_elementClass,NSClassFromString(@"GSWComponent"))) + if ([someAssociations isAssociationDebugEnabledInComponent:nil]) + [someAssociations associationsSetDebugEnabled]; + elementClass=NSClassFromString(aName); + NSDebugMLLog(@"info",@"elementClass %p:%@",elementClass,elementClass); + NSDebugMLLog(@"info",@"elementClass superClass:%@",[elementClass superClass]); + if (elementClass && !ClassIsKindOfClass(elementClass,NSClassFromString(@"GSWComponent"))) { - NSDebugMLLog(@"info",@"CREATE Element of Class %p:%@",name_,name_); - _element=[[[_elementClass alloc] initWithName:name_ - associations:associations_ - template:templateElement_] - autorelease]; - NSDebugMLLog(@"info",@"Created Element %p: %@",_element,_element); + NSDebugMLLog(@"info",@"CREATE Element of Class %p:%@",aName,aName); + element=[[[elementClass alloc] initWithName:aName + associations:someAssociations + template:templateElement] + autorelease]; + NSDebugMLLog(@"info",@"Created Element %p: %@",element,element); } else { - GSWComponentDefinition* _componentDefinition=nil; - _componentDefinition=[self lockedComponentDefinitionWithName:name_ - languages:languages_]; - if (_componentDefinition) + GSWComponentDefinition* componentDefinition=nil; + componentDefinition=[self lockedComponentDefinitionWithName:aName + languages:languages]; + if (componentDefinition) { - NSDebugMLLog(@"info",@"CREATE SubComponent %p:%@",name_,name_); - _element=[_componentDefinition componentReferenceWithAssociations:associations_ - template:templateElement_]; - NSDebugMLLog(@"info",@"Created SubComponent %p: %@",_element,_element); + NSDebugMLLog(@"info",@"CREATE SubComponent %p:%@",aName,aName); + element=[componentDefinition componentReferenceWithAssociations:someAssociations + template:templateElement]; + NSDebugMLLog(@"info",@"Created SubComponent %p: %@",element,element); } else { ExceptionRaise(@"GSWApplication", @"GSWApplication: Component Definition named '%@' not found or can't be created", - name_); + aName); }; }; - return _element; + return element; }; @@ -2242,19 +2261,19 @@ int GSWApplicationMain(NSString* applicationClassName, NSDebugMLog(@"ThreadID=%p\n",(void*)objc_thread_id()); registerForEventsSEL=@selector(registerForEvents); unregisterForEventsSEL=@selector(unregisterForEvents); - NSDebugMLLog(@"application",@"adaptors=%@",adaptors); - [adaptors makeObjectsPerformSelector:registerForEventsSEL]; + NSDebugMLLog(@"application",@"adaptors=%@",_adaptors); + [_adaptors makeObjectsPerformSelector:registerForEventsSEL]; NSDebugMLLog0(@"application",@"NSRunLoop run"); //call adaptor run //call self _openInitialURL NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary()); NSDebugMLLog(@"application",@"[NSRunLoop currentRunLoop]=%@",[NSRunLoop currentRunLoop]); - ASSIGN(currentRunLoop,[NSRunLoop currentRunLoop]); + ASSIGN(_currentRunLoop,[NSRunLoop currentRunLoop]); NSDebugMLLog(@"application",@"GSCurrentThreadDictionary()=%@",GSCurrentThreadDictionary()); [[NSRunLoop currentRunLoop] run]; NSDebugMLLog0(@"application",@"NSRunLoop end run"); - [adaptors makeObjectsPerformSelector:unregisterForEventsSEL]; + [_adaptors makeObjectsPerformSelector:unregisterForEventsSEL]; NSDebugMLLog0(@"application",@"GSWApplication end run"); LOGObjectFnStop(); }; @@ -2264,7 +2283,7 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSRunLoop*)runLoop { - return currentRunLoop;//[NSRunLoop currentRunLoop]; + return _currentRunLoop;//[NSRunLoop currentRunLoop]; }; //-------------------------------------------------------------------- @@ -2282,9 +2301,9 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //setTimeOut: --(void)setTimeOut:(NSTimeInterval)timeInterval_ +-(void)setTimeOut:(NSTimeInterval)aTimeInterval { - timeOut=timeInterval_; + _timeOut=aTimeInterval; }; //-------------------------------------------------------------------- @@ -2292,7 +2311,7 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSTimeInterval)timeOut { - return timeOut; + return _timeOut; }; //-------------------------------------------------------------------- @@ -2313,34 +2332,34 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- --(void)_scheduleApplicationTimerForTimeInterval:(NSTimeInterval)timeInterval_ +-(void)_scheduleApplicationTimerForTimeInterval:(NSTimeInterval)aTimeInterval { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- //NDFN --(void)addTimer:(NSTimer*)timer_ +-(void)addTimer:(NSTimer*)aTimer { LOGObjectFnStart(); [self lock]; NS_DURING - { - NSDebugMLLog(@"application",@"[self runLoop]=%p",(void*)[self runLoop]); - NSDebugMLLog(@"application",@"currentMode=%@",[[self runLoop]currentMode]); - NSDebugMLLog(@"application",@"NSDefaultRunLoopMode=%@",NSDefaultRunLoopMode); - [[self runLoop]addTimer:timer_ - forMode:NSDefaultRunLoopMode]; - NSDebugMLLog(@"application",@"limitDateForMode=%@",[[self runLoop]limitDateForMode:NSDefaultRunLoopMode]); - } + { + NSDebugMLLog(@"application",@"[self runLoop]=%p",(void*)[self runLoop]); + NSDebugMLLog(@"application",@"currentMode=%@",[[self runLoop]currentMode]); + NSDebugMLLog(@"application",@"NSDefaultRunLoopMode=%@",NSDefaultRunLoopMode); + [[self runLoop]addTimer:aTimer + forMode:NSDefaultRunLoopMode]; + NSDebugMLLog(@"application",@"limitDateForMode=%@",[[self runLoop]limitDateForMode:NSDefaultRunLoopMode]); + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In addTimer:"); - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In addTimer:"); + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -2365,7 +2384,7 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- --(void)_sessionDidTimeOutNotification:(NSNotification*)notification_ +-(void)_sessionDidTimeOutNotification:(NSNotification*)notification { //OK // does nothing ? @@ -2376,25 +2395,25 @@ int GSWApplicationMain(NSString* applicationClassName, { //call resourceMLanager ? if ([[self class]isDirectConnectEnabled]) - { - NSString* _directConnectURL=[self _directConnectURL]; - if ([[self class]autoOpenInBrowser]) - { - [self _openURL:_directConnectURL]; - if ([[self class]isDebuggingEnabled]) - { - //TODO - }; - }; - } + { + NSString* directConnectURL=[self _directConnectURL]; + if ([[self class]autoOpenInBrowser]) + { + [self _openURL:directConnectURL]; + if ([[self class]isDebuggingEnabled]) + { + //TODO + }; + }; + } else - { - //TODO - }; + { + //TODO + }; }; //-------------------------------------------------------------------- --(void)_openURL:(NSString*)_url +-(void)_openURL:(NSString*)url { // [NSBundle bundleForClass:XX]; //TODO finish @@ -2413,65 +2432,69 @@ int GSWApplicationMain(NSString* applicationClassName, //==================================================================== @implementation GSWApplication (GSWRequestHandling) --(GSWResponse*)checkAppIfRefused:(GSWRequest*)request_ +-(GSWResponse*)checkAppIfRefused:(GSWRequest*)aRequest { - NSDictionary* _requestHandlerValues=nil; - GSWResponse* _response=nil; - NSString* _sessionID=nil; - BOOL _refuseRequest = NO; + NSDictionary* requestHandlerValues=nil; + GSWResponse* response=nil; + NSString* sessionID=nil; + BOOL refuseRequest = NO; LOGObjectFnStart(); NS_DURING { - NSLog(@"Application : checkAppIfRefused"); - NSLog(@"Application : allSessionIDs = %@", [sessionStore allSessionIDs]); - _requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:request_]; - if (_requestHandlerValues) { - NSLog(@"Application : _requestHandlerValues is set"); + NSLog(@"Application : checkAppIfRefused"); + NSLog(@"Application : allSessionIDs = %@", [_sessionStore allSessionIDs]); + requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:aRequest]; + if (requestHandlerValues) + { + NSLog(@"Application : requestHandlerValues is set"); - _sessionID=[_requestHandlerValues objectForKey:GSWKey_SessionID[GSWebNamingConv]]; - if (!_sessionID) { - NSLog(@"Application : _sessionID is nil"); + sessionID=[requestHandlerValues objectForKey:GSWKey_SessionID[GSWebNamingConv]]; + if (!sessionID) + { + NSLog(@"Application : sessionID is nil"); - if ([self isRefusingNewSessions] == YES) { - _refuseRequest = YES; - } - } else { - NSLog(@"Application : _sessionID found : %@", _sessionID); - NSLog(@"Application : allSessionIDs = %@", [sessionStore allSessionIDs]); - // check for existing session ID - if ([sessionStore containsSessionID:_sessionID] == NO) { - NSLog(@"Application : sessionStore does not contain _sessionID"); - if ([self isRefusingNewSessions] == YES) { - _refuseRequest = YES; - } - } - } - if (_refuseRequest == YES) { - NSLog(@"Application : _refuseRequest == YES ,generate Response"); - // generate response, to refuse the request - _response=[GSWResponse generateRefusingResponseInContext:nil forRequest:request_]; - if (_response) { - [_response _finalizeInContext:nil]; //DO Call _finalizeInContext: ! - } - } - } + if ([self isRefusingNewSessions]) + refuseRequest = YES; + } + else + { + NSLog(@"Application : sessionID found : %@", sessionID); + NSLog(@"Application : allSessionIDs = %@", [_sessionStore allSessionIDs]); + // check for existing session ID + if (![_sessionStore containsSessionID:sessionID]) + { + NSLog(@"Application : sessionStore does not contain _sessionID"); + if ([self isRefusingNewSessions]) + refuseRequest = YES; + } + } + if (refuseRequest) + { + NSLog(@"Application : refuseRequest == YES ,generate Response"); + // generate response, to refuse the request + response=[GSWResponse generateRefusingResponseInContext:nil + forRequest:aRequest]; + if (response) + [response _finalizeInContext:nil]; //DO Call _finalizeInContext: ! + } + } } NS_HANDLER - + { + } NS_ENDHANDLER; - + LOGObjectFnStop(); - - return _response; + return response; } --(GSWResponse*)dispatchRequest:(GSWRequest*)request_ +-(GSWResponse*)dispatchRequest:(GSWRequest*)aRequest { //OK - GSWResponse* _response=nil; - GSWRequestHandler* _requestHandler=nil; + GSWResponse* response=nil; + GSWRequestHandler* requestHandler=nil; LOGObjectFnStart(); #ifndef NDEBUG [self lock]; @@ -2479,35 +2502,35 @@ int GSWApplicationMain(NSString* applicationClassName, [self unlock]; #endif - _response = [self checkAppIfRefused:request_]; - if (_response == nil) { - - NSDebugMLLog(@"requests",@"request_=%@",request_); - _requestHandler=[self handlerForRequest:request_]; - NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler); - if (!_requestHandler) - _requestHandler=[self defaultRequestHandler]; - NSDebugMLLog(@"requests",@"_requestHandler=%@",_requestHandler); - if (!_requestHandler) - { - NSDebugMLLog0(@"application",@"GSWApplication dispatchRequest: no request handler"); - //TODO error - } - else - { - NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore); - _response=[_requestHandler handleRequest:request_]; - NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore); - [self _resetCache]; - NSDebugMLLog(@"requests",@"sessionStore=%@",sessionStore); - }; - if (!_response) - { - //TODO RESPONSE_PB - } - } + response = [self checkAppIfRefused:aRequest]; + if (!response) + { + NSDebugMLLog(@"requests",@"aRequest=%@",aRequest); + requestHandler=[self handlerForRequest:aRequest]; + NSDebugMLLog(@"requests",@"requestHandler=%@",requestHandler); + if (!requestHandler) + requestHandler=[self defaultRequestHandler]; + NSDebugMLLog(@"requests",@"requestHandler=%@",requestHandler); + if (!requestHandler) + { + NSDebugMLLog0(@"application",@"GSWApplication dispatchRequest: no request handler"); + //TODO error + } + else + { + NSDebugMLLog(@"requests",@"sessionStore=%@",_sessionStore); + response=[requestHandler handleRequest:aRequest]; + NSDebugMLLog(@"requests",@"sessionStore=%@",_sessionStore); + [self _resetCache]; + NSDebugMLLog(@"requests",@"sessionStore=%@",_sessionStore); + }; + if (!response) + { + //TODO RESPONSE_PB + }; + }; LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- @@ -2521,17 +2544,17 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //takeValuesFromRequest:inContext: --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { //OK - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); - [context_ setValidate:YES]; - _session=[context_ existingSession]; - [_session takeValuesFromRequest:request_ - inContext:context_]; - [context_ setValidate:NO]; + [aContext setValidate:YES]; + session=[aContext existingSession]; + [session takeValuesFromRequest:aRequest + inContext:aContext]; + [aContext setValidate:NO]; LOGObjectFnStop(); }; @@ -2539,28 +2562,28 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //invokeActionForRequest:inContext: --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { //OK GSWElement* element=nil; - GSWSession* _session=nil; + GSWSession* session=nil; LOGObjectFnStart(); NS_DURING - { - _session=[context_ existingSession]; - element=[_session invokeActionForRequest:request_ - inContext:context_]; - } + { + session=[aContext existingSession]; + element=[session invokeActionForRequest:aRequest + inContext:aContext]; + } NS_HANDLER - { - LOGException0(@"exception in GSWApplication invokeActionForRequest:inContext"); - LOGException(@"exception=%@",localException); - localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, - @"In GSWApplication invokeActionForRequest:inContext"); - LOGException(@"exception=%@",localException); - [localException raise]; - } + { + LOGException0(@"exception in GSWApplication invokeActionForRequest:inContext"); + LOGException(@"exception=%@",localException); + localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, + @"In GSWApplication invokeActionForRequest:inContext"); + LOGException(@"exception=%@",localException); + [localException raise]; + } NS_ENDHANDLER; LOGObjectFnStop(); return element; @@ -2569,17 +2592,17 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //appendToResponse:inContext: --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { //OK - GSWRequest* _request=nil; - GSWSession* _session=nil; + GSWRequest* request=nil; + GSWSession* session=nil; LOGObjectFnStart(); - _request=[context_ request]; - _session=[context_ existingSession]; - [_session appendToResponse:response_ - inContext:context_]; + request=[aContext request]; + session=[aContext existingSession]; + [session appendToResponse:aResponse + inContext:aContext]; //call request headerForKey:@"x-gsweb-recording" //call applic recordingPath LOGObjectFnStop(); @@ -2599,74 +2622,74 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWErrorHandling) //-------------------------------------------------------------------- --(GSWResponse*)handleException:(NSException*)exception_ - inContext:(GSWContext*)context_ +-(GSWResponse*)handleException:(NSException*)anException + inContext:(GSWContext*)aContext { - GSWResponse* _response=nil; + GSWResponse* response=nil; LOGObjectFnStart(); - NSDebugMLLog(@"application",@"context=%@",context_); - NSDebugMLog(@"EXCEPTION=%@",exception_); + NSDebugMLLog(@"application",@"context=%@",aContext); + NSDebugMLog(@"EXCEPTION=%@",anException); NS_DURING - { - _response=[self _handleException:exception_ - inContext:context_]; - } + { + response=[self _handleException:anException + inContext:aContext]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleException:inContext:"); - LOGException(@"exception=%@",localException); - _response=[GSWResponse responseWithMessage:@"Exception Handling failed" - inContext:context_ - forRequest:nil]; - } + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _handleException:inContext:"); + LOGException(@"exception=%@",localException); + response=[GSWResponse responseWithMessage:@"Exception Handling failed" + inContext:aContext + forRequest:nil]; + } NS_ENDHANDLER; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleException: _finalizeInContext called for GSWResponse"); + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication handleException: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(GSWResponse*)_handleException:(NSException*)exception_ - inContext:(GSWContext*)context_ +-(GSWResponse*)_handleException:(NSException*)anException + inContext:(GSWContext*)aContext { - GSWContext* _context=context_; - GSWResponse* _response=nil; - GSWResourceManager* _resourceManager=nil; - NSString* _exceptionPage=nil; + GSWContext* context=aContext; + GSWResponse* response=nil; + GSWResourceManager* resourceManager=nil; + NSString* exceptionPage=nil; int iName=0; - GSWComponent* _page=nil; + GSWComponent* page=nil; LOGObjectFnStart(); - NSDebugMLLog(@"application",@"context=%@",_context); - if (_context) - [_context _putAwakeComponentsToSleep]; + NSDebugMLLog(@"application",@"context=%@",context); + if (context) + [context _putAwakeComponentsToSleep]; else - { - LOGError0(@"No context !"); - _context=[GSWContext contextWithRequest:nil]; - LOGError0(@"Really can't get context !"); - }; + { + LOGError0(@"No context !"); + context=[GSWContext contextWithRequest:nil]; + LOGError0(@"Really can't get context !"); + }; //TODO Hack: verify that there is an application context otherswise, it failed in component Creation if (![self _context]) + [self _setContext:context]; + resourceManager=[self resourceManager]; + for(iName=0;!page && iName<2;iName++) { - [self _setContext:_context]; - }; - _resourceManager=[self resourceManager]; - for(iName=0;!_page && iName<2;iName++) - { - _exceptionPage=[NSString stringWithFormat:@"%@%@", - GSWExceptionPageName[GSWebNamingConvForRound(iName)], - GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; - NSDebugMLog(@"_exceptionPage=%@",_exceptionPage); - if ([_resourceManager pathForResourceNamed:_exceptionPage - inFramework:GSWFramework_extensions[GSWebNamingConvForRound(iName)] - languages:nil]) + exceptionPage=[NSString stringWithFormat:@"%@%@", + GSWExceptionPageName[GSWebNamingConvForRound(iName)], + GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; + NSDebugMLog(@"exceptionPage=%@",exceptionPage); + if ([resourceManager pathForResourceNamed:exceptionPage + inFramework:GSWFramework_extensions[GSWebNamingConvForRound(iName)] + languages:nil]) { NS_DURING { - _page=[self pageWithName:GSWExceptionPageName[GSWebNamingConvForRound(iName)] - inContext:_context]; - [_page setIVarNamed:@"exception" - withValue:exception_]; + page=[self pageWithName:GSWExceptionPageName[GSWebNamingConvForRound(iName)] + inContext:context]; + [page setIVarNamed:@"exception" + withValue:anException]; } NS_HANDLER { @@ -2676,94 +2699,95 @@ int GSWApplicationMain(NSString* applicationClassName, NS_ENDHANDLER; }; }; - if (_page) + if (page) { - id _monitor=nil; - _response=[_page generateResponse]; - _monitor=[self _remoteMonitor]; - if (_monitor) + id monitor=nil; + response=[page generateResponse]; + monitor=[self _remoteMonitor]; + if (monitor) { - NSString* _monitorApplicationName=[self _monitorApplicationName]; + NSString* monitorApplicationName=[self _monitorApplicationName]; //TODO }; } else { LOGError0(@"Can't find exception page"); - _response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Exception Page" - inContext:_context - forRequest:nil]; + response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Exception Page" + inContext:context + forRequest:nil]; }; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handleException: _finalizeInContext called for GSWResponse"); + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication _handleException: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- //handlePageRestorationError --(GSWResponse*)handlePageRestorationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)handlePageRestorationErrorInContext:(GSWContext*)aContext { - GSWResponse* _response=nil; + GSWResponse* response=nil; LOGObjectFnStart(); NS_DURING - { - _response=[self _handlePageRestorationErrorInContext:context_]; - } + { + response=[self _handlePageRestorationErrorInContext:aContext]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handlePageRestorationErrorInContext:"); - LOGException(@"exception=%@",localException); - _response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page" - inContext:context_ - forRequest:nil]; - } + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _handlePageRestorationErrorInContext:"); + LOGException(@"exception=%@",localException); + response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page" + inContext:aContext + forRequest:nil]; + } NS_ENDHANDLER; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse"); + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- //handlePageRestorationError --(GSWResponse*)_handlePageRestorationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)_handlePageRestorationErrorInContext:(GSWContext*)aContext { - GSWContext* _context=context_; - GSWResponse* _response=nil; - GSWComponent* _errorPage=nil; - GSWResourceManager* _resourceManager=nil; + GSWContext* context=aContext; + GSWResponse* response=nil; + GSWComponent* errorPage=nil; + GSWResourceManager* resourceManager=nil; int iName=0; - NSString* _restorationErrorPage=nil; + NSString* restorationErrorPage=nil; LOGObjectFnStart(); - if (_context) - [_context _putAwakeComponentsToSleep]; + if (context) + [context _putAwakeComponentsToSleep]; else - { - LOGError0(@"No context !"); - _context=[GSWContext contextWithRequest:nil]; - LOGError0(@"Really can't get context !"); - }; + { + LOGError0(@"No context !"); + context=[GSWContext contextWithRequest:nil]; + LOGError0(@"Really can't get context !"); + }; //TODO Hack: verify that there is an application context otherswise, it failed in component Creation if (![self _context]) - { - [self _setContext:_context]; - }; - _resourceManager=[self resourceManager]; + [self _setContext:context]; + resourceManager=[self resourceManager]; NSDebugMLLog0(@"application",@"GSWComponentRequestHandler _dispatchWithPreparedSession no page"); - for(iName=0;!_errorPage && iName<2;iName++) + for(iName=0;!errorPage && iName<2;iName++) { - _restorationErrorPage=[NSString stringWithFormat:@"%@%@", - GSWPageRestorationErrorPageName[GSWebNamingConvForRound(iName)], - GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; - NSDebugMLog(@"_restorationErrorPage=%@",_restorationErrorPage); - if ([_resourceManager pathForResourceNamed:_restorationErrorPage + restorationErrorPage=[NSString stringWithFormat:@"%@%@", + GSWPageRestorationErrorPageName[GSWebNamingConvForRound(iName)], + GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; + NSDebugMLog(@"restorationErrorPage=%@",restorationErrorPage); + if ([resourceManager pathForResourceNamed:restorationErrorPage inFramework:GSWFramework_extensions[GSWebNamingConvForRound(iName)] - languages:nil]) + languages:nil]) { NS_DURING { - _errorPage=[self pageWithName:GSWPageRestorationErrorPageName[GSWebNamingConvForRound(iName)] - inContext:_context]; + errorPage=[self pageWithName:GSWPageRestorationErrorPageName[GSWebNamingConvForRound(iName)] + inContext:context]; } NS_HANDLER { @@ -2777,46 +2801,49 @@ int GSWApplicationMain(NSString* applicationClassName, LOGError0(@"");//TODO }; }; - if (_errorPage) - _response=[_errorPage generateResponse]; + if (errorPage) + response=[errorPage generateResponse]; else - { - _response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page" - inContext:_context - forRequest:nil]; - }; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse"); + { + response=[GSWResponse responseWithMessage:@"Exception Handling failed. Can't find Page Restoration Error Page" + inContext:context + forRequest:nil]; + }; + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication _handlePageRestorationErrorInContext: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- //handleSessionCreationError --(GSWResponse*)handleSessionCreationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)handleSessionCreationErrorInContext:(GSWContext*)aContext { - GSWResponse* _response=nil; + GSWResponse* response=nil; LOGObjectFnStart(); NS_DURING - { - _response=[self _handleSessionCreationErrorInContext:context_]; - } + { + response=[self _handleSessionCreationErrorInContext:aContext]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleSessionCreationErrorInContext:"); - LOGException(@"exception=%@",localException); - _response=[GSWResponse responseWithMessage:@"Session Creation Error Handling failed." - inContext:context_ - forRequest:nil]; - } + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _handleSessionCreationErrorInContext:"); + LOGException(@"exception=%@",localException); + response=[GSWResponse responseWithMessage:@"Session Creation Error Handling failed." + inContext:aContext + forRequest:nil]; + } NS_ENDHANDLER; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleSessionCreationErrorInContext: _finalizeInContext called for GSWResponse"); + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication handleSessionCreationErrorInContext: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- //handleSessionCreationError --(GSWResponse*)_handleSessionCreationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)_handleSessionCreationErrorInContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -2825,68 +2852,68 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //handleSessionRestorationError --(GSWResponse*)handleSessionRestorationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)handleSessionRestorationErrorInContext:(GSWContext*)aContext { - GSWResponse* _response=nil; + GSWResponse* response=nil; LOGObjectFnStart(); NS_DURING - { - _response=[self _handleSessionRestorationErrorInContext:context_]; - } + { + response=[self _handleSessionRestorationErrorInContext:aContext]; + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In _handleSessionRestorationErrorInContext:"); - LOGException(@"exception=%@",localException); - _response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed." - inContext:context_ - forRequest:nil]; - } + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In _handleSessionRestorationErrorInContext:"); + LOGException(@"exception=%@",localException); + response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed." + inContext:aContext + forRequest:nil]; + } NS_ENDHANDLER; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse"); + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse"); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- //handleSessionRestorationError --(GSWResponse*)_handleSessionRestorationErrorInContext:(GSWContext*)context_ +-(GSWResponse*)_handleSessionRestorationErrorInContext:(GSWContext*)aContext { - GSWContext* _context=context_; - GSWResponse* _response=nil; - GSWComponent* _errorPage=nil; - GSWResourceManager* _resourceManager=nil; - NSString* _sessionRestorationErrorPage=nil; + GSWContext* context=aContext; + GSWResponse* response=nil; + GSWComponent* errorPage=nil; + GSWResourceManager* resourceManager=nil; + NSString* sessionRestorationErrorPage=nil; int iName=0; LOGObjectFnStart(); - if (_context) - [_context _putAwakeComponentsToSleep]; + if (context) + [context _putAwakeComponentsToSleep]; else - { - LOGError0(@"No context !"); - _context=[GSWContext contextWithRequest:nil]; - LOGError0(@"Really can't get context !"); - }; + { + LOGError0(@"No context !"); + context=[GSWContext contextWithRequest:nil]; + LOGError0(@"Really can't get context !"); + }; //TODO Hack: verify that there is an application context otherswise, it failed in component Creation if (![self _context]) + [self _setContext:context]; + resourceManager=[self resourceManager]; + for(iName=0;!errorPage && iName<2;iName++) { - [self _setContext:_context]; - }; - _resourceManager=[self resourceManager]; - for(iName=0;!_errorPage && iName<2;iName++) - { - _sessionRestorationErrorPage=[NSString stringWithFormat:@"%@%@", - GSWSessionRestorationErrorPageName[GSWebNamingConvForRound(iName)], - GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; - NSDebugMLog(@"_sessionRestorationErrorPage=%@",_sessionRestorationErrorPage); - if ([_resourceManager pathForResourceNamed:_sessionRestorationErrorPage - inFramework:GSWFramework_extensions[GSWebNamingConvForRound(iName)] - languages:nil]) + sessionRestorationErrorPage=[NSString stringWithFormat:@"%@%@", + GSWSessionRestorationErrorPageName[GSWebNamingConvForRound(iName)], + GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; + NSDebugMLog(@"sessionRestorationErrorPage=%@",sessionRestorationErrorPage); + if ([resourceManager pathForResourceNamed:sessionRestorationErrorPage + inFramework:GSWFramework_extensions[GSWebNamingConvForRound(iName)] + languages:nil]) { NS_DURING { - _errorPage=[self pageWithName:GSWSessionRestorationErrorPageName[GSWebNamingConvForRound(iName)] - inContext:_context]; + errorPage=[self pageWithName:GSWSessionRestorationErrorPageName[GSWebNamingConvForRound(iName)] + inContext:context]; } NS_HANDLER { @@ -2901,19 +2928,19 @@ int GSWApplicationMain(NSString* applicationClassName, }; }; //======> - if (_errorPage) - _response=[_errorPage generateResponse]; + if (errorPage) + response=[errorPage generateResponse]; else //<======== - { - - _response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed." - inContext:_context - forRequest:nil]; - }; - NSAssert(![_response isFinalizeInContextHasBeenCalled],@"GSWApplication _handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse"); + { + response=[GSWResponse responseWithMessage:@"Session Restoration Error Handling failed." + inContext:context + forRequest:nil]; + }; + NSAssert(![response isFinalizeInContextHasBeenCalled], + @"GSWApplication _handleSessionRestorationErrorInContext: _finalizeInContext called for GSWResponse"); LOGObjectFnStart(); - return _response; + return response; }; @end @@ -2924,7 +2951,7 @@ int GSWApplicationMain(NSString* applicationClassName, return GSWApp; }; -+(void)_setApplication:(GSWApplication*)_application ++(void)_setApplication:(GSWApplication*)application { //OK //Call self _isDynamicLoadingEnabled @@ -2932,10 +2959,10 @@ int GSWApplicationMain(NSString* applicationClassName, //call self isCachingEnabled //call self isPageRefreshOnBacktrackEnabled NSDebugMLog(@"setApplication:%p (of class %@) name:%@", - _application, - [_application class], - [_application name]); - GSWApp=_application; + application, + [application class], + [application name]); + GSWApp=application; }; @end @@ -2945,20 +2972,20 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //setPrintsHTMLParserDiagnostics: --(void)setPrintsHTMLParserDiagnostics:(BOOL)flag_ +-(void)setPrintsHTMLParserDiagnostics:(BOOL)flag { [self lock]; NS_DURING - { - printsHTMLParserDiagnostics=flag_; - } + { + _printsHTMLParserDiagnostics=flag; + } NS_HANDLER - { - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; }; @@ -2980,7 +3007,7 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //scriptedClassWithPath: --(Class)scriptedClassWithPath:(NSString*)path_ +-(Class)scriptedClassWithPath:(NSString*)path { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -2989,23 +3016,23 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //scriptedClassWithPath:encoding: --(Class)scriptedClassWithPath:(NSString*)path_ - encoding:(NSStringEncoding)encoding_ +-(Class)scriptedClassWithPath:(NSString*)path + encoding:(NSStringEncoding)encoding { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(Class)_classWithScriptedClassName:(NSString*)_name - languages:(NSArray*)_languages +-(Class)_classWithScriptedClassName:(NSString*)aName + languages:(NSArray*)languages { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(void)_setClassFromNameResolutionEnabled:(BOOL)_flag +-(void)_setClassFromNameResolutionEnabled:(BOOL)flag { LOGObjectFnNotImplemented(); //TODOFN }; @@ -3016,19 +3043,19 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWLibrarySupport) //-------------------------------------------------------------------- //NDFN --(Class)libraryClassWithPath:(NSString*)path_ +-(Class)libraryClassWithPath:(NSString*)path { - Class _class=nil; - NSBundle* bundle=[NSBundle bundleWithPath:path_]; + Class aClass=nil; + NSBundle* bundle=[NSBundle bundleWithPath:path]; NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle=%@",bundle); if (bundle) - { - BOOL result=[bundle load]; - NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle load result=%d",result); - _class=[bundle principalClass]; - NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle _class=%@",_class); - }; - return _class; + { + BOOL result=[bundle load]; + NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle load result=%d",result); + aClass=[bundle principalClass]; + NSDebugMLLog(@"application",@"GSWApplication libraryClassWithPath:bundle class=%@",aClass); + }; + return aClass; }; @end @@ -3036,111 +3063,111 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWDebugging) //-------------------------------------------------------------------- --(void)debugWithString:(NSString*)string_ +-(void)debugWithString:(NSString*)aString { if ([[self class]isDebuggingEnabled]) - { - fputs([string_ cString],stderr); - fputs("\n",stderr); - fflush(stderr); - }; + { + fputs([aString cString],stderr); + fputs("\n",stderr); + fflush(stderr); + }; }; //-------------------------------------------------------------------- --(void)debugWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)debugWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { - NSString* _string=[NSString stringWithFormat:format_ - arguments:arguments_]; - [self debugWithString:_string]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; + [self debugWithString:string]; }; //-------------------------------------------------------------------- --(void)debugWithFormat:(NSString*)format_,... +-(void)debugWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [self debugWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self debugWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)debugWithFormat:(NSString*)format_,... ++(void)debugWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [GSWApp debugWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp debugWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)_setTracingAspect:(id)_unknwon - enabled:(BOOL)_enabled +-(void)_setTracingAspect:(id)unknwon + enabled:(BOOL)enabled { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)logWithFormat:(NSString*)format_,... +-(void)logWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [self logWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self logWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)logWithFormat:(NSString*)format_,... ++(void)logWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [GSWApp logWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp logWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)logWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)logWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { - NSString* string=[NSString stringWithFormat:format_ - arguments:arguments_]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; fputs([string cString],stderr); fputs("\n",stderr); fflush(stderr); }; //-------------------------------------------------------------------- --(void)logErrorWithFormat:(NSString*)format_,... +-(void)logErrorWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [self logErrorWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self logErrorWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)logErrorWithFormat:(NSString*)format_,... ++(void)logErrorWithFormat:(NSString*)aFormat,... { va_list ap=NULL; - va_start(ap,format_); - [GSWApp logErrorWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp logErrorWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)logErrorWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)logErrorWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { const char* cString=NULL; - NSString* string=[NSString stringWithFormat:format_ - arguments:arguments_]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; cString=[string cString]; fputs(cString,stderr); fputs("\n",stderr); @@ -3154,148 +3181,148 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //trace: --(void)trace:(BOOL)flag_ +-(void)trace:(BOOL)flag { - if (flag_!=isTracingEnabled) - { - [self lock]; - isTracingEnabled=flag_; - [self unlock]; - }; + if (flag!=_isTracingEnabled) + { + [self lock]; + _isTracingEnabled=flag; + [self unlock]; + }; }; //-------------------------------------------------------------------- //traceAssignments: --(void)traceAssignments:(BOOL)flag_ +-(void)traceAssignments:(BOOL)flag { - if (flag_!=isTracingAssignmentsEnabled) - { - [self lock]; - isTracingAssignmentsEnabled=flag_; - [self unlock]; - }; + if (flag!=_isTracingAssignmentsEnabled) + { + [self lock]; + _isTracingAssignmentsEnabled=flag; + [self unlock]; + }; }; //-------------------------------------------------------------------- //traceObjectiveCMessages: --(void)traceObjectiveCMessages:(BOOL)flag_ +-(void)traceObjectiveCMessages:(BOOL)flag { - if (flag_!=isTracingObjectiveCMessagesEnabled) - { - [self lock]; - isTracingObjectiveCMessagesEnabled=flag_; - [self unlock]; - }; + if (flag!=_isTracingObjectiveCMessagesEnabled) + { + [self lock]; + _isTracingObjectiveCMessagesEnabled=flag; + [self unlock]; + }; }; //-------------------------------------------------------------------- //traceScriptedMessages: --(void)traceScriptedMessages:(BOOL)flag_ +-(void)traceScriptedMessages:(BOOL)flag { - if (flag_!=isTracingScriptedMessagesEnabled) - { - [self lock]; - isTracingScriptedMessagesEnabled=flag_; - [self unlock]; - }; + if (flag!=_isTracingScriptedMessagesEnabled) + { + [self lock]; + _isTracingScriptedMessagesEnabled=flag; + [self unlock]; + }; }; //-------------------------------------------------------------------- //traceStatements: --(void)traceStatements:(BOOL)flag_ +-(void)traceStatements:(BOOL)flag { - if (flag_!=isTracingStatementsEnabled) - { - [self lock]; - isTracingStatementsEnabled=flag_; - [self unlock]; - }; + if (flag!=_isTracingStatementsEnabled) + { + [self lock]; + _isTracingStatementsEnabled=flag; + [self unlock]; + }; }; //-------------------------------------------------------------------- -+(void)logSynchronizeComponentToParentForValue:(id)value_ - association:(GSWAssociation*)association_ - inComponent:(NSObject*)component_ ++(void)logSynchronizeComponentToParentForValue:(id)aValue + association:(GSWAssociation*)anAssociation + inComponent:(NSObject*)aComponent { //TODO [self logWithFormat:@"ComponentToParent [%@:%@] %@ ==> %@", @"", - [component_ description], - value_, - [association_ bindingName]]; + [aComponent description], + aValue, + [anAssociation bindingName]]; }; //-------------------------------------------------------------------- -+(void)logSynchronizeParentToComponentForValue:(id)value_ - association:(GSWAssociation*)association_ - inComponent:(NSObject*)component_ ++(void)logSynchronizeParentToComponentForValue:(id)aValue + association:(GSWAssociation*)anAssociation + inComponent:(NSObject*)aComponent { //TODO [self logWithFormat:@"ParentToComponent [%@:%@] %@ ==> %@", - @"", - [component_ description], - value_, - [association_ bindingName]]; + @"", + [aComponent description], + aValue, + [anAssociation bindingName]]; }; //-------------------------------------------------------------------- -+(void)logTakeValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_ ++(void)logTakeValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)associationDescription + value:(id)aValue { - [GSWApp logTakeValueForDeclarationNamed:declarationName_ - type:declarationType_ - bindingNamed:bindingName_ - associationDescription:associationDescription_ - value:value_]; + [GSWApp logTakeValueForDeclarationNamed:aDeclarationName + type:aDeclarationType + bindingNamed:aBindingName + associationDescription:associationDescription + value:aValue]; }; //-------------------------------------------------------------------- -+(void)logSetValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_ ++(void)logSetValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)associationDescription + value:(id)aValue { - [GSWApp logSetValueForDeclarationNamed:declarationName_ - type:declarationType_ - bindingNamed:bindingName_ - associationDescription:associationDescription_ - value:value_]; + [GSWApp logSetValueForDeclarationNamed:aDeclarationName + type:aDeclarationType + bindingNamed:aBindingName + associationDescription:associationDescription + value:aValue]; }; //-------------------------------------------------------------------- --(void)logTakeValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_ +-(void)logTakeValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)associationDescription + value:(id)aValue { //TODO [self logWithFormat:@"TakeValue DeclarationNamed:%@ type:%@ bindingNamed:%@ associationDescription:%@ value:%@", - declarationName_, - declarationType_, - bindingName_, - associationDescription_, - value_]; + aDeclarationName, + aDeclarationType, + aBindingName, + associationDescription, + aValue]; }; //-------------------------------------------------------------------- --(void)logSetValueForDeclarationNamed:(NSString*)declarationName_ - type:(NSString*)declarationType_ - bindingNamed:(NSString*)bindingName_ - associationDescription:(NSString*)associationDescription_ - value:(id)value_ +-(void)logSetValueForDeclarationNamed:(NSString*)aDeclarationName + type:(NSString*)aDeclarationType + bindingNamed:(NSString*)aBindingName + associationDescription:(NSString*)associationDescription + value:(id)aValue { //TODO [self logWithFormat:@"SetValue DeclarationNamed:%@ type:%@ bindingNamed:%@ associationDescription:%@ value:%@", - declarationName_, - declarationType_, - bindingName_, - associationDescription_, - value_]; + aDeclarationName, + aDeclarationType, + aBindingName, + associationDescription, + aValue]; }; @end @@ -3305,72 +3332,72 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWDebuggingStatus) //-------------------------------------------------------------------- --(void)statusDebugWithString:(NSString*)string_ +-(void)statusDebugWithString:(NSString*)aString { if ([[self class]isStatusDebuggingEnabled]) - { - fputs([string_ cString],stdout); - fputs("\n",stdout); - fflush(stdout); - [self debugWithString:string_]; - }; + { + fputs([aString cString],stdout); + fputs("\n",stdout); + fflush(stdout); + [self debugWithString:aString]; + }; }; //-------------------------------------------------------------------- --(void)statusDebugWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)statusDebugWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { - NSString* _string=[NSString stringWithFormat:format_ - arguments:arguments_]; - [self statusDebugWithString:_string]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; + [self statusDebugWithString:string]; }; //-------------------------------------------------------------------- --(void)statusDebugWithFormat:(NSString*)format_,... +-(void)statusDebugWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [self statusDebugWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self statusDebugWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)statusDebugWithFormat:(NSString*)format_,... ++(void)statusDebugWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [GSWApp statusDebugWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp statusDebugWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)statusLogWithFormat:(NSString*)format_,... +-(void)statusLogWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [self statusLogWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self statusLogWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)statusLogWithFormat:(NSString*)format_,... ++(void)statusLogWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [GSWApp statusLogWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp statusLogWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)statusLogWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)statusLogWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { - NSString* string=[NSString stringWithFormat:format_ - arguments:arguments_]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; fputs([string cString],stdout); fputs("\n",stdout); fflush(stdout); @@ -3378,32 +3405,32 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- --(void)statusLogErrorWithFormat:(NSString*)format_,... +-(void)statusLogErrorWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [self statusLogErrorWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [self statusLogErrorWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- -+(void)statusLogErrorWithFormat:(NSString*)format_,... ++(void)statusLogErrorWithFormat:(NSString*)aFormat,... { va_list ap; - va_start(ap,format_); - [GSWApp statusLogErrorWithFormat:format_ - arguments:ap]; + va_start(ap,aFormat); + [GSWApp statusLogErrorWithFormat:aFormat + arguments:ap]; va_end(ap); }; //-------------------------------------------------------------------- --(void)statusLogErrorWithFormat:(NSString*)format_ - arguments:(va_list)arguments_ +-(void)statusLogErrorWithFormat:(NSString*)aFormat + arguments:(va_list)arguments { const char* cString=NULL; - NSString* string=[NSString stringWithFormat:format_ - arguments:arguments_]; + NSString* string=[NSString stringWithFormat:aFormat + arguments:arguments]; cString=[string cString]; fputs(cString,stdout); fputs("\n",stdout); @@ -3426,14 +3453,14 @@ int GSWApplicationMain(NSString* applicationClassName, //statisticsStore -(GSWStatisticsStore*)statisticsStore { - return statisticsStore; + return _statisticsStore; }; //-------------------------------------------------------------------- //setStatisticsStore: --(void)setStatisticsStore:(GSWStatisticsStore*)statisticsStore_ +-(void)setStatisticsStore:(GSWStatisticsStore*)statisticsStore { - ASSIGN(statisticsStore,statisticsStore_); + ASSIGN(_statisticsStore,statisticsStore); }; @end @@ -3453,23 +3480,23 @@ int GSWApplicationMain(NSString* applicationClassName, //activeSessionsCount -(int)activeSessionsCount { - return activeSessionsCount; + return _activeSessionsCount; }; //-------------------------------------------------------------------- //setMinimumActiveSessionsCount: //TODO return (Vv12@0:4i8) --(void)setMinimumActiveSessionsCount:(int)count_ +-(void)setMinimumActiveSessionsCount:(int)count { //LOGObjectFnNotImplemented(); //TODOFN - minimumActiveSessionsCount = count_; + _minimumActiveSessionsCount = count; }; //-------------------------------------------------------------------- //minimumActiveSessionsCountCount -(int)minimumActiveSessionsCount { - return minimumActiveSessionsCount; + return _minimumActiveSessionsCount; }; //-------------------------------------------------------------------- @@ -3477,7 +3504,7 @@ int GSWApplicationMain(NSString* applicationClassName, -(BOOL)isRefusingNewSessions { //LOGObjectFnNotImplemented(); //TODOFN - return refusingNewSessions; + return _refusingNewSessions; }; //-------------------------------------------------------------------- @@ -3485,13 +3512,13 @@ int GSWApplicationMain(NSString* applicationClassName, //TODO return: (Vv9@0:4c8) -(void)refuseNewSessions:(BOOL)flag { - refusingNewSessions = flag; + _refusingNewSessions = flag; //LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- //logToMonitorWithFormat: --(void)logToMonitorWithFormat:(NSString*)format_ +-(void)logToMonitorWithFormat:(NSString*)aFormat { LOGObjectFnNotImplemented(); //TODOFN }; @@ -3499,7 +3526,7 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //terminateAfterTimeInterval: //TODO return (Vv16@0:4d8) --(void)terminateAfterTimeInterval:(NSTimeInterval)timeInterval_ +-(void)terminateAfterTimeInterval:(NSTimeInterval)aTimeInterval { LOGObjectFnNotImplemented(); //TODOFN }; @@ -3510,21 +3537,21 @@ int GSWApplicationMain(NSString* applicationClassName, @implementation GSWApplication (GSWResourceManagerSupport) //-------------------------------------------------------------------- //setResourceManager: --(void)setResourceManager:(GSWResourceManager*)resourceManager_ +-(void)setResourceManager:(GSWResourceManager*)resourceManager { //OK [self lock]; NS_DURING - { - ASSIGN(resourceManager,resourceManager_); - } + { + ASSIGN(_resourceManager,resourceManager); + } NS_HANDLER - { - LOGException(@"%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + LOGException(@"%@ (%@)",localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; }; @@ -3533,7 +3560,7 @@ int GSWApplicationMain(NSString* applicationClassName, //resourceManager -(GSWResourceManager*)resourceManager { - return resourceManager; + return _resourceManager; }; @end @@ -3545,71 +3572,74 @@ int GSWApplicationMain(NSString* applicationClassName, -(GSWRequestHandler*)defaultRequestHandler { //OK - return defaultRequestHandler; + return _defaultRequestHandler; }; //-------------------------------------------------------------------- --(void)setDefaultRequestHandler:(GSWRequestHandler*)handler_ +-(void)setDefaultRequestHandler:(GSWRequestHandler*)handler { //OK LOGObjectFnStart(); [self lock]; NS_DURING - { - ASSIGN(defaultRequestHandler,handler_); - } + { + ASSIGN(_defaultRequestHandler,handler); + } NS_HANDLER - { - NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)registerRequestHandler:(GSWRequestHandler*)handler_ - forKey:(NSString*)key_ +-(void)registerRequestHandler:(GSWRequestHandler*)handler + forKey:(NSString*)aKey { //OK [self lock]; NS_DURING - { - if (!requestHandlers) - requestHandlers=[NSMutableDictionary new]; - [requestHandlers setObject:handler_ - forKey:key_]; - } + { + if (!_requestHandlers) + _requestHandlers=[NSMutableDictionary new]; + [_requestHandlers setObject:handler + forKey:aKey]; + } NS_HANDLER - { - NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; }; //-------------------------------------------------------------------- --(void)removeRequestHandlerForKey:(NSString*)requestHandlerKey_ +-(void)removeRequestHandlerForKey:(NSString*)requestHandlerKey { //OK [self lock]; NS_DURING - { - [requestHandlers removeObjectForKey:requestHandlerKey_]; - } + { + [_requestHandlers removeObjectForKey:requestHandlerKey]; + } NS_HANDLER - { - NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"application",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; }; @@ -3618,33 +3648,33 @@ int GSWApplicationMain(NSString* applicationClassName, -(NSArray*)registeredRequestHandlerKeys { //OK - return [requestHandlers allKeys]; + return [_requestHandlers allKeys]; }; //-------------------------------------------------------------------- --(GSWRequestHandler*)requestHandlerForKey:(NSString*)key_ +-(GSWRequestHandler*)requestHandlerForKey:(NSString*)aKey { //OK - GSWRequestHandler* _handler=nil; + GSWRequestHandler* handler=nil; LOGObjectFnStart(); - _handler=[requestHandlers objectForKey:key_]; - NSDebugMLogCond(!_handler,@"requestHandlers=%@",requestHandlers); + handler=[_requestHandlers objectForKey:aKey]; + NSDebugMLogCond(!handler,@"_requestHandlers=%@",_requestHandlers); LOGObjectFnStop(); - return _handler; + return handler; }; //-------------------------------------------------------------------- --(GSWRequestHandler*)handlerForRequest:(GSWRequest*)request_ +-(GSWRequestHandler*)handlerForRequest:(GSWRequest*)aRequest { //OK - GSWRequestHandler* _handler=nil; - NSString* _requestHandlerKey=nil; + GSWRequestHandler* handler=nil; + NSString* requestHandlerKey=nil; LOGObjectFnStart(); - _requestHandlerKey=[request_ requestHandlerKey]; - NSDebugMLLog(@"application",@"_requestHandlerKey=%@",_requestHandlerKey); - _handler=[self requestHandlerForKey:_requestHandlerKey]; + requestHandlerKey=[aRequest requestHandlerKey]; + NSDebugMLLog(@"application",@"requestHandlerKey=%@",requestHandlerKey); + handler=[self requestHandlerForKey:requestHandlerKey]; LOGObjectFnStop(); - return _handler; + return handler; }; @end @@ -3656,125 +3686,143 @@ int GSWApplicationMain(NSString* applicationClassName, //TODO: take values from application ? +(NSArray*)loadFrameworks { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_LoadFrameworks[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_LoadFrameworks[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setLoadFrameworks:(NSArray*)frameworks_ ++(void)setLoadFrameworks:(NSArray*)frameworks { - [[NSUserDefaults standardUserDefaults] setObject:frameworks_ - forKey:GSWOPT_LoadFrameworks[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:frameworks + forKey:GSWOPT_LoadFrameworks[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(BOOL)isDebuggingEnabled { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_DebuggingEnabled[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_DebuggingEnabled[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setDebuggingEnabled:(BOOL)flag_ ++(void)setDebuggingEnabled:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_DebuggingEnabled[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_DebuggingEnabled[GSWebNamingConv]]; }; //-------------------------------------------------------------------- //NDFN +(BOOL)isStatusDebuggingEnabled { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- //NDFN -+(void)setStatusDebuggingEnabled:(BOOL)flag_ ++(void)setStatusDebuggingEnabled:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_StatusDebuggingEnabled[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(BOOL)autoOpenInBrowser { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_AutoOpenInBrowser[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_AutoOpenInBrowser[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setAutoOpenInBrowser:(BOOL)flag_ ++(void)setAutoOpenInBrowser:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_AutoOpenInBrowser[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_AutoOpenInBrowser[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(BOOL)isDirectConnectEnabled { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_DirectConnectEnabled[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_DirectConnectEnabled[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setDirectConnectEnabled:(BOOL)flag_ ++(void)setDirectConnectEnabled:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_DirectConnectEnabled[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_DirectConnectEnabled[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)cgiAdaptorURL { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_CGIAdaptorURL[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_CGIAdaptorURL[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setCGIAdaptorURL:(NSString*)url_ ++(void)setCGIAdaptorURL:(NSString*)url { - [[NSUserDefaults standardUserDefaults] setObject:url_ - forKey:GSWOPT_CGIAdaptorURL[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:url + forKey:GSWOPT_CGIAdaptorURL[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(BOOL)isCachingEnabled { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_CachingEnabled[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_CachingEnabled[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setCachingEnabled:(BOOL)flag_ ++(void)setCachingEnabled:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_CachingEnabled[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_CachingEnabled[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)applicationBaseURL { - NSString* _url=nil; + NSString* url=nil; LOGClassFnStart(); - _url=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ApplicationBaseURL[GSWebNamingConv]]; - NSDebugMLLog(@"application",@"_url=%@",_url); + url=[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_ApplicationBaseURL[GSWebNamingConv]]; + NSDebugMLLog(@"application",@"url=%@",url); LOGClassFnStop(); - return _url; + return url; }; //-------------------------------------------------------------------- -+(void)setApplicationBaseURL:(NSString*)baseURL_ ++(void)setApplicationBaseURL:(NSString*)baseURL { - [[NSUserDefaults standardUserDefaults] setObject:baseURL_ - forKey:GSWOPT_ApplicationBaseURL[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:baseURL + forKey:GSWOPT_ApplicationBaseURL[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)frameworksBaseURL { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_FrameworksBaseURL[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_FrameworksBaseURL[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setFrameworksBaseURL:(NSString*)string_ ++(void)setFrameworksBaseURL:(NSString*)aString { - [[NSUserDefaults standardUserDefaults] setObject:string_ - forKey:GSWOPT_FrameworksBaseURL[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:aString + forKey:GSWOPT_FrameworksBaseURL[GSWebNamingConv]]; }; //-------------------------------------------------------------------- @@ -3797,102 +3845,116 @@ int GSWApplicationMain(NSString* applicationClassName, +(NSArray*)projectSearchPath { //OK //TODO - NSArray* _projectSearchPath=nil; - NSBundle* _mainBundle=nil; + NSArray* projectSearchPath=nil; + NSBundle* mainBundle=nil; LOGClassFnStart(); - _mainBundle=[NSBundle mainBundle]; - NSDebugMLLog(@"options",@"[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]=%@",[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]); - _projectSearchPath=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ProjectSearchPath]; //return H:\\Wotests - NSDebugMLLog(@"application",@"_projectSearchPath:%@",_projectSearchPath); - if (!_projectSearchPath) - { + mainBundle=[NSBundle mainBundle]; + NSDebugMLLog(@"options", + @"[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]=%@", + [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]); + projectSearchPath=[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_ProjectSearchPath]; //return H:\\Wotests + NSDebugMLLog(@"application",@"projectSearchPath:%@",projectSearchPath); + if (!projectSearchPath) + { //TODO dirty hack here ! - NSBundle* _mainBundle=[self mainBundle]; - NSString* _bundlePath=[_mainBundle bundlePath]; - NSString* _path_=[_bundlePath stringGoodPath]; - NSDebugMLLog(@"application",@"_bundlePath:%@",_bundlePath); - NSDebugMLLog(@"application",@"_path_:%@",_path_); - NSDebugMLLog(@"application",@"_mainBundle:%@",_mainBundle); - _path_=[_path_ stringByDeletingLastPathComponent]; - NSDebugMLLog(@"application",@"_path_:%@",_path_); - _projectSearchPath=[NSArray arrayWithObject:_path_]; - }; - NSDebugMLLog(@"application",@"_projectSearchPath:%@",_projectSearchPath); + NSBundle* mainBundle=[self mainBundle]; + NSString* bundlePath=[mainBundle bundlePath]; + NSString* path=[bundlePath stringGoodPath]; + NSDebugMLLog(@"application",@"bundlePath:%@",bundlePath); + NSDebugMLLog(@"application",@"path:%@",path); + NSDebugMLLog(@"application",@"mainBundle:%@",mainBundle); + path=[path stringByDeletingLastPathComponent]; + NSDebugMLLog(@"application",@"path:%@",path); + projectSearchPath=[NSArray arrayWithObject:path]; + }; + NSDebugMLLog(@"application",@"projectSearchPath:%@",projectSearchPath); LOGClassFnStop(); - return _projectSearchPath; + return projectSearchPath; }; //-------------------------------------------------------------------- -+(void)setProjectSearchPath:(NSArray*)paths_ ++(void)setProjectSearchPath:(NSArray*)paths { - [[NSUserDefaults standardUserDefaults] setObject:paths_ - forKey:GSWOPT_ProjectSearchPath]; + [[NSUserDefaults standardUserDefaults] + setObject:paths + forKey:GSWOPT_ProjectSearchPath]; }; //-------------------------------------------------------------------- +(BOOL)isMonitorEnabled { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_MonitorEnabled[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_MonitorEnabled[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setMonitorEnabled:(BOOL)flag_ ++(void)setMonitorEnabled:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_MonitorEnabled[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_MonitorEnabled[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)monitorHost { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_MonitorHost[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_MonitorHost[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setMonitorHost:(NSString*)hostName_ ++(void)setMonitorHost:(NSString*)hostName { - [[NSUserDefaults standardUserDefaults] setObject:hostName_ - forKey:GSWOPT_MonitorHost[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:hostName + forKey:GSWOPT_MonitorHost[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)SMTPHost { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_SMTPHost[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_SMTPHost[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setSMTPHost:(NSString*)hostName_ ++(void)setSMTPHost:(NSString*)hostName { - [[NSUserDefaults standardUserDefaults] setObject:hostName_ - forKey:GSWOPT_SMTPHost[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:hostName + forKey:GSWOPT_SMTPHost[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)adaptor { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_Adaptor[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_Adaptor[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setAdaptor:(NSString*)adaptorName_ ++(void)setAdaptor:(NSString*)adaptorName { - [[NSUserDefaults standardUserDefaults] setObject:adaptorName_ - forKey:GSWOPT_Adaptor[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:adaptorName + forKey:GSWOPT_Adaptor[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(id)port { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_Port[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_Port[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setPort:(id)port_ ++(void)setPort:(id)port { - [[NSUserDefaults standardUserDefaults] setObject:port_ - forKey:GSWOPT_Port[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:port + forKey:GSWOPT_Port[GSWebNamingConv]]; //TODO /* [[GSWApp adaptors] makeObjectsPerformSelector:@selector(setPort:) @@ -3903,182 +3965,204 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- +(id)host { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_Host[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_Host[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setHost:(id)host_ ++(void)setHost:(id)host { - [[NSUserDefaults standardUserDefaults] setObject:host_ - forKey:GSWOPT_Host[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:host + forKey:GSWOPT_Host[GSWebNamingConv]]; //TODO /* - [[GSWApp adaptors] makeObjectsPerformSelector:@selector(setHost:) + [[GSWApp adaptors] makeObjectsPerformSelector:@selector(setHost:) withObject:host_]; - */ + */ }; //-------------------------------------------------------------------- +(id)listenQueueSize { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setListenQueueSize:(id)listenQueueSize_ ++(void)setListenQueueSize:(id)listenQueueSize { - [[NSUserDefaults standardUserDefaults] setObject:listenQueueSize_ - forKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:listenQueueSize + forKey:GSWOPT_ListenQueueSize[GSWebNamingConv]]; [[GSWApp adaptors] makeObjectsPerformSelector:@selector(setListenQueueSize:) - withObject:listenQueueSize_]; + withObject:listenQueueSize]; }; //-------------------------------------------------------------------- +(id)workerThreadCount { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setWorkerThreadCount:(id)workerThreadCount_ ++(void)setWorkerThreadCount:(id)workerThreadCount { - [[NSUserDefaults standardUserDefaults] setObject:workerThreadCount_ - forKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:workerThreadCount + forKey:GSWOPT_WorkerThreadCount[GSWebNamingConv]]; [[GSWApp adaptors] makeObjectsPerformSelector:@selector(setWorkerThreadCount:) - withObject:workerThreadCount_]; + withObject:workerThreadCount]; }; //-------------------------------------------------------------------- +(NSArray*)additionalAdaptors { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_AdditionalAdaptors[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_AdditionalAdaptors[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setAdditionalAdaptors:(NSArray*)adaptorsArray_ ++(void)setAdditionalAdaptors:(NSArray*)adaptorsArray { - [[NSUserDefaults standardUserDefaults] setObject:adaptorsArray_ - forKey:GSWOPT_AdditionalAdaptors[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:adaptorsArray + forKey:GSWOPT_AdditionalAdaptors[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(BOOL)includeCommentsInResponses { - return [[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]] boolValue]; + return [[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]] boolValue]; }; //-------------------------------------------------------------------- -+(void)setIncludeCommentsInResponses:(BOOL)flag_ ++(void)setIncludeCommentsInResponses:(BOOL)flag { - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:flag_] - forKey:GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:[NSNumber numberWithBool:flag] + forKey:GSWOPT_IncludeCommentsInResponse[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)componentRequestHandlerKey { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setComponentRequestHandlerKey:(NSString*)key_ ++(void)setComponentRequestHandlerKey:(NSString*)aKey { - [[NSUserDefaults standardUserDefaults] setObject:key_ - forKey:GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:aKey + forKey:GSWOPT_ComponentRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)directActionRequestHandlerKey { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setDirectActionRequestHandlerKey:(NSString*)key_ ++(void)setDirectActionRequestHandlerKey:(NSString*)aKey { - [[NSUserDefaults standardUserDefaults] setObject:key_ - forKey:GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:aKey + forKey:GSWOPT_DirectActionRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(NSString*)resourceRequestHandlerKey { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setResourceRequestHandlerKey:(NSString*)key_ ++(void)setResourceRequestHandlerKey:(NSString*)aKey { - [[NSUserDefaults standardUserDefaults] setObject:key_ + [[NSUserDefaults standardUserDefaults] setObject:aKey forKey:GSWOPT_ResourceRequestHandlerKey[GSWebNamingConv]]; }; //-------------------------------------------------------------------- -+(void)setSessionTimeOut:(NSNumber*)timeOut_ ++(void)setSessionTimeOut:(NSNumber*)aTimeOut { LOGClassFnStart(); - NSDebugMLLog(@"sessions",@"timeOut_=%@",timeOut_); - [[NSUserDefaults standardUserDefaults] setObject:timeOut_ - forKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; + NSDebugMLLog(@"sessions",@"aTimeOut=%@",aTimeOut); + [[NSUserDefaults standardUserDefaults] + setObject:aTimeOut + forKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; LOGClassFnStop(); }; //-------------------------------------------------------------------- +(NSNumber*)sessionTimeOut { - id _sessionTimeOut=nil; + id sessionTimeOut=nil; LOGClassFnStart(); - _sessionTimeOut=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; - NSDebugMLLog(@"sessions",@"_sessionTimeOut=%@",_sessionTimeOut); + sessionTimeOut=[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; + NSDebugMLLog(@"sessions",@"sessionTimeOut=%@",sessionTimeOut); LOGClassFnStop(); - return _sessionTimeOut; + return sessionTimeOut; }; //-------------------------------------------------------------------- -+(void)setSessionTimeOutValue:(NSTimeInterval)timeOutValue_ ++(void)setSessionTimeOutValue:(NSTimeInterval)aTimeOutValue { LOGClassFnStart(); - NSDebugMLLog(@"sessions",@"timeOutValue_=%f",timeOutValue_); - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:timeOutValue_] + NSDebugMLLog(@"sessions",@"aTimeOutValue=%f",aTimeOutValue); + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:aTimeOutValue] forKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; LOGClassFnStop(); }; +(NSTimeInterval)sessionTimeOutValue { - id _sessionTimeOut=nil; + id sessionTimeOut=nil; LOGClassFnStart(); - _sessionTimeOut=[[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; - NSDebugMLLog(@"sessions",@"_sessionTimeOut=%@",_sessionTimeOut); + sessionTimeOut=[[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_SessionTimeOut[GSWebNamingConv]]; + NSDebugMLLog(@"sessions",@"sessionTimeOut=%@",sessionTimeOut); LOGClassFnStop(); - return (NSTimeInterval)[_sessionTimeOut intValue]; + return (NSTimeInterval)[sessionTimeOut intValue]; }; //-------------------------------------------------------------------- //NDFN +(NSString*)debugSetConfigFilePath { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_DebugSetConfigFilePath]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_DebugSetConfigFilePath]; }; //-------------------------------------------------------------------- -+(void)setDebugSetConfigFilePath:(NSString*)debugSetConfigFilePath_ ++(void)setDebugSetConfigFilePath:(NSString*)debugSetConfigFilePath { - [[NSUserDefaults standardUserDefaults] setObject:debugSetConfigFilePath_ - forKey:GSWOPT_DebugSetConfigFilePath]; + [[NSUserDefaults standardUserDefaults] + setObject:debugSetConfigFilePath + forKey:GSWOPT_DebugSetConfigFilePath]; }; /** Returns the path where to store responses or nil if responses are not saved **/ +(NSString*)saveResponsesPath { - return [[NSUserDefaults standardUserDefaults] objectForKey:GSWOPT_SaveResponsesPath[GSWebNamingConv]]; + return [[NSUserDefaults standardUserDefaults] + objectForKey:GSWOPT_SaveResponsesPath[GSWebNamingConv]]; }; //-------------------------------------------------------------------- +(void)setSaveResponsesPath:(NSString*)saveResponsesPath { - [[NSUserDefaults standardUserDefaults] setObject:saveResponsesPath - forKey:GSWOPT_SaveResponsesPath[GSWebNamingConv]]; + [[NSUserDefaults standardUserDefaults] + setObject:saveResponsesPath + forKey:GSWOPT_SaveResponsesPath[GSWebNamingConv]]; }; @end @@ -4098,8 +4182,9 @@ int GSWApplicationMain(NSString* applicationClassName, +(Class)_applicationClass { LOGObjectFnStart(); - [[GSWResourceManager _applicationGSWBundle] scriptedClassWithName:GSWClassName_Application//TODO - superclassName:GSWClassName_Application]; //retirune nil //TODO + [[GSWResourceManager _applicationGSWBundle] + scriptedClassWithName:GSWClassName_Application//TODO + superclassName:GSWClassName_Application]; //retirune nil //TODO LOGObjectFnStop(); return NSClassFromString(globalApplicationClassName); }; @@ -4114,7 +4199,7 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- +(GSWRequestHandler*)_componentRequestHandler { - return [GSWComponentRequestHandler handler]; + return (GSWRequestHandler*)[GSWComponentRequestHandler handler]; }; @end @@ -4135,7 +4220,7 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- -+(id)_modelGroupFromBundles:(id)_bundles ++(id)_modelGroupFromBundles:(id)bundles { LOGClassFnNotImplemented(); //TODOFN return nil; @@ -4225,7 +4310,7 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- -+(void)_setLockDefaultEditingContext:(BOOL)_flag ++(void)_setLockDefaultEditingContext:(BOOL)flag { LOGClassFnNotImplemented(); //TODOFN }; @@ -4238,7 +4323,7 @@ int GSWApplicationMain(NSString* applicationClassName, }; //-------------------------------------------------------------------- -+(void)_setAllowsConcurrentRequestHandling:(id)_unknown ++(void)_setAllowsConcurrentRequestHandling:(id)unknown { LOGClassFnNotImplemented(); //TODOFN }; @@ -4289,200 +4374,199 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //NDFN --(id)propListWithResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(id)propListWithResourceNamed:(NSString*)aName + ofType:(NSString*)type + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { - id _propList=nil; - GSWResourceManager* _resourceManager=nil; - NSString* _pathName=nil; + id propList=nil; + GSWResourceManager* resourceManager=nil; + NSString* pathName=nil; LOGObjectFnStart(); - _resourceManager=[self resourceManager]; - _pathName=[_resourceManager pathForResourceNamed:[NSString stringWithFormat:@"%@.%@",name_,type_] - inFramework:frameworkName_ - languages:languages_]; - NSDebugMLLog(@"application",@"_pathName:%@",_pathName); - if (_pathName) - { - NSString* _propListString=[NSString stringWithContentsOfFile:_pathName]; - _propList=[_propListString propertyList]; - if (!_propList) - { - LOGSeriousError(@"Bad propertyList \n%@\n from file %@", - _propListString, - _pathName); - }; - }; + resourceManager=[self resourceManager]; + pathName=[resourceManager pathForResourceNamed:[NSString stringWithFormat:@"%@.%@",aName,type] + inFramework:aFrameworkName + languages:languages]; + NSDebugMLLog(@"application",@"pathName:%@",pathName); + if (pathName) + { + NSString* propListString=[NSString stringWithContentsOfFile:pathName]; + propList=[propListString propertyList]; + if (!propList) + { + LOGSeriousError(@"Bad propertyList \n%@\n from file %@", + propListString, + pathName); + }; + }; LOGObjectFnStop(); - return _propList; + return propList; }; //-------------------------------------------------------------------- -+(BOOL)createUnknownComponentClasses:(NSArray*)classes_ - superClassName:(NSString*)superClassName_ ++(BOOL)createUnknownComponentClasses:(NSArray*)classes + superClassName:(NSString*)aSuperClassName { - BOOL _ok=YES; + BOOL ok=YES; LOGClassFnStart(); - if ([classes_ count]>0) - { - int i=0; - NSString* _className=nil; - Class _class=nil; - int _newClassIndex=0; - Class* _newClasses=(Class*)objc_malloc(sizeof(Class)*([classes_ count]+1)); - memset(_newClasses,0,sizeof(Class)*([classes_ count]+1)); - for(i=0;i<[classes_ count];i++) - { - _className=[classes_ objectAtIndex:i]; - NSDebugMLLog(@"application",@"_className:%@",_className); - _class=NSClassFromString(_className); - NSDebugMLLog(@"application",@"_class:%@",_class); - if (!_class) - { - NSString* _superClassName=nil; - _superClassName=[localDynCreateClassNames objectForKey:_className]; - NSDebugMLLog(@"application",@"_superClassName=%p",(void*)_superClassName); - if (!_superClassName) - { - _superClassName=superClassName_; - if (!_superClassName) - { - ExceptionRaise(@"GSWApplication", - @"GSWApplication: no superclass for class named: %@", - _className); - }; - }; - NSDebugMLLog(@"application",@"Create Unknown Class: %@ (superclass: %@)", - _className, - superClassName_); - if (_superClassName) - { - _class=[NGObjCClass createClassWithName:_className - superClassName:_superClassName - iVars:nil]; - NSDebugMLLog(@"application",@"_class:%p",_class); - if (_class) - { - _newClasses[_newClassIndex]=_class; - _newClassIndex++; - }; - }; - }; - }; - if (_newClassIndex>0) - { - NSString* _moduleName=[NSString stringUniqueIdWithLength:4];//TODO - NGObjCModule* module=[NGObjCModule moduleWithName:_moduleName]; - _ok=[module executeWithClassArray:_newClasses]; - NSDebugMLLog(@"application",@"_ok:%d",(int)_ok); - if (!_ok) - { - //TODO - LOGError(@"Can't create one of these classes %@",classes_); - } - else - { -/* infoClassNewClass=[NGObjCClass infoForClass:aNewClass]; - [infoClassNewClass addMethods:[infoClass methods]]; - [infoClassNewClass addClassMethods:[infoClass classMethods]]; -*/ - }; - }; - objc_free(_newClasses); - }; + if ([classes count]>0) + { + int i=0; + NSString* aClassName=nil; + Class aClass=nil; + int newClassIndex=0; + Class* newClasses=(Class*)objc_malloc(sizeof(Class)*([classes count]+1)); + memset(newClasses,0,sizeof(Class)*([classes count]+1)); + for(i=0;i<[classes count];i++) + { + aClassName=[classes objectAtIndex:i]; + NSDebugMLLog(@"application",@"aClassName:%@",aClassName); + aClass=NSClassFromString(aClassName); + NSDebugMLLog(@"application",@"aClass:%@",aClass); + if (!aClass) + { + NSString* superClassName=nil; + superClassName=[localDynCreateClassNames objectForKey:aClassName]; + NSDebugMLLog(@"application",@"superClassName=%p",(void*)superClassName); + if (!superClassName) + { + superClassName=aSuperClassName; + if (!superClassName) + { + ExceptionRaise(@"GSWApplication", + @"GSWApplication: no superclass for class named: %@", + aClassName); + }; + }; + NSDebugMLLog(@"application",@"Create Unknown Class: %@ (superclass: %@)", + aClassName, + superClassName); + if (superClassName) + { + aClass=[NGObjCClass createClassWithName:aClassName + superClassName:superClassName + iVars:nil]; + NSDebugMLLog(@"application",@"aClass:%p",aClass); + if (aClass) + { + newClasses[newClassIndex]=aClass; + newClassIndex++; + }; + }; + }; + }; + if (newClassIndex>0) + { + NSString* moduleName=[NSString stringUniqueIdWithLength:4];//TODO + NGObjCModule* module=[NGObjCModule moduleWithName:moduleName]; + ok=[module executeWithClassArray:newClasses]; + NSDebugMLLog(@"application",@"ok:%d",(int)ok); + if (!ok) + { + //TODO + LOGError(@"Can't create one of these classes %@",classes); + } + else + { + /* infoClassNewClass=[NGObjCClass infoForClass:aNewClass]; + [infoClassNewClass addMethods:[infoClass methods]]; + [infoClassNewClass addClassMethods:[infoClass classMethods]]; + */ + }; + }; + objc_free(newClasses); + }; LOGClassFnStop(); - return _ok; + return ok; }; //-------------------------------------------------------------------- -+(void)addDynCreateClassName:(NSString*)className_ - superClassName:(NSString*)superClassName_ ++(void)addDynCreateClassName:(NSString*)className + superClassName:(NSString*)superClassName { LOGClassFnStart(); - NSDebugMLLog(@"gswdync",@"ClassName:%@ superClassName:%@\n",className_,superClassName_); - [localDynCreateClassNames setObject:superClassName_ - forKey:className_]; + NSDebugMLLog(@"gswdync",@"ClassName:%@ superClassName:%@\n",className,superClassName); + [localDynCreateClassNames setObject:superClassName + forKey:className]; LOGClassFnStop(); }; //-------------------------------------------------------------------- //NDFN --(NSString*)pathForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)pathForResourceNamed:(NSString*)name + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { - return [[self resourceManager]pathForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_]; + return [[self resourceManager]pathForResourceNamed:name + inFramework:aFrameworkName + languages:languages]; }; //-------------------------------------------------------------------- //NDFN --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)type + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { - return [[self resourceManager]pathForResourceNamed:(type_ ? [NSString stringWithFormat:@"%@.%@",name_,type_] : name_) - inFramework:frameworkName_ - languages:languages_]; + return [[self resourceManager]pathForResourceNamed:(type ? [NSString stringWithFormat:@"%@.%@",aName,type] : aName) + inFramework:aFrameworkName + languages:languages]; }; //-------------------------------------------------------------------- //NDFN --(NSString*)urlForResourceNamed:(NSString*)name_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_ +-(NSString*)urlForResourceNamed:(NSString*)aName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages + request:(GSWRequest*)aRequest { - return [[self resourceManager]urlForResourceNamed:name_ - inFramework:frameworkName_ - languages:languages_ - request:request_]; + return [[self resourceManager]urlForResourceNamed:aName + inFramework:aFrameworkName + languages:languages + request:aRequest]; +}; + +//-------------------------------------------------------------------- +//NDFN +-(NSString*)stringForKey:(NSString*)aKey + inTableNamed:(NSString*)aTableName + withDefaultValue:(NSString*)defaultValue + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages +{ + return [[self resourceManager]stringForKey:aKey + inTableNamed:aTableName + withDefaultValue:defaultValue + inFramework:aFrameworkName + languages:languages]; }; //-------------------------------------------------------------------- //NDFN --(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - withDefaultValue:(NSString*)defaultValue_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ -{ - return [[self resourceManager]stringForKey:key_ - inTableNamed:tableName_ - withDefaultValue:defaultValue_ - inFramework:frameworkName_ - languages:languages_]; -}; - - -//-------------------------------------------------------------------- -//NDFN --(NSDictionary*)stringsTableNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSDictionary*)stringsTableNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { NSDictionary* st=nil; LOGObjectFnStart(); - st=[[self resourceManager]stringsTableNamed:tableName_ - inFramework:frameworkName_ - languages:languages_]; + st=[[self resourceManager]stringsTableNamed:aTableName + inFramework:aFrameworkName + languages:languages]; LOGObjectFnStop(); return st; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)tableName_ - inFramework:(NSString*)frameworkName_ - languages:(NSArray*)languages_ +-(NSArray*)stringsTableArrayNamed:(NSString*)aTableName + inFramework:(NSString*)aFrameworkName + languages:(NSArray*)languages { - return [[self resourceManager]stringsTableArrayNamed:tableName_ - inFramework:frameworkName_ - languages:languages_]; + return [[self resourceManager]stringsTableArrayNamed:aTableName + inFramework:aFrameworkName + languages:languages]; }; //-------------------------------------------------------------------- @@ -4503,15 +4587,15 @@ int GSWApplicationMain(NSString* applicationClassName, -(GSWComponent*)pageWithName:(NSString*)name_ { GSWComponent* component=nil; - Class _class=nil; + Class aClass=nil; NSDebugMLLog(@"application",@"Page with Name:%@\n",name_); //No Name ==> "Main" if (!name_ || [name_ length]==0) name_=GSWMainPageName; NSDebugMLLog(@"gswcomponents",@"Page with Name:%@\n",name_); - _class=NSClassFromString(name_); + aClass=NSClassFromString(name_); //If not found, search for library - if (!_class) + if (!aClass) { NSString* pagePath=[self pathForResourceNamed:name_ ofType:nil]; @@ -4519,16 +4603,16 @@ int GSWApplicationMain(NSString* applicationClassName, NSDebugMLLog(@"gswcomponents",@"_principalClass=%@",_principalClass); if (_principalClass) { - _class=NSClassFromString(name_); - NSDebugMLLog(@"gswcomponents",@"_class=%@",_class); + aClass=NSClassFromString(name_); + NSDebugMLLog(@"gswcomponents",@"aClass=%@",aClass); }; }; - if (!_class) + if (!aClass) { //TODO Load Scripted (PageName.gsws) }; - if (!_class) + if (!aClass) { //TODO exception NSDebugMLLog0(@"application",@"No component class\n"); @@ -4536,7 +4620,7 @@ int GSWApplicationMain(NSString* applicationClassName, else { Class GSWComponentClass=NSClassFromString(@"GSWComponent"); - if (!ClassIsKindOfClass(_class,GSWComponentClass)) + if (!ClassIsKindOfClass(aClass,GSWComponentClass)) { NSDebugMLLog0(@"application",@"component class is not a kind of GSWComponent\n"); //TODO exception @@ -4545,7 +4629,7 @@ int GSWApplicationMain(NSString* applicationClassName, { //TODOV NSDebugMLLog0(@"application",@"Create Componnent\n"); - component=[[_class new] autorelease]; + component=[[aClass new] autorelease]; if (!component) { //TODO exception @@ -4641,9 +4725,9 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //stringForKey:inTableNamed:withDefaultValue: --(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)tableName_ - withDefaultValue:(NSString*)defaultValue_ +-(NSString*)stringForKey:(NSString*)aKey + inTableNamed:(NSString*)aTableName + withDefaultValue:(NSString*)defaultValue { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -4652,24 +4736,24 @@ int GSWApplicationMain(NSString* applicationClassName, //-------------------------------------------------------------------- //handleRequest: //Olf Fn --(GSWResponse*)handleRequest:(GSWRequest*)request_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest { - return [self dispatchRequest:request_];//?? + return [self dispatchRequest:aRequest];//?? }; //-------------------------------------------------------------------- //dynamicElementWithName:associations:template: //OldFn -(GSWDynamicElement*)dynamicElementWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ + associations:(NSDictionary*)someAssociations template:(GSWElement*)templateElement_ { GSWDynamicElement* element=nil; // NSString* elementName=[_XMLElement attributeForKey:@"NAME"]; - Class _class=NSClassFromString(name_); + Class aClass=NSClassFromString(name_); LOGObjectFnNotImplemented(); //TODOFN NSDebugMLLog0(@"application",@"Begin GSWApplication:dynamicElementWithName\n"); - if (!_class) + if (!aClass) { ExceptionRaise(@"GSWApplication", @"GSWApplication: No class named '%@' for creating dynamic element", @@ -4678,7 +4762,7 @@ int GSWApplicationMain(NSString* applicationClassName, else { Class GSWElementClass=NSClassFromString(@"GSWElement"); - if (!ClassIsKindOfClass(_class,GSWElementClass)) + if (!ClassIsKindOfClass(aClass,GSWElementClass)) { ExceptionRaise(@"GSWApplication", @"GSWApplication: element '%@' is not kind of GSWElement", @@ -4686,9 +4770,9 @@ int GSWApplicationMain(NSString* applicationClassName, } else { - NSDebugMLLog(@"application",@"Creating DynamicElement of Class:%@\n",_class); - element=[[[_class alloc] initWithName:name_ - associations:associations_ + NSDebugMLLog(@"application",@"Creating DynamicElement of Class:%@\n",aClass); + element=[[[aClass alloc] initWithName:name_ + associations:someAssociations template:templateElement_] autorelease]; NSDebugMLLog(@"application",@"Creating DynamicElement:%@\n",element); }; diff --git a/GSWeb.framework/GSWBindingNameAssociation.h b/GSWeb.framework/GSWBindingNameAssociation.h index 04f332d..38fde92 100644 --- a/GSWeb.framework/GSWBindingNameAssociation.h +++ b/GSWeb.framework/GSWBindingNameAssociation.h @@ -1,11 +1,16 @@ -/* GSWBindingNameAssociation.h - GSWeb: Class GSWBindingNameAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBindingNameAssociation.h - GSWeb: Class GSWBindingNameAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Apr 1999 + Written by: Manuel Guesdon + Date: Apr 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,23 +35,23 @@ //==================================================================== @interface GSWBindingNameAssociation : GSWAssociation { - NSString* parentBindingName; - NSString* keyPath; + NSString* _parentBindingName; + NSString* _keyPath; //GSWeb Additions { - BOOL isNonMandatory; + BOOL _isNonMandatory; // } }; --(id)initWithKeyPath:(NSString*)keyPath_; +-(id)initWithKeyPath:(NSString*)keyPath; -(void)dealloc; -(id)copyWithZone:(NSZone*)zone; -(NSString*)description; --(BOOL)isImplementedForComponent:(NSObject*)object_; +-(BOOL)isImplementedForComponent:(NSObject*)object; -(BOOL)isValueConstant; -(BOOL)isValueSettable; --(id)valueInObject:(id)object_; --(void)setValue:(id)value_ - inObject:(id)object_; +-(id)valueInObject:(id)object; +-(void)setValue:(id)value + inObject:(id)object; @end #endif //_GSWBindingNameAssociation_h__ diff --git a/GSWeb.framework/GSWBindingNameAssociation.m b/GSWeb.framework/GSWBindingNameAssociation.m index 49af40f..ab22732 100644 --- a/GSWeb.framework/GSWBindingNameAssociation.m +++ b/GSWeb.framework/GSWBindingNameAssociation.m @@ -1,11 +1,16 @@ -/* GSWBindingNameAssociation.m - GSWeb: Class GSWBindingNameAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWBindingNameAssociation.m - GSWeb: Class GSWBindingNameAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Apr 1999 + Written by: Manuel Guesdon + Date: Apr 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,34 +35,34 @@ static char rcsId[] = "$Id$"; @implementation GSWBindingNameAssociation //-------------------------------------------------------------------- --(id)initWithKeyPath:(NSString*)keyPath_ +-(id)initWithKeyPath:(NSString*)aKeyPath { //OK LOGObjectFnStart(); if ((self=[super init])) - { - NSArray* keys=nil; - NSDebugMLLog(@"associations",@"keyPath_=%@",keyPath_); - keys=[keyPath_ componentsSeparatedByString:@"."]; - if ([keys count]>0) - { - if (!WOStrictFlag && [keyPath_ hasPrefix:@"^"]) - { - ASSIGNCOPY(parentBindingName,[[keys objectAtIndex:0] stringWithoutPrefix:@"^"]); - } - else if (!WOStrictFlag && [keyPath_ hasPrefix:@"~"]) - { - ASSIGNCOPY(parentBindingName,[[keys objectAtIndex:0] stringWithoutPrefix:@"~"]); - isNonMandatory=YES; - }; - if ([keys count]>1) - { - ASSIGN(keyPath,[[keys subarrayWithRange:NSMakeRange(1,[keys count]-1)]componentsJoinedByString:@"."]); - }; - }; - NSDebugMLLog(@"associations",@"parentBindingName=%@",parentBindingName); - NSDebugMLLog(@"associations",@"keyPath=%@",keyPath); - }; + { + NSArray* keys=nil; + NSDebugMLLog(@"associations",@"aKeyPath=%@",aKeyPath); + keys=[aKeyPath componentsSeparatedByString:@"."]; + if ([keys count]>0) + { + if (!WOStrictFlag && [aKeyPath hasPrefix:@"^"]) + { + ASSIGNCOPY(_parentBindingName,[[keys objectAtIndex:0] stringWithoutPrefix:@"^"]); + } + else if (!WOStrictFlag && [aKeyPath hasPrefix:@"~"]) + { + ASSIGNCOPY(_parentBindingName,[[keys objectAtIndex:0] stringWithoutPrefix:@"~"]); + _isNonMandatory=YES; + }; + if ([keys count]>1) + { + ASSIGN(_keyPath,[[keys subarrayWithRange:NSMakeRange(1,[keys count]-1)]componentsJoinedByString:@"."]); + }; + }; + NSDebugMLLog(@"associations",@"parentBindingName=%@",_parentBindingName); + NSDebugMLLog(@"associations",@"keyPath=%@",_keyPath); + }; LOGObjectFnStop(); return self; }; @@ -64,8 +70,8 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(parentBindingName); - DESTROY(keyPath); + DESTROY(_parentBindingName); + DESTROY(_keyPath); [super dealloc]; }; @@ -73,8 +79,9 @@ static char rcsId[] = "$Id$"; -(id)copyWithZone:(NSZone*)zone; { GSWBindingNameAssociation* clone = [super copyWithZone:zone]; - ASSIGN(clone->parentBindingName,parentBindingName); - ASSIGN(clone->keyPath,keyPath); + ASSIGN(clone->_parentBindingName,_parentBindingName); + ASSIGN(clone->_keyPath,_keyPath); + _isNonMandatory=_isNonMandatory; return clone; }; @@ -82,96 +89,96 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - parentBindingName=%@ keyPath=%@>", - object_get_class_name(self), - (void*)self, - parentBindingName, - keyPath]; + object_get_class_name(self), + (void*)self, + _parentBindingName, + _keyPath]; }; //-------------------------------------------------------------------- --(BOOL)isImplementedForComponent:(NSObject*)object_ +-(BOOL)isImplementedForComponent:(NSObject*)object { - BOOL _isImplemented=NO; + BOOL isImplemented=NO; LOGObjectFnStart(); - _isImplemented=[object_ hasBinding:parentBindingName]; + isImplemented=(BOOL)[object hasBinding:_parentBindingName]; LOGObjectFnStop(); - return _isImplemented; + return isImplemented; }; //-------------------------------------------------------------------- --(id)valueInObject:(id)object_ +-(id)valueInObject:(id)object { - id _value=nil; + id value=nil; LOGObjectFnStart(); - NSDebugMLLog(@"associations",@"parentBindingName=%@",parentBindingName); - NSDebugMLLog(@"associations",@"keyPath=%@",keyPath); - NSDebugMLLog(@"associations",@"object_=%@",object_); - if (object_) - { -/* -#if !GSWEB_STRICT - if (!isNonMandatory) -#endif - { - if (![self isImplementedForComponent:object_]) - { - ExceptionRaise(NSGenericException,@"%@ is not implemented for object of class %@", - self, - [object_ class]); - }; - }; -*/ - _value=[object_ valueForBinding:parentBindingName]; - NSDebugMLLog(@"associations",@"_value=%@",_value); - if (_value && keyPath) - { - _value=[GSWAssociation valueInObject:_value - forKeyPath:keyPath]; - NSDebugMLLog(@"associations",@"_value=%@",_value); - }; - }; - NSDebugMLLog(@"associations",@"_value=%@",_value); - [self logTakeValue:_value]; + NSDebugMLLog(@"associations",@"parentBindingName=%@",_parentBindingName); + NSDebugMLLog(@"associations",@"keyPath=%@",_keyPath); + NSDebugMLLog(@"associations",@"object=%@",object); + if (object) + { + /* + #if !GSWEB_STRICT + if (!isNonMandatory) + #endif + { + if (![self isImplementedForComponent:object_]) + { + ExceptionRaise(NSGenericException,@"%@ is not implemented for object of class %@", + self, + [object_ class]); + }; + }; + */ + value=[object valueForBinding:_parentBindingName]; + NSDebugMLLog(@"associations",@"value=%@",value); + if (value && _keyPath) + { + value=[GSWAssociation valueInObject:value + forKeyPath:_keyPath]; + NSDebugMLLog(@"associations",@"value=%@",value); + }; + }; + NSDebugMLLog(@"associations",@"value=%@",value); + [self logTakeValue:value]; LOGObjectFnStop(); - return _value; + return value; }; //-------------------------------------------------------------------- --(void)setValue:(id)value_ - inObject:(id)object_ +-(void)setValue:(id)value + inObject:(id)object { LOGObjectFnStart(); - NSDebugMLLog(@"associations",@"parentBindingName=%@",parentBindingName); - NSDebugMLLog(@"associations",@"keyPath=%@",keyPath); - if (object_) - { - [object_ validateValue:&value_ - forKey:self]; -/* -#if !GSWEB_STRICT - if (!isNonMandatory) -#endif - { - if (![self isImplementedForComponent:object_]) - { - ExceptionRaise(NSGenericException,@"%@ is not implemented for object of class %@", - self, - [object_ class]); - }; - }; -*/ - if (keyPath) - { - id tmpValue=[object_ valueForBinding:parentBindingName]; - [GSWAssociation setValue:value_ - inObject:tmpValue - forKeyPath:keyPath]; - } - else - [object_ setValue:value_ - forBinding:parentBindingName]; - }; - [self logSetValue:value_]; + NSDebugMLLog(@"associations",@"parentBindingName=%@",_parentBindingName); + NSDebugMLLog(@"associations",@"keyPath=%@",_keyPath); + if (object) + { + [object validateValue:&value + forKey:self]; + /* + #if !GSWEB_STRICT + if (!isNonMandatory) + #endif + { + if (![self isImplementedForComponent:object_]) + { + ExceptionRaise(NSGenericException,@"%@ is not implemented for object of class %@", + self, + [object_ class]); + }; + }; + */ + if (_keyPath) + { + id tmpValue=[object valueForBinding:_parentBindingName]; + [GSWAssociation setValue:value + inObject:tmpValue + forKeyPath:_keyPath]; + } + else + [object setValue:value + forBinding:_parentBindingName]; + }; + [self logSetValue:value]; LOGObjectFnStop(); }; diff --git a/GSWeb.framework/GSWBundle.h b/GSWeb.framework/GSWBundle.h index 962c572..d7f471c 100644 --- a/GSWeb.framework/GSWBundle.h +++ b/GSWeb.framework/GSWBundle.h @@ -1,11 +1,16 @@ -/* GSWBundle.h - GSWeb: Class GSWBundle - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWBundle.h - GSWeb: Class GSWBundle + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,21 +36,21 @@ //==================================================================== @interface GSWBundle : NSObject { - NSString* path; - NSString* baseURL; - NSString* frameworkName; - NSMutableDictionary* archiveCache; - NSMutableDictionary* apiCache;//NDFN - NSMutableDictionary* encodingCache; - NSMutableDictionary* pathCache; - NSMutableDictionary* urlCache; - NSMutableDictionary* stringsTableCache; - NSMutableDictionary* stringsTableArrayCache; //NDFN - NSMutableDictionary* templateCache; - NSMutableDictionary* classCache; - NSRecursiveLock* selfLock; + NSString* _path; + NSString* _baseURL; + NSString* _frameworkName; + NSMutableDictionary* _archiveCache; + NSMutableDictionary* _apiCache;//NDFN + NSMutableDictionary* _encodingCache; + NSMutableDictionary* _pathCache; + NSMutableDictionary* _urlCache; + NSMutableDictionary* _stringsTableCache; + NSMutableDictionary* _stringsTableArrayCache; //NDFN + NSMutableDictionary* _templateCache; + NSMutableDictionary* _classCache; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; + int _selfLockn; #endif }; @@ -53,11 +59,11 @@ -(NSString*)frameworkName; -(NSString*)description; -(void)dealloc; --(id)initWithPath:(NSString*)path_ - baseURL:(NSString*)baseURL_ - inFrameworkNamed:(NSString*)frameworkName_; --(id)initWithPath:(NSString*)path_ - baseURL:(NSString*)baseURL_; +-(id)initWithPath:(NSString*)aPath + baseURL:(NSString*)aBaseURL + inFrameworkNamed:(NSString*)aFrameworkName; +-(id)initWithPath:(NSString*)aPath + baseURL:(NSString*)aBaseURL; -(void)unlock; -(void)lock; @@ -69,75 +75,75 @@ @end @interface GSWBundle (GSWBundleA) --(id)lockedResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - withLanguages:(NSArray*)languages_ - usingCache:(NSMutableDictionary*)cache_ - relativePath:(NSString**)relativePath_ - absolutePath:(NSString**)absolutePath_; +-(id)lockedResourceNamed:(NSString*)aName + ofType:(NSString*)aType + withLanguages:(NSArray*)languages + usingCache:(NSMutableDictionary*)cache + relativePath:(NSString**)relativePath + absolutePath:(NSString**)absolutePath; @end @interface GSWBundle (GSWResourceManagement) --(void)initializeObject:(id)object_ - fromArchiveNamed:(NSString*)name_; +-(void)initializeObject:(id)anObject + fromArchiveNamed:(NSString*)aName; --(void)initializeObject:(id)object_ - fromArchive:(NSDictionary*)archive; +-(void)initializeObject:(id)anObject + fromArchive:(NSDictionary*)archive; --(Class)scriptedClassWithName:(NSString*)name_ - superclassName:(NSString*)superclassName_; +-(Class)scriptedClassWithName:(NSString*)aName + superclassName:(NSString*)superclassName; --(Class)lockedScriptedClassWithName:(NSString*)name_ - pathName:(NSString*)pathName_ - superclassName:(NSString*)superclassName_; +-(Class)lockedScriptedClassWithName:(NSString*)aName + pathName:(NSString*)pathName + superclassName:(NSString*)superclassName; --(NSString*)lockedScriptedClassPathWithName:(NSString*)name_; +-(NSString*)lockedScriptedClassPathWithName:(NSString*)aName; --(Class)compiledClassWithName:(NSString*)name_ - superclassName:(NSString*)superclassName_; +-(Class)compiledClassWithName:(NSString*)aName + superclassName:(NSString*)superclassName; --(GSWElement*)templateNamed:(NSString*)name_ - languages:(NSArray*)languages_; +-(GSWElement*)templateNamed:(NSString*)aName + languages:(NSArray*)languages; --(GSWElement*)lockedTemplateNamed:(NSString*)name_ - languages:(NSArray*)languages_; +-(GSWElement*)lockedTemplateNamed:(NSString*)aName + languages:(NSArray*)languages; -(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)name_ - withDefaultValue:(NSString*)defaultValue_ - languages:(NSArray*)languages_; + inTableNamed:(NSString*)aName + withDefaultValue:(NSString*)defaultValue + languages:(NSArray*)languages; //NDFN --(NSDictionary*)stringsTableNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_; +-(NSDictionary*)stringsTableNamed:(NSString*)aName + withLanguages:(NSArray*)languages; //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_; +-(NSArray*)stringsTableArrayNamed:(NSString*)aName + withLanguages:(NSArray*)languages; --(NSString*)urlForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_; +-(NSString*)urlForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)languages + request:(GSWRequest*)aRequest; --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_; +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)languages; --(NSStringEncoding)encodingForResourcesNamed:(NSString*)name_; +-(NSStringEncoding)encodingForResourcesNamed:(NSString*)aName; --(NSDictionary*)archiveNamed:(NSString*)name_; --(NSDictionary*)apiNamed:(NSString*)name_;//NDFN +-(NSDictionary*)archiveNamed:(NSString*)aName; +-(NSDictionary*)apiNamed:(NSString*)aName;//NDFN --(NSDictionary*)lockedArchiveNamed:(NSString*)name_; --(NSDictionary*)lockedApiNamed:(NSString*)name_;//NDFN +-(NSDictionary*)lockedArchiveNamed:(NSString*)aName; +-(NSDictionary*)lockedApiNamed:(NSString*)aName;//NDFN @end - + @interface GSWBundle (GSWBundleC) --(id)scriptedClassNameFromClassName:(NSString*)name_; --(id)scriptPathNameFromScriptedClassName:(NSString*)name_; +-(id)scriptedClassNameFromClassName:(NSString*)aName; +-(id)scriptPathNameFromScriptedClassName:(NSString*)aName; @end #endif //_GSWBundle_h__ diff --git a/GSWeb.framework/GSWBundle.m b/GSWeb.framework/GSWBundle.m index 2834d31..599298b 100644 --- a/GSWeb.framework/GSWBundle.m +++ b/GSWeb.framework/GSWBundle.m @@ -2,8 +2,8 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Mar 1999 + Written by: Manuel Guesdon + Date: Mar 1999 $Revision$ $Date$ @@ -76,40 +76,40 @@ objectForReference:(NSString*)keyPath @implementation GSWBundle //-------------------------------------------------------------------- --(id)initWithPath:(NSString*)path_ - baseURL:(NSString*)baseURL_ +-(id)initWithPath:(NSString*)aPath + baseURL:(NSString*)aBaseURL { - return [self initWithPath:path_ - baseURL:baseURL_ - inFrameworkNamed:nil]; + return [self initWithPath:aPath + baseURL:aBaseURL + inFrameworkNamed:nil]; }; //-------------------------------------------------------------------- --(id)initWithPath:(NSString*)path_ - baseURL:(NSString*)baseURL_ - inFrameworkNamed:(NSString*)frameworkName_ +-(id)initWithPath:(NSString*)aPath + baseURL:(NSString*)aBaseURL + inFrameworkNamed:(NSString*)aFrameworkName { if ((self=[super init])) - { - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"path_=%@",path_); - NSDebugMLLog(@"bundles",@"baseURL_=%@",baseURL_); - ASSIGN(path,[path_ stringGoodPath]); - NSDebugMLLog(@"bundles",@"path=%@",path); - ASSIGN(baseURL,baseURL_); - ASSIGN(frameworkName,frameworkName_); - archiveCache=[NSMutableDictionary new]; - apiCache=[NSMutableDictionary new]; - encodingCache=[NSMutableDictionary new]; - pathCache=[NSMutableDictionary new]; - urlCache=[NSMutableDictionary new]; - stringsTableCache=[NSMutableDictionary new]; - stringsTableArrayCache=[NSMutableDictionary new]; - templateCache=[NSMutableDictionary new]; - classCache=[NSMutableDictionary new]; - selfLock=[NSRecursiveLock new]; - LOGObjectFnStop(); - }; + { + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aPath=%@",aPath); + NSDebugMLLog(@"bundles",@"aBaseURL=%@",aBaseURL); + ASSIGN(_path,[aPath stringGoodPath]); + NSDebugMLLog(@"bundles",@"path=%@",_path); + ASSIGN(_baseURL,aBaseURL); + ASSIGN(_frameworkName,aFrameworkName); + _archiveCache=[NSMutableDictionary new]; + _apiCache=[NSMutableDictionary new]; + _encodingCache=[NSMutableDictionary new]; + _pathCache=[NSMutableDictionary new]; + _urlCache=[NSMutableDictionary new]; + _stringsTableCache=[NSMutableDictionary new]; + _stringsTableArrayCache=[NSMutableDictionary new]; + _templateCache=[NSMutableDictionary new]; + _classCache=[NSMutableDictionary new]; + _selfLock=[NSRecursiveLock new]; + LOGObjectFnStop(); + }; return self; }; @@ -118,29 +118,29 @@ objectForReference:(NSString*)keyPath { GSWLogC("Dealloc GSWBundle"); GSWLogC("Dealloc GSWBundle: path"); - DESTROY(path); + DESTROY(_path); GSWLogC("Dealloc GSWBundle: baseURL"); - DESTROY(baseURL); + DESTROY(_baseURL); GSWLogC("Dealloc GSWBundle: archiveCache"); - DESTROY(archiveCache); + DESTROY(_archiveCache); GSWLogC("Dealloc GSWBundle: apiCache"); - DESTROY(apiCache); + DESTROY(_apiCache); GSWLogC("Dealloc GSWBundle: encodingCache"); - DESTROY(encodingCache); + DESTROY(_encodingCache); GSWLogC("Dealloc GSWBundle: pathCache"); - DESTROY(pathCache); + DESTROY(_pathCache); GSWLogC("Dealloc GSWBundle: urlCache"); - DESTROY(urlCache); + DESTROY(_urlCache); GSWLogC("Dealloc GSWBundle: stringsTableCache"); - DESTROY(stringsTableCache); + DESTROY(_stringsTableCache); GSWLogC("Dealloc GSWBundle: stringsTableArrayCache"); - DESTROY(stringsTableArrayCache); + DESTROY(_stringsTableArrayCache); GSWLogC("Dealloc GSWBundle: templateCache"); - DESTROY(templateCache); + DESTROY(_templateCache); GSWLogC("Dealloc GSWBundle: classCache"); - DESTROY(classCache); + DESTROY(_classCache); GSWLogC("Dealloc GSWBundle: selfLock"); - DESTROY(selfLock); + DESTROY(_selfLock); GSWLogC("Dealloc GSWBundle Super"); [super dealloc]; GSWLogC("End Dealloc GSWBundle"); @@ -149,19 +149,19 @@ objectForReference:(NSString*)keyPath //-------------------------------------------------------------------- -(NSString*)baseURL { - return baseURL; + return _baseURL; }; //-------------------------------------------------------------------- -(NSString*)path { - return path; + return _path; }; //-------------------------------------------------------------------- -(NSString*)frameworkName { - return frameworkName; + return _frameworkName; }; //-------------------------------------------------------------------- @@ -171,15 +171,15 @@ objectForReference:(NSString*)keyPath // GSWLogC("GSWBundle description A"); // NSDebugMLLog(@"bundles",@"GSWBundle description Self=%p",self); descr=[NSString stringWithFormat:@"<%s %p - ", - object_get_class_name(self), - (void*)self]; -// GSWLogC("GSWBundle description B"); + object_get_class_name(self), + (void*)self]; + // GSWLogC("GSWBundle description B"); descr=[descr stringByAppendingFormat:@"path:[%@] ", - path]; -// GSWLogC("GSWBundle description C"); + _path]; + // GSWLogC("GSWBundle description C"); descr=[descr stringByAppendingFormat:@"baseURL:[%@] frameworkName:[%@]>", - baseURL, - frameworkName]; + _baseURL, + _frameworkName]; // GSWLogC("GSWBundle description D"); return descr; }; @@ -188,12 +188,12 @@ objectForReference:(NSString*)keyPath -(void)unlock { LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"selfLockn=%d",selfLockn); - TmpUnlock(selfLock); + NSDebugMLLog(@"bundles",@"selfLockn=%d",_selfLockn); + TmpUnlock(_selfLock); #ifndef NDEBUG - selfLockn--; + _selfLockn--; #endif - NSDebugMLLog(@"bundles",@"selfLockn=%d",selfLockn); + NSDebugMLLog(@"bundles",@"selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; @@ -201,12 +201,12 @@ objectForReference:(NSString*)keyPath -(void)lock { LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"selfLockn=%d",selfLockn); - TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + NSDebugMLLog(@"bundles",@"selfLockn=%d",_selfLockn); + TmpLockBeforeDate(_selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); #ifndef NDEBUG - selfLockn++; + _selfLockn++; #endif - NSDebugMLLog(@"bundles",@"selfLockn=%d",selfLockn); + NSDebugMLLog(@"bundles",@"selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; @@ -222,17 +222,18 @@ objectForReference:(NSString*)keyPath LOGObjectFnStart(); [self lock]; NS_DURING - { - //TemplateCache clearr ? - LOGObjectFnNotImplemented(); //TODOFN - } + { + //TemplateCache clearr ? + LOGObjectFnNotImplemented(); //TODOFN + } NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -248,74 +249,79 @@ objectForReference:(NSString*)keyPath //==================================================================== @implementation GSWBundle (GSWBundleA) --(id)lockedResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - withLanguages:(NSArray*)languages_ - usingCache:(NSMutableDictionary*)cache_ - relativePath:(NSString**)relativePath_ - absolutePath:(NSString**)absolutePath_ +-(id)lockedResourceNamed:(NSString*)aName + ofType:(NSString*)aType + withLanguages:(NSArray*)someLanguages + usingCache:(NSMutableDictionary*)aCache + relativePath:(NSString**)aRelativePath + absolutePath:(NSString**)anAbsolutePath { - int _languageIndex=0; - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - NSString* _fileName=nil; - NSString* _language=nil; - id _resource=nil; - NSString* _path=nil; - NSFileManager* _fileManager=nil; - int _languagesNb=nil; - BOOL _exists=NO; + int languageIndex=0; + NSString* relativePath=nil; + NSString* absolutePath=nil; + NSString* fileName=nil; + NSString* language=nil; + id resource=nil; + NSString* path=nil; + NSFileManager* fileManager=nil; + int languagesNb=nil; + BOOL exists=NO; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"type=%@",type_); - _languagesNb=[languages_ count]; + NSDebugMLLog(@"bundles",@"type=%@",aType); + languagesNb=[someLanguages count]; - _fileManager=[NSFileManager defaultManager]; + fileManager=[NSFileManager defaultManager]; + NSAssert(fileManager,@"No fileManager"); - _fileName=[NSString stringWithFormat:@"%@.%@",name_,type_]; - NSDebugMLLog(@"bundles",@"fileName=%@",_fileName); - for(_languageIndex=0;!_resource && !_path && _languageIndex<=_languagesNb;_languageIndex++) - { - _language=nil; - if (_languageIndex==_languagesNb) - _relativePath=[NSString stringWithFormat:@"/%@", - _fileName]; - else - { - _language=[languages_ objectAtIndex:_languageIndex]; - _relativePath=[NSString stringWithFormat:@"/%@.%@/%@", - _language, - GSLanguageSuffix, - _fileName]; - }; - _absolutePath=[path stringByAppendingString:_relativePath]; - if ([[GSWApplication application] isCachingEnabled]) - _resource=[cache_ objectForKey:_relativePath]; - if (_resource==GSNotFoundMarker) + fileName=[NSString stringWithFormat:@"%@.%@",aName,aType]; + NSDebugMLLog(@"bundles",@"fileName=%@",fileName); + for(languageIndex=0;!resource && !path && languageIndex<=languagesNb;languageIndex++) + { + language=nil; + if (languageIndex==languagesNb) + relativePath=[NSString stringWithFormat:@"/%@", + fileName]; + else + { + language=[someLanguages objectAtIndex:languageIndex]; + relativePath=[NSString stringWithFormat:@"/%@.%@/%@", + language, + GSLanguageSuffix, + fileName]; + }; + NSDebugMLLog(@"bundles",@"language=%@",language); + NSDebugMLLog(@"bundles",@"relativePath=%@",relativePath); + absolutePath=[_path stringByAppendingString:relativePath]; + NSDebugMLLog(@"bundles",@"absolutePath=%@",absolutePath); + if ([[GSWApplication application] isCachingEnabled]) + resource=[aCache objectForKey:relativePath]; + NSDebugMLLog(@"bundles",@"resource=%@",resource); + if (resource==GSNotFoundMarker) + { + resource=nil; + absolutePath=nil; + relativePath=nil; + } + else if (!resource) + { + exists=[fileManager fileExistsAtPath:absolutePath]; + NSDebugMLLog(@"bundles",@"%@ exists=%s",absolutePath,(exists ? "YES" : "NO")); + if (!exists) { - _resource=nil; - _absolutePath=nil; - _relativePath=nil; - } - else if (!_resource) - { - _exists=[_fileManager fileExistsAtPath:_absolutePath]; - NSDebugMLLog(@"bundles",@"%@ _exists=%s",_absolutePath,(_exists ? "YES" : "NO")); - if (!_exists) - { - if ([[GSWApplication application] isCachingEnabled]) - [cache_ setObject:GSNotFoundMarker - forKey:_relativePath]; - _relativePath=nil; - _absolutePath=nil; - }; - }; + if ([[GSWApplication application] isCachingEnabled]) + [aCache setObject:GSNotFoundMarker + forKey:relativePath]; + relativePath=nil; + absolutePath=nil; + }; + }; }; - if (relativePath_) - *relativePath_=_relativePath; - if (absolutePath_) - *absolutePath_=_absolutePath; + if (aRelativePath) + *aRelativePath=relativePath; + if (anAbsolutePath) + *anAbsolutePath=absolutePath; LOGObjectFnStop(); - return _resource; + return resource; }; @end @@ -323,55 +329,55 @@ objectForReference:(NSString*)keyPath @implementation GSWBundle (GSWResourceManagement) //-------------------------------------------------------------------- --(void)initializeObject:(id)object_ - fromArchiveNamed:(NSString*)name_ +-(void)initializeObject:(id)anObject + fromArchiveNamed:(NSString*)aName { //OK - NSDictionary* _archive=nil; + NSDictionary* archive=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"object_:%@",object_); - NSDebugMLLog(@"bundles",@"name_:%@",name_); + NSDebugMLLog(@"bundles",@"anObject:%@",anObject); + NSDebugMLLog(@"bundles",@"aName:%@",aName); //call application _isDynamicLoadingEnabled //call -- isTerminating //call -- isCachingEnabled //call -- isPageRefreshOnBacktrackEnabled//0 - _archive=[self archiveNamed:name_]; + archive=[self archiveNamed:aName]; //Verify - NSDebugMLLog(@"bundles",@"_archive:%@",_archive); - if (_archive) - [self initializeObject:object_ - fromArchive:_archive]; + NSDebugMLLog(@"bundles",@"archive:%@",archive); + if (archive) + [self initializeObject:anObject + fromArchive:archive]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)initializeObject:(id)object_ - fromArchive:(NSDictionary*)archive_ +-(void)initializeObject:(id)anObject + fromArchive:(NSDictionary*)anArchive { LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"object_:%@",object_); - NSDebugMLLog(@"bundles",@"archive_:%@",archive_); + NSDebugMLLog(@"bundles",@"anObject:%@",anObject); + NSDebugMLLog(@"bundles",@"anArchive:%@",anArchive); [self lock]; NS_DURING { if (!WOStrictFlag) { - NSDictionary* _userDictionary=[archive_ objectForKey:@"userDictionary"]; - NSDictionary* _userAssociations=[archive_ objectForKey:@"userAssociations"]; - NSDictionary* _defaultAssociations=[archive_ objectForKey:@"defaultAssociations"]; - NSDebugMLLog(@"bundles",@"_userDictionary:%@",_userDictionary); - NSDebugMLLog(@"bundles",@"_userAssociations:%@",_userAssociations); - NSDebugMLLog(@"bundles",@"_defaultAssociations:%@",_defaultAssociations); - _userAssociations=[_userAssociations dictionaryByReplacingStringsWithAssociations]; - NSDebugMLLog(@"bundles",@"_userAssociations:%@",_userAssociations); - _defaultAssociations=[_defaultAssociations dictionaryByReplacingStringsWithAssociations]; - NSDebugMLLog(@"bundles",@"_defaultAssociations:%@",_defaultAssociations); - if (_userDictionary && [object_ respondsToSelector:@selector(setUserDictionary:)]) - [object_ setUserDictionary:_userDictionary]; - if (_userAssociations && [object_ respondsToSelector:@selector(setUserAssociations:)]) - [object_ setUserAssociations:_userAssociations]; - if (_defaultAssociations && [object_ respondsToSelector:@selector(setDefaultAssociations:)]) - [object_ setDefaultAssociations:_defaultAssociations]; + NSDictionary* userDictionary=[anArchive objectForKey:@"userDictionary"]; + NSDictionary* userAssociations=[anArchive objectForKey:@"userAssociations"]; + NSDictionary* defaultAssociations=[anArchive objectForKey:@"defaultAssociations"]; + NSDebugMLLog(@"bundles",@"userDictionary:%@",userDictionary); + NSDebugMLLog(@"bundles",@"userAssociations:%@",userAssociations); + NSDebugMLLog(@"bundles",@"defaultAssociations:%@",defaultAssociations); + userAssociations=[userAssociations dictionaryByReplacingStringsWithAssociations]; + NSDebugMLLog(@"bundles",@"userAssociations:%@",userAssociations); + defaultAssociations=[defaultAssociations dictionaryByReplacingStringsWithAssociations]; + NSDebugMLLog(@"bundles",@"defaultAssociations:%@",defaultAssociations); + if (userDictionary && [anObject respondsToSelector:@selector(setUserDictionary:)]) + [anObject setUserDictionary:userDictionary]; + if (userAssociations && [anObject respondsToSelector:@selector(setUserAssociations:)]) + [anObject setUserAssociations:userAssociations]; + if (defaultAssociations && [anObject respondsToSelector:@selector(setDefaultAssociations:)]) + [anObject setDefaultAssociations:defaultAssociations]; }; #if GDL2 // GDL2 implementation { @@ -380,11 +386,11 @@ objectForReference:(NSString*)keyPath NSDictionary* variables=nil; NSEnumerator* variablesEnum=nil; id variableName=nil; - NSDebugMLLog(@"bundles",@"archive_ %p:%@",archive_,archive_); - unarchiver=[[[EOKeyValueUnarchiver alloc] initWithDictionary:archive_] + NSDebugMLLog(@"bundles",@"anArchive %p:%@",anArchive,anArchive); + unarchiver=[[[EOKeyValueUnarchiver alloc] initWithDictionary:anArchive] autorelease]; NSDebugMLLog(@"bundles",@"unarchiver %p:%@",unarchiver,unarchiver); - bundleDelegate=[[[GSWBundleUnarchiverDelegate alloc] initWithObject:object_] + bundleDelegate=[[[GSWBundleUnarchiverDelegate alloc] initWithObject:anObject] autorelease]; NSDebugMLLog(@"bundles",@"bundleDelegate %p:%@",bundleDelegate,bundleDelegate); [unarchiver setDelegate:bundleDelegate]; @@ -401,7 +407,7 @@ objectForReference:(NSString*)keyPath { id variableValue=[variables objectForKey:variableName]; NSDebugMLLog(@"bundles",@"ObjectClas=%@ variableName %p:%@ variableValue %p:%@", - [object_ class], + [anObject class], variableName, variableName, variableValue, @@ -410,7 +416,7 @@ objectForReference:(NSString*)keyPath variableValue, variableValue, [variableValue retainCount]); - [object_ smartTakeValue:variableValue + [anObject smartTakeValue:variableValue forKey:variableName]; NSDebugMLLog(@"bundles",@"AFT variableValue %p:%@ [RC=%d]", variableValue, @@ -439,660 +445,669 @@ objectForReference:(NSString*)keyPath }; //-------------------------------------------------------------------- --(Class)scriptedClassWithName:(NSString*)name_ - superclassName:(NSString*)superclassName_ +-(Class)scriptedClassWithName:(NSString*)aName + superclassName:(NSString*)aSuperclassName { //OK - Class _class=nil; - NSString* _pathName=nil; + Class aClass=nil; + NSString* pathName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name=%@",name_); - NSDebugMLLog(@"bundles",@"superclassName_=%@",superclassName_); + NSDebugMLLog(@"bundles",@"Name=%@",aName); + NSDebugMLLog(@"bundles",@"aSuperclassName=%@",aSuperclassName); [self lock]; NS_DURING - { - _pathName=[self lockedScriptedClassPathWithName:name_]; - //Verify - if (_pathName) - { - _class=[self lockedScriptedClassWithName:name_ - pathName:_pathName - superclassName:superclassName_]; - }; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _class; -}; - -//-------------------------------------------------------------------- --(Class)lockedScriptedClassWithName:(NSString*)name_ - pathName:(NSString*)pathName_ - superclassName:(NSString*)superclassName_ -{ - LOGObjectFnNotImplemented(); //TODOFN - return nil; -}; - -//-------------------------------------------------------------------- --(NSString*)lockedScriptedClassPathWithName:(NSString*)name_ -{ - NSString* _path=nil; - id _script=nil; - _script=[self lockedResourceNamed:name_ - ofType:GSWScriptSuffix[GSWebNamingConv] - withLanguages:nil - usingCache:classCache - relativePath:NULL - absolutePath:&_path]; - if (!_script && !_path) - _script=[self lockedResourceNamed:name_ - ofType:GSWScriptSuffix[GSWebNamingConvInversed] - withLanguages:nil - usingCache:classCache - relativePath:NULL - absolutePath:&_path]; - return _path; -}; - -//-------------------------------------------------------------------- --(Class)compiledClassWithName:(NSString*)name_ - superclassName:(NSString*)superclassName_ -{ - LOGObjectFnNotImplemented(); //TODOFN - return nil; -}; - -//-------------------------------------------------------------------- --(GSWElement*)templateNamed:(NSString*)name_ - languages:(NSArray*)languages_ -{ - GSWElement* _template=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name=%@",name_); - //OK - [self lock]; - NS_DURING - { - _template=[self lockedTemplateNamed:name_ - languages:languages_]; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedTemplateNamed"); - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - NSDebugMLLog(@"bundles",@"_template=%@",_template); - LOGObjectFnStop(); - return _template; -}; - -//-------------------------------------------------------------------- --(GSWElement*)lockedTemplateNamed:(NSString*)name_ - languages:(NSArray*)languages_ -{ - //OK - GSWElement* _template=nil; - NSString* _relativeTemplatePath=nil; - NSString* _absoluteTemplatePath=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"Languages_=%@",languages_); - NSDebugMLLog(@"bundles",@"Path=%@",path); - NSDebugMLLog(@"bundles",@"baseURL=%@",baseURL); - NSDebugMLLog(@"bundles",@"frameworkName=%@",frameworkName); - _template=[self lockedResourceNamed:name_ - ofType:GSWComponentTemplateSuffix - withLanguages:languages_ - usingCache:templateCache - relativePath:&_relativeTemplatePath - absolutePath:&_absoluteTemplatePath]; - if (!_template) - { - if (!_relativeTemplatePath) - { - NSDebugMLLog(@"errors",@"No template named:%@ for languages:%@", - name_, - languages_); - } - else - { - NSStringEncoding encoding=[self encodingForResourcesNamed:name_]; - NSString* _pageDefString=nil; - //TODO use encoding ! - NSString* _htmlString=[NSString stringWithContentsOfFile:_absoluteTemplatePath]; - NSDebugMLLog(@"bundles",@"htmlPath=%@",_absoluteTemplatePath); - if (!_htmlString) - { - NSDebugMLLog(@"errors",@"No html file for template named:%@ for languages:%@", - name_, - languages_); - } - else - { - NSString* _absoluteDefinitionPath=nil; - _pageDefString=[self lockedResourceNamed:name_ - ofType:GSWComponentDefinitionSuffix[GSWebNamingConv] - withLanguages:languages_ - usingCache:nil - relativePath:NULL - absolutePath:&_absoluteDefinitionPath]; - NSDebugMLLog(@"bundles",@"_absoluteDefinitionPath=%@", - _absoluteDefinitionPath); - if (!_pageDefString && !_absoluteDefinitionPath) - { - _pageDefString=[self lockedResourceNamed:name_ - ofType:GSWComponentDefinitionSuffix[GSWebNamingConvInversed] - withLanguages:languages_ - usingCache:nil - relativePath:NULL - absolutePath:&_absoluteDefinitionPath]; - NSDebugMLLog(@"bundles",@"_absoluteDefinitionPath=%@", - _absoluteDefinitionPath); - }; - - if (_absoluteDefinitionPath) - { - //TODO use encoding ! - NSDebugMLLog(@"bundles",@"_absoluteDefinitionPath=%@", - _absoluteDefinitionPath); - _pageDefString=[NSString stringWithContentsOfFile:_absoluteDefinitionPath]; - }; -#ifndef NDEBUG - NS_DURING -#endif - { - NSDebugMLLog(@"bundles",@"GSWTemplateParser on template named %@", - name_); - _template=[GSWTemplateParserXML templateNamed:name_ - inFrameworkNamed:[self frameworkName] - withParserClassName:nil - withString:_htmlString - encoding:encoding - fromPath:_absoluteTemplatePath - definitionsString:_pageDefString - languages:languages_ - definitionPath:_absoluteDefinitionPath]; - } -#ifndef NDEBUG - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", - localException, - [localException reason], - __FILE__, - __LINE__); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, - @"In template Parsing"); - [localException raise]; - }; - NS_ENDHANDLER; -#endif - GSWLogC("TemplateParsed\n"); - NSDebugMLLog(@"bundles",@"_template=%@",_template); - }; - if ([[GSWApplication application] isCachingEnabled]) - { - if (_template) - [templateCache setObject:_template - forKey:_relativeTemplatePath]; - else - [templateCache setObject:GSNotFoundMarker - forKey:_relativeTemplatePath]; - }; - }; - }; - NSDebugMLLog(@"bundles",@"_template=%@",_template); - LOGObjectFnStop(); - return _template; -}; - -//-------------------------------------------------------------------- --(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)name_ - withDefaultValue:(NSString*)defaultValue_ - languages:(NSArray*)languages_ -{ - NSDictionary* _stringsTable=nil; - NSString* _string=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Key_=%@",key_); - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"Languages_=%@",languages_); - NSDebugMLLog(@"bundles",@"defaultValue_=%@",defaultValue_); - _stringsTable=[self stringsTableNamed:name_ - withLanguages:languages_]; - if (_stringsTable) - _string=[_stringsTable objectForKey:key_]; - if (!_string) - _string=defaultValue_; - LOGObjectFnStop(); - return _string; -}; - -//-------------------------------------------------------------------- -//NDFN --(NSDictionary*)stringsTableNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_ -{ - NSDictionary* _stringsTable=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"Languages_=%@",languages_); - [self lock]; - NS_DURING - { - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - LOGObjectFnStart(); - _stringsTable=[self lockedResourceNamed:name_ - ofType:GSWStringTableSuffix - withLanguages:languages_ - usingCache:stringsTableCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - if (!_stringsTable) - { - if (_absolutePath) - { - //TODO use encoding ?? - _stringsTable=[NSDictionary dictionaryWithContentsOfFile:_absolutePath]; - if (!_stringsTable) - { - NSString* _tmpString=[NSString stringWithContentsOfFile:_absolutePath]; - LOGSeriousError(@"Bad stringTable \n%@\n from file %@", - _tmpString, - _absolutePath); - }; - if ([[GSWApplication application] isCachingEnabled]) - { - if (_stringsTable) - [stringsTableCache setObject:_stringsTable - forKey:_relativePath]; - else - [stringsTableCache setObject:GSNotFoundMarker - forKey:_relativePath]; - }; - }; - }; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _stringsTable; -}; - -//-------------------------------------------------------------------- -//NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_ -{ - NSArray* _stringsTableArray=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"Languages_=%@",languages_); - [self lock]; - NS_DURING - { - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - LOGObjectFnStart(); - _stringsTableArray=[self lockedResourceNamed:name_ - ofType:GSWStringTableArraySuffix - withLanguages:languages_ - usingCache:stringsTableArrayCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - if (!_stringsTableArray) - { - if (_absolutePath) - { - //TODO use encoding ?? - _stringsTableArray=[NSArray arrayWithContentsOfFile:_absolutePath]; - if (!_stringsTableArray) - { - NSString* _tmpString=[NSString stringWithContentsOfFile:_absolutePath]; - LOGSeriousError(@"Bad stringTableArray \n%@\n from file %@", - _tmpString, - _absolutePath); - }; - if ([[GSWApplication application] isCachingEnabled]) - { - if (_stringsTableArray) - [stringsTableArrayCache setObject:_stringsTableArray - forKey:_relativePath]; - else - [stringsTableArrayCache setObject:GSNotFoundMarker - forKey:_relativePath]; - }; - }; - }; - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, - @"During stringsTableArrayNamed:withLanguages:"); - LOGException(@"exception=%@",localException); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _stringsTableArray; -}; - -//-------------------------------------------------------------------- --(NSString*)urlForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_ -{ - BOOL _isUsingWebServer=NO; - NSString* _url=nil; - LOGObjectFnStart(); - _isUsingWebServer=[request_ _isUsingWebServer]; - [self lock]; - NS_DURING - { - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - NSString* _baseURL=nil; - LOGObjectFnStart(); - _baseURL=[self lockedResourceNamed:name_ - ofType:type_ - withLanguages:languages_ - usingCache:urlCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - if (!_baseURL) - { - if (_relativePath) - { - _baseURL=_relativePath; - if ([[GSWApplication application] isCachingEnabled]) - { - [pathCache setObject:_baseURL - forKey:_relativePath]; - }; - }; - }; - if (_baseURL) - { - if (_isUsingWebServer) - { - _url=[baseURL stringByAppendingString:_baseURL]; - } - else - { - NSString* _completePath=[path stringByAppendingString:_baseURL]; - _url=(NSString*)[request_ _urlWithRequestHandlerKey:GSWResourceRequestHandlerKey[GSWebNamingConv] - path:nil - queryString:[NSString stringWithFormat:@"%@=%@", - GSWKey_Data[GSWebNamingConv], - _completePath]];//TODO Escape - }; - }; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _url; -}; - -//-------------------------------------------------------------------- --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ -{ - NSString* _absolutePath=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"type_=%@",type_); - NSDebugMLLog(@"bundles",@"languages_=%@",languages_); - [self lock]; - NS_DURING - { - NSString* _path=nil; - NSString* _relativePath=nil; - LOGObjectFnStart(); - _path=[self lockedResourceNamed:name_ - ofType:type_ - withLanguages:languages_ - usingCache:stringsTableCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - if (_path) - _absolutePath=_path; - else if (_absolutePath - &&[[GSWApplication application] isCachingEnabled]) - { - [pathCache setObject:_absolutePath - forKey:_relativePath]; - }; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _absolutePath; -}; - -//-------------------------------------------------------------------- --(NSStringEncoding)encodingForResourcesNamed:(NSString*)name_ -{ - NSDictionary* _archive=nil; - NSStringEncoding _encoding=GSUndefinedEncoding; - id _encodingObject=nil; - LOGObjectFnStart(); - [self lock]; - NS_DURING - { - NSDebugMLLog(@"bundles",@"Name_=%@",name_); - NSDebugMLLog(@"bundles",@"encodingCache=%@",encodingCache); - NSDebugMLLog(@"bundles",@"archiveCache=%@",archiveCache); - _encodingObject=[encodingCache objectForKey:name_]; - if (!_encodingObject) - { - _archive=[self archiveNamed:name_]; - if (_archive) - { - _encodingObject=[_archive objectForKey:@"encoding"]; - if (_encodingObject) - { - _encodingObject=[NSNumber valueFromString:_encodingObject]; - [encodingCache setObject:_encodingObject - forKey:name_]; - }; - }; - }; - if (_encodingObject) - _encoding=[_encodingObject unsignedIntValue]; - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - LOGObjectFnStop(); - return _encoding; -}; - -//-------------------------------------------------------------------- --(NSDictionary*)archiveNamed:(NSString*)name_ -{ - //OK - NSDictionary* _archive=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@",name_); - [self lock]; - NS_DURING - { - _archive=[self lockedArchiveNamed:name_]; - NSDebugMLLog(@"bundles",@"_archive=%@",_archive); - } - NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; - NS_ENDHANDLER; - [self unlock]; - NSDebugMLLog(@"bundles",@"_archive=%@",_archive); - LOGObjectFnStop(); - return _archive; -}; - -//-------------------------------------------------------------------- --(NSDictionary*)lockedArchiveNamed:(NSString*)name_ -{ - //OK - NSDictionary* _archive=nil; - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - BOOL _isCachingEnabled=NO; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"search=%@.%@",name_,GSWArchiveSuffix[GSWebNamingConv]); - _archive=[self lockedResourceNamed:name_ - ofType:GSWArchiveSuffix[GSWebNamingConv] - withLanguages:nil - usingCache:archiveCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - NSDebugMLLog(@"bundles",@"_archive=%p _absolutePath=%@",_archive,_absolutePath); - if (!_archive && !_absolutePath) { - NSDebugMLLog(@"bundles",@"search=%@.%@",name_,GSWArchiveSuffix[GSWebNamingConvInversed]); - _archive=[self lockedResourceNamed:name_ - ofType:GSWArchiveSuffix[GSWebNamingConvInversed] - withLanguages:nil - usingCache:archiveCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - NSDebugMLLog(@"bundles",@"_archive=%p _absolutePath=%@",_archive,_absolutePath); - }; - if (!_archive) - { - if (_absolutePath) - { - _archive=[NSDictionary dictionaryWithContentsOfFile:_absolutePath]; - if ([[GSWApplication application] isCachingEnabled]) - { - if (_archive) - [pathCache setObject:_archive - forKey:_relativePath]; - else - [archiveCache setObject:GSNotFoundMarker - forKey:_relativePath]; - }; - }; - }; - NSDebugMLLog(@"bundles",@"_archive=%@",_archive); - LOGObjectFnStop(); - return _archive; -}; - -//-------------------------------------------------------------------- --(NSDictionary*)apiNamed:(NSString*)name_ -{ - //OK - NSDictionary* _api=nil; - LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@",name_); - [self lock]; - NS_DURING - { - _api=[self lockedApiNamed:name_]; - NSDebugMLLog(@"bundles",@"_api=%@",_api); - } + pathName=[self lockedScriptedClassPathWithName:aName]; + //Verify + if (pathName) + { + aClass=[self lockedScriptedClassWithName:aName + pathName:pathName + superclassName:aSuperclassName]; + }; + } NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; - NSDebugMLLog(@"bundles",@"_api=%@",_api); LOGObjectFnStop(); - return _api; + return aClass; }; //-------------------------------------------------------------------- --(NSDictionary*)lockedApiNamed:(NSString*)name_ +-(Class)lockedScriptedClassWithName:(NSString*)aName + pathName:(NSString*)aPathName + superclassName:(NSString*)aSuperclassName +{ + LOGObjectFnNotImplemented(); //TODOFN + return nil; +}; + +//-------------------------------------------------------------------- +-(NSString*)lockedScriptedClassPathWithName:(NSString*)aName +{ + NSString* path=nil; + id script=nil; + script=[self lockedResourceNamed:aName + ofType:GSWScriptSuffix[GSWebNamingConv] + withLanguages:nil + usingCache:_classCache + relativePath:NULL + absolutePath:&path]; + if (!script && !path) + script=[self lockedResourceNamed:aName + ofType:GSWScriptSuffix[GSWebNamingConvInversed] + withLanguages:nil + usingCache:_classCache + relativePath:NULL + absolutePath:&path]; + return path; +}; + +//-------------------------------------------------------------------- +-(Class)compiledClassWithName:(NSString*)aName + superclassName:(NSString*)aSuperclassName +{ + LOGObjectFnNotImplemented(); //TODOFN + return nil; +}; + +//-------------------------------------------------------------------- +-(GSWElement*)templateNamed:(NSString*)aName + languages:(NSArray*)someLanguages +{ + GSWElement* template=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"Name=%@",aName); + //OK + [self lock]; + NS_DURING + { + template=[self lockedTemplateNamed:aName + languages:someLanguages]; + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedTemplateNamed"); + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + NSDebugMLLog(@"bundles",@"template=%@",template); + LOGObjectFnStop(); + return template; +}; + +//-------------------------------------------------------------------- +-(GSWElement*)lockedTemplateNamed:(NSString*)aName + languages:(NSArray*)someLanguages { //OK - NSDictionary* _api=nil; - NSString* _relativePath=nil; - NSString* _absolutePath=nil; - BOOL _isCachingEnabled=NO; + GSWElement* template=nil; + NSString* relativeTemplatePath=nil; + NSString* absoluteTemplatePath=nil; LOGObjectFnStart(); - _api=[self lockedResourceNamed:name_ - ofType:GSWAPISuffix - withLanguages:nil - usingCache:apiCache - relativePath:&_relativePath - absolutePath:&_absolutePath]; - if (!_api) - { - if (_absolutePath) - { - _api=[NSDictionary dictionaryWithContentsOfFile:_absolutePath]; - if ([[GSWApplication application] isCachingEnabled]) - { - if (_api) - [apiCache setObject:_api - forKey:_relativePath]; - else - [apiCache setObject:GSNotFoundMarker - forKey:_relativePath]; - }; - }; - }; - NSDebugMLLog(@"bundles",@"_api=%@",_api); + NSDebugMLLog(@"bundles",@"AName=%@",aName); + NSDebugMLLog(@"bundles",@"SomeLanguages=%@",someLanguages); + NSDebugMLLog(@"bundles",@"Path=%@",_path); + NSDebugMLLog(@"bundles",@"baseURL=%@",_baseURL); + NSDebugMLLog(@"bundles",@"frameworkName=%@",_frameworkName); + template=[self lockedResourceNamed:aName + ofType:GSWComponentTemplateSuffix + withLanguages:someLanguages + usingCache:_templateCache + relativePath:&relativeTemplatePath + absolutePath:&absoluteTemplatePath]; + if (!template) + { + if (!relativeTemplatePath) + { + NSDebugMLLog(@"errors",@"No template named:%@ for languages:%@", + aName, + someLanguages); + } + else + { + NSStringEncoding encoding=[self encodingForResourcesNamed:aName]; + NSString* pageDefString=nil; + //TODO use encoding ! + NSString* htmlString=[NSString stringWithContentsOfFile:absoluteTemplatePath]; + NSDebugMLLog(@"bundles",@"htmlPath=%@",absoluteTemplatePath); + if (!htmlString) + { + NSDebugMLLog(@"errors",@"No html file for template named:%@ for languages:%@", + aName, + someLanguages); + } + else + { + NSString* absoluteDefinitionPath=nil; + pageDefString=[self lockedResourceNamed:aName + ofType:GSWComponentDefinitionSuffix[GSWebNamingConv] + withLanguages:someLanguages + usingCache:nil + relativePath:NULL + absolutePath:&absoluteDefinitionPath]; + NSDebugMLLog(@"bundles",@"absoluteDefinitionPath=%@", + absoluteDefinitionPath); + if (!pageDefString && !absoluteDefinitionPath) + { + pageDefString=[self lockedResourceNamed:aName + ofType:GSWComponentDefinitionSuffix[GSWebNamingConvInversed] + withLanguages:someLanguages + usingCache:nil + relativePath:NULL + absolutePath:&absoluteDefinitionPath]; + NSDebugMLLog(@"bundles",@"absoluteDefinitionPath=%@", + absoluteDefinitionPath); + }; + + if (absoluteDefinitionPath) + { + //TODO use encoding ! + NSDebugMLLog(@"bundles",@"absoluteDefinitionPath=%@", + absoluteDefinitionPath); + pageDefString=[NSString stringWithContentsOfFile:absoluteDefinitionPath]; + }; +#ifndef NDEBUG + NS_DURING +#endif + { + NSDebugMLLog(@"bundles",@"GSWTemplateParser on template named %@", + aName); + template=[GSWTemplateParserXML templateNamed:aName + inFrameworkNamed:[self frameworkName] + withParserClassName:nil + withString:htmlString + encoding:encoding + fromPath:absoluteTemplatePath + definitionsString:pageDefString + languages:someLanguages + definitionPath:absoluteDefinitionPath]; + } +#ifndef NDEBUG + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException, + [localException reason], + __FILE__, + __LINE__); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In template Parsing"); + [localException raise]; + }; + NS_ENDHANDLER; +#endif + GSWLogC("TemplateParsed\n"); + NSDebugMLLog(@"bundles",@"template=%@",template); + }; + if ([[GSWApplication application] isCachingEnabled]) + { + if (template) + [_templateCache setObject:template + forKey:relativeTemplatePath]; + else + [_templateCache setObject:GSNotFoundMarker + forKey:relativeTemplatePath]; + }; + }; + }; + NSDebugMLLog(@"bundles",@"template=%@",template); LOGObjectFnStop(); - return _api; + return template; +}; + +//-------------------------------------------------------------------- +-(NSString*)stringForKey:(NSString*)aKey + inTableNamed:(NSString*)aName + withDefaultValue:(NSString*)defaultValue + languages:(NSArray*)someLanguages +{ + NSDictionary* stringsTable=nil; + NSString* string=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"AKey=%@",aKey); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + NSDebugMLLog(@"bundles",@"SomeLanguages=%@",someLanguages); + NSDebugMLLog(@"bundles",@"defaultValue_=%@",defaultValue); + stringsTable=[self stringsTableNamed:aName + withLanguages:someLanguages]; + if (stringsTable) + string=[stringsTable objectForKey:aKey]; + if (!string) + string=defaultValue; + LOGObjectFnStop(); + return string; +}; + +//-------------------------------------------------------------------- +//NDFN +-(NSDictionary*)stringsTableNamed:(NSString*)aName + withLanguages:(NSArray*)someLanguages +{ + NSDictionary* stringsTable=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + NSDebugMLLog(@"bundles",@"SomeLanguages=%@",someLanguages); + [self lock]; + NS_DURING + { + NSString* relativePath=nil; + NSString* absolutePath=nil; + LOGObjectFnStart(); + stringsTable=[self lockedResourceNamed:aName + ofType:GSWStringTableSuffix + withLanguages:someLanguages + usingCache:_stringsTableCache + relativePath:&relativePath + absolutePath:&absolutePath]; + if (!stringsTable) + { + if (absolutePath) + { + //TODO use encoding ?? + stringsTable=[NSDictionary dictionaryWithContentsOfFile:absolutePath]; + if (!stringsTable) + { + NSString* tmpString=[NSString stringWithContentsOfFile:absolutePath]; + LOGSeriousError(@"Bad stringTable \n%@\n from file %@", + tmpString, + absolutePath); + }; + if ([[GSWApplication application] isCachingEnabled]) + { + if (stringsTable) + [_stringsTableCache setObject:stringsTable + forKey:relativePath]; + else + [_stringsTableCache setObject:GSNotFoundMarker + forKey:relativePath]; + }; + }; + }; + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return stringsTable; +}; + +//-------------------------------------------------------------------- +//NDFN +-(NSArray*)stringsTableArrayNamed:(NSString*)aName + withLanguages:(NSArray*)someLanguages +{ + NSArray* stringsTableArray=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + NSDebugMLLog(@"bundles",@"SomeLanguages=%@",someLanguages); + [self lock]; + NS_DURING + { + NSString* relativePath=nil; + NSString* absolutePath=nil; + LOGObjectFnStart(); + stringsTableArray=[self lockedResourceNamed:aName + ofType:GSWStringTableArraySuffix + withLanguages:someLanguages + usingCache:_stringsTableArrayCache + relativePath:&relativePath + absolutePath:&absolutePath]; + if (!stringsTableArray) + { + if (absolutePath) + { + //TODO use encoding ?? + stringsTableArray=[NSArray arrayWithContentsOfFile:absolutePath]; + if (!stringsTableArray) + { + NSString* tmpString=[NSString stringWithContentsOfFile:absolutePath]; + LOGSeriousError(@"Bad stringTableArray \n%@\n from file %@", + tmpString, + absolutePath); + }; + if ([[GSWApplication application] isCachingEnabled]) + { + if (stringsTableArray) + [_stringsTableArrayCache setObject:stringsTableArray + forKey:relativePath]; + else + [_stringsTableArrayCache setObject:GSNotFoundMarker + forKey:relativePath]; + }; + }; + }; + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"During stringsTableArrayNamed:withLanguages:"); + LOGException(@"exception=%@",localException); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return stringsTableArray; +}; + +//-------------------------------------------------------------------- +-(NSString*)urlForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)someLanguages + request:(GSWRequest*)aRequest +{ + BOOL isUsingWebServer=NO; + NSString* url=nil; + LOGObjectFnStart(); + isUsingWebServer=[aRequest _isUsingWebServer]; + [self lock]; + NS_DURING + { + NSString* relativePath=nil; + NSString* absolutePath=nil; + NSString* baseURL=nil; + LOGObjectFnStart(); + baseURL=[self lockedResourceNamed:aName + ofType:aType + withLanguages:someLanguages + usingCache:_urlCache + relativePath:&relativePath + absolutePath:&absolutePath]; + if (!baseURL) + { + if (relativePath) + { + baseURL=relativePath; + if ([[GSWApplication application] isCachingEnabled]) + { + [_pathCache setObject:baseURL + forKey:relativePath]; + }; + }; + }; + if (baseURL) + { + if (isUsingWebServer) + { + url=[_baseURL stringByAppendingString:baseURL]; + } + else + { + NSString* completePath=[_path stringByAppendingString:baseURL]; + url=(NSString*)[aRequest _urlWithRequestHandlerKey:GSWResourceRequestHandlerKey[GSWebNamingConv] + path:nil + queryString:[NSString stringWithFormat:@"%@=%@", + GSWKey_Data[GSWebNamingConv], + completePath]];//TODO Escape + }; + }; + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return url; +}; + +//-------------------------------------------------------------------- +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)someLanguages +{ + NSString* absolutePath=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + NSDebugMLLog(@"bundles",@"aType=%@",aType); + NSDebugMLLog(@"bundles",@"someLanguages=%@",someLanguages); + [self lock]; + NS_DURING + { + NSString* path=nil; + NSString* relativePath=nil; + LOGObjectFnStart(); + path=[self lockedResourceNamed:aName + ofType:aType + withLanguages:someLanguages + usingCache:_stringsTableCache + relativePath:&relativePath + absolutePath:&absolutePath]; + if (path) + absolutePath=path; + else if (absolutePath + &&[[GSWApplication application] isCachingEnabled]) + { + [_pathCache setObject:absolutePath + forKey:relativePath]; + }; + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return absolutePath; +}; + +//-------------------------------------------------------------------- +-(NSStringEncoding)encodingForResourcesNamed:(NSString*)aName +{ + NSDictionary* archive=nil; + NSStringEncoding encoding=GSUndefinedEncoding; + id encodingObject=nil; + LOGObjectFnStart(); + [self lock]; + NS_DURING + { + NSDebugMLLog(@"bundles",@"aName=%@",aName); + NSDebugMLLog(@"bundles",@"encodingCache=%@",_encodingCache); + NSDebugMLLog(@"bundles",@"archiveCache=%@",_archiveCache); + encodingObject=[_encodingCache objectForKey:aName]; + if (!encodingObject) + { + archive=[self archiveNamed:aName]; + if (archive) + { + encodingObject=[archive objectForKey:@"encoding"]; + if (encodingObject) + { + encodingObject=[NSNumber valueFromString:encodingObject]; + [_encodingCache setObject:encodingObject + forKey:aName]; + }; + }; + }; + if (encodingObject) + encoding=[encodingObject unsignedIntValue]; + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + LOGObjectFnStop(); + return encoding; +}; + +//-------------------------------------------------------------------- +-(NSDictionary*)archiveNamed:(NSString*)aName +{ + //OK + NSDictionary* archive=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + [self lock]; + NS_DURING + { + archive=[self lockedArchiveNamed:aName]; + NSDebugMLLog(@"bundles",@"archive=%@",archive); + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + NSDebugMLLog(@"bundles",@"archive=%@",archive); + LOGObjectFnStop(); + return archive; +}; + +//-------------------------------------------------------------------- +-(NSDictionary*)lockedArchiveNamed:(NSString*)aName +{ + //OK + NSDictionary* archive=nil; + NSString* relativePath=nil; + NSString* absolutePath=nil; + BOOL isCachingEnabled=NO; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"search=%@.%@",aName,GSWArchiveSuffix[GSWebNamingConv]); + archive=[self lockedResourceNamed:aName + ofType:GSWArchiveSuffix[GSWebNamingConv] + withLanguages:nil + usingCache:_archiveCache + relativePath:&relativePath + absolutePath:&absolutePath]; + NSDebugMLLog(@"bundles",@"archive=%p absolutePath=%@",archive,absolutePath); + if (!archive && !absolutePath) + { + NSDebugMLLog(@"bundles",@"search=%@.%@",aName,GSWArchiveSuffix[GSWebNamingConvInversed]); + archive=[self lockedResourceNamed:aName + ofType:GSWArchiveSuffix[GSWebNamingConvInversed] + withLanguages:nil + usingCache:_archiveCache + relativePath:&relativePath + absolutePath:&absolutePath]; + NSDebugMLLog(@"bundles",@"archive=%p absolutePath=%@",archive,absolutePath); + }; + if (!archive) + { + if (absolutePath) + { + archive=[NSDictionary dictionaryWithContentsOfFile:absolutePath]; + if ([[GSWApplication application] isCachingEnabled]) + { + if (archive) + [_archiveCache setObject:archive + forKey:relativePath]; + else + [_archiveCache setObject:GSNotFoundMarker + forKey:relativePath]; + }; + }; + }; + NSDebugMLLog(@"bundles",@"archive=%@",archive); + LOGObjectFnStop(); + return archive; +}; + +//-------------------------------------------------------------------- +-(NSDictionary*)apiNamed:(NSString*)aName +{ + //OK + NSDictionary* api=nil; + LOGObjectFnStart(); + NSDebugMLLog(@"bundles",@"aName=%@",aName); + [self lock]; + NS_DURING + { + api=[self lockedApiNamed:aName]; + NSDebugMLLog(@"bundles",@"api=%@",api); + } + NS_HANDLER + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + }; + NS_ENDHANDLER; + [self unlock]; + NSDebugMLLog(@"bundles",@"api=%@",api); + LOGObjectFnStop(); + return api; +}; + +//-------------------------------------------------------------------- +-(NSDictionary*)lockedApiNamed:(NSString*)aName +{ + //OK + NSDictionary* api=nil; + NSString* relativePath=nil; + NSString* absolutePath=nil; + BOOL isCachingEnabled=NO; + LOGObjectFnStart(); + api=[self lockedResourceNamed:aName + ofType:GSWAPISuffix + withLanguages:nil + usingCache:_apiCache + relativePath:&relativePath + absolutePath:&absolutePath]; + if (!api) + { + if (absolutePath) + { + api=[NSDictionary dictionaryWithContentsOfFile:absolutePath]; + if ([[GSWApplication application] isCachingEnabled]) + { + if (api) + [_apiCache setObject:api + forKey:relativePath]; + else + [_apiCache setObject:GSNotFoundMarker + forKey:relativePath]; + }; + }; + }; + NSDebugMLLog(@"bundles",@"api=%@",api); + LOGObjectFnStop(); + return api; }; @end @@ -1101,14 +1116,14 @@ objectForReference:(NSString*)keyPath @implementation GSWBundle (GSWBundleC) //-------------------------------------------------------------------- --(id)scriptedClassNameFromClassName:(NSString*)name_ +-(id)scriptedClassNameFromClassName:(NSString*)aName { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(id)scriptPathNameFromScriptedClassName:(NSString*)name_ +-(id)scriptPathNameFromScriptedClassName:(NSString*)aName { LOGObjectFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWCheckBoxList.m b/GSWeb.framework/GSWCheckBoxList.m index f655974..ac1166b 100644 --- a/GSWeb.framework/GSWCheckBoxList.m +++ b/GSWeb.framework/GSWCheckBoxList.m @@ -311,7 +311,8 @@ static char rcsId[] = "$Id$"; inComponent:component]; prefixValue=[_prefix valueInComponent:component]; suffixValue=[_suffix valueInComponent:component]; - disableValue=[_itemDisabled valueInComponent:component]; + disableValue=[self evaluateCondition:_itemDisabled + inContext:context]; [_index setValue:[NSNumber numberWithShort:i] inComponent:component]; displayStringValue=[_displayString valueInComponent:component]; diff --git a/GSWeb.framework/GSWClientSideScript.h b/GSWeb.framework/GSWClientSideScript.h index cf3f64d..8068808 100644 --- a/GSWeb.framework/GSWClientSideScript.h +++ b/GSWeb.framework/GSWClientSideScript.h @@ -2,7 +2,7 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Feb 1999 $Revision$ diff --git a/GSWeb.framework/GSWComponent.m b/GSWeb.framework/GSWComponent.m index 49cbb37..687ca30 100644 --- a/GSWeb.framework/GSWComponent.m +++ b/GSWeb.framework/GSWComponent.m @@ -199,6 +199,7 @@ static char rcsId[] = "$Id$"; GSWComponentDefinition* aComponentDefinition=nil; LOGObjectFnStart(); aComponentDefinition=[self _componentDefinition]; + NSAssert(aComponentDefinition,@"No componentDefinition"); aFrameworkName=[aComponentDefinition frameworkName]; NSDebugMLLog(@"GSWComponent",@"aFrameworkName=%@",aFrameworkName); LOGObjectFnStop(); @@ -458,7 +459,9 @@ associationsKeys:(NSArray*)associationsKeys LOGObjectFnStart(); if (!template) { + NSDebugMLLog(@"GSWComponent",@"templateName=%@",[self _templateName]); template=[self templateWithName:[self _templateName]]; + NSDebugMLLog(@"GSWComponent",@"template=%p",template); if ([self isCachingEnabled]) { ASSIGN(_template,template); @@ -474,13 +477,17 @@ associationsKeys:(NSArray*)associationsKeys //OK GSWComponentDefinition* aComponentDefinition=nil; LOGObjectFnStart(); + NSDebugMLLog(@"GSWComponent",@"_componentDefinition=%@",_componentDefinition); if (_componentDefinition) aComponentDefinition=_componentDefinition; else { NSArray* languages=[self languages]; + NSDebugMLLog(@"GSWComponent",@"languages=%@",languages); + NSDebugMLLog(@"GSWComponent",@"_name=%@",_name); aComponentDefinition=[GSWApp componentDefinitionWithName:_name languages:languages]; + NSDebugMLLog(@"GSWComponent",@"aComponentDefinition=%@",aComponentDefinition); if ([self isCachingEnabled]) { ASSIGN(_componentDefinition,aComponentDefinition); @@ -543,9 +550,10 @@ associationsKeys:(NSArray*)associationsKeys LOGObjectFnStart(); languages=[self languages]; aComponentDefinition=[self _componentDefinition]; + NSAssert(aComponentDefinition,@"No componentDefinition"); template=[aComponentDefinition templateWithName:aName languages:languages]; - NSDebugMLLog(@"GSWComponent",@"template=%@",template); + NSDebugMLLog(@"GSWComponent",@"aName=%@ template=%@",aName,template); LOGObjectFnStop(); return template; }; @@ -988,17 +996,20 @@ associationsKeys:(NSArray*)associationsKeys GSWElementIDString* debugElementID=[aContext elementID]; #endif LOGObjectFnStart(); + NSAssert(aContext,@"No Context"); + NSAssert(aResponse,@"No Response"); GSWStartElement(aContext); GSWSaveAppendToResponseElementID(aContext); template=[self _template]; - + NSAssert(template,@"No template"); #ifndef NDEBUG - if(GSDebugSet(@"gswcomponents") == YES) + if(GSDebugSet(@"gswcomponents")) [aResponse appendDebugCommentContentString:[NSString stringWithFormat:@"Start %@",[self _templateName]]]; #endif request=[aContext request]; + NSAssert(request,@"No request"); isFromClientComponent=[request isFromClientComponent]; component=[aContext component]; [aContext appendZeroElementIDComponent]; diff --git a/GSWeb.framework/GSWComponentDefinition.h b/GSWeb.framework/GSWComponentDefinition.h index d407a2f..d587606 100644 --- a/GSWeb.framework/GSWComponentDefinition.h +++ b/GSWeb.framework/GSWComponentDefinition.h @@ -1,11 +1,16 @@ -/* GSWComponentDefinition.h - GSWeb: Class GSWComponentDefinition - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWComponentDefinition.h - GSWeb: Class GSWComponentDefinition + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,36 +24,36 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ #ifndef _GSWComponentDefinition_h__ #define _GSWComponentDefinition_h__ - //==================================================================== @interface GSWComponentDefinition : NSObject { - NSString* name; - GSWBundle* bundle; - NSMutableArray* observers; - NSString* frameworkName; - NSString* templateName; - Class componentClass; - BOOL isScriptedClass; - BOOL isCachingEnabled; - BOOL isAwake; + NSString* _name; + GSWBundle* _bundle; + NSMutableArray* _observers; + NSString* _frameworkName; + NSString* _templateName; + Class _componentClass; + BOOL _isScriptedClass; + BOOL _isCachingEnabled; + BOOL _isAwake; }; --(id)initWithName:(NSString*)name_ - path:(NSString*)_path - baseURL:(NSString*)_baseURL - frameworkName:(NSString*)_frameworkName; +-(id)initWithName:(NSString*)aName + path:(NSString*)aPath + baseURL:(NSString*)baseURL + frameworkName:(NSString*)aFrameworkName; -(void)dealloc; --(id)initWithCoder:(NSCoder*)coder_; --(void)encodeWithCoder:(NSCoder*)coder_; --(id)copyWithZone:(NSZone*)zone_; +-(id)initWithCoder:(NSCoder*)coder; +-(void)encodeWithCoder:(NSCoder*)coder; +-(id)copyWithZone:(NSZone*)zone; -(NSString*)frameworkName; -(NSString*)baseURL; @@ -62,7 +67,7 @@ //==================================================================== @interface GSWComponentDefinition (GSWCacheManagement) -(BOOL)isCachingEnabled; --(void)setCachingEnabled:(BOOL)flag_; +-(void)setCachingEnabled:(BOOL)flag; @end //==================================================================== @@ -72,55 +77,55 @@ //==================================================================== @interface GSWComponentDefinition (GSWComponentDefinitionB) --(GSWElement*)templateWithName:(NSString*)name_ - languages:(NSArray*)languages_; +-(GSWElement*)templateWithName:(NSString*)aName + languages:(NSArray*)languages; /* -(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)name_ - withDefaultValue:(NSString*)defaultValue_ - languages:(NSArray*)languages_; + inTableNamed:(NSString*)aName + withDefaultValue:(NSString*)defaultValue_ + languages:(NSArray*)languages; //NDFN --(NSDictionary*)stringsTableNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_; +-(NSDictionary*)stringsTableNamed:(NSString*)aName + withLanguages:(NSArray*)languages; //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_; +-(NSArray*)stringsTableArrayNamed:(NSString*)aName + withLanguages:(NSArray*)languages; --(NSString*)urlForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_; +-(NSString*)urlForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)languages + request:(GSWRequest*)aRequest; */ --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_; +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)languages; @end //==================================================================== @interface GSWComponentDefinition (GSWComponentDefinitionC) --(GSWComponent*)componentInstanceInContext:(GSWContext*)context_; +-(GSWComponent*)componentInstanceInContext:(GSWContext*)aContext; -(Class)componentClass; -(Class)_componentClass; --(GSWComponentReference*)componentReferenceWithAssociations:(NSDictionary*)associations_ - template:(GSWElement*)_template; +-(GSWComponentReference*)componentReferenceWithAssociations:(NSDictionary*)associations + template:(GSWElement*)template; -(NSDictionary*)componentAPI;//NDFN @end //==================================================================== @interface GSWComponentDefinition (GSWComponentDefinitionD) --(void)_finishInitializingComponent:(GSWComponent*)_component; +-(void)_finishInitializingComponent:(GSWComponent*)aComponent; @end //==================================================================== @interface GSWComponentDefinition (GSWComponentDefinitionE) --(void)_notifyObserversForDyingComponent:(GSWComponent*)_component; --(void)_awakeObserversForComponent:(GSWComponent*)_component; --(void)_deallocForComponent:(GSWComponent*)_component; --(void)_awakeForComponent:(GSWComponent*)_component; --(void)_registerObserver:(id)_observer; -+(void)_registerObserver:(id)_observer; +-(void)_notifyObserversForDyingComponent:(GSWComponent*)aComponent; +-(void)_awakeObserversForComponent:(GSWComponent*)aComponent; +-(void)_deallocForComponent:(GSWComponent*)aComponent; +-(void)_awakeForComponent:(GSWComponent*)aComponent; +-(void)_registerObserver:(id)observer; ++(void)_registerObserver:(id)observer; @end diff --git a/GSWeb.framework/GSWComponentDefinition.m b/GSWeb.framework/GSWComponentDefinition.m index a0deaf4..5c26c45 100644 --- a/GSWeb.framework/GSWComponentDefinition.m +++ b/GSWeb.framework/GSWComponentDefinition.m @@ -1,11 +1,16 @@ -/* GSWComponentDefinition.m - GSWeb: Class GSWComponentDefinition - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWComponentDefinition.m - GSWeb: Class GSWComponentDefinition + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,28 +35,28 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentDefinition //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - path:(NSString*)path_ - baseURL:(NSString*)baseURL_ - frameworkName:(NSString*)frameworkName_ +-(id)initWithName:(NSString*)aName + path:(NSString*)aPath + baseURL:(NSString*)baseURL + frameworkName:(NSString*)aFrameworkName { LOGObjectFnStart(); if ((self=[super init])) { - NSDebugMLLog(@"gswcomponents",@"name_=%@ frameworkName_=%@",name_,frameworkName_); - ASSIGN(name,name_); - bundle=[[GSWBundle alloc] initWithPath:path_ - baseURL:baseURL_ - inFrameworkNamed:frameworkName_]; - observers=nil; - ASSIGN(frameworkName,frameworkName_); - NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",frameworkName); - ASSIGN(templateName,name_);//TODOV - NSDebugMLLog(@"gswcomponents",@"templateName=%@",templateName); - componentClass=Nil; - isScriptedClass=NO; - isCachingEnabled=NO; - isAwake=NO; + NSDebugMLLog(@"gswcomponents",@"aName=%@ aFrameworkName=%@",aName,aFrameworkName); + ASSIGN(_name,aName); + _bundle=[[GSWBundle alloc] initWithPath:aPath + baseURL:baseURL + inFrameworkNamed:aFrameworkName]; + _observers=nil; + ASSIGN(_frameworkName,aFrameworkName); + NSDebugMLLog(@"gswcomponents",@"frameworkName=%@",_frameworkName); + ASSIGN(_templateName,aName);//TODOV + NSDebugMLLog(@"gswcomponents",@"templateName=%@",_templateName); + _componentClass=Nil; + _isScriptedClass=NO; + _isCachingEnabled=NO; + _isAwake=NO; [self setCachingEnabled:[GSWApplication isCachingEnabled]]; }; LOGObjectFnStop(); @@ -62,108 +68,108 @@ static char rcsId[] = "$Id$"; { GSWLogC("Dealloc GSWComponentDefinition"); GSWLogC("Dealloc GSWComponentDefinition: name"); - DESTROY(name); + DESTROY(_name); GSWLogC("Dealloc GSWComponentDefinition: bundle"); - DESTROY(bundle); + DESTROY(_bundle); GSWLogC("Dealloc GSWComponentDefinition: observers"); - DESTROY(observers); + DESTROY(_observers); GSWLogC("Dealloc GSWComponentDefinition: frameworkName"); - DESTROY(frameworkName); + DESTROY(_frameworkName); GSWLogC("Dealloc GSWComponentDefinition: templateName"); - DESTROY(templateName); + DESTROY(_templateName); GSWLogC("Dealloc GSWComponentDefinition: componentClass"); - DESTROY(componentClass); + DESTROY(_componentClass); GSWLogC("Dealloc GSWComponentDefinition Super"); [super dealloc]; GSWLogC("End Dealloc GSWComponentDefinition"); }; //-------------------------------------------------------------------- --(id)initWithCoder:(NSCoder*)coder_ +-(id)initWithCoder:(NSCoder*)coder { if ((self = [super init])) - { - [coder_ decodeValueOfObjCType:@encode(id) - at:&name]; - [coder_ decodeValueOfObjCType:@encode(id) - at:&bundle]; - [coder_ decodeValueOfObjCType:@encode(id) - at:&observers]; //TODOV - [coder_ decodeValueOfObjCType:@encode(id) - at:&frameworkName]; - [coder_ decodeValueOfObjCType:@encode(id) - at:&templateName]; - [coder_ decodeValueOfObjCType:@encode(Class) - at:&componentClass]; - [coder_ decodeValueOfObjCType:@encode(BOOL) - at:&isScriptedClass]; - [coder_ decodeValueOfObjCType:@encode(BOOL) - at:&isCachingEnabled]; - [coder_ decodeValueOfObjCType:@encode(BOOL) - at:&isAwake]; + { + [coder decodeValueOfObjCType:@encode(id) + at:&_name]; + [coder decodeValueOfObjCType:@encode(id) + at:&_bundle]; + [coder decodeValueOfObjCType:@encode(id) + at:&_observers]; //TODOV + [coder decodeValueOfObjCType:@encode(id) + at:&_frameworkName]; + [coder decodeValueOfObjCType:@encode(id) + at:&_templateName]; + [coder decodeValueOfObjCType:@encode(Class) + at:&_componentClass]; + [coder decodeValueOfObjCType:@encode(BOOL) + at:&_isScriptedClass]; + [coder decodeValueOfObjCType:@encode(BOOL) + at:&_isCachingEnabled]; + [coder decodeValueOfObjCType:@encode(BOOL) + at:&_isAwake]; }; return self; }; //-------------------------------------------------------------------- --(void)encodeWithCoder:(NSCoder*)coder_ +-(void)encodeWithCoder:(NSCoder*)coder { - [coder_ encodeObject:name]; - [coder_ encodeObject:bundle]; - [coder_ encodeObject:observers]; //TODOV - [coder_ encodeObject:frameworkName]; - [coder_ encodeObject:templateName]; - [coder_ encodeValueOfObjCType:@encode(Class) - at:&componentClass]; - [coder_ encodeValueOfObjCType:@encode(BOOL) - at:&isScriptedClass]; - [coder_ encodeValueOfObjCType:@encode(BOOL) - at:&isCachingEnabled]; - [coder_ encodeValueOfObjCType:@encode(BOOL) - at:&isAwake]; + [coder encodeObject:_name]; + [coder encodeObject:_bundle]; + [coder encodeObject:_observers]; //TODOV + [coder encodeObject:_frameworkName]; + [coder encodeObject:_templateName]; + [coder encodeValueOfObjCType:@encode(Class) + at:&_componentClass]; + [coder encodeValueOfObjCType:@encode(BOOL) + at:&_isScriptedClass]; + [coder encodeValueOfObjCType:@encode(BOOL) + at:&_isCachingEnabled]; + [coder encodeValueOfObjCType:@encode(BOOL) + at:&_isAwake]; }; //-------------------------------------------------------------------- --(id)copyWithZone:(NSZone*)zone_ +-(id)copyWithZone:(NSZone*)zone { - GSWComponentDefinition* clone = [[isa allocWithZone:zone_] init]; + GSWComponentDefinition* clone = [[isa allocWithZone:zone] init]; if (clone) - { - ASSIGNCOPY(clone->name,name); - ASSIGNCOPY(clone->bundle,bundle); - ASSIGNCOPY(clone->observers,observers); - ASSIGNCOPY(clone->frameworkName,frameworkName); - ASSIGNCOPY(clone->templateName,templateName); - clone->componentClass=componentClass; - clone->isScriptedClass=isScriptedClass; - clone->isCachingEnabled=isCachingEnabled; - clone->isAwake=isAwake; - }; + { + ASSIGNCOPY(clone->_name,_name); + ASSIGNCOPY(clone->_bundle,_bundle); + ASSIGNCOPY(clone->_observers,_observers); + ASSIGNCOPY(clone->_frameworkName,_frameworkName); + ASSIGNCOPY(clone->_templateName,_templateName); + clone->_componentClass=_componentClass; + clone->_isScriptedClass=_isScriptedClass; + clone->_isCachingEnabled=_isCachingEnabled; + clone->_isAwake=_isAwake; + }; return clone; }; //-------------------------------------------------------------------- -(NSString*)frameworkName { - return frameworkName; + return _frameworkName; }; //-------------------------------------------------------------------- -(NSString*)baseURL { - return [bundle baseURL]; + return [_bundle baseURL]; }; //-------------------------------------------------------------------- -(NSString*)path { - return [bundle path]; + return [_bundle path]; }; //-------------------------------------------------------------------- -(NSString*)name { - return name; + return _name; }; //-------------------------------------------------------------------- @@ -173,15 +179,15 @@ static char rcsId[] = "$Id$"; return [NSString stringWithFormat:@"<%s %p - name:[%@] bundle:[%@] observers=[%@] frameworkName=[%@] templateName=[%@] componentClass=[%@] isScriptedClass=[%s] isCachingEnabled=[%s] isAwake=[%s]>", object_get_class_name(self), (void*)self, - name, - bundle, - observers, - frameworkName, - templateName, - componentClass, - isScriptedClass ? "YES" : "NO", - isCachingEnabled ? "YES" : "NO", - isAwake ? "YES" : "NO"]; + _name, + _bundle, + _observers, + _frameworkName, + _templateName, + _componentClass, + _isScriptedClass ? "YES" : "NO", + _isCachingEnabled ? "YES" : "NO", + _isAwake ? "YES" : "NO"]; }; //-------------------------------------------------------------------- @@ -189,7 +195,7 @@ static char rcsId[] = "$Id$"; { //OK LOGObjectFnStart(); - isAwake=NO; + _isAwake=NO; LOGObjectFnStop(); }; @@ -197,12 +203,12 @@ static char rcsId[] = "$Id$"; -(void)awake { //OK - BOOL _isCachingEnabled=NO; + BOOL isCachingEnabled=NO; LOGObjectFnStart(); - isAwake=YES; - _isCachingEnabled=[self isCachingEnabled]; - if (!_isCachingEnabled) //?? - [self _clearCache]; + _isAwake=YES; + isCachingEnabled=[self isCachingEnabled]; + if (!isCachingEnabled) //?? + [self _clearCache]; //call self componentClass LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnStop(); @@ -216,13 +222,13 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(BOOL)isCachingEnabled { - return isCachingEnabled; + return _isCachingEnabled; }; //-------------------------------------------------------------------- --(void)setCachingEnabled:(BOOL)flag_ +-(void)setCachingEnabled:(BOOL)flag { - isCachingEnabled=flag_; + _isCachingEnabled=flag; }; @end @@ -235,7 +241,7 @@ static char rcsId[] = "$Id$"; { //OK LOGObjectFnStart(); - [bundle clearCache]; + [_bundle clearCache]; LOGObjectFnStop(); }; @@ -245,88 +251,88 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentDefinition (GSWComponentDefinitionB) //-------------------------------------------------------------------- --(GSWElement*)templateWithName:(NSString*)name_ - languages:(NSArray*)languages_ +-(GSWElement*)templateWithName:(NSString*)aName + languages:(NSArray*)languages { - GSWElement* _element=nil; + GSWElement* element=nil; LOGObjectFnStart(); - _element=[bundle templateNamed:name_ - languages:languages_]; - NSDebugMLLog(@"gswcomponents",@"_element=%@",_element); + element=[_bundle templateNamed:aName + languages:languages]; + NSDebugMLLog(@"gswcomponents",@"aName=%@ languages=%@ element=%@",aName,languages,element); LOGObjectFnStop(); - return _element; + return element; }; /* //-------------------------------------------------------------------- --(NSString*)stringForKey:(NSString*)key_ - inTableNamed:(NSString*)name_ - withDefaultValue:(NSString*)defaultValue_ - languages:(NSArray*)languages_ +-(NSString*)stringForKey:(NSString*)key +inTableNamed:(NSString*)aName +withDefaultValue:(NSString*)defaultValue +languages:(NSArray*)languages { - NSString* _string=nil; + NSString* string=nil; LOGObjectFnStart(); - _string=[bundle stringForKey:key_ - inTableNamed:name_ - withDefaultValue:defaultValue_ - languages:languages_]; + string=[_bundle stringForKey:key + inTableNamed:aName + withDefaultValue:defaultValue + languages:languages]; LOGObjectFnStop(); - return _string; + return string; }; //-------------------------------------------------------------------- //NDFN --(NSDictionary*)stringsTableNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_ +-(NSDictionary*)stringsTableNamed:(NSString*)aName + withLanguages:(NSArray*)languages { - NSDictionary* _stringsTable=nil; + NSDictionary* stringsTable=nil; LOGObjectFnStart(); - _stringsTable=[bundle stringsTableNamed:name_ - withLanguages:languages_]; + stringsTable=[bundle stringsTableNamed:aName + withLanguages:languages]; LOGObjectFnStop(); - return _stringsTable; + return stringsTable; }; //-------------------------------------------------------------------- //NDFN --(NSArray*)stringsTableArrayNamed:(NSString*)name_ - withLanguages:(NSArray*)languages_ +-(NSArray*)stringsTableArrayNamed:(NSString*)aName + withLanguages:(NSArray*)languages { - NSArray* _stringsTableArray=nil; + NSArray* stringsTableArray=nil; LOGObjectFnStart(); - _stringsTableArray=[bundle stringsTableArrayNamed:name_ - withLanguages:languages_]; + stringsTableArray=[bundle stringsTableArrayNamed:aName + withLanguages:languages]; LOGObjectFnStop(); - return _stringsTableArray; + return stringsTableArray; }; //-------------------------------------------------------------------- --(NSString*)urlForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ - request:(GSWRequest*)request_ +-(NSString*)urlForResourceNamed:(NSString*)aName + ofType:(NSString*)type + languages:(NSArray*)languages + request:(GSWRequest*)request { - NSString* _url=nil; + NSString* url=nil; LOGObjectFnStart(); - _url=[bundle urlForResourceNamed:name_ - ofType:type_ - languages:languages_ - request:request_]; + url=[bundle urlForResourceNamed:aName + ofType:type + languages:languages + request:request]; LOGObjectFnStop(); - return _url; + return url; }; */ //-------------------------------------------------------------------- --(NSString*)pathForResourceNamed:(NSString*)name_ - ofType:(NSString*)type_ - languages:(NSArray*)languages_ +-(NSString*)pathForResourceNamed:(NSString*)aName + ofType:(NSString*)aType + languages:(NSArray*)languages { - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - _path=[bundle pathForResourceNamed:name_ - ofType:type_ - languages:languages_]; + path=[_bundle pathForResourceNamed:aName + ofType:aType + languages:languages]; LOGObjectFnStop(); - return _path; + return path; }; @end @@ -335,35 +341,37 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentDefinition (GSWComponentDefinitionC) //-------------------------------------------------------------------- --(GSWComponent*)componentInstanceInContext:(GSWContext*)_context +-(GSWComponent*)componentInstanceInContext:(GSWContext*)aContext { //OK - GSWComponent* _component=nil; - Class _componentClass=nil; - NSMutableDictionary* _threadDictionary=nil; + GSWComponent* component=nil; + Class componentClass=nil; + NSMutableDictionary* threadDictionary=nil; LOGObjectFnStart(); - NSAssert(_context,@"No Context"); - NSDebugMLLog(@"gswcomponents",@"_context=%@",_context); - _componentClass=[self componentClass]; - NSDebugMLLog(@"gswcomponents",@"_componentClass=%p",(void*)_componentClass); - _threadDictionary=GSCurrentThreadDictionary(); - [_threadDictionary setObject:self - forKey:GSWThreadKey_ComponentDefinition]; + NSAssert(aContext,@"No Context"); + NSDebugMLLog(@"gswcomponents",@"aContext=%@",aContext); + componentClass=[self componentClass]; + NSAssert(componentClass,@"No componentClass"); + NSDebugMLLog(@"gswcomponents",@"componentClass=%p",(void*)componentClass); + threadDictionary=GSCurrentThreadDictionary(); + [threadDictionary setObject:self + forKey:GSWThreadKey_ComponentDefinition]; NS_DURING - { - _component=[[_componentClass new] autorelease]; - } + { + component=[[componentClass new] autorelease]; + } NS_HANDLER - { - LOGException(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - [_threadDictionary removeObjectForKey:GSWThreadKey_ComponentDefinition]; - [localException raise]; - }; + { + LOGException(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason],__FILE__,__LINE__); + [threadDictionary removeObjectForKey:GSWThreadKey_ComponentDefinition]; + [localException raise]; + }; NS_ENDHANDLER; - [_threadDictionary removeObjectForKey:GSWThreadKey_ComponentDefinition]; + [threadDictionary removeObjectForKey:GSWThreadKey_ComponentDefinition]; // [_component context];//so what ? LOGObjectFnStop(); - return _component; + return component; }; //-------------------------------------------------------------------- @@ -377,71 +385,71 @@ static char rcsId[] = "$Id$"; -(Class)_componentClass { //OK To Verify - Class _componentClass=componentClass; + Class componentClass=_componentClass; LOGObjectFnStart(); - NSDebugMLLog(@"gswcomponents",@"_componentClass=%@",_componentClass); - NSDebugMLLog(@"gswcomponents",@"name=%@",name); - if (!_componentClass) - _componentClass=NSClassFromString(name);//??? - NSDebugMLLog(@"gswcomponents",@"_componentClass=%@",_componentClass); - NSDebugMLLog(@"gswcomponents",@"_componentClass superclass=%@",[_componentClass superclass]); - if (!_componentClass) - { - BOOL _createClassesOk=NO; - NSString* _superClassName=nil; - if (!WOStrictFlag) + NSDebugMLLog(@"gswcomponents",@"componentClass=%@",componentClass); + NSDebugMLLog(@"gswcomponents",@"name=%@",_name); + if (!componentClass) + componentClass=NSClassFromString(_name);//??? + NSDebugMLLog(@"gswcomponents",@"componentClass=%@",componentClass); + NSDebugMLLog(@"gswcomponents",@"componentClass superclass=%@",[componentClass superclass]); + if (!componentClass) + { + BOOL createClassesOk=NO; + NSString* superClassName=nil; + if (!WOStrictFlag) + { + NSDictionary* archive=[_bundle archiveNamed:_name]; + NSDebugMLLog(@"gswcomponents",@"archive=%@",archive); + superClassName=[archive objectForKey:@"superClassName"]; + NSDebugMLLog(@"gswcomponents",@"superClassName=%@",superClassName); + if (superClassName) { - NSDictionary* _archive=[bundle archiveNamed:name]; - NSDebugMLLog(@"gswcomponents",@"_archive=%@",_archive); - _superClassName=[_archive objectForKey:@"superClassName"]; - NSDebugMLLog(@"gswcomponents",@"_superClassName=%@",_superClassName); - if (_superClassName) - { - if (!NSClassFromString(_superClassName)) - { - ExceptionRaise(NSGenericException,@"Superclass %@ of component %@ doesn't exist", - _superClassName, - name); - }; - }; + if (!NSClassFromString(superClassName)) + { + ExceptionRaise(NSGenericException,@"Superclass %@ of component %@ doesn't exist", + superClassName, + _name); + }; }; - if (!_superClassName) - _superClassName=@"GSWComponent"; - NSDebugMLLog(@"gswcomponents",@"_superClassName=%@",_superClassName); - _createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:name] - superClassName:_superClassName]; - _componentClass=NSClassFromString(name); - NSDebugMLLog(@"gswcomponents",@"_componentClass=%p",(void*)_componentClass); - }; + }; + if (!superClassName) + superClassName=@"GSWComponent"; + NSDebugMLLog(@"gswcomponents",@"superClassName=%@",superClassName); + createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name] + superClassName:superClassName]; + componentClass=NSClassFromString(_name); + NSDebugMLLog(@"gswcomponents",@"componentClass=%p",(void*)componentClass); + }; //call GSWApp isCaching NSDebugMLLog(@"gswcomponents",@"componentClass=%@",componentClass); LOGObjectFnStop(); - return _componentClass; + return componentClass; }; //-------------------------------------------------------------------- --(GSWComponentReference*)componentReferenceWithAssociations:(NSDictionary*)_associations - template:(GSWElement*)_template +-(GSWComponentReference*)componentReferenceWithAssociations:(NSDictionary*)associations + template:(GSWElement*)template { //OK - GSWComponentReference* _componentReference=nil; + GSWComponentReference* componentReference=nil; LOGObjectFnStart(); - _componentReference=[[[GSWComponentReference alloc]initWithName:name - associations:_associations - template:_template] autorelease]; + componentReference=[[[GSWComponentReference alloc]initWithName:_name + associations:associations + template:template] autorelease]; LOGObjectFnStop(); - return _componentReference; + return componentReference; }; //-------------------------------------------------------------------- //NDFN -(NSDictionary*)componentAPI { - NSDictionary* _componentAPI=nil; + NSDictionary* componentAPI=nil; LOGObjectFnStart(); - _componentAPI=[bundle apiNamed:name]; + componentAPI=[_bundle apiNamed:_name]; LOGObjectFnStop(); - return _componentAPI; + return componentAPI; }; @end @@ -450,14 +458,14 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentDefinition (GSWComponentDefinitionD) //-------------------------------------------------------------------- --(void)_finishInitializingComponent:(GSWComponent*)_component +-(void)_finishInitializingComponent:(GSWComponent*)component { //OK - NSDictionary* _archive=nil; + NSDictionary* archive=nil; LOGObjectFnStart(); - _archive=[bundle archiveNamed:name]; - [bundle initializeObject:_component - fromArchive:_archive]; + archive=[_bundle archiveNamed:_name]; + [_bundle initializeObject:component + fromArchive:archive]; LOGObjectFnStop(); }; @@ -467,37 +475,37 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentDefinition (GSWComponentDefinitionE) //-------------------------------------------------------------------- --(void)_notifyObserversForDyingComponent:(GSWComponent*)_component +-(void)_notifyObserversForDyingComponent:(GSWComponent*)aComponent { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_awakeObserversForComponent:(GSWComponent*)_component +-(void)_awakeObserversForComponent:(GSWComponent*)aComponent { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_deallocForComponent:(GSWComponent*)_component +-(void)_deallocForComponent:(GSWComponent*)aComponent { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_awakeForComponent:(GSWComponent*)_component +-(void)_awakeForComponent:(GSWComponent*)aComponent { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_registerObserver:(id)_observer +-(void)_registerObserver:(id)observer { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- -+(void)_registerObserver:(id)_observer ++(void)_registerObserver:(id)observer { LOGClassFnNotImplemented(); //TODOFN }; diff --git a/GSWeb.framework/GSWComponentRequestHandler.h b/GSWeb.framework/GSWComponentRequestHandler.h index ab7d21b..9fbfa0f 100644 --- a/GSWeb.framework/GSWComponentRequestHandler.h +++ b/GSWeb.framework/GSWComponentRequestHandler.h @@ -1,11 +1,16 @@ -/* GSWComponentRequestHandler.h - GSWeb: Class GSWComponentRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWComponentRequestHandler.h - GSWeb: Class GSWComponentRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,27 +37,27 @@ { } --(GSWResponse*)handleRequest:(GSWRequest*)request_; --(GSWResponse*)lockedHandleRequest:(GSWRequest*)request_; --(GSWResponse*)lockedDispatchWithPreparedApplication:(GSWApplication*)_application - inContext:(GSWContext*)context_ - elements:(NSDictionary*)_elements; --(GSWResponse*)lockedDispatchWithPreparedSession:(GSWSession*)_session - inContext:(GSWContext*)context_ - elements:(NSDictionary*)_elements; +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest; +-(GSWResponse*)lockedHandleRequest:(GSWRequest*)aRequest; +-(GSWResponse*)lockedDispatchWithPreparedApplication:(GSWApplication*)application + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements; +-(GSWResponse*)lockedDispatchWithPreparedSession:(GSWSession*)aSession + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements; -(GSWResponse*)lockedDispatchWithPreparedPage:(GSWComponent*)_component - inSession:(GSWSession*)_session - inContext:(GSWContext*)context_ - elements:(NSDictionary*)_elements; --(GSWComponent*)lockedRestorePageForContextID:(NSString*)context_ID - inSession:(GSWSession*)_session; + inSession:(GSWSession*)aSession + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements; +-(GSWComponent*)lockedRestorePageForContextID:(NSString*)aContextID + inSession:(GSWSession*)aSession; @end //==================================================================== @interface GSWComponentRequestHandler (GSWRequestHandlerClassA) +(id)handler; -+(NSDictionary*)_requestHandlerValuesForRequest:(GSWRequest*)request_; ++(NSDictionary*)_requestHandlerValuesForRequest:(GSWRequest*)aRequest; @end #endif //_GSWComponentRequestHandler_h__ diff --git a/GSWeb.framework/GSWComponentRequestHandler.m b/GSWeb.framework/GSWComponentRequestHandler.m index 8bbe401..a148c8b 100644 --- a/GSWeb.framework/GSWComponentRequestHandler.m +++ b/GSWeb.framework/GSWComponentRequestHandler.m @@ -1,11 +1,16 @@ -/* GSWComponentRequestHandler.m - GSWeb: Class GSWComponentRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWComponentRequestHandler.m - GSWeb: Class GSWComponentRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,465 +35,489 @@ static char rcsId[] = "$Id$"; @implementation GSWComponentRequestHandler //-------------------------------------------------------------------- --(GSWResponse*)handleRequest:(GSWRequest*)request_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest { //OK - GSWResponse* _response=nil; - GSWApplication* _application=[GSWApplication application]; + GSWResponse* response=nil; + GSWApplication* application=[GSWApplication application]; LOGObjectFnStart(); - [_application lockRequestHandling]; - _response=[self lockedHandleRequest:request_]; - if (!_response) + [application lockRequestHandling]; + response=[self lockedHandleRequest:aRequest]; + if (!response) { - _response=[GSWResponse responseWithMessage:@"Component Handle request failed" - inContext:nil - forRequest:request_]; - [_response _finalizeInContext:nil]; //DO Call _finalizeInContext: ! + response=[GSWResponse responseWithMessage:@"Component Handle request failed" + inContext:nil + forRequest:aRequest]; + [response _finalizeInContext:nil]; //DO Call _finalizeInContext: ! }; - [_application unlockRequestHandling]; - NSDebugMLLog(@"requests",@"_response=%@",_response); + [application unlockRequestHandling]; + NSDebugMLLog(@"requests",@"response=%@",response); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(GSWResponse*)lockedHandleRequest:(GSWRequest*)request_ +-(GSWResponse*)lockedHandleRequest:(GSWRequest*)aRequest { //OK - GSWStatisticsStore* _statisticsStore=nil; - GSWApplication* _application=[GSWApplication application]; - GSWContext* _context=nil; - GSWResponse* _response=nil; - NSDictionary* _requestHandlerValues=nil; - NSString* _senderID=nil; - BOOL _exceptionRaised=NO; + GSWStatisticsStore* statisticsStore=nil; + GSWApplication* application=[GSWApplication application]; + GSWContext* aContext=nil; + GSWResponse* response=nil; + NSDictionary* requestHandlerValues=nil; + NSString* senderID=nil; + BOOL exceptionRaised=NO; LOGObjectFnStart(); NS_DURING { - _requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:request_]; + requestHandlerValues=[GSWComponentRequestHandler _requestHandlerValuesForRequest:aRequest]; } NS_HANDLER { - _exceptionRaised=YES; + exceptionRaised=YES; LOGException(@"%@ (%@)", localException, [localException reason]); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In -lockedHandleRequest:"); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In -lockedHandleRequest:"); LOGException(@"exception=%@",localException); - [_application awake]; - _response=[_application handleException:localException - inContext:nil]; - [_application sleep]; - [_response _finalizeInContext:_context];//DO Call _finalizeInContext: ! - NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse"); + [application awake]; + response=[application handleException:localException + inContext:nil]; + [application sleep]; + [response _finalizeInContext:aContext];//DO Call _finalizeInContext: ! + NSAssert(!response || [response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse"); }; NS_ENDHANDLER; - if (!_exceptionRaised) + if (!exceptionRaised) { - NSDebugMLLog(@"requests",@"_requestHandlerValues=%@",_requestHandlerValues); - _statisticsStore=[[GSWApplication application]statisticsStore]; - NSDebugMLLog(@"requests",@"_statisticsStore=%@",_statisticsStore); - [_statisticsStore _applicationWillHandleComponentActionRequest]; - _context=[GSWContext contextWithRequest:request_]; - _senderID=[_requestHandlerValues objectForKey:GSWKey_ElementID[GSWebNamingConv]]; - NSDebugMLLog(@"requests",@"AA _senderID=%@",_senderID); - [_context _setSenderID:_senderID]; - [_application _setContext:_context]; -//====> - NS_DURING - { - [_application awake]; - _response=[self lockedDispatchWithPreparedApplication:_application - inContext:_context - elements:_requestHandlerValues]; - - } - NS_HANDLER - { - _exceptionRaised=YES; - LOGException(@"%@ (%@)", - localException, - [localException reason]); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In lockedDispatchWithPreparedApplication"); - LOGException(@"exception=%@",localException); - _response=[_application handleException:localException - inContext:_context]; - [_application sleep]; - [_response _finalizeInContext:_context]; //DO Call _finalizeInContext: ! - NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse"); - }; - NS_ENDHANDLER; - if (!_exceptionRaised) - { - NS_DURING - { - [_application sleep]; - [_response _finalizeInContext:_context];//LAST //CLEAN - } - NS_HANDLER - { - LOGException(@"%@ (%@)", - localException, - [localException reason]); - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, - @"In [application sleep] or [_response _finalizeInContext:_context]"); - LOGException(@"exception=%@",localException); - _response=[_application handleException:localException - inContext:nil]; - [_response _finalizeInContext:_context]; //DO Call _finalizeInContext: ! - NSAssert(!_response || [_response isFinalizeInContextHasBeenCalled],@"_finalizeInContext not called for GSWResponse"); - }; - NS_ENDHANDLER; - }; -//<=========== - }; - - [_application _setContext:nil]; - _statisticsStore=[[GSWApplication application] statisticsStore]; - [_statisticsStore _applicationDidHandleComponentActionRequest]; - NSDebugMLLog(@"requests",@"_response=%@",_response); + NSDebugMLLog(@"requests",@"requestHandlerValues=%@",requestHandlerValues); + statisticsStore=[[GSWApplication application]statisticsStore]; + NSDebugMLLog(@"requests",@"statisticsStore=%@",statisticsStore); + [statisticsStore _applicationWillHandleComponentActionRequest]; + aContext=[GSWContext contextWithRequest:aRequest]; + NSDebugMLLog(@"aContext",@"aContext=%@",aContext); + senderID=[requestHandlerValues objectForKey:GSWKey_ElementID[GSWebNamingConv]]; + NSDebugMLLog(@"requests",@"AA senderID=%@",senderID); + [aContext _setSenderID:senderID]; + [application _setContext:aContext]; + //====> + NS_DURING + { + [application awake]; + response=[self lockedDispatchWithPreparedApplication:application + inContext:aContext + elements:requestHandlerValues]; + + } + NS_HANDLER + { + exceptionRaised=YES; + LOGException(@"%@ (%@)", + localException, + [localException reason]); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In lockedDispatchWithPreparedApplication"); + LOGException(@"exception=%@",localException); + response=[application handleException:localException + inContext:aContext]; + [application sleep]; + [response _finalizeInContext:aContext]; //DO Call _finalizeInContext: ! + NSAssert(!response || [response isFinalizeInContextHasBeenCalled], + @"_finalizeInContext not called for GSWResponse"); + }; + NS_ENDHANDLER; + if (!exceptionRaised) + { + NS_DURING + { + [application sleep]; + [response _finalizeInContext:aContext];//LAST //CLEAN + } + NS_HANDLER + { + LOGException(@"%@ (%@)", + localException, + [localException reason]); + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In [application sleep] or [response _finalizeInContext:aContext]"); + LOGException(@"exception=%@",localException); + response=[application handleException:localException + inContext:nil]; + [response _finalizeInContext:aContext]; //DO Call _finalizeInContext: ! + NSAssert(!response || [response isFinalizeInContextHasBeenCalled], + @"_finalizeInContext not called for GSWResponse"); + }; + NS_ENDHANDLER; + }; + //<=========== + }; + + [application _setContext:nil]; + statisticsStore=[[GSWApplication application] statisticsStore]; + [statisticsStore _applicationDidHandleComponentActionRequest]; + NSDebugMLLog(@"requests",@"response=%@",response); LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(GSWResponse*)lockedDispatchWithPreparedApplication:(GSWApplication*)_application - inContext:(GSWContext*)_context - elements:(NSDictionary*)_elements +-(GSWResponse*)lockedDispatchWithPreparedApplication:(GSWApplication*)application + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements { //OK - GSWResponse* _response=nil; - GSWResponse* _errorResponse=nil; - GSWSession* _session=nil; - NSString* _sessionID=nil; + GSWResponse* response=nil; + GSWResponse* errorResponse=nil; + GSWSession* session=nil; + NSString* sessionID=nil; LOGObjectFnStart(); NS_DURING - { - _sessionID=[_elements objectForKey:GSWKey_SessionID[GSWebNamingConv]]; - NSDebugMLLog(@"requests",@"_sessionID=%@",_sessionID); - if (_sessionID) - { - _session=[_application restoreSessionWithID:_sessionID - inContext:_context]; - if (!_session) - { - // check for refuseNewSessions - _errorResponse=[_application handleSessionRestorationErrorInContext:_context]; - }; - } - else - { - // check for refuseNewSessions - _session=[_application _initializeSessionInContext:_context]; - } - } + { + sessionID=[elements objectForKey:GSWKey_SessionID[GSWebNamingConv]]; + NSDebugMLLog(@"requests",@"sessionID=%@",sessionID); + if (sessionID) + { + session=[application restoreSessionWithID:sessionID + inContext:aContext]; + if (!session) + { + // check for refuseNewSessions + errorResponse=[application handleSessionRestorationErrorInContext:aContext]; + }; + } + else + { + // check for refuseNewSessions + session=[application _initializeSessionInContext:aContext]; + } + } NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"in session create/restore"); - LOGException(@"exception=%@",localException); - _errorResponse=[_application handleException:localException - inContext:_context]; - } + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"in session create/restore"); + LOGException(@"exception=%@",localException); + errorResponse=[application handleException:localException + inContext:aContext]; + } NS_ENDHANDLER; - if (!_response && !_errorResponse) - { - if (_session) - { - NSDebugMLLog(@"requests",@"_session=%@",_session); - NS_DURING - { - _response=[self lockedDispatchWithPreparedSession:_session - inContext:_context - elements:_elements]; - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"in lockedDispatchWithPreparedSession"); - LOGException(@"exception=%@",localException); - _errorResponse=[_application handleException:localException - inContext:_context]; - } - NS_ENDHANDLER; - }; - }; -//======LAST //CLEAN - if (_response || _errorResponse) - { - NSDebugMLLog(@"requests",@"_response=%@",_response); - NSDebugMLLog(@"requests",@"_errorResponse=%@",_errorResponse); - RETAIN(_response); - [_context _putAwakeComponentsToSleep]; - [_application saveSessionForContext:_context]; - NSDebugMLLog(@"requests",@"_session=%@",_session); - NSDebugMLLog(@"requests",@"_sessionCount=%u",[_session retainCount]); - NSDebugMLLog(@"requests",@"_response=%@",_response); - AUTORELEASE(_response); - }; + if (!response && !errorResponse) + { + if (session) + { + NSDebugMLLog(@"requests",@"session=%@",session); + NS_DURING + { + response=[self lockedDispatchWithPreparedSession:session + inContext:aContext + elements:elements]; + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"in lockedDispatchWithPreparedSession"); + LOGException(@"exception=%@",localException); + errorResponse=[application handleException:localException + inContext:aContext]; + } + NS_ENDHANDLER; + }; + }; + //======LAST //CLEAN + if (response || errorResponse) + { + NSDebugMLLog(@"requests",@"response=%@",response); + NSDebugMLLog(@"requests",@"errorResponse=%@",errorResponse); + RETAIN(response); + [aContext _putAwakeComponentsToSleep]; + [application saveSessionForContext:aContext]; + NSDebugMLLog(@"requests",@"session=%@",session); + NSDebugMLLog(@"requests",@"sessionCount=%u",[session retainCount]); + NSDebugMLLog(@"requests",@"response=%@",response); + AUTORELEASE(response); + }; LOGObjectFnStop(); - return _response ? _response : _errorResponse; + return response ? response : errorResponse; }; //-------------------------------------------------------------------- --(GSWResponse*)lockedDispatchWithPreparedSession:(GSWSession*)_session - inContext:(GSWContext*)_context - elements:(NSDictionary*)_elements +-(GSWResponse*)lockedDispatchWithPreparedSession:(GSWSession*)aSession + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements { //OK - GSWResponse* _errorResponse=nil; - GSWResponse* _response=nil; - GSWComponent* _page=nil; - BOOL _storesIDsInCookies=NO; - NSString* _contextID=nil; + GSWResponse* errorResponse=nil; + GSWResponse* response=nil; + GSWComponent* page=nil; + BOOL storesIDsInCookies=NO; + NSString* contextID=nil; LOGObjectFnStart(); - NSDebugMLLog(@"requests",@"_session=%@",_session); - NSDebugMLLog(@"requests",@"_context=%@",_context); - _storesIDsInCookies=[_session storesIDsInCookies]; //For What ? - NSDebugMLLog(@"requests",@"_storesIDsInCookies=%s",(_storesIDsInCookies ? "YES" : "NO")); - _contextID=[_elements objectForKey:GSWKey_ContextID[GSWebNamingConv]]; - NSDebugMLLog(@"requests",@"_contextID=%@",_contextID); - if (_contextID) // ?? - { - NSAssert([_contextID length]>0,@"contextID empty"); - _page=[self lockedRestorePageForContextID:_contextID - inSession:_session]; - //?? - NSDebugMLLog(@"requests",@"_contextID=%@",_contextID); - NSDebugMLLog(@"requests",@"_session=%@",_session); - NSDebugMLLog(@"requests",@"_page=%@",_page); - if (!_page) - { - GSWApplication* _application=[_session application]; - _errorResponse=[_application handlePageRestorationErrorInContext:_context]; - }; - } + + NSDebugMLLog(@"requests",@"aSession=%@",aSession); + NSDebugMLLog(@"requests",@"aContext=%@",aContext); + + storesIDsInCookies=[aSession storesIDsInCookies]; //For What ? + NSDebugMLLog(@"requests",@"storesIDsInCookies=%s",(storesIDsInCookies ? "YES" : "NO")); + + contextID=[elements objectForKey:GSWKey_ContextID[GSWebNamingConv]]; + NSDebugMLLog(@"requests",@"contextID=%@",contextID); + + if (contextID) // ?? + { + NSAssert([contextID length]>0,@"contextID empty"); + page=[self lockedRestorePageForContextID:contextID + inSession:aSession]; + //?? + NSDebugMLLog(@"requests",@"contextID=%@",contextID); + NSDebugMLLog(@"requests",@"aSession=%@",aSession); + NSDebugMLLog(@"requests",@"page=%@",page); + if (!page) + { + GSWApplication* application=[aSession application]; + errorResponse=[application handlePageRestorationErrorInContext:aContext]; + }; + } else - { - NSString* _pageName=[_elements objectForKey:GSWKey_PageName[GSWebNamingConv]]; - NSException* _exception=nil; - NSDebugMLLog(@"requests",@"_pageName=%@",_pageName); - NS_DURING - { - _page=[[GSWApplication application] pageWithName:_pageName - inContext:_context]; - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException,@"In pageWithName"); - LOGException(@"exception=%@",localException); - ASSIGN(_exception,localException); - } - NS_ENDHANDLER; - if (!_page) - { - _errorResponse=[[GSWApplication application] handleException:_exception - inContext:_context]; - }; - DESTROY(_exception); - }; - if (!_response && !_errorResponse && _page) - { - [_context _setPageElement:_page]; - _response=[self lockedDispatchWithPreparedPage:_page - inSession:_session - inContext:_context - elements:_elements]; - }; - if (_response) - { - BOOL _isPageRefreshOnBacktrackEnabled=[[GSWApplication application] isPageRefreshOnBacktrackEnabled]; - //TODO method adds a header to the HTTP response. This header sets the expiration date for an HTML page to the date and time of the creation of the page. Later, when the browser checks its cache for this page, it finds that the page is no longer valid and so refetches it by resubmitting the request URL to the WebObjects application. + { + NSString* pageName=[elements objectForKey:GSWKey_PageName[GSWebNamingConv]]; + NSException* exception=nil; + NSDebugMLLog(@"requests",@"pageName=%@",pageName); + NS_DURING + { + page=[[GSWApplication application] pageWithName:pageName + inContext:aContext]; + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, + @"In pageWithName"); + LOGException(@"exception=%@",localException); + ASSIGN(exception,localException); + } + NS_ENDHANDLER; + if (!page) + { + errorResponse=[[GSWApplication application] handleException:exception + inContext:aContext]; + }; + DESTROY(exception); + }; + if (!response && !errorResponse && page) + { + [aContext _setPageElement:page]; + response=[self lockedDispatchWithPreparedPage:page + inSession:aSession + inContext:aContext + elements:elements]; + }; + if (response) + { + BOOL isPageRefreshOnBacktrackEnabled=[[GSWApplication application] isPageRefreshOnBacktrackEnabled]; + //TODO method adds a header to the HTTP response. This header sets the expiration date for an HTML page to the date and time of the creation of the page. Later, when the browser checks its cache for this page, it finds that the page is no longer valid and so refetches it by resubmitting the request URL to the WebObjects application. - [_session _saveCurrentPage]; + [aSession _saveCurrentPage]; #if 0 - if (!_contextID) // ?? - { - if (![_session storesIDsInCookies])//?? - [_session clearCookieFromResponse:_response]; - }; + if (!contextID) // ?? + { + if (![aSession storesIDsInCookies])//?? + [aSession clearCookieFromResponse:response]; + }; #endif - }; - NSDebugMLLog(@"requests",@"_response=%@",_response); + }; + NSDebugMLLog(@"requests",@"response=%@",response); LOGObjectFnStop(); - return _response ? _response : _errorResponse; + return response ? response : errorResponse; }; //-------------------------------------------------------------------- --(GSWResponse*)lockedDispatchWithPreparedPage:(GSWComponent*)_component - inSession:(GSWSession*)_session - inContext:(GSWContext*)_context - elements:(NSDictionary*)_elements +-(GSWResponse*)lockedDispatchWithPreparedPage:(GSWComponent*)aComponent + inSession:(GSWSession*)aSession + inContext:(GSWContext*)aContext + elements:(NSDictionary*)elements { //OK - GSWRequest* _request=nil; - GSWResponse* _response=nil; - GSWResponse* _errorResponse=nil; - NSString* _senderID=nil; - NSString* _contextID=nil; - NSString* _httpVersion=nil; - GSWElement* _page=nil; - GSWElement* _responsePage=nil; - BOOL _isFromClientComponent=NO; - BOOL _hasFormValues=NO; - GSWContext* _responseContext=nil; - GSWComponent* _responsePageElement=nil; - GSWRequest* _responseRequest=nil; + GSWRequest* request=nil; + GSWResponse* response=nil; + GSWResponse* errorResponse=nil; + NSString* senderID=nil; + NSString* contextID=nil; + NSString* httpVersion=nil; + GSWElement* page=nil; + GSWElement* responsePage=nil; + BOOL isFromClientComponent=NO; + BOOL hasFormValues=NO; + GSWContext* responseContext=nil; + GSWComponent* responsePageElement=nil; + GSWRequest* responseRequest=nil; LOGObjectFnStart(); - NSDebugMLLog(@"requests",@"_component=%@",_component); - _request=[_context request]; - _contextID=[_elements objectForKey:GSWKey_ContextID[GSWebNamingConv]]; - NSDebugMLLog(@"requests",@"_contextID=%@",_contextID); - _response=[[GSWResponse new]autorelease]; - NSDebugMLLog(@"requests",@"_response=%@",_response); - NSDebugMLLog(@"requests",@"_session=%@",_session); - NSDebugMLLog(@"requests",@"_context=%@",_context); - _senderID=[_context senderID]; - NSDebugMLLog(@"requests",@"AA _senderID=%@",_senderID); + NSDebugMLLog(@"requests",@"aComponent=%@",aComponent); + + request=[aContext request]; + contextID=[elements objectForKey:GSWKey_ContextID[GSWebNamingConv]]; + NSDebugMLLog(@"requests",@"contextID=%@",contextID); + + response=[[GSWResponse new]autorelease]; + NSDebugMLLog(@"requests",@"response=%@",response); + NSDebugMLLog(@"requests",@"aSession=%@",aSession); + NSDebugMLLog(@"requests",@"aContext=%@",aContext); + + senderID=[aContext senderID]; + NSDebugMLLog(@"requests",@"AA senderID=%@",senderID); //TODO { - GSWContext* _matchedContext=[_session _contextIDMatchingContextID:_contextID - requestSenderID:_senderID]; + GSWContext* matchedContext=[aSession _contextIDMatchingContextID:contextID + requestSenderID:senderID]; } - _httpVersion=[_request httpVersion]; - [_response setHTTPVersion:_httpVersion]; - [_response setHeader:@"text/html" - forKey:@"content-type"]; - [_context _setResponse:_response]; - _page=[_context page]; - if (_contextID)//?? - { - _hasFormValues=[_request _hasFormValues]; - } + httpVersion=[request httpVersion]; + [response setHTTPVersion:httpVersion]; + [response setHeader:@"text/html" + forKey:@"content-type"]; + [aContext _setResponse:response]; + page=[aContext page]; + if (contextID)//?? + { + hasFormValues=[request _hasFormValues]; + } else - { - [_context _setPageChanged:NO]; - _isFromClientComponent=[_request isFromClientComponent]; - //?? - [_context _setPageReplaced:NO]; - _isFromClientComponent=[_request isFromClientComponent]; - }; - if (_hasFormValues) - { - NSDebugMLLog(@"requests",@"Before takeValues [_context elementID]=%@",[_context elementID]); - NSAssert([[_context elementID] length]==0,@"1 lockedDispatchWithPreparedPage elementID length>0"); - [[GSWApplication application] takeValuesFromRequest:_request - inContext:_context]; - NSDebugMLLog(@"requests",@"After takeValues[_context elementID]=%@",[_context elementID]); - if (![[_context elementID] length]==0) - { - LOGSeriousError0(@"2 lockedDispatchWithPreparedPage elementID length>0"); - [_context deleteAllElementIDComponents];//NDFN - }; - [_context _setPageChanged:NO];//??? - _isFromClientComponent=[_request isFromClientComponent]; - [_context _setPageReplaced:NO]; - }; - if (_senderID) //?? - { - BOOL _pageChanged=NO; - NSException* _exception=nil; - NSDebugMLLog(@"requests",@"Before invokeAction [_context elementID]=%@",[_context elementID]); - NSAssert([[_context elementID] length]==0,@"3 lockedDispatchWithPreparedPage elementID length>0"); - // Exception catching here ? - NS_DURING - { - _responsePage=[[GSWApplication application] invokeActionForRequest:_request - inContext:_context]; - NSDebugMLLog(@"requests",@"After invokeAction [_context elementID]=%@",[_context elementID]); - NSAssert([[_context elementID] length]==0,@"4 lockedDispatchWithPreparedPage elementID length>0"); - } - NS_HANDLER - { - LOGException0(@"exception in invokeActionForRequest"); - LOGException(@"exception=%@",localException); - localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, - @"In invokeActionForRequest component=%@ of Class %@", - [_component name], - [_component class]); - LOGException(@"exception=%@",localException); - ASSIGN(_exception,localException); - if (!_responsePage) - { - _errorResponse=[[GSWApplication application] handleException:_exception - inContext:_context]; - }; - DESTROY(_exception); - } - NS_ENDHANDLER; -// [_context deleteAllElementIDComponents];//NDFN - NSDebugMLLog(@"requests",@"_responsePage=%@",_responsePage); - if (_errorResponse) - { - _response=_errorResponse; - _responseContext=_context; - } - else - { - if (!_responsePage) - _responsePage=_page; - - _responseContext=[(GSWComponent*)_responsePage context];//So what ? - NSDebugMLLog(@"requests",@"_responseContext=%@",_responseContext); - [_responseContext _setPageReplaced:NO]; - _responsePageElement=[_responseContext _pageElement]; - NSDebugMLLog(@"requests",@"_responsePageElement=%@",_responsePageElement); - _pageChanged=(_responsePage!=_responsePageElement); - [_responseContext _setPageChanged:_pageChanged];//?? - if (_pageChanged) - { - [_responseContext _setPageElement:_responsePage]; - }; - _responseRequest=[_responseContext request];//SoWhat ? - [_responseRequest isFromClientComponent];//SoWhat - }; - } + { + [aContext _setPageChanged:NO]; + isFromClientComponent=[request isFromClientComponent]; + //?? + [aContext _setPageReplaced:NO]; + isFromClientComponent=[request isFromClientComponent]; + }; + if (hasFormValues) + { + NSDebugMLLog(@"requests",@"Before takeValues [aContext elementID]=%@", + [aContext elementID]); + NSAssert([[aContext elementID] length]==0, + @"1 lockedDispatchWithPreparedPage elementID length>0"); + [[GSWApplication application] takeValuesFromRequest:request + inContext:aContext]; + NSDebugMLLog(@"requests",@"After takeValues[aContext elementID]=%@", + [aContext elementID]); + if (![[aContext elementID] length]==0) + { + LOGSeriousError0(@"2 lockedDispatchWithPreparedPage elementID length>0"); + [aContext deleteAllElementIDComponents];//NDFN + }; + [aContext _setPageChanged:NO];//??? + isFromClientComponent=[request isFromClientComponent]; + [aContext _setPageReplaced:NO]; + }; + if (senderID) //?? + { + BOOL pageChanged=NO; + NSException* exception=nil; + NSDebugMLLog(@"requests",@"Before invokeAction [aContext elementID]=%@", + [aContext elementID]); + NSAssert([[aContext elementID] length]==0, + @"3 lockedDispatchWithPreparedPage elementID length>0"); + // Exception catching here ? + NS_DURING + { + responsePage=[[GSWApplication application] invokeActionForRequest:request + inContext:aContext]; + NSDebugMLLog(@"requests",@"After invokeAction [aContext elementID]=%@",[aContext elementID]); + NSAssert([[aContext elementID] length]==0,@"4 lockedDispatchWithPreparedPage elementID length>0"); + } + NS_HANDLER + { + LOGException0(@"exception in invokeActionForRequest"); + LOGException(@"exception=%@",localException); + localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, + @"In invokeActionForRequest component=%@ of Class %@", + [aComponent name], + [aComponent class]); + LOGException(@"exception=%@",localException); + ASSIGN(exception,localException); + if (!responsePage) + { + errorResponse=[[GSWApplication application] handleException:exception + inContext:aContext]; + }; + DESTROY(exception); + } + NS_ENDHANDLER; + // [aContext deleteAllElementIDComponents];//NDFN + NSDebugMLLog(@"requests",@"responsePage=%@",responsePage); + if (errorResponse) + { + response=errorResponse; + responseContext=aContext; + } + else + { + if (!responsePage) + responsePage=page; + + responseContext=[(GSWComponent*)responsePage context];//So what ? + NSDebugMLLog(@"requests",@"responseContext=%@",responseContext); + [responseContext _setPageReplaced:NO]; + responsePageElement=[responseContext _pageElement]; + NSDebugMLLog(@"requests",@"responsePageElement=%@",responsePageElement); + pageChanged=(responsePage!=responsePageElement); + [responseContext _setPageChanged:pageChanged];//?? + if (pageChanged) + { + [responseContext _setPageElement:responsePage]; + }; + responseRequest=[responseContext request];//SoWhat ? + [responseRequest isFromClientComponent];//SoWhat + }; + } else - { - _responseContext=_context; - _responsePageElement=_page; - _responsePage=_component; - _responseRequest=_request; - }; - if (!_errorResponse) - { - NS_DURING - { - NSDebugMLLog(@"requests",@"_response before appendToResponse=%@",_response); - NSDebugMLLog(@"requests",@"_responseContext=%@",_responseContext); - NSAssert([[_context elementID] length]==0,@"5 lockedDispatchWithPreparedPage elementID length>0"); - NSDebugMLLog(@"requests",@"Before appendToResponse [_context elementID]=%@",[_context elementID]); - [[GSWApplication application] appendToResponse:_response - inContext:_responseContext]; - NSDebugMLLog(@"requests",@"After appendToResponse [_context elementID]=%@",[_context elementID]); - NSAssert([[_context elementID] length]==0,@"6 lockedDispatchWithPreparedPage elementID length>0"); - _responseRequest=[_responseContext request];//SoWhat ? - [_responseRequest isFromClientComponent];//SoWhat - } - NS_HANDLER - { - localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, - @"In appendToResponse page=%@ of Class %@", - [_page name], - [_page class]); - LOGException(@"exception=%@",localException); - NSDebugMLLog(@"requests",@"context=%@",_context); - _errorResponse=[[GSWApplication application] handleException:localException - inContext:_context]; - } - NS_ENDHANDLER; - }; - NSDebugMLLog(@"requests",@"_response=%@",_response); + { + responseContext=aContext; + responsePageElement=page; + responsePage=aComponent; + responseRequest=request; + }; + if (!errorResponse) + { + NS_DURING + { + NSDebugMLLog(@"requests",@"response before appendToResponse=%@",response); + NSDebugMLLog(@"requests",@"responseContext=%@",responseContext); + NSAssert([[aContext elementID] length]==0, + @"5 lockedDispatchWithPreparedPage elementID length>0"); + NSDebugMLLog(@"requests",@"Before appendToResponse [aContext elementID]=%@", + [aContext elementID]); + [[GSWApplication application] appendToResponse:response + inContext:responseContext]; + NSDebugMLLog(@"requests",@"After appendToResponse [aContext elementID]=%@", + [aContext elementID]); + NSAssert([[aContext elementID] length]==0, + @"6 lockedDispatchWithPreparedPage elementID length>0"); + responseRequest=[responseContext request];//SoWhat ? + [responseRequest isFromClientComponent];//SoWhat + } + NS_HANDLER + { + localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, + @"In appendToResponse page=%@ of Class %@", + [page name], + [page class]); + LOGException(@"exception=%@",localException); + NSDebugMLLog(@"requests",@"context=%@",aContext); + errorResponse=[[GSWApplication application] handleException:localException + inContext:aContext]; + } + NS_ENDHANDLER; + }; + NSDebugMLLog(@"requests",@"response=%@",response); LOGObjectFnStop(); - return _errorResponse ? _errorResponse : _response; + return errorResponse ? errorResponse : response; }; //-------------------------------------------------------------------- --(GSWComponent*)lockedRestorePageForContextID:(NSString*)_contextID - inSession:(GSWSession*)_session +-(GSWComponent*)lockedRestorePageForContextID:(NSString*)aContextID + inSession:(GSWSession*)aSession { //OK - GSWComponent* _page=[_session restorePageForContextID:_contextID]; - return _page; + GSWComponent* page=[aSession restorePageForContextID:aContextID]; + return page; }; @end @@ -502,14 +532,14 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- -+(NSDictionary*)_requestHandlerValuesForRequest:(GSWRequest*)request_ ++(NSDictionary*)_requestHandlerValuesForRequest:(GSWRequest*)aRequest { //OK - NSDictionary* _values=nil; + NSDictionary* values=nil; LOGClassFnStart(); NS_DURING { - _values=[request_ uriOrFormOrCookiesElements]; + values=[aRequest uriOrFormOrCookiesElements]; } NS_HANDLER { @@ -522,7 +552,7 @@ static char rcsId[] = "$Id$"; }; NS_ENDHANDLER; LOGClassFnStop(); - return _values; + return values; }; diff --git a/GSWeb.framework/GSWConstantValueAssociation.h b/GSWeb.framework/GSWConstantValueAssociation.h index 782550a..0284ce3 100644 --- a/GSWeb.framework/GSWConstantValueAssociation.h +++ b/GSWeb.framework/GSWConstantValueAssociation.h @@ -1,11 +1,16 @@ -/* GSWConstantValueAssociation.h - GSWeb: Class GSWConstantValueAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWConstantValueAssociation.h - GSWeb: Class GSWConstantValueAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,18 +35,18 @@ //==================================================================== @interface GSWConstantValueAssociation:GSWAssociation { - id value; + id _value; }; --(id)initWithValue:(id)value_; +-(id)initWithValue:(id)aValue; -(void)dealloc; --(id)copyWithZone:(NSZone *)zone; +-(id)copyWithZone:(NSZone*)zone; -(NSString*)debugDescription; -(BOOL)isValueConstant; -(BOOL)isValueSettable; --(id)valueInObject:(id)object_; --(void)setValue:(id)value_ - inObject:(id)object_; +-(id)valueInObject:(id)object; +-(void)setValue:(id)aValue + inObject:(id)object; -(NSString*)description; @end diff --git a/GSWeb.framework/GSWConstantValueAssociation.m b/GSWeb.framework/GSWConstantValueAssociation.m index d4a2c2a..b10d96b 100644 --- a/GSWeb.framework/GSWConstantValueAssociation.m +++ b/GSWeb.framework/GSWConstantValueAssociation.m @@ -1,11 +1,16 @@ -/* GSWConstantValueAssociation.m - GSWeb: Class GSWConstantValueAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWConstantValueAssociation.m - GSWeb: Class GSWConstantValueAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,13 +35,13 @@ static char rcsId[] = "$Id$"; @implementation GSWConstantValueAssociation //-------------------------------------------------------------------- --(id)initWithValue:(id)value_ +-(id)initWithValue:(id)aValue { //OK if ((self=[super init])) - { - ASSIGNCOPY(value,value_); - }; + { + ASSIGNCOPY(_value,aValue); + }; return self; }; @@ -44,29 +50,29 @@ static char rcsId[] = "$Id$"; { GSWLogMemC("GSWConstantValueAssociation start of dealloc"); GSWLogAssertGood(self); - DESTROY(value); + DESTROY(_value); GSWLogMemC("value deallocated"); [super dealloc]; GSWLogMemC("GSWConstantValueAssociation end of dealloc"); }; //-------------------------------------------------------------------- --(id)copyWithZone:(NSZone*)zone; +-(id)copyWithZone:(NSZone*)zone { GSWConstantValueAssociation* clone = [super copyWithZone:zone]; - ASSIGN(clone->value,value); + ASSIGN(clone->_value,_value); return clone; }; //-------------------------------------------------------------------- -(NSString*)debugDescription { - NSString* _dscr=[NSString stringWithFormat:@"<%s %p - value=%@ (class: %@)>", - object_get_class_name(self), - (void*)self, - value, - [value class]]; - return _dscr; + NSString* dscr=[NSString stringWithFormat:@"<%s %p - value=%@ (class: %@)>", + object_get_class_name(self), + (void*)self, + _value, + [_value class]]; + return dscr; }; //-------------------------------------------------------------------- @@ -82,34 +88,35 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(id)valueInObject:(id)object_ +-(id)valueInObject:(id)object { - [self logTakeValue:value]; - return value; + [self logTakeValue:_value]; + return _value; }; //-------------------------------------------------------------------- --(void)setValue:(id)value_ - inObject:(id)object_ +-(void)setValue:(id)aValue + inObject:(id)object { - ExceptionRaise0(@"GSWConstantValueAssociation",@"Can't set value for a constant value association"); + ExceptionRaise0(@"GSWConstantValueAssociation", + @"Can't set value for a constant value association"); }; //-------------------------------------------------------------------- -(NSString*)description { - NSString* _dscr=nil; + NSString* dscr=nil; GSWLogAssertGood(self); - if (value) - { - GSWLogAssertGood(value); - }; - _dscr=[NSString stringWithFormat:@"<%s %p - value=%@ (class: %@)>", - object_get_class_name(self), - (void*)self, - value, - [value class]]; - return _dscr; + if (_value) + { + GSWLogAssertGood(_value); + }; + dscr=[NSString stringWithFormat:@"<%s %p - value=%@ (class: %@)>", + object_get_class_name(self), + (void*)self, + _value, + [_value class]]; + return dscr; }; @end diff --git a/GSWeb.framework/GSWDebug.m b/GSWeb.framework/GSWDebug.m index 9853e46..e0f831a 100644 --- a/GSWeb.framework/GSWDebug.m +++ b/GSWeb.framework/GSWDebug.m @@ -1,11 +1,16 @@ -/* debug.m - debug - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Jan 1999 +/** GSWDebug.m - GSWeb: Debug + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + Written by: Manuel Guesdon + Date: Jan 1999 + + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -78,237 +84,241 @@ NSString* objectDescription(id object) { NSString* description=nil; if ([object respondsToSelector:@selector(description)]) - { - NS_DURING - description=[object description]; - NS_HANDLER - NS_ENDHANDLER; - }; + { + NS_DURING + { + description=[object description]; + } + NS_HANDLER + { + } + NS_ENDHANDLER; + }; return description; }; //-------------------------------------------------------------------- -NSString* IVarInString(const char* _type,void* _value) +NSString* IVarInString(const char* aType,void* aValue) { - if (_type && _value) - { - switch (*_type) - { - case _C_ID: - { - id* pvalue=(id*)_value; - return [NSString stringWithFormat:@"object:%ld Class:%s Description:%@", - (long)(*pvalue), - [*pvalue class], - objectDescription(*pvalue)]; - }; - break; - case _C_CLASS: - { - Class* pvalue=(Class*)_value; - return [NSString stringWithFormat:@"Class:%s", - class_get_class_name(*pvalue)]; - }; - break; - case _C_SEL: - { - SEL* pvalue=(SEL*)_value; - return [NSString stringWithFormat:@"SEL:%s", - sel_get_name(*pvalue)]; - }; - break; - case _C_CHR: - { - char* pvalue=(char*)_value; - return [NSString stringWithFormat:@"CHAR:%c", - *pvalue]; - }; - break; - case _C_UCHR: - { - unsigned char* pvalue=(unsigned char*)_value; - return [NSString stringWithFormat:@"UCHAR:%d", - (int)*pvalue]; - }; - break; - case _C_SHT: - { - short* pvalue=(short*)_value; - return [NSString stringWithFormat:@"SHORT:%d", - (int)*pvalue]; - }; - break; - case _C_USHT: - { - unsigned short* pvalue=(unsigned short*)_value; - return [NSString stringWithFormat:@"USHORT:%d", - (int)*pvalue]; - }; - break; - case _C_INT: - { - int* pvalue=(int*)_value; - return [NSString stringWithFormat:@"INT:%d", - *pvalue]; - }; - break; - case _C_UINT: - { - unsigned int* pvalue=(unsigned int*)_value; - return [NSString stringWithFormat:@"UINT:%u", - *pvalue]; - }; - break; - case _C_LNG: - { - long* pvalue=(long*)_value; - return [NSString stringWithFormat:@"LONG:%ld", - *pvalue]; - }; - break; - case _C_ULNG: - { - unsigned long* pvalue=(unsigned long*)_value; - return [NSString stringWithFormat:@"ULONG:%lu", - *pvalue]; - }; - break; - case _C_FLT: - { - float* pvalue=(float*)_value; - return [NSString stringWithFormat:@"FLOAT:%f", - (double)*pvalue]; - }; - break; - case _C_DBL: - { - double* pvalue=(double*)_value; - return [NSString stringWithFormat:@"DOUBLE:%f", - *pvalue]; - }; - break; - case _C_VOID: - { - void* pvalue=(void*)_value; - return [NSString stringWithFormat:@"VOID:*%lX", - (unsigned long)pvalue]; - }; - break; - case _C_CHARPTR: - { - char* pvalue=(void*)_value; - return [NSString stringWithFormat:@"CHAR*:%s", - pvalue]; - }; - break; - case _C_PTR: - { - return [NSString stringWithFormat:@"PTR"]; - }; - break; - case _C_STRUCT_B: - { - return [NSString stringWithFormat:@"STRUCT"]; - }; - break; - default: - return [NSString stringWithFormat:@"Unknown"]; - }; - } + if (aType && aValue) + { + switch (*aType) + { + case _C_ID: + { + id* pvalue=(id*)aValue; + return [NSString stringWithFormat:@"object:%ld Class:%s Description:%@", + (long)(*pvalue), + [*pvalue class], + objectDescription(*pvalue)]; + }; + break; + case _C_CLASS: + { + Class* pvalue=(Class*)aValue; + return [NSString stringWithFormat:@"Class:%s", + class_get_class_name(*pvalue)]; + }; + break; + case _C_SEL: + { + SEL* pvalue=(SEL*)aValue; + return [NSString stringWithFormat:@"SEL:%s", + sel_get_name(*pvalue)]; + }; + break; + case _C_CHR: + { + char* pvalue=(char*)aValue; + return [NSString stringWithFormat:@"CHAR:%c", + *pvalue]; + }; + break; + case _C_UCHR: + { + unsigned char* pvalue=(unsigned char*)aValue; + return [NSString stringWithFormat:@"UCHAR:%d", + (int)*pvalue]; + }; + break; + case _C_SHT: + { + short* pvalue=(short*)aValue; + return [NSString stringWithFormat:@"SHORT:%d", + (int)*pvalue]; + }; + break; + case _C_USHT: + { + unsigned short* pvalue=(unsigned short*)aValue; + return [NSString stringWithFormat:@"USHORT:%d", + (int)*pvalue]; + }; + break; + case _C_INT: + { + int* pvalue=(int*)aValue; + return [NSString stringWithFormat:@"INT:%d", + *pvalue]; + }; + break; + case _C_UINT: + { + unsigned int* pvalue=(unsigned int*)aValue; + return [NSString stringWithFormat:@"UINT:%u", + *pvalue]; + }; + break; + case _C_LNG: + { + long* pvalue=(long*)aValue; + return [NSString stringWithFormat:@"LONG:%ld", + *pvalue]; + }; + break; + case _C_ULNG: + { + unsigned long* pvalue=(unsigned long*)aValue; + return [NSString stringWithFormat:@"ULONG:%lu", + *pvalue]; + }; + break; + case _C_FLT: + { + float* pvalue=(float*)aValue; + return [NSString stringWithFormat:@"FLOAT:%f", + (double)*pvalue]; + }; + break; + case _C_DBL: + { + double* pvalue=(double*)aValue; + return [NSString stringWithFormat:@"DOUBLE:%f", + *pvalue]; + }; + break; + case _C_VOID: + { + void* pvalue=(void*)aValue; + return [NSString stringWithFormat:@"VOID:*%lX", + (unsigned long)pvalue]; + }; + break; + case _C_CHARPTR: + { + char* pvalue=(void*)aValue; + return [NSString stringWithFormat:@"CHAR*:%s", + pvalue]; + }; + break; + case _C_PTR: + { + return [NSString stringWithFormat:@"PTR"]; + }; + break; + case _C_STRUCT_B: + { + return [NSString stringWithFormat:@"STRUCT"]; + }; + break; + default: + return [NSString stringWithFormat:@"Unknown"]; + }; + } else - return [NSString stringWithString:@"NULL type or NULL pValue"]; + return [NSString stringWithString:@"NULL type or NULL pValue"]; }; //-------------------------------------------------------------------- -NSString* TypeToNSString(const char* _type) +NSString* TypeToNSString(const char* aType) { - if (_type) - { - switch (*_type) - { - case _C_ID: - { // '@' - const char *t = _type + 1; - if (*t == '"') - { - const char *start = t + 1; - do - { - t++; - } - while ((*t != '"') && (*t != '\0')); + if (aType) + { + switch (*aType) + { + case _C_ID: + { // '@' + const char *t = aType + 1; + if (*t == '"') + { + const char *start = t + 1; + do + { + t++; + } + while ((*t != '"') && (*t != '\0')); - return [[NSString stringWithCString:start - length:(t - start)] - stringByAppendingString:@" *"]; - } - else - return @"id"; - }; - break; - case _C_CLASS: return @"Class"; - case _C_SEL: return @"SEL"; - case _C_CHR: return @"char"; - case _C_UCHR: return @"unsigned char"; - case _C_SHT: return @"short"; - case _C_USHT: return @"unsigned short"; - case _C_INT: return @"int"; - case _C_UINT: return @"unsigned int"; - case _C_LNG: return @"long"; - case _C_ULNG: return @"unsigned long"; -// case _C_LNG_LNG: return @"long long"; -// case _C_ULNG_LNG: return @"unsigned long long"; - case _C_FLT: return @"float"; - case _C_DBL: return @"double"; - case _C_VOID: return @"void"; - case _C_CHARPTR: return @"char *"; - case _C_PTR: - return [NSString stringWithFormat:@"%@ *", - TypeToNSString(_type + 1)]; - break; - case _C_STRUCT_B: - { - NSString *structName = nil; - const char *t = _type + 1; + return [[NSString stringWithCString:start + length:(t - start)] + stringByAppendingString:@" *"]; + } + else + return @"id"; + }; + break; + case _C_CLASS: return @"Class"; + case _C_SEL: return @"SEL"; + case _C_CHR: return @"char"; + case _C_UCHR: return @"unsigned char"; + case _C_SHT: return @"short"; + case _C_USHT: return @"unsigned short"; + case _C_INT: return @"int"; + case _C_UINT: return @"unsigned int"; + case _C_LNG: return @"long"; + case _C_ULNG: return @"unsigned long"; + // case _C_LNG_LNG: return @"long long"; + // case _C_ULNG_LNG: return @"unsigned long long"; + case _C_FLT: return @"float"; + case _C_DBL: return @"double"; + case _C_VOID: return @"void"; + case _C_CHARPTR: return @"char *"; + case _C_PTR: + return [NSString stringWithFormat:@"%@ *", + TypeToNSString(aType + 1)]; + break; + case _C_STRUCT_B: + { + NSString *structName = nil; + const char *t = aType + 1; - if (*t == '?') - structName = @"?"; - else - { - const char *beg = t; - while ((*t != '=') && (*t != '\0') && (*t != _C_STRUCT_E)) - t++; - structName = [NSString stringWithCString:beg length:(t - beg)]; - }; + if (*t == '?') + structName = @"?"; + else + { + const char *beg = t; + while ((*t != '=') && (*t != '\0') && (*t != _C_STRUCT_E)) + t++; + structName = [NSString stringWithCString:beg length:(t - beg)]; + }; - return [NSString stringWithFormat:@"struct %@ {...}", structName]; - }; + return [NSString stringWithFormat:@"struct %@ {...}", structName]; + }; - default: - return [NSString stringWithFormat:@"%s", _type]; - }; - } + default: + return [NSString stringWithFormat:@"%s", aType]; + }; + } else - return [NSString stringWithString:@"NULL type"]; + return [NSString stringWithString:@"NULL type"]; }; //-------------------------------------------------------------------- void DumpIVar(id object,struct objc_ivar* ivar,int deep) { if (ivar && object && deep>=0) - { - void* pValue=((void*)object) + ivar->ivar_offset; - NSString* pType=TypeToNSString(ivar->ivar_type); - NSString* pIVar=IVarInString(ivar->ivar_type,pValue); - NSDebugFLog(@"IVar %s type:%@ value:%@\n", - ivar->ivar_name, - pType, - pIVar); - if (deep>0 && ivar->ivar_type && *ivar->ivar_type==_C_ID && pValue) - { - GSWLogDumpObjectFn(NULL,0,*((id*)pValue),deep); - }; - }; + { + void* pValue=((void*)object) + ivar->ivar_offset; + NSString* pType=TypeToNSString(ivar->ivar_type); + NSString* pIVar=IVarInString(ivar->ivar_type,pValue); + NSDebugFLog(@"IVar %s type:%@ value:%@\n", + ivar->ivar_name, + pType, + pIVar); + if (deep>0 && ivar->ivar_type && *ivar->ivar_type==_C_ID && pValue) + { + GSWLogDumpObjectFn(NULL,0,*((id*)pValue),deep); + }; + }; }; //-------------------------------------------------------------------- @@ -316,59 +326,59 @@ void DumpIVar(id object,struct objc_ivar* ivar,int deep) void GSWLogDumpObjectFn(CONST char* file,int line,id object,int deep) { USTART - if (object && deep>0) - { - struct objc_ivar_list *ivars=NULL; - Class class = [object class]; - if (class) - { - NSDebugFLog(@"--%s %d [%d] Dumping object %p of Class %s Description:%@\n", - (file && isalpha(*file) && line>=0 && line<=20000) ? file :"", - line, - deep, - (void*)object, - class->name, - objectDescription(object)); - while (class) - { - ivars = class->ivars; - class = class->super_class; - if (ivars) - { - int i; - for (i = 0; i < ivars->ivar_count; i++) - { - DumpIVar(object,&ivars->ivar_list[i],deep-1); - }; - } - }; - }; - }; + if (object && deep>0) + { + struct objc_ivar_list *ivars=NULL; + Class class = [object class]; + if (class) + { + NSDebugFLog(@"--%s %d [%d] Dumping object %p of Class %s Description:%@\n", + (file && isalpha(*file) && line>=0 && line<=20000) ? file :"", + line, + deep, + (void*)object, + class->name, + objectDescription(object)); + while (class) + { + ivars = class->ivars; + class = class->super_class; + if (ivars) + { + int i; + for (i = 0; i < ivars->ivar_count; i++) + { + DumpIVar(object,&ivars->ivar_list[i],deep-1); + }; + } + }; + }; + }; USTOP -}; + }; //-------------------------------------------------------------------- void GSWLogAssertGoodFn(CONST char* file,int line,NSObject* object) { if (object) - { - if ([object isa]==((Class)0xdeadface)) - { - [GSWApp statusDebugWithFormat:@"DEAD FACE: object %p isa=%p in %s at %d\n", - (void*)object, - (void*)[object isa], - file, - line]; - NSCParameterAssert([object isa]==(Class)0xdeadface); - }; - } + { + if ([object isa]==((Class)0xdeadface)) + { + [GSWApp statusDebugWithFormat:@"DEAD FACE: object %p isa=%p in %s at %d\n", + (void*)object, + (void*)[object isa], + file, + line]; + NSCParameterAssert([object isa]==(Class)0xdeadface); + }; + } else - { - [GSWApp statusDebugWithFormat:@"NULL: object %p in %s at %d\n", - (void*)object, - file, - line]; - NSCParameterAssert(object); - }; + { + [GSWApp statusDebugWithFormat:@"NULL: object %p in %s at %d\n", + (void*)object, + file, + line]; + NSCParameterAssert(object); + }; }; #endif diff --git a/GSWeb.framework/GSWDeployedBundle.h b/GSWeb.framework/GSWDeployedBundle.h index fc46e7e..9a42ce4 100644 --- a/GSWeb.framework/GSWDeployedBundle.h +++ b/GSWeb.framework/GSWDeployedBundle.h @@ -1,11 +1,18 @@ -/* GSWDeployedBundle.h - GSWeb: Class GSWDeployedBundle - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDeployedBundle.h - GSWeb: Class GSWDeployedBundle + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Mar 1999 + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + + + This file is part of the GNUstep Web 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 @@ -19,7 +26,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,50 +38,50 @@ //==================================================================== @interface GSWDeployedBundle : NSObject { - NSString* bundlePath; - GSWMultiKeyDictionary* relativePathsCache; - NSRecursiveLock* selfLock; + NSString* _bundlePath; + GSWMultiKeyDictionary* _relativePathsCache; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; - objc_thread_t selfLock_thread_id; - objc_thread_t creation_thread_id; + int _selfLockn; + objc_thread_t _selfLock_thread_id; + objc_thread_t _creation_thread_id; #endif }; -(void)dealloc; -(NSString*)description; --(id)initWithPath:(NSString*)path_; +-(id)initWithPath:(NSString*)aPath; -(GSWProjectBundle*)projectBundle; -(BOOL)isFramework; -(NSString*)wrapperName; -(NSString*)projectName; -(NSString*)bundlePath; --(NSArray*)pathsForResourcesOfType:(NSString*)type_; --(NSArray*)lockedPathsForResourcesOfType:(NSString*)type_; --(NSString*)relativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_; --(NSString*)relativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(NSString*)directory_ - forLanguages:(NSArray*)languages_; --(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(NSString*)directory_ - forLanguage:(NSString*)language_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(NSString*)directory_ - forLanguage:(NSString*)language_; +-(NSArray*)pathsForResourcesOfType:(NSString*)aType; +-(NSArray*)lockedPathsForResourcesOfType:(NSString*)aType; +-(NSString*)relativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage; +-(NSString*)relativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(NSString*)aDirectory + forLanguages:(NSArray*)someLanguages; +-(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(NSString*)aDirectory + forLanguage:(NSString*)aLanguage; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(NSString*)aDirectory + forLanguage:(NSString*)aLanguage; -(void)lock; -(void)unlock; @end @interface GSWDeployedBundle (GSWDeployedBundleA) -+(GSWDeployedBundle*)bundleWithPath:(NSString*)path_; ++(GSWDeployedBundle*)bundleWithPath:(NSString*)aPath; @end #endif //_GSWDeployedBundle_h__ diff --git a/GSWeb.framework/GSWDeployedBundle.m b/GSWeb.framework/GSWDeployedBundle.m index 2a2f747..ea1858e 100644 --- a/GSWeb.framework/GSWDeployedBundle.m +++ b/GSWeb.framework/GSWDeployedBundle.m @@ -1,4 +1,5 @@ /** GSWDeployedBundle.m - GSWeb: Class GSWDeployedBundle + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon @@ -37,29 +38,29 @@ static char rcsId[] = "$Id$"; @implementation GSWDeployedBundle //-------------------------------------------------------------------- --(id)initWithPath:(NSString*)path_ +-(id)initWithPath:(NSString*)aPath { LOGObjectFnStart(); if ((self=[super init])) - { - NSDebugMLLog(@"bundles",@"path_=%@",path_); - ASSIGN(bundlePath,[path_ stringGoodPath]); - NSDebugMLLog(@"bundles",@"bundlePath=%@",bundlePath); - relativePathsCache=[GSWMultiKeyDictionary new]; + { + NSDebugMLLog(@"bundles",@"aPath=%@",aPath); + ASSIGN(_bundlePath,[aPath stringGoodPath]); + NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath); + _relativePathsCache=[GSWMultiKeyDictionary new]; #ifndef NDEBUG - creation_thread_id=objc_thread_id(); + _creation_thread_id=objc_thread_id(); #endif - selfLock=[NSRecursiveLock new]; + _selfLock=[NSRecursiveLock new]; /* - NSDebugMLog(@"selfLock->mutex=%p",(void*)selfLock->mutex); - NSDebugMLog(@"selfLock->mutex backend=%p",(void*)((pthread_mutex_t*)(selfLock->mutex->backend))); - NSDebugMLog(@"selfLock->mutex backend m_owner=%p", - (void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_owner)); - NSDebugMLog(@"selfLock->mutex backend m_count=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_count)); - NSDebugMLog(@"selfLock->mutex backend m_kind=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_kind)); - NSDebugMLog(@"selfLock->mutex backend m_spinlock=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_spinlock)); + NSDebugMLog(@"selfLock->mutex=%p",(void*)selfLock->mutex); + NSDebugMLog(@"selfLock->mutex backend=%p",(void*)((pthread_mutex_t*)(selfLock->mutex->backend))); + NSDebugMLog(@"selfLock->mutex backend m_owner=%p", + (void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_owner)); + NSDebugMLog(@"selfLock->mutex backend m_count=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_count)); + NSDebugMLog(@"selfLock->mutex backend m_kind=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_kind)); + NSDebugMLog(@"selfLock->mutex backend m_spinlock=%p",(void*)(((pthread_mutex_t*)(selfLock->mutex->backend))->m_spinlock)); */ - }; + }; LOGObjectFnStop(); return self; }; @@ -68,17 +69,17 @@ static char rcsId[] = "$Id$"; -(void)dealloc { NSDebugFLog(@"Dealloc GSWDeployedBundle %p",(void*)self); - DESTROY(bundlePath); - DESTROY(relativePathsCache); + DESTROY(_bundlePath); + DESTROY(_relativePathsCache); GSWLogC("Dealloc GSWDeployedBundle: selfLock"); NSDebugFLog(@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p creation_thread_id=%p", - (void*)selfLock, - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id(), - (void*)creation_thread_id); + (void*)_selfLock, + _selfLockn, + (void*)_selfLock_thread_id, + (void*)objc_thread_id(), + (void*)_creation_thread_id); fflush(stderr); - DESTROY(selfLock); + DESTROY(_selfLock); GSWLogC("Dealloc GSWDeployedBundle Super"); [super dealloc]; NSDebugFLog(@"End Dealloc GSWDeployedBundle %p",(void*)self); @@ -90,14 +91,14 @@ static char rcsId[] = "$Id$"; NSString* descr=nil; // GSWLogC("GSWDeployedBundle description A"); descr=[NSString stringWithFormat:@"<%s %p - ", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; // GSWLogC("GSWDeployedBundle description B"); descr=[descr stringByAppendingFormat:@"bundlePath:%@ ", - bundlePath]; + _bundlePath]; // GSWLogC("GSWDeployedBundle description C"); descr=[descr stringByAppendingFormat:@"relativePathsCache=%p>", - (void*)relativePathsCache]; + (void*)_relativePathsCache]; // GSWLogC("GSWDeployedBundle description D"); return descr; }; @@ -106,41 +107,41 @@ static char rcsId[] = "$Id$"; -(GSWProjectBundle*)projectBundle { //OK - NSString* _projectName=nil; - BOOL _isFramework=NO; - GSWDeployedBundle* _projectBundle=nil; + NSString* projectName=nil; + BOOL isFramework=NO; + GSWDeployedBundle* projectBundle=nil; LOGObjectFnStart(); - _projectName=[self projectName]; - NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName); - _isFramework=[self isFramework]; - NSDebugMLLog(@"bundles",@"_isFramework=%s",(_isFramework ? "YES" : "NO")); - _projectBundle=[GSWProjectBundle projectBundleForProjectNamed:_projectName - isFramework:_isFramework]; - NSDebugMLLog(@"bundles",@"_projectBundle=%@",_projectBundle); + projectName=[self projectName]; + NSDebugMLLog(@"bundles",@"projectName=%@",projectName); + isFramework=[self isFramework]; + NSDebugMLLog(@"bundles",@"isFramework=%s",(isFramework ? "YES" : "NO")); + projectBundle=[GSWProjectBundle projectBundleForProjectNamed:projectName + isFramework:isFramework]; + NSDebugMLLog(@"bundles",@"projectBundle=%@",projectBundle); LOGObjectFnStop(); - return (GSWProjectBundle*)_projectBundle; + return (GSWProjectBundle*)projectBundle; }; //-------------------------------------------------------------------- -(BOOL)isFramework { //OK ?? - return [bundlePath hasSuffix:GSFrameworkSuffix]; + return [_bundlePath hasSuffix:GSFrameworkSuffix]; }; //-------------------------------------------------------------------- -(NSString*)wrapperName { //OK ? - NSString* _projectName=nil; + NSString* projectName=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"bundlePath=%@",bundlePath); - _projectName=[bundlePath lastPathComponent]; - NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName); - _projectName=[_projectName stringByDeletingPathExtension]; - NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName); + NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath); + projectName=[_bundlePath lastPathComponent]; + NSDebugMLLog(@"bundles",@"projectName=%@",projectName); + projectName=[projectName stringByDeletingPathExtension]; + NSDebugMLLog(@"bundles",@"projectName=%@",projectName); LOGObjectFnStop(); - return _projectName; + return projectName; }; //-------------------------------------------------------------------- @@ -148,291 +149,295 @@ static char rcsId[] = "$Id$"; { // H:\Wotests\ObjCTest3\ObjCTest3.gswa ==> ObjCTest3 //OK ? - NSString* _projectName=nil; + NSString* projectName=nil; LOGObjectFnStart(); NSDebugMLLog(@"bundles",@"_gnustep_target_cpu=%@",[NSBundle _gnustep_target_cpu]); NSDebugMLLog(@"bundles",@"_gnustep_target_dir=%@",[NSBundle _gnustep_target_dir]); NSDebugMLLog(@"bundles",@"_gnustep_target_os=%@",[NSBundle _gnustep_target_os]); NSDebugMLLog(@"bundles",@"_library_combo=%@",[NSBundle _library_combo]); - NSDebugMLLog(@"bundles",@"bundlePath=%@",bundlePath); - _projectName=[bundlePath lastPathComponent]; - NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName); - _projectName=[_projectName stringByDeletingPathExtension]; - NSDebugMLLog(@"bundles",@"_projectName=%@",_projectName); + NSDebugMLLog(@"bundles",@"_bundlePath=%@",_bundlePath); + projectName=[_bundlePath lastPathComponent]; + NSDebugMLLog(@"bundles",@"projectName=%@",projectName); + projectName=[projectName stringByDeletingPathExtension]; + NSDebugMLLog(@"bundles",@"projectName=%@",projectName); LOGObjectFnStop(); - return _projectName; + return projectName; }; //-------------------------------------------------------------------- -(NSString*)bundlePath { - return bundlePath; + return _bundlePath; }; //-------------------------------------------------------------------- --(NSArray*)pathsForResourcesOfType:(NSString*)type_ +-(NSArray*)pathsForResourcesOfType:(NSString*)aType { //OK - NSArray* _paths=nil; + NSArray* paths=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"type_=%@ language_=%@",type_); + NSDebugMLLog(@"bundles",@"aType=%@",aType); [self lock]; NS_DURING - { - _paths=[self lockedPathsForResourcesOfType:type_]; - NSDebugMLLog(@"bundles",@"_paths=%@",_paths); - } + { + paths=[self lockedPathsForResourcesOfType:aType]; + NSDebugMLLog(@"bundles",@"paths=%@",paths); + } NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)", + localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; - return _paths; + return paths; }; //-------------------------------------------------------------------- --(NSArray*)lockedPathsForResourcesOfType:(NSString*)type_ +-(NSArray*)lockedPathsForResourcesOfType:(NSString*)aType { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(NSString*)relativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_ +-(NSString*)relativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); [self lock]; - NSDebugMLLog(@"bundles",@"name_=%@ language_=%@",name_,language_); + NSDebugMLLog(@"bundles",@"aName=%@ aLanguage=%@",aName,aLanguage); NS_DURING - { - _path=[self lockedRelativePathForResourceNamed:name_ - forLanguage:language_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - } + { + path=[self lockedRelativePathForResourceNamed:aName + forLanguage:aLanguage]; + NSDebugMLLog(@"bundles",@"path=%@",path); + } NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)", + localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)relativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_ +-(NSString*)relativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages { - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ languages_=%@",name_,languages_); + NSDebugMLLog(@"bundles",@"aName=%@ someLanguages=%@",aName,someLanguages); [self lock]; NS_DURING - { - _path=[self lockedRelativePathForResourceNamed:name_ - forLanguages:languages_]; - //NSDebugMLLog(@"bundles",@"_path=%@",_path); - } + { + path=[self lockedRelativePathForResourceNamed:aName + forLanguages:someLanguages]; + //NSDebugMLLog(@"bundles",@"path=%@",path); + } NS_HANDLER - { - NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)",localException,[localException reason]); - //TODO - [self unlock]; - [localException raise]; - }; + { + NSDebugMLLog(@"bundles",@"EXCEPTION:%@ (%@)", + localException,[localException reason]); + //TODO + [self unlock]; + [localException raise]; + }; NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ language_=%@",name_,language_); - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"Resources/WebServer" - forLanguage:language_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - if (!_path) - { - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"Resources" - forLanguage:language_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - if (!_path) - { - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"." - forLanguage:language_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - }; - }; + NSDebugMLLog(@"bundles",@"aName=%@ aLanguage=%@",aName,aLanguage); + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"Resources/WebServer" + forLanguage:aLanguage]; + NSDebugMLLog(@"bundles",@"path=%@",path); + if (!path) + { + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"Resources" + forLanguage:aLanguage]; + NSDebugMLLog(@"bundles",@"path=%@",path); + if (!path) + { + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"." + forLanguage:aLanguage]; + NSDebugMLLog(@"bundles",@"path=%@",path); + }; + }; LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ languages_=%@",name_,languages_); - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"Resources/WebServer" - forLanguages:languages_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - if (!_path) - { - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"Resources" - forLanguages:languages_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - if (!_path) - { - NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",bundlePath); - _path=[self lockedRelativePathForResourceNamed:name_ - inDirectory:@"." - forLanguages:languages_]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - }; - }; + NSDebugMLLog(@"bundles",@"aName=%@ someLanguages=%@",aName,someLanguages); + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources/WebServer",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"Resources/WebServer" + forLanguages:someLanguages]; + NSDebugMLLog(@"bundles",@"path=%@",path); + if (!path) + { + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying Resources",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"Resources" + forLanguages:someLanguages]; + NSDebugMLLog(@"bundles",@"path=%@",path); + if (!path) + { + NSDebugMLLog(@"bundles",@"bundlePath=%@ Trying .",_bundlePath); + path=[self lockedRelativePathForResourceNamed:aName + inDirectory:@"." + forLanguages:someLanguages]; + NSDebugMLLog(@"bundles",@"path=%@",path); + }; + }; LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(id)directory_ - forLanguages:(NSArray*)languages_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(id)aDirectory + forLanguages:(NSArray*)someLanguages { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ directory_=%@ languages_=%@",name_,directory_,languages_); - if (languages_) - { - int i=0; - for(i=0;!_path && i<[languages_ count];i++) - { - _path=[self lockedCachedRelativePathForResourceNamed:name_ - inDirectory:directory_ - forLanguage:[languages_ objectAtIndex:i]]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); - }; - }; - if (!_path) - _path=[self lockedCachedRelativePathForResourceNamed:name_ - inDirectory:directory_ - forLanguage:nil]; - NSDebugMLLog(@"bundles",@"_path=%@",_path); + NSDebugMLLog(@"bundles",@"aName=%@ aDirectory=%@ someLanguages=%@",aName,aDirectory,someLanguages); + if (someLanguages) + { + int i=0; + for(i=0;!path && i<[someLanguages count];i++) + { + path=[self lockedCachedRelativePathForResourceNamed:aName + inDirectory:aDirectory + forLanguage:[someLanguages objectAtIndex:i]]; + NSDebugMLLog(@"bundles",@"path=%@",path); + }; + }; + if (!path) + path=[self lockedCachedRelativePathForResourceNamed:aName + inDirectory:aDirectory + forLanguage:nil]; + NSDebugMLLog(@"bundles",@"path=%@",path); LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(NSString*)directory_ - forLanguage:(NSString*)language_ +-(NSString*)lockedCachedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(NSString*)aDirectory + forLanguage:(NSString*)aLanguage { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ directory_=%@ language_=%@",name_,directory_,language_); - if (name_) - { - NSString* _emptyString=[NSString string]; - NSString* _bundlePath=[self bundlePath]; - NSArray* _keys; - if ([directory_ isEqualToString:@"."]) - directory_=nil; - if (language_) - _keys=[NSArray arrayWithObjects:name_, - _bundlePath ? _bundlePath : _emptyString, - directory_ ? directory_ : _emptyString, - language_ ? language_ : _emptyString, - nil]; - else - _keys=[NSArray arrayWithObjects:name_, - _bundlePath ? _bundlePath : _emptyString, - directory_ ? directory_ : _emptyString, - nil]; - //NSDebugMLLog(@"bundles",@"_keys=%@",_keys); - _path=[relativePathsCache objectForKeysArray:_keys]; - //NSDebugMLLog(@"bundles",@"_path=%@",_path); - if (_path==GSNotFoundMarker) - _path=nil; - if (!_path) - { - //call again _relativePathForResourceNamed:inDirectory:forLanguage: - NSString* _completePathTest=nil; - BOOL _exists=NO; - NSFileManager* _fileManager=nil; - NSString* _pathTest=[NSString string]; - if (directory_) - _pathTest=[_pathTest stringByAppendingPathComponent:directory_]; - //NSDebugMLLog(@"bundles",@"_pathTest=%@",_pathTest); - if (language_) - _pathTest=[_pathTest stringByAppendingPathComponent: - [language_ stringByAppendingString:GSLanguagePSuffix]]; - //NSDebugMLLog(@"bundles",@"_pathTest=%@",_pathTest); - _pathTest=[_pathTest stringByAppendingPathComponent:name_]; - NSDebugMLLog(@"bundles",@"_pathTest=%@",_pathTest); - _completePathTest=[_bundlePath stringByAppendingPathComponent:_pathTest]; - NSDebugMLLog(@"bundles",@"_completePathTest=%@",_completePathTest); - _fileManager=[NSFileManager defaultManager]; - _exists=[_fileManager fileExistsAtPath:_completePathTest]; - NSDebugMLLog(@"bundles",@"_exists=%s",(_exists ? "YES" : "NO")); - if (_exists) - { - _path=_pathTest; - [relativePathsCache setObject:_path - forKeysArray:_keys]; - } - else - [relativePathsCache setObject:GSNotFoundMarker - forKeysArray:_keys]; - }; - }; - NSDebugMLLog(@"bundles",@"_path=%@",_path); + NSDebugMLLog(@"bundles",@"aName=%@ aDirectory=%@ aLanguage=%@",aName,aDirectory,aLanguage); + if (aName) + { + NSString* emptyString=[NSString string]; + NSString* bundlePath=[self bundlePath]; + NSArray* keys; + if ([aDirectory isEqualToString:@"."]) + aDirectory=nil; + if (aLanguage) + keys=[NSArray arrayWithObjects:aName, + bundlePath ? bundlePath : emptyString, + aDirectory ? aDirectory : emptyString, + aLanguage ? aLanguage : emptyString, + nil]; + else + keys=[NSArray arrayWithObjects:aName, + bundlePath ? bundlePath : emptyString, + aDirectory ? aDirectory : emptyString, + nil]; + //NSDebugMLLog(@"bundles",@"_keys=%@",_keys); + path=[_relativePathsCache objectForKeysArray:keys]; + //NSDebugMLLog(@"bundles",@"_path=%@",_path); + if (path==GSNotFoundMarker) + path=nil; + if (!path) + { + //call again _relativePathForResourceNamed:inDirectory:forLanguage: + NSString* completePathTest=nil; + BOOL exists=NO; + NSFileManager* fileManager=nil; + NSString* pathTest=[NSString string]; + if (aDirectory) + pathTest=[pathTest stringByAppendingPathComponent:aDirectory]; + //NSDebugMLLog(@"bundles",@"_pathTest=%@",_pathTest); + if (aLanguage) + pathTest=[pathTest stringByAppendingPathComponent: + [aLanguage stringByAppendingString:GSLanguagePSuffix]]; + //NSDebugMLLog(@"bundles",@"pathTest=%@",pathTest); + pathTest=[pathTest stringByAppendingPathComponent:aName]; + NSDebugMLLog(@"bundles",@"pathTest=%@",pathTest); + completePathTest=[bundlePath stringByAppendingPathComponent:pathTest]; + NSDebugMLLog(@"bundles",@"completePathTest=%@",completePathTest); + fileManager=[NSFileManager defaultManager]; + exists=[fileManager fileExistsAtPath:completePathTest]; + NSDebugMLLog(@"bundles",@"exists=%s",(exists ? "YES" : "NO")); + if (exists) + { + path=pathTest; + [_relativePathsCache setObject:path + forKeysArray:keys]; + } + else + [_relativePathsCache setObject:GSNotFoundMarker + forKeysArray:keys]; + }; + }; + NSDebugMLLog(@"bundles",@"path=%@",path); LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - inDirectory:(NSString*)directory_ - forLanguage:(NSString*)language_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + inDirectory:(NSString*)aDirectory + forLanguage:(NSString*)aLanguage { //OK - NSString* _path=nil; + NSString* path=nil; LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"name_=%@ directory_=%@ language_=%@",name_,directory_,language_); - _path=[self lockedCachedRelativePathForResourceNamed:name_ - inDirectory:directory_ - forLanguage:language_]; + NSDebugMLLog(@"bundles",@"aName=%@ aDirectory=%@ aLanguage=%@", + aName,aDirectory,aLanguage); + path=[self lockedCachedRelativePathForResourceNamed:aName + inDirectory:aDirectory + forLanguage:aLanguage]; LOGObjectFnStop(); - return _path; + return path; }; //-------------------------------------------------------------------- @@ -441,27 +446,27 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); NSDebugMLLog(@"bundles",@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - (void*)selfLock, - selfLockn, - (void*)selfLock_thread_id, + (void*)_selfLock, + _selfLockn, + (void*)_selfLock_thread_id, (void*)objc_thread_id()); - if (selfLockn>0) - { - if (selfLock_thread_id!=objc_thread_id()) - { - NSDebugMLog0(@"PROBLEM: owner!=thread id"); - }; - }; - TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + if (_selfLockn>0) + { + if (_selfLock_thread_id!=objc_thread_id()) + { + NSDebugMLog0(@"PROBLEM: owner!=thread id"); + }; + }; + TmpLockBeforeDate(_selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); #ifndef NDEBUG - selfLockn++; - selfLock_thread_id=objc_thread_id(); + _selfLockn++; + _selfLock_thread_id=objc_thread_id(); #endif NSDebugMLLog(@"bundles",@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - selfLock, - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id()); + _selfLock, + _selfLockn, + (void*)_selfLock_thread_id, + (void*)objc_thread_id()); LOGObjectFnStop(); }; @@ -471,28 +476,28 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); NSDebugMLLog(@"bundles",@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - (void*)selfLock, - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id()); - if (selfLockn>0) - { - if (selfLock_thread_id!=objc_thread_id()) - { - NSDebugMLog0(@"PROBLEM: owner!=thread id"); - }; - }; - TmpUnlock(selfLock); + (void*)_selfLock, + _selfLockn, + (void*)_selfLock_thread_id, + (void*)objc_thread_id()); + if (_selfLockn>0) + { + if (_selfLock_thread_id!=objc_thread_id()) + { + NSDebugMLog0(@"PROBLEM: owner!=thread id"); + }; + }; + TmpUnlock(_selfLock); #ifndef NDEBUG - selfLockn--; - if (selfLockn==0) - selfLock_thread_id=NULL; + _selfLockn--; + if (_selfLockn==0) + _selfLock_thread_id=NULL; #endif NSDebugMLLog(@"bundles",@"selfLock=%p selfLockn=%d selfLock_thread_id=%p objc_thread_id()=%p", - (void*)selfLock, - selfLockn, - (void*)selfLock_thread_id, - (void*)objc_thread_id()); + (void*)_selfLock, + _selfLockn, + (void*)_selfLock_thread_id, + (void*)objc_thread_id()); LOGObjectFnStop(); }; @@ -502,12 +507,12 @@ static char rcsId[] = "$Id$"; @implementation GSWDeployedBundle (GSWDeployedBundleA) //-------------------------------------------------------------------- -+(id)bundleWithPath:(NSString*)path_ ++(id)bundleWithPath:(NSString*)aPath { - id _bundle=nil; - NSDebugMLLog(@"bundles",@"path_=%@",path_); - _bundle=[[[GSWDeployedBundle alloc]initWithPath:path_]autorelease]; - return _bundle; + id bundle=nil; + NSDebugMLLog(@"bundles",@"aPath=%@",aPath); + bundle=[[[GSWDeployedBundle alloc]initWithPath:aPath]autorelease]; + return bundle; }; @end diff --git a/GSWeb.framework/GSWDirectActionRequestHandler.h b/GSWeb.framework/GSWDirectActionRequestHandler.h index a07942f..2c7be8e 100644 --- a/GSWeb.framework/GSWDirectActionRequestHandler.h +++ b/GSWeb.framework/GSWDirectActionRequestHandler.h @@ -1,11 +1,16 @@ -/* GSWDirectActionRequestHandler.h - GSWeb: Class GSWDirectActionRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDirectActionRequestHandler.h - GSWeb: Class GSWDirectActionRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,10 +37,10 @@ { }; --(GSWResponse*)handleRequest:(GSWRequest*)request_; +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest; -(GSWResponse*)_nilResponse; --(void)_initializeRequestSessionIDInContext:(GSWContext*)context_; --(id)submitButtonsActionPathFromRequest:(GSWRequest*)_request; +-(void)_initializeRequestSessionIDInContext:(GSWContext*)aContext; +-(id)submitButtonsActionPathFromRequest:(GSWRequest*)aRequest; @end //==================================================================== diff --git a/GSWeb.framework/GSWDirectActionRequestHandler.m b/GSWeb.framework/GSWDirectActionRequestHandler.m index 68f7fd4..7b1795a 100644 --- a/GSWeb.framework/GSWDirectActionRequestHandler.m +++ b/GSWeb.framework/GSWDirectActionRequestHandler.m @@ -1,11 +1,16 @@ -/* GSWDirectActionRequestHandler.m - GSWeb: Class GSWDirectActionRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDirectActionRequestHandler.m - GSWeb: Class GSWDirectActionRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,171 +35,176 @@ static char rcsId[] = "$Id$"; @implementation GSWDirectActionRequestHandler //-------------------------------------------------------------------- --(GSWResponse*)handleRequest:(GSWRequest*)request_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest { //OK - GSWResponse* _response=nil; - GSWStatisticsStore* _statisticsStore=nil; - GSWApplication* _application=nil; + GSWResponse* response=nil; + GSWStatisticsStore* statisticsStore=nil; + GSWApplication* application=nil; LOGObjectFnStart(); - _application=[GSWApplication application]; - if (0/*[_application isRefusingNewSessions]*/) - { - //TODO - } + application=[GSWApplication application]; + if (0/*[application isRefusingNewSessions]*/) + { + //TODO + } else - { - id _submitButtonsActionPathFromRequest=nil; - NSArray* _requestHandlerPathArray=nil; - NSString* _actionName=nil; - NSString* _className=nil; - GSWContext* _context=nil; - [_application lockRequestHandling]; - NS_DURING + { + id submitButtonsActionPathFromRequest=nil; + NSArray* requestHandlerPathArray=nil; + NSString* actionName=nil; + NSString* className=nil; + GSWContext* context=nil; + [application lockRequestHandling]; + NS_DURING + { + NS_DURING { - NS_DURING + statisticsStore=[[GSWApplication application]statisticsStore]; + [statisticsStore _applicationWillHandleDirectActionRequest]; + submitButtonsActionPathFromRequest=[self submitButtonsActionPathFromRequest:aRequest]; //So what ? + NSDebugMLLog(@"requests",@"submitButtonsActionPathFromRequest=%@", + submitButtonsActionPathFromRequest); + requestHandlerPathArray=[aRequest requestHandlerPathArray]; + NSDebugMLLog(@"requests",@"requestHandlerPathArray=%@", + requestHandlerPathArray); + switch([requestHandlerPathArray count]) { - _statisticsStore=[[GSWApplication application]statisticsStore]; - [_statisticsStore _applicationWillHandleDirectActionRequest]; - _submitButtonsActionPathFromRequest=[self submitButtonsActionPathFromRequest:request_]; //So what ? - NSDebugMLLog(@"requests",@"_submitButtonsActionPathFromRequest=%@",_submitButtonsActionPathFromRequest); - _requestHandlerPathArray=[request_ requestHandlerPathArray]; - NSDebugMLLog(@"requests",@"_requestHandlerPathArray=%@",_requestHandlerPathArray); - switch([_requestHandlerPathArray count]) - { - case 0: - _actionName=@"default"; - _className=@"DirectAction"; - break; - case 1: + case 0: + actionName=@"default"; + className=@"DirectAction"; + break; + case 1: + { + NSString* tmpActionName=[NSString stringWithFormat:@"%@Action", + [requestHandlerPathArray objectAtIndex:0]]; + SEL tmpActionSel=NSSelectorFromString(tmpActionName); + Class aClass = NSClassFromString(@"DirectAction"); + NSDebugMLLog(@"requests",@"tmpActionName=%@", + tmpActionName); + if (tmpActionSel && aClass) { - NSString* _tmpActionName=[NSString stringWithFormat:@"%@Action", - [_requestHandlerPathArray objectAtIndex:0]]; - SEL _tmpActionSel=NSSelectorFromString(_tmpActionName); - Class _class = NSClassFromString(@"DirectAction"); - NSDebugMLLog(@"requests",@"_tmpActionName=%@",_tmpActionName); - if (_tmpActionSel && _class) + if ([aClass instancesRespondToSelector:tmpActionSel]) { - if ([_class instancesRespondToSelector:_tmpActionSel]) - { - _actionName=[_requestHandlerPathArray objectAtIndex:0]; - _className=@"DirectAction"; - }; - }; - if (!_actionName) - { - _className=[_requestHandlerPathArray objectAtIndex:0]; - _actionName=@"default"; + actionName=[requestHandlerPathArray objectAtIndex:0]; + className=@"DirectAction"; }; }; - break; - case 2: - _className=[_requestHandlerPathArray objectAtIndex:0]; - _actionName=[NSString stringWithFormat:@"%@", - [_requestHandlerPathArray objectAtIndex:1]]; - break; - default: - ExceptionRaise0(@"GSWDirectActionRequestHandler",@"bad parameters count"); - break; - }; - NSDebugMLLog(@"requests",@"_className=%@",_className); - NSDebugMLLog(@"requests",@"_actionName=%@",_actionName); - if ([_application isCachingEnabled]) - { - //TODO - }; - { - GSWResourceManager* _resourceManager=nil; - GSWDeployedBundle* _appBundle=nil; - GSWDirectAction* _directAction=nil; - id _actionResult=nil; - Class _class=nil; - _resourceManager=[_application resourceManager]; - _appBundle=[_resourceManager _appProjectBundle]; - [_resourceManager _allFrameworkProjectBundles];//So what ? - [_application awake]; - _class=NSClassFromString(_className); - NSAssert1(_class,@"No direct action class named %@",_className); - _directAction=[[_class alloc]initWithRequest:request_]; - NSAssert1(_directAction,@"Direct action of class named %@ can't be created",_className); - _context=[_directAction _context]; - _actionResult=[_directAction performActionNamed:_actionName]; - _response=[_actionResult generateResponse]; - - //Finir ? - }; - } - NS_HANDLER - { - LOGException(@"%@ (%@)",localException,[localException reason]); - if (!_context) - _context=[GSWApp _context]; - _response=[_application handleException:localException - inContext:_context]; - //TODO - }; - NS_ENDHANDLER; - NSDebugMLLog(@"requests",@"_response=%@",_response); - RETAIN(_response); - if (!_context) - _context=[GSWApp _context]; - [_context _putAwakeComponentsToSleep]; - [_application saveSessionForContext:_context]; - NSDebugMLLog(@"requests",@"_response=%@",_response); - AUTORELEASE(_response); - - //Here ??? - [_application sleep]; - //TODO do not fnalize if already done (in handleException for exemple) - [_response _finalizeInContext:_context]; - [_application _setContext:nil]; - _statisticsStore=[[GSWApplication application] statisticsStore]; - [_statisticsStore _applicationDidHandleDirectActionRequestWithActionNamed:_actionName]; + if (!actionName) + { + className=[requestHandlerPathArray objectAtIndex:0]; + actionName=@"default"; + }; + }; + break; + case 2: + className=[requestHandlerPathArray objectAtIndex:0]; + actionName=[NSString stringWithFormat:@"%@", + [requestHandlerPathArray objectAtIndex:1]]; + break; + default: + ExceptionRaise0(@"GSWDirectActionRequestHandler",@"bad parameters count"); + break; + }; + NSDebugMLLog(@"requests",@"className=%@",className); + NSDebugMLLog(@"requests",@"actionName=%@",actionName); + if ([application isCachingEnabled]) + { + //TODO + }; + { + GSWResourceManager* resourceManager=nil; + GSWDeployedBundle* appBundle=nil; + GSWDirectAction* directAction=nil; + id actionResult=nil; + Class aClass=nil; + resourceManager=[application resourceManager]; + appBundle=[resourceManager _appProjectBundle]; + [resourceManager _allFrameworkProjectBundles];//So what ? + [application awake]; + aClass=NSClassFromString(className); + NSAssert1(aClass,@"No direct action class named %@", + className); + directAction=[[aClass alloc]initWithRequest:aRequest]; + NSAssert1(directAction,@"Direct action of class named %@ can't be created", + className); + context=[directAction _context]; + actionResult=[directAction performActionNamed:actionName]; + response=[actionResult generateResponse]; + + //Finir ? + }; } - NS_HANDLER + NS_HANDLER { LOGException(@"%@ (%@)",localException,[localException reason]); - [_application unlockRequestHandling]; - [localException raise];//TODO + if (!context) + context=[GSWApp _context]; + response=[application handleException:localException + inContext:context]; + //TODO }; - NS_ENDHANDLER; - [_application unlockRequestHandling]; - }; + NS_ENDHANDLER; + NSDebugMLLog(@"requests",@"response=%@",response); + RETAIN(response); + if (!context) + context=[GSWApp _context]; + [context _putAwakeComponentsToSleep]; + [application saveSessionForContext:context]; + NSDebugMLLog(@"requests",@"response=%@",response); + AUTORELEASE(response); + + //Here ??? + [application sleep]; + //TODO do not fnalize if already done (in handleException for exemple) + [response _finalizeInContext:context]; + [application _setContext:nil]; + statisticsStore=[[GSWApplication application] statisticsStore]; + [statisticsStore _applicationDidHandleDirectActionRequestWithActionNamed:actionName]; + } + NS_HANDLER + { + LOGException(@"%@ (%@)",localException,[localException reason]); + [application unlockRequestHandling]; + [localException raise];//TODO + }; + NS_ENDHANDLER; + [application unlockRequestHandling]; + }; LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- -(GSWResponse*)_nilResponse { //OK - GSWResponse* _response=nil; + GSWResponse* response=nil; LOGObjectFnStart(); - _response=[[GSWResponse new]autorelease]; - [_response appendContentString:@"DirectAction ErrorThe result of a direct action returned nothing."]; + response=[[GSWResponse new]autorelease]; + [response appendContentString:@"DirectAction ErrorThe result of a direct action returned nothing."]; LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(void)_initializeRequestSessionIDInContext:(GSWContext*)_context +-(void)_initializeRequestSessionIDInContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(id)submitButtonsActionPathFromRequest:(GSWRequest*)_request +-(id)submitButtonsActionPathFromRequest:(GSWRequest*)aRequest { //OK - NSArray* _submitActions=nil; + NSArray* submitActions=nil; LOGObjectFnStart(); - _submitActions=[_request formValuesForKey:GSWKey_SubmitAction[GSWebNamingConv]]; - if (_submitActions) - { - //TODO - }; - + submitActions=[aRequest formValuesForKey:GSWKey_SubmitAction[GSWebNamingConv]]; + if (submitActions) + { + //TODO + }; + LOGObjectFnNotImplemented(); //TODOFN LOGObjectFnStop(); return nil; diff --git a/GSWeb.framework/GSWDisplayGroup.h b/GSWeb.framework/GSWDisplayGroup.h index dffb7c7..82efe84 100644 --- a/GSWeb.framework/GSWDisplayGroup.h +++ b/GSWeb.framework/GSWDisplayGroup.h @@ -1,11 +1,16 @@ -/* GSWDisplayGroup.h - GSWeb: Class GSWDisplayGroup - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDisplayGroup.h - GSWeb: Class GSWDisplayGroup + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -27,46 +33,46 @@ #define _GSWDisplayGroup_h__ #if !GDL2 -#ifndef TCSDB -#include -#include -#include -#include -#include -#include + #ifdef TCSDB + #import + #import + #else // TCSDB + #include + #include + #include + #include + #include + #include -#include -#include -#include + #include + #include + #include -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include -#include -#include -#include + #include + #include + #include -@class EOKeyValueUnarchiver; + @class EOKeyValueUnarchiver; -#define EODataSource EODatabaseDataSource -#else // TCSDB -#import -#import -#endif + #define EODataSource EODatabaseDataSource + #endif #else -#import -#import -#import -#import -#import + #import + #import + #import + #import + #import #endif @interface GSWDisplayGroup : NSObject { - id delegate; + id _delegate; /* objects (array) supplied by the EODataSource EOQualifier and EOSortOrderings to filter the objects for display @@ -149,17 +155,17 @@ - (unsigned)indexOfLastDisplayedObject; - (id)init; - (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver*)unarchiver; -- (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object_; +- (void)awakeFromKeyValueUnarchiver:(EOKeyValueUnarchiver*)object; - (NSMutableDictionary *)inputObjectForQualifier; - (BOOL)inQueryMode; -- (void)editingContext:(id)editingContext_ +- (void)editingContext:(id)editingContext presentErrorMessage:(id)msg; - (id)insert; - (id)insertAfterLastObject; - (NSDictionary *)insertedObjectDefaultValues; -- (void)insertObject:object_ +- (void)insertObject:object atIndex:(unsigned)index; -- (id)insertObjectAtIndex:(unsigned)index_; +- (id)insertObjectAtIndex:(unsigned)index; - (EOQualifier *)lastQualifierFromInputValues; - (NSArray *)localKeys; - (id)masterObject; @@ -190,11 +196,11 @@ - (id)selectPrevious; - (BOOL)selectsFirstObjectAfterFetch; - (void)setBuildsQualifierFromInput:(BOOL)flag; -- (void)setCurrentBatchIndex:(unsigned)index_; -- (void)setDataSource:(EODataSource *)dataSource_; +- (void)setCurrentBatchIndex:(unsigned)index; +- (void)setDataSource:(EODataSource *)dataSource; - (void)setDefaultStringMatchFormat:(NSString *)format; - (void)setDefaultStringMatchOperator:(NSString *)operator; -- (void)setDelegate:(id)object_; +- (void)setDelegate:(id)object; - (void)setDetailKey:(NSString *)detailKey; - (void)setFetchesOnLoad:(BOOL)flag; - (void)setInQueryMode:(BOOL)flag; @@ -204,7 +210,7 @@ - (void)setMasterObject:(id)masterObject; - (void)setNumberOfObjectsPerBatch:(unsigned)count; - (void)setObjectArray:(NSArray *)objects; -- (void)setQualifier:(EOQualifier *)qualifier_; +- (void)setQualifier:(EOQualifier *)qualifier; - (BOOL)setSelectionIndexes:(NSArray *)selection; - (void)setSelectsFirstObjectAfterFetch:(BOOL)flag; - (void)setSortOrderings:(NSArray *)orderings; @@ -219,46 +225,46 @@ @interface NSObject (GSWDisplayGroupDelegation) --(void)displayGroup:(GSWDisplayGroup*)displayGroup_ -createObjectFailedForDataSource:(id)dataSource_; +-(void)displayGroup:(GSWDisplayGroup*)displayGroup +createObjectFailedForDataSource:(id)dataSource; --(void)displayGroup:(GSWDisplayGroup*)displayGroup_ - didDeleteObject:(id)object_; +-(void)displayGroup:(GSWDisplayGroup*)displayGroup + didDeleteObject:(id)object; --(void)displayGroup:(GSWDisplayGroup*)displayGroup_ +-(void)displayGroup:(GSWDisplayGroup*)displayGroup didFetchObjects:(NSArray*)objects; --(void)displayGroup:(GSWDisplayGroup*)displayGroup_ - didInsertObject:object_; +-(void)displayGroup:(GSWDisplayGroup*)displayGroup + didInsertObject:(id)object; --(void)displayGroup:(GSWDisplayGroup*)displayGroup_ +-(void)displayGroup:(GSWDisplayGroup*)displayGroup didSetValue:(id)value - forObject:(id)object_ + forObject:(id)object key:(NSString*)key; --(NSArray*)displayGroup:(GSWDisplayGroup*)displayGroup_ +-(NSArray*)displayGroup:(GSWDisplayGroup*)displayGroup displayArrayForObjects:(NSArray*)objects; --(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup_ +-(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup shouldChangeSelectionToIndexes:(NSArray*)newIndexes; --(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup_ - shouldInsertObject:object_ - atIndex:(unsigned)index_; +-(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup + shouldInsertObject:object + atIndex:(unsigned)index; -(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup shouldDeleteObject:object; --(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup_ -shouldRedisplayForEditingContextChangeNotification:(NSNotification*)notification_; +-(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup +shouldRedisplayForEditingContextChangeNotification:(NSNotification*)notification; --(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup_ -shouldRefetchForInvalidatedAllObjectsNotification:(NSNotification*)notification_; +-(BOOL)displayGroup:(GSWDisplayGroup*)displayGroup +shouldRefetchForInvalidatedAllObjectsNotification:(NSNotification*)notification; --(void)displayGroupDidChangeDataSource:(GSWDisplayGroup*)displayGroup_; --(void)displayGroupDidChangeSelectedObjects:(GSWDisplayGroup*)displayGroup_; --(void)displayGroupDidChangeSelection:(GSWDisplayGroup*)displayGroup_; --(BOOL)displayGroupShouldFetch:(GSWDisplayGroup*)displayGroup_; +-(void)displayGroupDidChangeDataSource:(GSWDisplayGroup*)displayGroup; +-(void)displayGroupDidChangeSelectedObjects:(GSWDisplayGroup*)displayGroup; +-(void)displayGroupDidChangeSelection:(GSWDisplayGroup*)displayGroup; +-(BOOL)displayGroupShouldFetch:(GSWDisplayGroup*)displayGroup; @end diff --git a/GSWeb.framework/GSWDisplayGroup.m b/GSWeb.framework/GSWDisplayGroup.m index d2f460f..e7862fc 100644 --- a/GSWeb.framework/GSWDisplayGroup.m +++ b/GSWeb.framework/GSWDisplayGroup.m @@ -1,12 +1,17 @@ -/* GSWDisplayGroup.m - GSWeb: Class GSWDisplayGroup - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDisplayGroup.m - GSWeb: Class GSWDisplayGroup + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Mirko Viviani - Date: Jan 1999 + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +25,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -53,7 +59,7 @@ static char rcsId[] = "$Id$"; _queryBindings = [[NSMutableDictionary alloc] initWithCapacity:8]; // _selection = 1; //???? - _batchIndex = 1; + _batchIndex = 1; [[NSNotificationCenter defaultCenter] addObserver:self @@ -312,7 +318,7 @@ Description: return qualifier; }; --(BOOL)_deleteObjectsAtIndexes:(id)indexes_ +-(BOOL)_deleteObjectsAtIndexes:(id)indexes { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -321,7 +327,7 @@ Description: }; --(BOOL)_deleteObject:(id)object_ +-(BOOL)_deleteObject:(id)object { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -338,7 +344,7 @@ Description: }; --(void)_lastObserverNotified:(id)object_ +-(void)_lastObserverNotified:(id)object { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -346,7 +352,7 @@ Description: }; --(void)_beginObserverNotification:(id)object_ +-(void)_beginObserverNotification:(id)object { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -362,7 +368,7 @@ Description: --(void)_notifyRowChanged:(int)row_ +-(void)_notifyRowChanged:(int)row { LOGObjectFnStart(); //-1 ==> nil ? @@ -372,19 +378,19 @@ Description: --(id)_notify:(SEL)selector_ +-(id)_notify:(SEL)selector with:(id)object1 with:(id)object2 { LOGObjectFnStart(); //TODOFN - if (selector_==@selector(displayGroup:didFetchObjects:)) //TODO ???? + if (selector==@selector(displayGroup:didFetchObjects:)) //TODO ???? { //Do it on object1 if(_delegateRespondsTo.didFetchObjects) - [delegate displayGroup:object1 - didFetchObjects:object2]; + [_delegate displayGroup:object1 + didFetchObjects:object2]; } else { @@ -395,8 +401,8 @@ Description: }; --(id)_notify:(SEL)selector_ - with:(id)object_ +-(id)_notify:(SEL)selector + with:(id)object { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -422,7 +428,7 @@ Description: }; --(void)objectsChangedInEditingContext:(id)object_ +-(void)objectsChangedInEditingContext:(id)object { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -436,7 +442,7 @@ Description: LOGObjectFnStart(); if(_delegateRespondsTo.shouldRedisplay == YES) - redisplay = [delegate displayGroup:self + redisplay = [_delegate displayGroup:self shouldRedisplayForEditingContextChangeNotification:notification]; if(redisplay == YES) @@ -450,7 +456,7 @@ Description: LOGObjectFnStart(); if(_delegateRespondsTo.shouldRefetchObjects == YES) - refetch = [delegate displayGroup:self + refetch = [_delegate displayGroup:self shouldRefetchForInvalidatedAllObjectsNotification: notification]; @@ -464,7 +470,7 @@ Description: { [[NSNotificationCenter defaultCenter] removeObserver:self]; - delegate = nil; + _delegate = nil; DESTROY(_dataSource); @@ -574,7 +580,7 @@ Description: //-------------------------------------------------------------------- // setDataSource: -- (void)setDataSource:(EODataSource *)dataSource_ +- (void)setDataSource:(EODataSource *)dataSource { EOEditingContext *context=nil; LOGObjectFnStart(); @@ -587,7 +593,7 @@ Description: [context setMessageHandler:nil]; } - ASSIGN(_dataSource, dataSource_); + ASSIGN(_dataSource,dataSource); context = [_dataSource editingContext]; [context addEditor:self]; @@ -597,7 +603,7 @@ Description: [_displayedObjects removeAllObjects]; if(_delegateRespondsTo.didChangeDataSource == YES) - [delegate displayGroupDidChangeDataSource:self]; + [_delegate displayGroupDidChangeDataSource:self]; LOGObjectFnStop(); } @@ -622,47 +628,47 @@ Description: - (id)delegate { - return delegate; + return _delegate; } //-------------------------------------------------------------------- // setDelegate: -- (void)setDelegate:(id)delegate_ +- (void)setDelegate:(id)delegate { LOGObjectFnStart(); - delegate = delegate_; + _delegate = delegate; _delegateRespondsTo.createObjectFailed = - [delegate respondsToSelector:@selector(displayGroup:createObjectFailedForDataSource:)]; + [_delegate respondsToSelector:@selector(displayGroup:createObjectFailedForDataSource:)]; _delegateRespondsTo.didDeleteObject = - [delegate respondsToSelector:@selector(displayGroup:didDeleteObject:)]; + [_delegate respondsToSelector:@selector(displayGroup:didDeleteObject:)]; _delegateRespondsTo.didFetchObjects = - [delegate respondsToSelector:@selector(displayGroup:didFetchObjects:)]; + [_delegate respondsToSelector:@selector(displayGroup:didFetchObjects:)]; _delegateRespondsTo.didInsertObject = - [delegate respondsToSelector:@selector(displayGroup:didInsertObject:)]; + [_delegate respondsToSelector:@selector(displayGroup:didInsertObject:)]; _delegateRespondsTo.didSetValueForObject = - [delegate respondsToSelector:@selector(displayGroup:didSetValue:forObject:key:)]; + [_delegate respondsToSelector:@selector(displayGroup:didSetValue:forObject:key:)]; _delegateRespondsTo.displayArrayForObjects = - [delegate respondsToSelector:@selector(displayGroup:displayArrayForObjects:)]; + [_delegate respondsToSelector:@selector(displayGroup:displayArrayForObjects:)]; _delegateRespondsTo.shouldChangeSelection = - [delegate respondsToSelector:@selector(displayGroup:shouldChangeSelectionToIndexes:)]; + [_delegate respondsToSelector:@selector(displayGroup:shouldChangeSelectionToIndexes:)]; _delegateRespondsTo.shouldInsertObject = - [delegate respondsToSelector:@selector(displayGroup:shouldInsertObject:atIndex:)]; + [_delegate respondsToSelector:@selector(displayGroup:shouldInsertObject:atIndex:)]; _delegateRespondsTo.shouldDeleteObject = - [delegate respondsToSelector:@selector(displayGroup:shouldDeleteObject:)]; + [_delegate respondsToSelector:@selector(displayGroup:shouldDeleteObject:)]; _delegateRespondsTo.shouldRedisplay = - [delegate respondsToSelector:@selector(displayGroup:shouldRedisplayForEditingContextChangeNotification:)]; + [_delegate respondsToSelector:@selector(displayGroup:shouldRedisplayForEditingContextChangeNotification:)]; _delegateRespondsTo.shouldRefetchObjects = - [delegate respondsToSelector:@selector(displayGroup:shouldRefetchForInvalidatedAllObjectsNotification:)]; + [_delegate respondsToSelector:@selector(displayGroup:shouldRefetchForInvalidatedAllObjectsNotification:)]; _delegateRespondsTo.didChangeDataSource = - [delegate respondsToSelector:@selector(displayGroupDidChangeDataSource:)]; + [_delegate respondsToSelector:@selector(displayGroupDidChangeDataSource:)]; _delegateRespondsTo.didChangeSelectedObjects = - [delegate respondsToSelector:@selector(displayGroupDidChangeSelectedObjects:)]; + [_delegate respondsToSelector:@selector(displayGroupDidChangeSelectedObjects:)]; _delegateRespondsTo.didChangeSelection = - [delegate respondsToSelector:@selector(displayGroupDidChangeSelection:)]; + [_delegate respondsToSelector:@selector(displayGroupDidChangeSelection:)]; _delegateRespondsTo.shouldFetchObjects = - [delegate respondsToSelector:@selector(displayGroupShouldFetch:)]; + [_delegate respondsToSelector:@selector(displayGroupShouldFetch:)]; LOGObjectFnStop(); } @@ -689,7 +695,7 @@ Description: object = [_allObjects objectAtIndex:index]; if(_delegateRespondsTo.shouldDeleteObject == YES) - delete = [delegate displayGroup:self shouldDeleteObject:object]; + delete = [_delegate displayGroup:self shouldDeleteObject:object]; if(delete) { @@ -701,7 +707,7 @@ Description: [_allObjects removeObjectIdenticalTo:object]; if(_delegateRespondsTo.didDeleteObject == YES) - [delegate displayGroup:self didDeleteObject:object]; + [_delegate displayGroup:self didDeleteObject:object]; } NS_HANDLER { @@ -738,7 +744,7 @@ Description: while((object = [enumerator nextObject])) { if(_delegateRespondsTo.shouldDeleteObject == YES) - delete = [delegate displayGroup:self + delete = [_delegate displayGroup:self shouldDeleteObject:object]; if(delete == NO) @@ -757,7 +763,7 @@ Description: [_allObjects removeObjectIdenticalTo:object]; if(_delegateRespondsTo.didDeleteObject == YES) - [delegate displayGroup:self + [_delegate displayGroup:self didDeleteObject:object]; } } @@ -938,7 +944,7 @@ Description: [_dataSource setQualifierBindings:_queryBindings]; if(_delegateRespondsTo.shouldFetchObjects == YES) - fetch = [delegate displayGroupShouldFetch:self]; + fetch = [_delegate displayGroupShouldFetch:self]; if(fetch) { @@ -1034,7 +1040,7 @@ Description: } //-------------------------------------------------------------------- --(void)editingContext:(id)editingContext_ +-(void)editingContext:(id)editingContext presentErrorMessage:(id)msg { LOGObjectFnStart(); @@ -1090,7 +1096,7 @@ Description: LOGObjectFnStart(); if(_delegateRespondsTo.shouldInsertObject == YES) - insert = [delegate displayGroup:self + insert = [_delegate displayGroup:self shouldInsertObject:anObject atIndex:index]; @@ -1105,7 +1111,7 @@ Description: [self setCurrentBatchIndex:_batchIndex]; if(_delegateRespondsTo.didInsertObject == YES) - [delegate displayGroup:self + [_delegate displayGroup:self didInsertObject:anObject]; [self setSelectionIndexes:[NSArray arrayWithObject:[NSNumber numberWithUnsignedInt:index]]]; @@ -1127,7 +1133,7 @@ Description: if(object == nil) { if(_delegateRespondsTo.createObjectFailed == YES) - [delegate displayGroup:self + [_delegate displayGroup:self createObjectFailedForDataSource:_dataSource]; } else @@ -1660,20 +1666,20 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1 //-------------------------------------------------------------------- // setCurrentBatchIndex: -- (void)setCurrentBatchIndex:(unsigned)index_ +- (void)setCurrentBatchIndex:(unsigned)index { unsigned batchCount, num; int i; LOGObjectFnStart(); - if(index_) + if(index) { [_displayedObjects removeAllObjects]; batchCount = [self batchCount]; NSLog(@"setCurrentBatchIndex : [self batchCount] = %d", [self batchCount]); - if(index_ > batchCount) - index_ = 1; + if(index > batchCount) + index = 1; num = [_allObjects count]; NSLog(@"setCurrentBatchIndex : [_allObjects count] = %d", [_allObjects count]); @@ -1683,11 +1689,11 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1 if(num) { - NSLog(@"setCurrentBatchIndex : index_ = %d", index_); + NSLog(@"setCurrentBatchIndex : index = %d", index); NSLog(@"setCurrentBatchIndex : num = %d", num); - for( i = (index_-1) * num; - ((i < index_ * num) && (i < [_allObjects count])); + for( i = (index-1) * num; + ((i < index * num) && (i < [_allObjects count])); i++) [_displayedObjects addObject:[_allObjects objectAtIndex:i]]; @@ -1712,7 +1718,7 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1 }; --(BOOL)_allowsNullForKey:(id)key_ +-(BOOL)_allowsNullForKey:(id)key { LOGObjectFnStart(); LOGObjectFnNotImplemented(); //TODOFN @@ -1879,10 +1885,10 @@ self setSelectionIndexes:indexes of objects in objects? //ret 1 //-------------------------------------------------------------------- // setQualifier: -- (void)setQualifier:(EOQualifier *)qualifier_ +- (void)setQualifier:(EOQualifier *)qualifier { LOGObjectFnStart(); - ASSIGN(_qualifier, qualifier_); + ASSIGN(_qualifier, qualifier); LOGObjectFnStop(); } @@ -1948,7 +1954,7 @@ STOP ? LOGObjectFnStart(); //call selectedObjects // if(_delegateRespondsTo.shouldChangeSelection == YES - && [delegate displayGroup:self + && [_delegate displayGroup:self shouldChangeSelectionToIndexes:selection_] == NO) retValue=NO; else @@ -1983,10 +1989,10 @@ STOP ? ASSIGN(_selection, selection_); if(_delegateRespondsTo.didChangeSelection == YES) - [delegate displayGroupDidChangeSelection:self]; + [_delegate displayGroupDidChangeSelection:self]; if(_delegateRespondsTo.didChangeSelectedObjects == YES) - [delegate displayGroupDidChangeSelectedObjects:self]; + [_delegate displayGroupDidChangeSelectedObjects:self]; }; }; LOGObjectFnStop(); @@ -2052,8 +2058,8 @@ STOP ? if(_delegateRespondsTo.displayArrayForObjects == YES) { - [_displayedObjects addObjectsFromArray:[delegate displayGroup:self - displayArrayForObjects:_allObjects]]; + [_displayedObjects addObjectsFromArray:[_delegate displayGroup:self + displayArrayForObjects:_allObjects]]; } else { diff --git a/GSWeb.framework/GSWDynamicURLString.h b/GSWeb.framework/GSWDynamicURLString.h index 6d0e4b0..64131cc 100644 --- a/GSWeb.framework/GSWDynamicURLString.h +++ b/GSWeb.framework/GSWDynamicURLString.h @@ -1,11 +1,16 @@ -/* GSWDynamicURLString.h - GSWeb: Class GSWDynamicURLString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDynamicURLString.h - GSWeb: Class GSWDynamicURLString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Mar 1999 + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,49 +36,49 @@ //==================================================================== @interface GSWDynamicURLString : NSObject { - NSMutableString* url; - NSString* protocol;//NDFN - NSString* host;//NDFN - int port;//NDFN - NSString* prefix; - NSString* applicationName; - NSString* applicationNumberString; - NSString* requestHandlerKey; - NSString* queryString; - NSString* requestHandlerPath; - int applicationNumber; - BOOL composed; + NSMutableString* _url; + NSString* _protocol;//NDFN + NSString* _host;//NDFN + int _port;//NDFN + NSString* _prefix; + NSString* _applicationName; + NSString* _applicationNumberString; + NSString* _requestHandlerKey; + NSString* _queryString; + NSString* _requestHandlerPath; + int _applicationNumber; + BOOL _composed; }; -(id)init; -(id)initWithCharactersNoCopy:(unichar*)chars - length:(unsigned int)length - freeWhenDone:(BOOL)flag; + length:(unsigned int)length + freeWhenDone:(BOOL)flag; -(id)initWithCharacters:(const unichar*)chars - length:(unsigned int)length; + length:(unsigned int)length; -(id)initWithCStringNoCopy:(char*)byteString - length:(unsigned int)length - freeWhenDone:(BOOL)flag; + length:(unsigned int)length + freeWhenDone:(BOOL)flag; -(id)initWithCString:(const char*)byteString - length:(unsigned int)length; + length:(unsigned int)length; -(id)initWithCString:(const char*)byteString; -(id)initWithString:(NSString*)string; -(id)initWithFormat:(NSString*)format,...; -(id)initWithFormat:(NSString*)format - arguments:(va_list)argList; + arguments:(va_list)argList; -(id)initWithData:(NSData*)data - encoding:(NSStringEncoding)encoding; + encoding:(NSStringEncoding)encoding; -(id)initWithContentsOfFile:(NSString*)path; -(void)dealloc; --(id)initWithCoder:(NSCoder*)coder_; --(void)encodeWithCoder:(NSCoder*)coder_; +-(id)initWithCoder:(NSCoder*)coder; +-(void)encodeWithCoder:(NSCoder*)coder; --(id)copyWithZone:(NSZone*)zone_; +-(id)copyWithZone:(NSZone*)zone; -(NSString*)description; --(void)forwardInvocation:(NSInvocation*)invocation_; --(NSMethodSignature*)methodSignatureForSelector:(SEL)selector_; +-(void)forwardInvocation:(NSInvocation*)invocation; +-(NSMethodSignature*)methodSignatureForSelector:(SEL)selector; @end //==================================================================== @@ -99,15 +105,15 @@ //==================================================================== @interface GSWDynamicURLString (GSWDynamicURLStringSet) --(void)setURLRequestHandlerPath:(NSString*)string_; --(void)setURLQueryString:(NSString*)string_; --(void)setURLRequestHandlerKey:(NSString*)string_; --(void)setURLApplicationNumber:(int)applicationNumber_; --(void)setURLApplicationName:(NSString*)string_; --(void)setURLPrefix:(NSString*)string_; --(void)setURLProtocol:(NSString*)string_;//NDFN --(void)setURLHost:(NSString*)string_;//NDFN --(void)setURLPortString:(NSString*)string_;//NDFN +-(void)setURLRequestHandlerPath:(NSString*)aString; +-(void)setURLQueryString:(NSString*)aString; +-(void)setURLRequestHandlerKey:(NSString*)aString; +-(void)setURLApplicationNumber:(int)applicationNumber; +-(void)setURLApplicationName:(NSString*)aString; +-(void)setURLPrefix:(NSString*)aString; +-(void)setURLProtocol:(NSString*)aString;//NDFN +-(void)setURLHost:(NSString*)aString;//NDFN +-(void)setURLPortString:(NSString*)aString;//NDFN -(void)setURLPort:(int)port_;//NDFN @end diff --git a/GSWeb.framework/GSWDynamicURLString.m b/GSWeb.framework/GSWDynamicURLString.m index 5e66497..92b68fa 100644 --- a/GSWeb.framework/GSWDynamicURLString.m +++ b/GSWeb.framework/GSWDynamicURLString.m @@ -1,11 +1,16 @@ -/* GSWDynamicURLString.m - GSWeb: Class GSWDynamicURLString - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWDynamicURLString.m - GSWeb: Class GSWDynamicURLString + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Mar 1999 + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -34,29 +40,29 @@ static char rcsId[] = "$Id$"; //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[NSMutableString new]; - NSDebugMLLog(@"low",@"url class=%@",[url class]); - }; + { + _url=[NSMutableString new]; + NSDebugMLLog(@"low",@"url class=%@",[_url class]); + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- -(id)initWithCharactersNoCopy:(unichar*)chars - length:(unsigned int)length - freeWhenDone:(BOOL)flag + length:(unsigned int)length + freeWhenDone:(BOOL)flag { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithCharactersNoCopy:chars - length:length - freeWhenDone:flag]; - if (chars) - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithCharactersNoCopy:chars + length:length + freeWhenDone:flag]; + if (chars) + [self _parse]; + }; LOGObjectFnStop(); return self; }; @@ -64,57 +70,57 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(id)initWithCharacters:(const unichar*)chars - length:(unsigned int)length + length:(unsigned int)length { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithCharacters:chars - length:length]; - if (chars) - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithCharacters:chars + length:length]; + if (chars) + [self _parse]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- -(id)initWithCStringNoCopy:(char*)byteString - length:(unsigned int)length - freeWhenDone:(BOOL)flag + length:(unsigned int)length + freeWhenDone:(BOOL)flag { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithCStringNoCopy:byteString - length:length - freeWhenDone:flag]; - if (byteString) - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithCStringNoCopy:byteString + length:length + freeWhenDone:flag]; + if (byteString) + [self _parse]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- -(id)initWithCString:(const char*)byteString - length:(unsigned int)length; + length:(unsigned int)length; { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithCString:byteString - length:length]; - NSDebugMLLog(@"low",@"url=%@",url); - NSDebugMLLog(@"low",@"url class=%@",[url class]); - if (byteString) - [self _parse]; - NSDebugMLLog(@"low",@"url=%@",url); - NSDebugMLLog(@"low",@"url class=%@",[url class]); - }; + { + _url=[[NSMutableString alloc]initWithCString:byteString + length:length]; + NSDebugMLLog(@"low",@"url=%@",_url); + NSDebugMLLog(@"low",@"url class=%@",[_url class]); + if (byteString) + [self _parse]; + NSDebugMLLog(@"low",@"url=%@",_url); + NSDebugMLLog(@"low",@"url class=%@",[_url class]); + }; LOGObjectFnStop(); return self; }; @@ -125,14 +131,14 @@ static char rcsId[] = "$Id$"; //OK LOGObjectFnStart(); if ((self=[super init])) - { - NSDebugMLLog(@"low",@"byteString=%s",byteString); - url=[[NSMutableString alloc]initWithCString:byteString]; - if (byteString) - [self _parse]; - NSDebugMLLog(@"low",@"url=%@",url); - NSDebugMLLog(@"low",@"url class=%@",[url class]); - }; + { + NSDebugMLLog(@"low",@"byteString=%s",byteString); + _url=[[NSMutableString alloc]initWithCString:byteString]; + if (byteString) + [self _parse]; + NSDebugMLLog(@"low",@"url=%@",_url); + NSDebugMLLog(@"low",@"url class=%@",[_url class]); + }; LOGObjectFnStop(); return self; }; @@ -143,11 +149,11 @@ static char rcsId[] = "$Id$"; //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithString:string]; - if (string) - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithString:string]; + if (string) + [self _parse]; + }; LOGObjectFnStop(); return self; }; @@ -158,47 +164,47 @@ static char rcsId[] = "$Id$"; //OK LOGObjectFnStart(); if ((self=[super init])) - { - va_list ap; - va_start(ap,format); - url=[[NSMutableString alloc]initWithFormat:format - arguments:ap]; - va_end(ap); - [self _parse]; - }; + { + va_list ap; + va_start(ap,format); + _url=[[NSMutableString alloc]initWithFormat:format + arguments:ap]; + va_end(ap); + [self _parse]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- -(id)initWithFormat:(NSString*)format - arguments:(va_list)argList + arguments:(va_list)argList { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithFormat:format - arguments:argList]; - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithFormat:format + arguments:argList]; + [self _parse]; + }; LOGObjectFnStop(); return self; }; //-------------------------------------------------------------------- -(id)initWithData:(NSData*)data - encoding:(NSStringEncoding)encoding + encoding:(NSStringEncoding)encoding { //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithData:data - encoding:encoding]; - if (data) - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithData:data + encoding:encoding]; + if (data) + [self _parse]; + }; LOGObjectFnStop(); return self; }; @@ -209,10 +215,10 @@ static char rcsId[] = "$Id$"; //OK LOGObjectFnStart(); if ((self=[super init])) - { - url=[[NSMutableString alloc]initWithContentsOfFile:path]; - [self _parse]; - }; + { + _url=[[NSMutableString alloc]initWithContentsOfFile:path]; + [self _parse]; + }; LOGObjectFnStop(); return self; }; @@ -220,61 +226,61 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(url); - DESTROY(prefix); - DESTROY(applicationName); - DESTROY(applicationNumberString); - DESTROY(requestHandlerKey); - DESTROY(queryString); - DESTROY(requestHandlerPath); + DESTROY(_url); + DESTROY(_prefix); + DESTROY(_applicationName); + DESTROY(_applicationNumberString); + DESTROY(_requestHandlerKey); + DESTROY(_queryString); + DESTROY(_requestHandlerPath); [super dealloc]; }; //-------------------------------------------------------------------- --(id)initWithCoder:(NSCoder*)coder_ +-(id)initWithCoder:(NSCoder*)coder { - if ((self = [super initWithCoder:coder_])) - { - [coder_ decodeValueOfObjCType:@encode(id) - at:&url]; - composed=YES; - [self _parse]; - }; + if ((self = [super initWithCoder:coder])) + { + [coder decodeValueOfObjCType:@encode(id) + at:&_url]; + _composed=YES; + [self _parse]; + }; return self; }; //-------------------------------------------------------------------- --(void)encodeWithCoder:(NSCoder*)coder_ +-(void)encodeWithCoder:(NSCoder*)coder { - [super encodeWithCoder: coder_]; + [super encodeWithCoder:coder]; [self _compose]; - [coder_ encodeObject:url]; + [coder encodeObject:_url]; }; //-------------------------------------------------------------------- --(id)copyWithZone:(NSZone*)zone_ +-(id)copyWithZone:(NSZone*)zone { GSWDynamicURLString* clone = nil; LOGObjectFnStart(); - NSDebugMLLog(@"low",@"url class=%@",[url class]); - clone=[[isa allocWithZone:zone_] init]; + NSDebugMLLog(@"low",@"url class=%@",[_url class]); + clone=[[isa allocWithZone:zone] init]; if (clone) - { - DESTROY(clone->url); - clone->url=[url mutableCopyWithZone:zone_]; - NSDebugMLLog(@"low",@"clone->url class=%@",[clone->url class]); - ASSIGNCOPY(clone->protocol,protocol); - ASSIGNCOPY(clone->host,host); - clone->port=port; - ASSIGNCOPY(clone->prefix,prefix); - ASSIGNCOPY(clone->applicationName,applicationName); - ASSIGNCOPY(clone->applicationNumberString,applicationNumberString); - ASSIGNCOPY(clone->requestHandlerKey,requestHandlerKey); - ASSIGNCOPY(clone->queryString,queryString); - ASSIGNCOPY(clone->requestHandlerPath,requestHandlerPath); - clone->applicationNumber=applicationNumber; - clone->composed=composed; - }; + { + DESTROY(clone->_url); + clone->_url=[_url mutableCopyWithZone:zone]; + NSDebugMLLog(@"low",@"clone->_url class=%@",[clone->_url class]); + ASSIGNCOPY(clone->_protocol,_protocol); + ASSIGNCOPY(clone->_host,_host); + clone->_port=_port; + ASSIGNCOPY(clone->_prefix,_prefix); + ASSIGNCOPY(clone->_applicationName,_applicationName); + ASSIGNCOPY(clone->_applicationNumberString,_applicationNumberString); + ASSIGNCOPY(clone->_requestHandlerKey,_requestHandlerKey); + ASSIGNCOPY(clone->_queryString,_queryString); + ASSIGNCOPY(clone->_requestHandlerPath,_requestHandlerPath); + clone->_applicationNumber=_applicationNumber; + clone->_composed=_composed; + }; LOGObjectFnStop(); return clone; }; @@ -284,26 +290,26 @@ static char rcsId[] = "$Id$"; { //OK [self _compose]; - return url; + return _url; }; //-------------------------------------------------------------------- --(void)forwardInvocation:(NSInvocation*)invocation_ +-(void)forwardInvocation:(NSInvocation*)invocation { - NSString* _urlBackup=nil; - if (!composed) - [self _compose]; - _urlBackup=[url copy]; - [invocation_ invokeWithTarget:url]; - if (![url isEqualToString:_urlBackup]) - [self _parse]; - [_urlBackup release]; + NSString* urlBackup=nil; + if (!_composed) + [self _compose]; + urlBackup=[_url copy]; + [invocation invokeWithTarget:_url]; + if (![_url isEqualToString:urlBackup]) + [self _parse]; + [urlBackup release]; }; //-------------------------------------------------------------------- --(NSMethodSignature*)methodSignatureForSelector:(SEL)selector_ +-(NSMethodSignature*)methodSignatureForSelector:(SEL)selector { - return [url methodSignatureForSelector:selector_]; + return [_url methodSignatureForSelector:selector]; }; @end @@ -312,258 +318,249 @@ static char rcsId[] = "$Id$"; @implementation GSWDynamicURLString (GSWDynamicURLStringParsing) -(void)_compose { - if (!composed) - { - if (url) - { - int _length=[url length]; - NSDebugMLLog(@"low",@"url %@ class=%@",url,[url class]); - if (_length>0) - [url deleteCharactersInRange:NSMakeRange(0,_length)]; - } - else - url=[NSMutableString new]; - if (protocol) - { - if (host) - [url appendFormat:@"%@://",protocol]; - else if (port) - [url appendFormat:@"%@://localhost",protocol]; - else if (prefix) - [url appendFormat:@"%@:/",protocol]; - else - [url appendFormat:@"%@://",protocol]; - }; - if (host) - [url appendString:host]; - if (port) - [url appendFormat:@":%d",port]; - if (prefix) - [url appendFormat:@"%@/",prefix]; - if (applicationName) - [url appendFormat:@"%@.%@/",applicationName,GSWApplicationSuffix[GSWebNamingConv]]; - if (applicationNumber>=0) - [url appendFormat:@"%d/",applicationNumber]; - if (requestHandlerKey) - [url appendFormat:@"%@/",requestHandlerKey]; - if (requestHandlerPath) - [url appendFormat:@"%@",requestHandlerPath]; - if (queryString) - [url appendFormat:@"?%@",queryString]; - NSDebugMLLog(@"low",@"url %@ class=%@",url,[url class]); - }; + if (!_composed) + { + if (_url) + { + int length=[_url length]; + NSDebugMLLog(@"low",@"url %@ class=%@",_url,[_url class]); + if (length>0) + [_url deleteCharactersInRange:NSMakeRange(0,length)]; + } + else + _url=[NSMutableString new]; + if (_protocol) + { + if (_host) + [_url appendFormat:@"%@://",_protocol]; + else if (_port) + [_url appendFormat:@"%@://localhost",_protocol]; + else if (_prefix) + [_url appendFormat:@"%@:/",_protocol]; + else + [_url appendFormat:@"%@://",_protocol]; + }; + if (_host) + [_url appendString:_host]; + if (_port) + [_url appendFormat:@":%d",_port]; + if (_prefix) + [_url appendFormat:@"%@/",_prefix]; + if (_applicationName) + [_url appendFormat:@"%@.%@/", + _applicationName, + GSWApplicationSuffix[GSWebNamingConv]]; + if (_applicationNumber>=0) + [_url appendFormat:@"%d/",_applicationNumber]; + if (_requestHandlerKey) + [_url appendFormat:@"%@/",_requestHandlerKey]; + if (_requestHandlerPath) + [_url appendFormat:@"%@",_requestHandlerPath]; + if (_queryString) + [_url appendFormat:@"?%@",_queryString]; + NSDebugMLLog(@"low",@"url %@ class=%@",_url,[_url class]); + }; }; //-------------------------------------------------------------------- -(void)_parse { - DESTROY(prefix); - DESTROY(applicationName); - DESTROY(applicationNumberString); - DESTROY(requestHandlerKey); - DESTROY(queryString); - DESTROY(requestHandlerPath); - applicationNumber=-1; - composed=NO; //?? - if (url) - { - NSArray* _components=nil; - NSString* Left=url; - int index=0; - int tmpIndex=0; - NSRange protocolEndRange; - NSRange queryStringStartRange=[Left rangeOfString:@"?"]; - if (queryStringStartRange.length>0) - { - if (queryStringStartRange.location+1<[Left length]) - { - ASSIGN(queryString,[Left substringFromIndex:queryStringStartRange.location+queryStringStartRange.length]); - }; - Left=[Left substringToIndex:queryStringStartRange.location]; - }; - NSDebugMLLog(@"low",@"Left [%@]",Left); - NSDebugMLLog(@"low",@"queryString [%@]",queryString); - - //Protocol - protocolEndRange=[Left rangeOfString:@"://"]; - if (protocolEndRange.length>0) - { - ASSIGN(protocol,[Left substringToIndex:protocolEndRange.location]); - NSDebugMLLog(@"low",@"protocol [%@]",protocol); - if (protocolEndRange.location+protocolEndRange.length<[Left length]) - Left=[Left substringFromIndex:protocolEndRange.location+protocolEndRange.length]; - else - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - //Host - if ([Left length]>0) - { - NSRange hostEndRangePort=[Left rangeOfString:@":"]; - if (hostEndRangePort.length>0) - { - ASSIGN(host,[Left substringToIndex:hostEndRangePort.location]); - NSDebugMLLog(@"low",@"host [%@]",host); - if (hostEndRangePort.location+hostEndRangePort.length<[Left length]) - Left=[Left substringFromIndex:hostEndRangePort.location+hostEndRangePort.length]; - else - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - if (Left) - { - NSRange portEndRange=[Left rangeOfString:@"/"]; - if (portEndRange.length>0) - { - NSString* portString=[Left substringToIndex:portEndRange.location]; - NSDebugMLLog(@"low",@"portString [%@]",Left); - port=[portString intValue]; - NSDebugMLLog(@"low",@"port [%d]",port); - if (portEndRange.location+portEndRange.length<[Left length]) - Left=[Left substringFromIndex:portEndRange.location+portEndRange.length-1]; //Keep the '/' - else - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - } - else - { - port=[Left intValue]; - NSDebugMLLog(@"low",@"port [%d]",port); - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - }; - }; - } - else - { - NSRange hostEndRangeSlash=[Left rangeOfString:@"/"]; - if (hostEndRangeSlash.length>0) - { - ASSIGN(host,[Left substringToIndex:hostEndRangeSlash.location]); - NSDebugMLLog(@"low",@"host [%@]",host); - if (hostEndRangeSlash.location+hostEndRangeSlash.length<[Left length]) - Left=[Left substringFromIndex:hostEndRangeSlash.location+hostEndRangeSlash.length-1];//Keep the '/' - else - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - } - else - { - ASSIGN(host,Left); - NSDebugMLLog(@"low",@"host [%@]",host); - Left=nil; - NSDebugMLLog(@"low",@"Left [%@]",Left); - }; - }; - }; - }; - - NSDebugMLLog(@"low",@"Left [%@]",Left); - //prefix - NSDebugMLLog(@"low",@"prefix: _components [%@]",_components); - _components=[Left componentsSeparatedByString:@"/"]; -/* - for(tmpIndex=index;!prefix && tmpIndex<[_components count];tmpIndex++) - { - if ([[_components objectAtIndex:tmpIndex]hasPrefix:GSWURLPrefix]) - { - ASSIGN(prefix,[[_components subarrayWithRange:NSMakeRange(index,tmpIndex-index+1)]componentsJoinedByString:@"/"]); - index=tmpIndex+1; - }; - }; -*/ - for(tmpIndex=index;!prefix && tmpIndex<[_components count];tmpIndex++) - { - NSString* tmp=[_components objectAtIndex:tmpIndex]; - if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]] - || [tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) + DESTROY(_prefix); + DESTROY(_applicationName); + DESTROY(_applicationNumberString); + DESTROY(_requestHandlerKey); + DESTROY(_queryString); + DESTROY(_requestHandlerPath); + _applicationNumber=-1; + _composed=NO; //?? + if (_url) + { + NSArray* components=nil; + NSString* Left=_url; + int index=0; + int tmpIndex=0; + NSRange protocolEndRange; + NSRange queryStringStartRange=[Left rangeOfString:@"?"]; + if (queryStringStartRange.length>0) + { + if (queryStringStartRange.location+1<[Left length]) + { + ASSIGN(_queryString,[Left substringFromIndex:queryStringStartRange.location+queryStringStartRange.length]); + }; + Left=[Left substringToIndex:queryStringStartRange.location]; + }; + NSDebugMLLog(@"low",@"Left [%@]",Left); + NSDebugMLLog(@"low",@"queryString [%@]",_queryString); + + //Protocol + protocolEndRange=[Left rangeOfString:@"://"]; + if (protocolEndRange.length>0) + { + ASSIGN(_protocol,[Left substringToIndex:protocolEndRange.location]); + NSDebugMLLog(@"low",@"protocol [%@]",_protocol); + if (protocolEndRange.location+protocolEndRange.length<[Left length]) + Left=[Left substringFromIndex:protocolEndRange.location+protocolEndRange.length]; + else + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); + //Host + if ([Left length]>0) + { + NSRange hostEndRangePort=[Left rangeOfString:@":"]; + if (hostEndRangePort.length>0) + { + ASSIGN(_host,[Left substringToIndex:hostEndRangePort.location]); + NSDebugMLLog(@"low",@"host [%@]",_host); + if (hostEndRangePort.location+hostEndRangePort.length<[Left length]) + Left=[Left substringFromIndex:hostEndRangePort.location+hostEndRangePort.length]; + else + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); + if (Left) { - if (tmpIndex-index>1) + NSRange portEndRange=[Left rangeOfString:@"/"]; + if (portEndRange.length>0) { - ASSIGN(prefix,[[_components subarrayWithRange:NSMakeRange(index,tmpIndex-index)]componentsJoinedByString:@"/"]); - index=tmpIndex;//Stay on ApplicationName ! + NSString* portString=[Left substringToIndex:portEndRange.location]; + NSDebugMLLog(@"low",@"portString [%@]",Left); + _port=[portString intValue]; + NSDebugMLLog(@"low",@"port [%d]",_port); + if (portEndRange.location+portEndRange.length<[Left length]) + Left=[Left substringFromIndex:portEndRange.location+portEndRange.length-1]; //Keep the '/' + else + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); + } + else + { + _port=[Left intValue]; + NSDebugMLLog(@"low",@"port [%d]",_port); + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); }; }; - }; - if (!prefix) - { - //TODO Erreur - NSDebugMLLog(@"low",@"No prefix in [%@]",url); - } - else - { - //applicationName - if (index>=[_components count]) - { - //TODO Erreur - NSDebugMLLog(@"low",@"No applicationName in [%@]",url); - } - else - { - NSDebugMLLog(@"low",@"applicationName: _components [%@]", - [_components subarrayWithRange:NSMakeRange(index,[_components count]-index)]); - for(tmpIndex=index;!applicationName && tmpIndex<[_components count];tmpIndex++) - { - NSString* tmp=[_components objectAtIndex:tmpIndex]; - NSString* appSuffix=nil; - if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]) - appSuffix=GSWApplicationPSuffix[GSWNAMES_INDEX]; - else if ([tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) - appSuffix=GSWApplicationPSuffix[WONAMES_INDEX]; - if (appSuffix) - { - ASSIGN(applicationName,[[[_components - subarrayWithRange:NSMakeRange(index,tmpIndex-index+1)] - componentsJoinedByString:@"/"] - stringWithoutSuffix:appSuffix]); - index=tmpIndex+1; - }; - }; - if (!applicationName) - { - NSString* tmp=[[_components subarrayWithRange:NSMakeRange(index,[_components count]-index)] - componentsJoinedByString:@"/"]; - if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]) - tmp=[tmp stringWithoutSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]; - else if ([tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) - tmp=[tmp stringWithoutSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]; - ASSIGN(applicationName,tmp); - index=[_components count]; - }; - - //Application Number - if (index<[_components count]) - { - NSDebugMLLog(@"low",@"applicationNumber: _components [%@]", - [_components subarrayWithRange:NSMakeRange(index,[_components count]-index)]); - ASSIGN(applicationNumberString,[_components objectAtIndex:index]); - applicationNumber=[applicationNumberString intValue]; - index++; - //requestHandlerKey - if (index<[_components count]) - { - NSDebugMLLog(@"low",@"requestHandlerKey: _components [%@]", - [_components subarrayWithRange:NSMakeRange(index,[_components count]-index)]); - ASSIGN(requestHandlerKey,[_components objectAtIndex:index]); - index++; - //requestHandlerPath - if (index<[_components count]) - { - NSDebugMLLog(@"low",@"requestHandlerPath: _components [%@]", - [_components subarrayWithRange:NSMakeRange(index,[_components count]-index)]); - ASSIGN(requestHandlerPath,[[_components subarrayWithRange:NSMakeRange(index,[_components count]-index)]componentsJoinedByString:@"/"]); - index++; - }; - }; - }; - }; - }; - }; - NSDebugMLLog(@"low",@"url=%@",url); - NSDebugMLLog(@"low",@"prefix=%@",prefix); - NSDebugMLLog(@"low",@"applicationName=%@",applicationName); - NSDebugMLLog(@"low",@"applicationNumberString=%@",applicationNumberString); - NSDebugMLLog(@"low",@"requestHandlerKey=%@",requestHandlerKey); - NSDebugMLLog(@"low",@"queryString=%@",queryString); - NSDebugMLLog(@"low",@"requestHandlerPath=%@",requestHandlerPath); + } + else + { + NSRange hostEndRangeSlash=[Left rangeOfString:@"/"]; + if (hostEndRangeSlash.length>0) + { + ASSIGN(_host,[Left substringToIndex:hostEndRangeSlash.location]); + NSDebugMLLog(@"low",@"host [%@]",_host); + if (hostEndRangeSlash.location+hostEndRangeSlash.length<[Left length]) + Left=[Left substringFromIndex:hostEndRangeSlash.location+hostEndRangeSlash.length-1];//Keep the '/' + else + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); + } + else + { + ASSIGN(_host,Left); + NSDebugMLLog(@"low",@"host [%@]",_host); + Left=nil; + NSDebugMLLog(@"low",@"Left [%@]",Left); + }; + }; + }; + }; + + NSDebugMLLog(@"low",@"Left [%@]",Left); + //prefix + NSDebugMLLog(@"low",@"prefix: components [%@]",components); + components=[Left componentsSeparatedByString:@"/"]; + for(tmpIndex=index;!_prefix && tmpIndex<[components count];tmpIndex++) + { + NSString* tmp=[components objectAtIndex:tmpIndex]; + if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]] + || [tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) + { + if (tmpIndex-index>1) + { + ASSIGN(_prefix,[[components subarrayWithRange:NSMakeRange(index,tmpIndex-index)]componentsJoinedByString:@"/"]); + index=tmpIndex;//Stay on ApplicationName ! + }; + }; + }; + if (!_prefix) + { + //TODO Erreur + NSDebugMLLog(@"low",@"No prefix in [%@]",_url); + } + else + { + //applicationName + if (index>=[components count]) + { + //TODO Erreur + NSDebugMLLog(@"low",@"No applicationName in [%@]",_url); + } + else + { + NSDebugMLLog(@"low",@"applicationName: components [%@]", + [components subarrayWithRange:NSMakeRange(index,[components count]-index)]); + for(tmpIndex=index;!_applicationName && tmpIndex<[components count];tmpIndex++) + { + NSString* tmp=[components objectAtIndex:tmpIndex]; + NSString* appSuffix=nil; + if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]) + appSuffix=GSWApplicationPSuffix[GSWNAMES_INDEX]; + else if ([tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) + appSuffix=GSWApplicationPSuffix[WONAMES_INDEX]; + if (appSuffix) + { + ASSIGN(_applicationName,[[[components subarrayWithRange:NSMakeRange(index,tmpIndex-index+1)] + componentsJoinedByString:@"/"] + stringWithoutSuffix:appSuffix]); + index=tmpIndex+1; + }; + }; + if (!_applicationName) + { + NSString* tmp=[[components subarrayWithRange:NSMakeRange(index,[components count]-index)] + componentsJoinedByString:@"/"]; + if ([tmp hasSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]) + tmp=[tmp stringWithoutSuffix:GSWApplicationPSuffix[GSWNAMES_INDEX]]; + else if ([tmp hasSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]) + tmp=[tmp stringWithoutSuffix:GSWApplicationPSuffix[WONAMES_INDEX]]; + ASSIGN(_applicationName,tmp); + index=[components count]; + }; + + //Application Number + if (index<[components count]) + { + NSDebugMLLog(@"low",@"applicationNumber: components [%@]", + [components subarrayWithRange:NSMakeRange(index,[components count]-index)]); + ASSIGN(_applicationNumberString,[components objectAtIndex:index]); + _applicationNumber=[_applicationNumberString intValue]; + index++; + //requestHandlerKey + if (index<[components count]) + { + NSDebugMLLog(@"low",@"requestHandlerKey: _components [%@]", + [components subarrayWithRange:NSMakeRange(index,[components count]-index)]); + ASSIGN(_requestHandlerKey,[components objectAtIndex:index]); + index++; + //requestHandlerPath + if (index<[components count]) + { + NSDebugMLLog(@"low",@"requestHandlerPath: components [%@]", + [components subarrayWithRange:NSMakeRange(index,[components count]-index)]); + ASSIGN(_requestHandlerPath,[[components subarrayWithRange:NSMakeRange(index,[components count]-index)]componentsJoinedByString:@"/"]); + index++; + }; + }; + }; + }; + }; + }; + NSDebugMLLog(@"low",@"url=%@",_url); + NSDebugMLLog(@"low",@"prefix=%@",_prefix); + NSDebugMLLog(@"low",@"applicationName=%@",_applicationName); + NSDebugMLLog(@"low",@"applicationNumberString=%@",_applicationNumberString); + NSDebugMLLog(@"low",@"requestHandlerKey=%@",_requestHandlerKey); + NSDebugMLLog(@"low",@"queryString=%@",_queryString); + NSDebugMLLog(@"low",@"requestHandlerPath=%@",_requestHandlerPath); }; @end @@ -581,37 +578,37 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(NSString*)urlRequestHandlerPath { - return requestHandlerPath; + return _requestHandlerPath; }; //-------------------------------------------------------------------- -(NSString*)urlQueryString { - return queryString; + return _queryString; }; //-------------------------------------------------------------------- -(NSString*)urlRequestHandlerKey { - return requestHandlerKey; + return _requestHandlerKey; }; //-------------------------------------------------------------------- -(int)urlApplicationNumber { - return applicationNumber; + return _applicationNumber; }; //-------------------------------------------------------------------- -(NSString*)urlApplicationName { - return applicationName; + return _applicationName; }; //-------------------------------------------------------------------- -(NSString*)urlPrefix { - return prefix; + return _prefix; }; //-------------------------------------------------------------------- @@ -624,145 +621,145 @@ static char rcsId[] = "$Id$"; //NDFN -(NSString*)urlProtocol { - return protocol; + return _protocol; }; //-------------------------------------------------------------------- //NDFN -(NSString*)urlHost { - return host; + return _host; }; //-------------------------------------------------------------------- //NDFN -(NSString*)urlPortString { - return [NSString stringWithFormat:@"%d",port]; + return [NSString stringWithFormat:@"%d",_port]; }; //-------------------------------------------------------------------- //NDFN -(int)urlPort { - return port; + return _port; }; //-------------------------------------------------------------------- //NDFN -(NSString*)urlProtocolHostPort { - NSMutableString* _url=[NSMutableString string]; - if (protocol) - { - if (host) - [_url appendFormat:@"%@://",protocol]; - else if (port) - [_url appendFormat:@"%@://localhost",protocol]; - else - [_url appendFormat:@"%@://",protocol]; - }; - if (host) - [_url appendString:host]; - if (port) - [_url appendFormat:@":%d",port]; - return [NSString stringWithString:_url]; + NSMutableString* url=[NSMutableString string]; + if (_protocol) + { + if (_host) + [url appendFormat:@"%@://",_protocol]; + else if (_port) + [url appendFormat:@"%@://localhost",_protocol]; + else + [url appendFormat:@"%@://",_protocol]; + }; + if (_host) + [url appendString:_host]; + if (_port) + [url appendFormat:@":%d",_port]; + return [NSString stringWithString:url]; }; @end //==================================================================== @implementation GSWDynamicURLString (GSWDynamicURLStringSet) --(void)setURLRequestHandlerPath:(NSString*)string_ +-(void)setURLRequestHandlerPath:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(requestHandlerPath,string_); - composed=NO; + ASSIGN(_requestHandlerPath,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLQueryString:(NSString*)string_ +-(void)setURLQueryString:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(queryString,string_); - composed=NO; + ASSIGN(_queryString,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLRequestHandlerKey:(NSString*)string_ +-(void)setURLRequestHandlerKey:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(requestHandlerKey,string_); - composed=NO; + ASSIGN(_requestHandlerKey,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLApplicationNumber:(int)applicationNumber_ +-(void)setURLApplicationNumber:(int)applicationNumber { LOGObjectFnStart(); - applicationNumber=applicationNumber_; - composed=NO; + _applicationNumber=applicationNumber; + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLApplicationName:(NSString*)string_ +-(void)setURLApplicationName:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(applicationName,string_); - composed=NO; + ASSIGN(_applicationName,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)setURLPrefix:(NSString*)string_ +-(void)setURLPrefix:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(prefix,string_); - composed=NO; + ASSIGN(_prefix,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- //NDFN --(void)setURLProtocol:(NSString*)string_ +-(void)setURLProtocol:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(protocol,string_); - composed=NO; + ASSIGN(_protocol,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- //NDFN --(void)setURLHost:(NSString*)string_ +-(void)setURLHost:(NSString*)aString { LOGObjectFnStart(); - ASSIGN(host,string_); - composed=NO; + ASSIGN(_host,aString); + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- //NDFN --(void)setURLPortString:(NSString*)string_ +-(void)setURLPortString:(NSString*)aString { LOGObjectFnStart(); - port=[string_ intValue]; - composed=NO; + _port=[aString intValue]; + _composed=NO; LOGObjectFnStop(); }; //-------------------------------------------------------------------- //NDFN --(void)setURLPort:(int)port_ +-(void)setURLPort:(int)port { LOGObjectFnStart(); - port=port_; - composed=NO; + _port=port; + _composed=NO; LOGObjectFnStop(); }; diff --git a/GSWeb.framework/GSWElement.m b/GSWeb.framework/GSWElement.m index 77753f8..f015e02 100644 --- a/GSWeb.framework/GSWElement.m +++ b/GSWeb.framework/GSWElement.m @@ -2,7 +2,7 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 $Revision$ diff --git a/GSWeb.framework/GSWEmbeddedObject.h b/GSWeb.framework/GSWEmbeddedObject.h index 8cdb698..b9e2ca7 100644 --- a/GSWeb.framework/GSWEmbeddedObject.h +++ b/GSWeb.framework/GSWEmbeddedObject.h @@ -2,8 +2,8 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 $Revision$ $Date$ diff --git a/GSWeb.framework/GSWEmbeddedObject.m b/GSWeb.framework/GSWEmbeddedObject.m index 09397e5..55327c2 100644 --- a/GSWeb.framework/GSWEmbeddedObject.m +++ b/GSWeb.framework/GSWEmbeddedObject.m @@ -1,11 +1,16 @@ -/* GSWEmbeddedObject.m - GSWeb: Class GSWEmbeddedObject - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWEmbeddedObject.m - GSWeb: Class GSWEmbeddedObject + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -28,9 +34,9 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWEmbeddedObject --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { LOGObjectFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWGenericContainer.h b/GSWeb.framework/GSWGenericContainer.h index 635dfd7..7047141 100644 --- a/GSWeb.framework/GSWGenericContainer.h +++ b/GSWeb.framework/GSWGenericContainer.h @@ -1,11 +1,16 @@ -/* GSWGenericContainer.h - GSWeb: Class GSWGenericContainer - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWGenericContainer.h - GSWeb: Class GSWGenericContainer + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,25 +36,25 @@ //==================================================================== @interface GSWGenericContainer: GSWDynamicElement { - GSWAssociation* children; - NSDictionary *associations; - GSWElement* element; + GSWAssociation* _children; + NSDictionary* _associations; + GSWElement* _element; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_; +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement; -(void)dealloc; -(NSString*)description; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(void)appendToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(void)takeValuesFromRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; @end diff --git a/GSWeb.framework/GSWGenericContainer.m b/GSWeb.framework/GSWGenericContainer.m index 89368f6..a083bb1 100644 --- a/GSWeb.framework/GSWGenericContainer.m +++ b/GSWeb.framework/GSWGenericContainer.m @@ -1,11 +1,16 @@ -/* GSWGenericContainer.m - GSWeb: Class GSWGenericContainer - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWGenericContainer.m - GSWeb: Class GSWGenericContainer + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -28,83 +34,84 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWGenericContainer --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement { - self = [super init]; - associations=[associations_ retain]; - element=[templateElement_ retain]; - return self; + if ((self = [super init])) + { + ASSIGN(_associations,associations); + ASSIGN(_element,templateElement); + }; + return self; }; //-------------------------------------------------------------------- -(void)dealloc { - [associations release]; - [element release]; - [super dealloc]; + DESTROY(_associations); + DESTROY(_element); + [super dealloc]; }; //-------------------------------------------------------------------- -(NSString*)description { -//TODOFN + //TODOFN return [super description]; }; //-------------------------------------------------------------------- --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { - NSEnumerator *assocEnumer; - id currentAssocKey; - id component = [context_ component]; - id theValue; - id otherTag = nil; - id tag = [[associations objectForKey:@"elementName"] valueInComponent:component]; + NSEnumerator *assocEnumer=nil; + id currentAssocKey=nil; + id component = [aContext component]; + id theValue=nil; + id otherTag = nil; + id tag = [[_associations objectForKey:@"elementName"] valueInComponent:component]; + + [aResponse appendContentString:[NSString stringWithFormat:@"<%@",tag]]; - [response_ appendContentString:[NSString stringWithFormat:@"<%@",tag]]; - - if (otherTag = [[associations objectForKey:@"otherTagString"] valueInComponent:component]) { - [response_ appendContentString:[NSString stringWithFormat:@" %@",otherTag]]; + if ((otherTag = [[_associations objectForKey:@"otherTagString"] valueInComponent:component])) + { + [aResponse appendContentString:[NSString stringWithFormat:@" %@",otherTag]]; } - - assocEnumer = [associations keyEnumerator]; - while (currentAssocKey = [assocEnumer nextObject]) { - theValue = [[associations objectForKey:currentAssocKey] valueInComponent:component]; - if (([currentAssocKey isEqualToString:@"elementName"] == NO) && ([currentAssocKey isEqualToString:@"otherTagString"] == NO)) { - [response_ appendContentString:[NSString stringWithFormat:@" %@=\"%@\"",currentAssocKey,theValue]]; + assocEnumer = [_associations keyEnumerator]; + while ((currentAssocKey = [assocEnumer nextObject])) + { + theValue = [[_associations objectForKey:currentAssocKey] valueInComponent:component]; + if (([currentAssocKey isEqualToString:@"elementName"] == NO) + && ([currentAssocKey isEqualToString:@"otherTagString"] == NO)) + { + [aResponse appendContentString:[NSString stringWithFormat:@" %@=\"%@\"",currentAssocKey,theValue]]; } } - - [response_ appendContentString:@">"]; - [element appendToResponse:response_ inContext:context_]; - [response_ appendContentString:[NSString stringWithFormat:@"",tag]]; + + [aResponse appendContentString:@">"]; + [_element appendToResponse:aResponse inContext:aContext]; + [aResponse appendContentString:[NSString stringWithFormat:@"",tag]]; }; //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { -// LOGObjectFnNotImplemented(); //TODOFN - - return [element invokeActionForRequest:request_ inContext:context_]; - + return [_element invokeActionForRequest:aRequest + inContext:aContext]; }; //-------------------------------------------------------------------- --(void)takeValuesFromRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(void)takeValuesFromRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { - // LOGObjectFnNotImplemented(); //TODOFN - - return [element takeValuesFromRequest:request_ inContext:context_]; - + return [_element takeValuesFromRequest:aRequest + inContext:aContext]; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWHTMLAttrParserExt.h b/GSWeb.framework/GSWHTMLAttrParserExt.h index 2813d54..60be82b 100644 --- a/GSWeb.framework/GSWHTMLAttrParserExt.h +++ b/GSWeb.framework/GSWHTMLAttrParserExt.h @@ -1,12 +1,16 @@ -/* GSWHTMLAttrParserExt.h - GSWeb: Class GSWPageElementParser: Categories +/** GSWHTMLAttrParserExt.h - GSWeb: Class GSWHTMLAttrParserExt: Categories - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -32,9 +37,9 @@ -(NSString*)tagName; -(NSDictionary*)attributes; -(void)dealloc; --(void)reportErrorWithException:(NSException*)_exception; --(void)reportError:(NSString*)_text; --(void)reportWarning:(NSString*)_text; +-(void)reportErrorWithException:(NSException*)exception; +-(void)reportError:(NSString*)text; +-(void)reportWarning:(NSString*)text; -(BOOL)isError; -(BOOL)isWarning; -(NSArray*)errors; diff --git a/GSWeb.framework/GSWHTMLAttrParserExt.m b/GSWeb.framework/GSWHTMLAttrParserExt.m index c9abce1..6cbb7e8 100644 --- a/GSWeb.framework/GSWHTMLAttrParserExt.m +++ b/GSWeb.framework/GSWHTMLAttrParserExt.m @@ -1,12 +1,16 @@ -/* GSWHTMLAttrParserExt.m - GSWeb: Class GSWHTMLAttrParser: Categories +/** GSWHTMLAttrParserExt.m - GSWeb: Class GSWHTMLAttrParserExt: Categories - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -59,37 +64,37 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- --(void)reportErrorWithException:(NSException*)_exception +-(void)reportErrorWithException:(NSException*)exception { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", - [_exception description], - [_exception reason]]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", + [exception description], + [exception reason]]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportError:(NSString*)_text +-(void)reportError:(NSString*)text { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Error: %@", - _text]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Error: %@", + text]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportWarning:(NSString*)_text +-(void)reportWarning:(NSString*)text { - NSString* _warning=nil; + NSString* warning=nil; if (!warnings) - warnings=[NSMutableArray new]; - _warning=[NSString stringWithFormat:@"Parsing Warning: %@", - _text]; - [warnings addObject:_warning]; + warnings=[NSMutableArray new]; + warning=[NSString stringWithFormat:@"Parsing Warning: %@", + text]; + [warnings addObject:warning]; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWHTMLParserExt.h b/GSWeb.framework/GSWHTMLParserExt.h index e231ea1..05c9f94 100644 --- a/GSWeb.framework/GSWHTMLParserExt.h +++ b/GSWeb.framework/GSWHTMLParserExt.h @@ -1,12 +1,16 @@ -/* GSWHTMLParserExt.h - GSWeb: Class GSWHTMLParser: Categories +/** GSWHTMLParserExt.h - GSWeb: Class GSWHTMLParser: Categories - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,9 +35,9 @@ @interface GSWHTMLParser (GSWHTMLParserExt) -(void)dealloc; --(void)reportErrorWithException:(NSException*)_exception; --(void)reportError:(NSString*)_text; --(void)reportWarning:(NSString*)_text; +-(void)reportErrorWithException:(NSException*)exception; +-(void)reportError:(NSString*)text; +-(void)reportWarning:(NSString*)text; -(BOOL)isError; -(BOOL)isWarning; -(NSArray*)errors; diff --git a/GSWeb.framework/GSWHTMLParserExt.m b/GSWeb.framework/GSWHTMLParserExt.m index 3f559ef..9925a59 100644 --- a/GSWeb.framework/GSWHTMLParserExt.m +++ b/GSWeb.framework/GSWHTMLParserExt.m @@ -1,12 +1,16 @@ -/* GSWHTMLParserExt.m - GSWeb: Class GSWHTMLParser: Categories +/** GSWHTMLParserExt.m - GSWeb: Class GSWHTMLParser: Categories - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -42,37 +47,37 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(void)reportErrorWithException:(NSException*)_exception +-(void)reportErrorWithException:(NSException*)exception { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", - [_exception description], - [_exception reason]]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", + [exception description], + [exception reason]]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportError:(NSString*)_text +-(void)reportError:(NSString*)text { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Error: %@", - _text]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Error: %@", + text]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportWarning:(NSString*)_text +-(void)reportWarning:(NSString*)text { - NSString* _warning=nil; + NSString* warning=nil; if (!warnings) - warnings=[NSMutableArray new]; - _warning=[NSString stringWithFormat:@"Parsing Warning: %@", - _text]; - [warnings addObject:_warning]; + warnings=[NSMutableArray new]; + warning=[NSString stringWithFormat:@"Parsing Warning: %@", + text]; + [warnings addObject:warning]; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWHTMLURLValuedElement.h b/GSWeb.framework/GSWHTMLURLValuedElement.h index 841bb53..b4e74f4 100644 --- a/GSWeb.framework/GSWHTMLURLValuedElement.h +++ b/GSWeb.framework/GSWHTMLURLValuedElement.h @@ -1,11 +1,16 @@ -/* GSWHTMLURLValuedElement.h - GSWeb: Class GSWHTMLURLValuedElement - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Apr 1999 +/** GSWHTMLURLValuedElement.m - GSWeb: Class GSWHTMLURLValuedElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Apr 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,27 +35,27 @@ @interface GSWHTMLURLValuedElement: GSWHTMLDynamicElement { - GSWAssociation* src; - GSWAssociation* value; - GSWAssociation* pageName; + GSWAssociation* _src; + GSWAssociation* _value; + GSWAssociation* _pageName; //GSWeb Additions { - NSDictionary* pageSetVarAssociations; - GSWAssociation* pageSetVarAssociationsDynamic; + NSDictionary* _pageSetVarAssociations; + GSWAssociation* _pageSetVarAssociationsDynamic; // } - GSWAssociation* filename; - GSWAssociation* framework; - GSWAssociation* data; - GSWAssociation* mimeType; - GSWAssociation* key; - GSWAssociation* actionClass; - GSWAssociation* directActionName; - GSWAssociation* queryDictionary; - NSDictionary* otherQueryAssociations; + GSWAssociation* _filename; + GSWAssociation* _framework; + GSWAssociation* _data; + GSWAssociation* _mimeType; + GSWAssociation* _key; + GSWAssociation* _actionClass; + GSWAssociation* _directActionName; + GSWAssociation* _queryDictionary; + NSDictionary* _otherQueryAssociations; }; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_; +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements; -(void)dealloc; -(NSString*)valueAttributeName; @@ -58,21 +64,21 @@ @end @interface GSWHTMLURLValuedElement (GSWHTMLURLValuedElementA) --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; @end @interface GSWHTMLURLValuedElement (GSWHTMLURLValuedElementB) //NDFN --(void)appendURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)_appendCGIActionURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(id)computeActionStringInContext:(GSWContext*)context_; --(id)computeQueryDictionaryInContext:(GSWContext*)context_; --(NSString*)frameworkNameInContext:(GSWContext*)context_; +-(void)appendURLToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; +-(void)_appendCGIActionURLToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; +-(id)computeActionStringInContext:(GSWContext*)aContext; +-(id)computeQueryDictionaryInContext:(GSWContext*)aContext; +-(NSString*)frameworkNameInContext:(GSWContext*)aContext; @end #endif // _GSWHTMLURLValuedElement_h__ diff --git a/GSWeb.framework/GSWHTMLURLValuedElement.m b/GSWeb.framework/GSWHTMLURLValuedElement.m index f67b441..1fb018b 100644 --- a/GSWeb.framework/GSWHTMLURLValuedElement.m +++ b/GSWeb.framework/GSWHTMLURLValuedElement.m @@ -1,11 +1,16 @@ -/* GSWHTMLURLValuedElement.m - GSWeb: Class GSWHTMLURLValuedElement - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Jan 1999 +/** GSWHTMLURLValuedElement.m - GSWeb: Class GSWHTMLURLValuedElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Apr 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,93 +35,93 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLURLValuedElement //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)inAssociations + contentElements:(NSArray*)elements { - NSString* _urlAttributeName=nil; - NSString* _valueAttributeName=nil; - NSMutableDictionary* _associations=nil; + NSString* urlAttributeName=nil; + NSString* valueAttributeName=nil; + NSMutableDictionary* associations=nil; LOGObjectFnStartC("GSWHTMLURLValuedElement"); - _urlAttributeName=[self urlAttributeName];//so what ? - _valueAttributeName=[self valueAttributeName];//so what ? + urlAttributeName=[self urlAttributeName];//so what ? + valueAttributeName=[self valueAttributeName];//so what ? - _associations=[NSMutableDictionary dictionaryWithDictionary:associations_]; + associations=[NSMutableDictionary dictionaryWithDictionary:inAssociations]; - src = [[associations_ objectForKey:src__Key - withDefaultObject:[src autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"src=%@",src); + _src = [[inAssociations objectForKey:src__Key + withDefaultObject:[_src autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"src=%@",_src); - value = [[associations_ objectForKey:value__Key - withDefaultObject:[value autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"value=%@",value); + _value = [[inAssociations objectForKey:value__Key + withDefaultObject:[_value autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"value=%@",_value); - pageName = [[associations_ objectForKey:pageName__Key - withDefaultObject:[pageName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"pageName=%@",pageName); + _pageName = [[inAssociations objectForKey:pageName__Key + withDefaultObject:[_pageName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"pageName=%@",_pageName); - filename = [[associations_ objectForKey:filename__Key - withDefaultObject:[filename autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"filename=%@",filename); + _filename = [[inAssociations objectForKey:filename__Key + withDefaultObject:[_filename autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"filename=%@",_filename); - framework = [[associations_ objectForKey:framework__Key - withDefaultObject:[framework autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"framework=%@",framework); + _framework = [[inAssociations objectForKey:framework__Key + withDefaultObject:[_framework autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"framework=%@",_framework); - data = [[associations_ objectForKey:data__Key - withDefaultObject:[data autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"data=%@",data); + _data = [[inAssociations objectForKey:data__Key + withDefaultObject:[_data autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"data=%@",_data); - mimeType = [[associations_ objectForKey:mimeType__Key - withDefaultObject:[mimeType autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"mimeType=%@",mimeType); + _mimeType = [[inAssociations objectForKey:mimeType__Key + withDefaultObject:[_mimeType autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"mimeType=%@",_mimeType); - key = [[associations_ objectForKey:key__Key - withDefaultObject:[key autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"key=%@",key); + _key = [[inAssociations objectForKey:key__Key + withDefaultObject:[_key autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"key=%@",_key); - actionClass = [[associations_ objectForKey:actionClass__Key - withDefaultObject:[actionClass autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"actionClass=%@",actionClass); + _actionClass = [[inAssociations objectForKey:actionClass__Key + withDefaultObject:[_actionClass autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"actionClass=%@",_actionClass); - directActionName = [[associations_ objectForKey:directActionName__Key - withDefaultObject:[directActionName autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"directActionName=%@",directActionName); + _directActionName = [[inAssociations objectForKey:directActionName__Key + withDefaultObject:[_directActionName autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"directActionName=%@",_directActionName); - queryDictionary = [[associations_ objectForKey:queryDictionary__Key - withDefaultObject:[queryDictionary autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"queryDictionary=%@",queryDictionary); + _queryDictionary = [[inAssociations objectForKey:queryDictionary__Key + withDefaultObject:[_queryDictionary autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"queryDictionary=%@",_queryDictionary); - [_associations removeObjectForKey:src__Key]; - [_associations removeObjectForKey:value__Key]; - [_associations removeObjectForKey:pageName__Key]; - [_associations removeObjectForKey:filename__Key]; - [_associations removeObjectForKey:framework__Key]; - [_associations removeObjectForKey:data__Key]; - [_associations removeObjectForKey:mimeType__Key]; - [_associations removeObjectForKey:key__Key]; - [_associations removeObjectForKey:actionClass__Key]; - [_associations removeObjectForKey:directActionName__Key]; - [_associations removeObjectForKey:queryDictionary__Key]; + [associations removeObjectForKey:src__Key]; + [associations removeObjectForKey:value__Key]; + [associations removeObjectForKey:pageName__Key]; + [associations removeObjectForKey:filename__Key]; + [associations removeObjectForKey:framework__Key]; + [associations removeObjectForKey:data__Key]; + [associations removeObjectForKey:mimeType__Key]; + [associations removeObjectForKey:key__Key]; + [associations removeObjectForKey:actionClass__Key]; + [associations removeObjectForKey:directActionName__Key]; + [associations removeObjectForKey:queryDictionary__Key]; if (!WOStrictFlag) { - //pageSetVarAssociations//GNUstepWeb only - - NSDictionary* _pageSetVarAssociations=[associations_ associationsWithoutPrefix:pageSetVar__Prefix__Key - removeFrom:_associations]; - if ([_pageSetVarAssociations count]>0) - pageSetVarAssociations=[_pageSetVarAssociations retain]; - - pageSetVarAssociationsDynamic=[[associations_ objectForKey:pageSetVars__Key - withDefaultObject:[pageSetVarAssociationsDynamic autorelease]] retain]; - NSDebugMLLog(@"gswdync",@"pageSetVarAssociationsDynamic=%@",pageSetVarAssociationsDynamic); - [_associations removeObjectForKey:pageSetVars__Key]; + //pageSetVarAssociations//GNUstepWeb only + NSDictionary* pageSetVarAssociations=[inAssociations associationsWithoutPrefix:pageSetVar__Prefix__Key + removeFrom:associations]; + if ([pageSetVarAssociations count]>0) + { + ASSIGN(_pageSetVarAssociations,pageSetVarAssociations); + }; + _pageSetVarAssociationsDynamic=[[inAssociations objectForKey:pageSetVars__Key + withDefaultObject:[_pageSetVarAssociationsDynamic autorelease]] retain]; + NSDebugMLLog(@"gswdync",@"_pageSetVarAssociationsDynamic=%@",_pageSetVarAssociationsDynamic); + [associations removeObjectForKey:pageSetVars__Key]; }; if ((self=[super initWithName:[self elementName]//NEW - attributeAssociations:_associations - contentElements:elements_])) - { - }; + attributeAssociations:associations + contentElements:elements])) + { + }; LOGObjectFnStopC("GSWHTMLURLValuedElement"); return self; }; @@ -123,20 +129,20 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(src); - DESTROY(value); - DESTROY(pageName); - DESTROY(pageSetVarAssociations);//GNUstepWeb only - DESTROY(pageSetVarAssociationsDynamic);//GSWeb only - DESTROY(filename); - DESTROY(framework); - DESTROY(data); - DESTROY(mimeType); - DESTROY(key); - DESTROY(actionClass); - DESTROY(directActionName); - DESTROY(queryDictionary); - DESTROY(otherQueryAssociations); + DESTROY(_src); + DESTROY(_value); + DESTROY(_pageName); + DESTROY(_pageSetVarAssociations);//GNUstepWeb only + DESTROY(_pageSetVarAssociationsDynamic);//GSWeb only + DESTROY(_filename); + DESTROY(_framework); + DESTROY(_data); + DESTROY(_mimeType); + DESTROY(_key); + DESTROY(_actionClass); + DESTROY(_directActionName); + DESTROY(_queryDictionary); + DESTROY(_otherQueryAssociations); [super dealloc]; } @@ -158,8 +164,8 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p>", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; @end @@ -168,76 +174,76 @@ static char rcsId[] = "$Id$"; @implementation GSWHTMLURLValuedElement (GSWHTMLURLValuedElementA) //-------------------------------------------------------------------- --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { //OK - GSWElement* _element=nil; - NSString* _senderID=nil; - NSString* _elementID=nil; + GSWElement* element=nil; + NSString* senderID=nil; + NSString* elementID=nil; LOGObjectFnStartC("GSWHTMLURLValuedElement"); - NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[context_ elementID]); - _senderID=[context_ senderID]; - _elementID=[context_ elementID]; - NSDebugMLLog(@"gswdync",@"_senderID=%@",_senderID); - NSDebugMLLog(@"gswdync",@"_elementID=%@",_elementID); - NSDebugMLLog(@"gswdync",@"[_elementID isEqualToString:_senderID]=%d",(int)[_elementID isEqualToString:_senderID]); - if ([_elementID isEqualToString:_senderID]) - { - GSWComponent* _component=[context_ component]; - if (value) - _element=[value valueInComponent:_component]; - else if (pageName) - { - NSString* _pageNameValue=[pageName valueInComponent:_component]; - _element=[GSWApp pageWithName:_pageNameValue - inContext:context_]; - if (!WOStrictFlag && _element)//GNUstepWeb only - { - if (pageSetVarAssociations) - { - [pageSetVarAssociations associationsSetValuesFromObject:_component - inObject:(GSWComponent*)_element]; - }; - if (pageSetVarAssociationsDynamic) - { - NSDictionary* _assocs=[pageSetVarAssociationsDynamic valueInComponent:_component]; - if (_assocs) - { - if (![_assocs isKindOfClass:[NSDictionary class]]) - { - ExceptionRaise(@"GSWHTMLURLValuedElement",@"%@ (%@) must return a Dictionary, not a %@ like %@", - pageSetVars__Key, - pageSetVarAssociationsDynamic, - [_assocs class], - _assocs); - } - else - { - [_assocs associationsSetValuesFromObject:_component - inObject:(GSWComponent*)_element]; - }; - }; - }; - }; - }; - NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke _element=%@",_element); - //the end ? - //TODOV - if (!_element) - _element=[context_ page]; - } + NSDebugMLLog(@"gswdync",@"ET=%@ id=%@",[self class],[aContext elementID]); + senderID=[aContext senderID]; + elementID=[aContext elementID]; + NSDebugMLLog(@"gswdync",@"senderID=%@",senderID); + NSDebugMLLog(@"gswdync",@"elementID=%@",elementID); + NSDebugMLLog(@"gswdync",@"[elementID isEqualToString:senderID]=%d",(int)[elementID isEqualToString:senderID]); + if ([elementID isEqualToString:senderID]) + { + GSWComponent* component=[aContext component]; + if (_value) + element=[_value valueInComponent:component]; + else if (_pageName) + { + NSString* pageNameValue=[_pageName valueInComponent:component]; + element=[GSWApp pageWithName:pageNameValue + inContext:aContext]; + if (!WOStrictFlag && element)//GNUstepWeb only + { + if (_pageSetVarAssociations) + { + [_pageSetVarAssociations associationsSetValuesFromObject:component + inObject:(GSWComponent*)element]; + }; + if (_pageSetVarAssociationsDynamic) + { + NSDictionary* assocs=[_pageSetVarAssociationsDynamic valueInComponent:component]; + if (assocs) + { + if (![assocs isKindOfClass:[NSDictionary class]]) + { + ExceptionRaise(@"GSWHTMLURLValuedElement",@"%@ (%@) must return a Dictionary, not a %@ like %@", + pageSetVars__Key, + _pageSetVarAssociationsDynamic, + [assocs class], + assocs); + } + else + { + [assocs associationsSetValuesFromObject:component + inObject:(GSWComponent*)element]; + }; + }; + }; + }; + }; + NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke element=%@",element); + //the end ? + //TODOV + if (!element) + element=[aContext page]; + } else - { - _element=[super invokeActionForRequest:request_ - inContext:context_]; - }; - NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke _element=%@",_element); - NSDebugMLLog(@"gswdync",@"_senderID=%@",[context_ senderID]); - NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); - NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[context_ elementID]); + { + element=[super invokeActionForRequest:aRequest + inContext:aContext]; + }; + NSDebugMLLog(@"gswdync",@"GSWHTMLURLValuedElement invoke element=%@",element); + NSDebugMLLog(@"gswdync",@"senderID=%@",[aContext senderID]); + NSDebugMLLog(@"gswdync",@"elementID=%@",[aContext elementID]); + NSDebugMLLog(@"gswdync",@"END ET=%@ id=%@",[self class],[aContext elementID]); LOGObjectFnStopC("GSWHTMLURLValuedElement"); - return _element; + return element; }; @@ -246,146 +252,146 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- //NDFN --(void)appendURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendURLToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { //OK - NSString* _urlAttributeName=nil; - NSString* _url=nil; - GSWComponent* _component=nil; - NSString* _keyValue=nil; - id _data=nil; - id _mimeTypeValue=nil; - GSWURLValuedElementData* _dataValue=nil; - GSWResourceManager* _resourceManager=nil; + NSString* urlAttributeName=nil; + NSString* url=nil; + GSWComponent* component=nil; + NSString* keyValue=nil; + id data=nil; + id mimeTypeValue=nil; + GSWURLValuedElementData* dataValue=nil; + GSWResourceManager* resourceManager=nil; LOGObjectFnStartC("GSWHTMLURLValuedElement"); - NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); - _component=[context_ component]; - NSDebugMLLog(@"gswdync",@"data=%@",data); - NSDebugMLLog(@"gswdync",@"filename=%@",filename); - NSDebugMLLog(@"gswdync",@"pageName=%@",pageName); - _resourceManager=[[GSWApplication application]resourceManager]; - if (src) - _url=[src valueInComponent:_component]; + NSDebugMLLog(@"gswdync",@"elementID=%@",[aContext elementID]); + component=[aContext component]; + NSDebugMLLog(@"gswdync",@"data=%@",_data); + NSDebugMLLog(@"gswdync",@"filename=%@",_filename); + NSDebugMLLog(@"gswdync",@"pageName=%@",_pageName); + resourceManager=[[GSWApplication application]resourceManager]; + if (_src) + url=[_src valueInComponent:component]; else - { - if (key) - { - _keyValue=[key valueInComponent:_component]; - _dataValue=[_resourceManager _cachedDataForKey:_keyValue]; - }; - if (!_dataValue && data) - { - _data=[data valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_data=%@",_data); - _mimeTypeValue=[mimeType valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"mimeType=%@",mimeType); - NSDebugMLLog(@"gswdync",@"_mimeTypeValue=%@",_mimeTypeValue); - _dataValue=[[[GSWURLValuedElementData alloc] initWithData:_data - mimeType:_mimeTypeValue - key:nil] autorelease]; - NSDebugMLLog(@"gswdync",@"_dataValue=%@",_dataValue); - [_resourceManager setURLValuedElementData:_dataValue]; - } - else if (filename) - { - //Exemple: Body with filename - id _filenameValue=nil; - id _frameworkValue=nil; - GSWRequest* _request=nil; - NSArray* _languages=nil; - NSDebugMLLog(@"gswdync",@"filename=%@",filename); - _filenameValue=[filename valueInComponent:_component]; - NSDebugMLLog(@"gswdync",@"_filenameValue=%@",_filenameValue); - _frameworkValue=[self frameworkNameInContext:context_]; - NSDebugMLLog(@"gswdync",@"_frameworkValue=%@",_frameworkValue); - _request=[context_ request]; - _languages=[context_ languages]; - _url=[_resourceManager urlForResourceNamed:_filenameValue - inFramework:_frameworkValue - languages:_languages - request:_request]; - }; - }; - [response_ appendContentCharacter:' ']; - _urlAttributeName=[self urlAttributeName]; - if (_urlAttributeName) - { - [response_ _appendContentAsciiString:_urlAttributeName]; - [response_ _appendContentAsciiString:@"=\""]; - }; - if (src) - { - [response_ appendContentString:_url]; - } + { + if (_key) + { + keyValue=[_key valueInComponent:component]; + dataValue=[resourceManager _cachedDataForKey:keyValue]; + }; + if (!dataValue && _data) + { + data=[_data valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"_data=%@",data); + mimeTypeValue=[_mimeType valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"mimeType=%@",_mimeType); + NSDebugMLLog(@"gswdync",@"mimeTypeValue=%@",mimeTypeValue); + dataValue=[[[GSWURLValuedElementData alloc] initWithData:data + mimeType:mimeTypeValue + key:nil] autorelease]; + NSDebugMLLog(@"gswdync",@"dataValue=%@",dataValue); + [resourceManager setURLValuedElementData:dataValue]; + } + else if (_filename) + { + //Exemple: Body with filename + id filenameValue=nil; + id frameworkValue=nil; + GSWRequest* request=nil; + NSArray* languages=nil; + NSDebugMLLog(@"gswdync",@"filename=%@",_filename); + filenameValue=[_filename valueInComponent:component]; + NSDebugMLLog(@"gswdync",@"filenameValue=%@",filenameValue); + frameworkValue=[self frameworkNameInContext:aContext]; + NSDebugMLLog(@"gswdync",@"frameworkValue=%@",frameworkValue); + request=[aContext request]; + languages=[aContext languages]; + url=[resourceManager urlForResourceNamed:filenameValue + inFramework:frameworkValue + languages:languages + request:request]; + }; + }; + [aResponse appendContentCharacter:' ']; + urlAttributeName=[self urlAttributeName]; + if (urlAttributeName) + { + [aResponse _appendContentAsciiString:urlAttributeName]; + [aResponse _appendContentAsciiString:@"=\""]; + }; + if (_src) + { + [aResponse appendContentString:url]; + } else - { - if (key || data) - { - [_dataValue appendDataURLToResponse:response_ - inContext:context_]; - } - else if (filename) - { - NSDebugMLLog(@"gswdync",@"_url = %@",_url); - [response_ appendContentString:_url]; - } - else - { - GSWDynamicURLString* _componentActionURL=[context_ componentActionURL]; - NSDebugMLLog(@"gswdync",@"_componentActionURL=%@",_componentActionURL); - [response_ appendContentString:(NSString*)_componentActionURL]; - }; - }; - if (_urlAttributeName) - [response_ appendContentCharacter:'"']; - NSDebugMLLog(@"gswdync",@"_elementID=%@",[context_ elementID]); + { + if (_key || _data) + { + [dataValue appendDataURLToResponse:aResponse + inContext:aContext]; + } + else if (_filename) + { + NSDebugMLLog(@"gswdync",@"url = %@",url); + [aResponse appendContentString:url]; + } + else + { + GSWDynamicURLString* componentActionURL=[aContext componentActionURL]; + NSDebugMLLog(@"gswdync",@"componentActionURL=%@",componentActionURL); + [aResponse appendContentString:(NSString*)componentActionURL]; + }; + }; + if (urlAttributeName) + [aResponse appendContentCharacter:'"']; + NSDebugMLLog(@"gswdync",@"_elementID=%@",[aContext elementID]); LOGObjectFnStopC("GSWHTMLURLValuedElement"); }; //-------------------------------------------------------------------- --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { //OK LOGObjectFnStartC("GSWHTMLURLValuedElement"); - [self appendURLToResponse:response_ - inContext:context_]; + [self appendURLToResponse:aResponse + inContext:aContext]; LOGObjectFnStopC("GSWHTMLURLValuedElement"); }; //-------------------------------------------------------------------- --(void)_appendCGIActionURLToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)_appendCGIActionURLToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(id)computeActionStringInContext:(GSWContext*)context_ +-(id)computeActionStringInContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(id)computeQueryDictionaryInContext:(GSWContext*)context_ +-(id)computeQueryDictionaryInContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(NSString*)frameworkNameInContext:(GSWContext*)context_ +-(NSString*)frameworkNameInContext:(GSWContext*)aContext { //OK - NSString* _frameworkName=nil; - GSWComponent* _component=[context_ component]; - NSDebugMLog(@"framework=%@",framework); - if (framework) - _frameworkName=[framework valueInComponent:_component]; + NSString* frameworkName=nil; + GSWComponent* component=[aContext component]; + NSDebugMLog(@"framework=%@",_framework); + if (_framework) + frameworkName=[_framework valueInComponent:component]; else - _frameworkName=[_component frameworkName]; - return _frameworkName; + frameworkName=[component frameworkName]; + return frameworkName; }; @end diff --git a/GSWeb.framework/GSWKeyValueAssociation.h b/GSWeb.framework/GSWKeyValueAssociation.h index cf507e3..86a515a 100644 --- a/GSWeb.framework/GSWKeyValueAssociation.h +++ b/GSWeb.framework/GSWKeyValueAssociation.h @@ -1,11 +1,16 @@ -/* GSWKeyValueAssociation.h - GSWeb: Class GSWKeyValueAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWKeyValueAssociation.h - GSWeb: Class GSWKeyValueAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Feb 1999 + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,16 +35,16 @@ //==================================================================== @interface GSWKeyValueAssociation : GSWAssociation { - NSString* keyPath; + NSString* _keyPath; } --(id)initWithKeyPath:(NSString*)keypath_; +-(id)initWithKeyPath:(NSString*)aKeyPath; -(void)dealloc; -(id)copyWithZone:(NSZone*)zone; --(id)valueInObject:(id)object_; --(void)setValue:(id)value_ - inObject:(id)object_; +-(id)valueInObject:(id)object; +-(void)setValue:(id)aValue + inObject:(id)object; -(BOOL)isValueConstant; -(BOOL)isValueSettable; diff --git a/GSWeb.framework/GSWKeyValueAssociation.m b/GSWeb.framework/GSWKeyValueAssociation.m index ec24e1b..bd32cc7 100644 --- a/GSWeb.framework/GSWKeyValueAssociation.m +++ b/GSWeb.framework/GSWKeyValueAssociation.m @@ -1,11 +1,16 @@ -/* GSWKeyValueAssociation.m - GSWeb: Class GSWKeyValueAssociation - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWKeyValueAssociation.m - GSWeb: Class GSWKeyValueAssociation + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,13 +35,13 @@ static char rcsId[] = "$Id$"; @implementation GSWKeyValueAssociation //-------------------------------------------------------------------- --(id)initWithKeyPath:(NSString*)keyPath_ +-(id)initWithKeyPath:(NSString*)aKeyPath { //OK if ((self=[super init])) - { - ASSIGNCOPY(keyPath,keyPath_); - }; + { + ASSIGNCOPY(_keyPath,aKeyPath); + }; return self; }; @@ -44,30 +50,30 @@ static char rcsId[] = "$Id$"; { GSWLogMemC("GSWKeyValueAssociation start of dealloc"); GSWLogAssertGood(self); - DESTROY(keyPath); + DESTROY(_keyPath); GSWLogMemC("keyPath deallocated"); [super dealloc]; GSWLogMemC("GSWKeyValueAssociation end of dealloc"); }; //-------------------------------------------------------------------- --(id)copyWithZone:(NSZone*)zone; +-(id)copyWithZone:(NSZone*)zone { GSWKeyValueAssociation* clone = [super copyWithZone:zone]; - ASSIGN(clone->keyPath,keyPath); + ASSIGN(clone->_keyPath,_keyPath); return clone; }; //-------------------------------------------------------------------- --(id)valueInObject:(id)object_ +-(id)valueInObject:(id)object { id retValue=nil; LOGObjectFnStart(); NSDebugMLLog(@"associations",@"self=%@ ",self); - NSDebugMLLog(@"associations",@"keyPath=%@ ",keyPath); - NSDebugMLLog(@"associations",@"object_=%@ ", object_); - retValue=[GSWAssociation valueInObject:object_ - forKeyPath:keyPath]; + NSDebugMLLog(@"associations",@"keyPath=%@ ",_keyPath); + NSDebugMLLog(@"associations",@"object=%@ ", object); + retValue=[GSWAssociation valueInObject:object + forKeyPath:_keyPath]; NSDebugMLLog(@"associations",@"self=%@ retValue=%@ (%p) (class=%@)", self, retValue, @@ -79,24 +85,25 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(void)setValue:(id)value_ - inObject:(id)object_ +-(void)setValue:(id)aValue + inObject:(id)object { LOGObjectFnStart(); - NSDebugMLLog(@"associations",@"keyPath=%@ ",keyPath); - NSDebugMLLog(@"associations",@"GSWAssociation: setValue:%@ (self=%@)",value_,self); - if (value_) { - NSDebugMLLog(@"associations",@"value_ class:%@",NSStringFromClass([value_ class])); - } + NSDebugMLLog(@"associations",@"keyPath=%@ ",_keyPath); + NSDebugMLLog(@"associations",@"GSWAssociation: setValue:%@ (self=%@)",aValue,self); + if (aValue) + { + NSDebugMLLog(@"associations",@"value_ class:%@",NSStringFromClass([aValue class])); + } /*Not Here because self is not a string key ! //TODO (return something!) - [object_ validateValue:&value_ - forKey:self]; + [object validateValue:&aValue + forKey:self]; */ - [GSWAssociation setValue:value_ - inObject:object_ - forKeyPath:keyPath]; - [self logSetValue:value_]; + [GSWAssociation setValue:aValue + inObject:object + forKeyPath:_keyPath]; + [self logSetValue:aValue]; LOGObjectFnStop(); }; @@ -121,7 +128,7 @@ static char rcsId[] = "$Id$"; object_get_class_name(self), (void*)self]; dscr=[dscr stringByAppendingFormat:@" keyPath=%@>", - keyPath]; + _keyPath]; return dscr; }; @@ -133,7 +140,7 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(NSString*)keyPath { - return keyPath; + return _keyPath; }; //-------------------------------------------------------------------- diff --git a/GSWeb.framework/GSWMultiKeyDictionary.h b/GSWeb.framework/GSWMultiKeyDictionary.h index a7b2cd5..de3e928 100644 --- a/GSWeb.framework/GSWMultiKeyDictionary.h +++ b/GSWeb.framework/GSWMultiKeyDictionary.h @@ -1,11 +1,16 @@ -/* GSWMultiKeyDictionary.h - GSWeb: Class GSWMultiKeyDictionary - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWMultiKeyDictionary.h - GSWeb: Class GSWMultiKeyDictionary + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,35 +36,35 @@ //============================================================================== @interface GSWMultiKeyDictionary : NSObject { - NSMutableDictionary* dict; + NSMutableDictionary* _dict; }; +(id)dictionary; -(id)init; --(id)initWithCapacity:(unsigned int)capacity_; +-(id)initWithCapacity:(unsigned int)capacity; -(void)dealloc; -(NSString*)description; -(NSEnumerator*)objectEnumerator; -(void)removeAllObjects; --(void)setObject:(id)object_ - forKeys:(id)keys_,...; --(id)objectForKeys:(id)keys_,...; +-(void)setObject:(id)object + forKeys:(id)keys,...; +-(id)objectForKeys:(id)keys,...; --(void)setObject:(id)object_ - forKeysArray:(NSArray*)keys_; --(id)objectForKeysArray:(NSArray*)keys_; +-(void)setObject:(id)object + forKeysArray:(NSArray*)keys; +-(id)objectForKeysArray:(NSArray*)keys; -(NSArray*)allValues; -(NSArray*)allKeys; --(NSArray*)objectsForKeysArrays:(NSArray*)keys_ - notFoundMarker:(id)notFoundMarker_; --(void)makeObjectsPerformSelector:(SEL)selector_; --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object_; --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_; +-(NSArray*)objectsForKeysArrays:(NSArray*)keys + notFoundMarker:(id)notFoundMarker; +-(void)makeObjectsPerformSelector:(SEL)selector; +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object; +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object1 + withObject:(id)object2; @end #endif // _GSWMultiKeyDictionary_h__ diff --git a/GSWeb.framework/GSWMultiKeyDictionary.m b/GSWeb.framework/GSWMultiKeyDictionary.m index 8eb526c..a7a242f 100644 --- a/GSWeb.framework/GSWMultiKeyDictionary.m +++ b/GSWeb.framework/GSWMultiKeyDictionary.m @@ -1,11 +1,16 @@ -/* GSWMultiKeyDictionary.m - GSWeb: Class GSWMultiKeyDictionary - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWMultiKeyDictionary.m - GSWeb: Class GSWMultiKeyDictionary + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -46,13 +52,13 @@ static char rcsId[] = "$Id$"; }; //------------------------------------------------------------------------------ --(id)initWithCapacity:(unsigned int)capacity_ +-(id)initWithCapacity:(unsigned int)capacity { LOGObjectFnStart(); if ((self=[super init])) - { - dict=[[NSMutableDictionary dictionaryWithCapacity:capacity_] retain]; - }; + { + _dict=[[NSMutableDictionary dictionaryWithCapacity:capacity] retain]; + }; LOGObjectFnStop(); return self; }; @@ -60,7 +66,7 @@ static char rcsId[] = "$Id$"; //------------------------------------------------------------------------------ -(void)dealloc { - DESTROY(dict); + DESTROY(_dict); [super dealloc]; }; @@ -74,7 +80,7 @@ static char rcsId[] = "$Id$"; (void*)self]; // GSWLogC("GSWMultiKeyDictionary description B"); descr=[descr stringByAppendingFormat:@"dict=%@>", - dict]; + _dict]; // GSWLogC("GSWMultiKeyDictionary description C"); return descr; }; @@ -82,18 +88,18 @@ static char rcsId[] = "$Id$"; //------------------------------------------------------------------------------ -(NSEnumerator*)objectEnumerator { - return [dict objectEnumerator]; + return [_dict objectEnumerator]; }; //------------------------------------------------------------------------------ -(void)removeAllObjects { - [dict removeAllObjects]; + [_dict removeAllObjects]; }; //------------------------------------------------------------------------------ --(void)setObject:(id)object_ - forKeys:(id)keys_,... +-(void)setObject:(id)object + forKeys:(id)keys,... { NSMutableArray* array=nil; va_list ap; @@ -101,37 +107,39 @@ static char rcsId[] = "$Id$"; array = [NSMutableArray array]; - va_start(ap, keys_); + va_start(ap, keys); - tmpId = keys_; - do { - [array addObject:tmpId]; - tmpId = va_arg(ap,id); - } - while ( tmpId ); + tmpId = keys; + do + { + [array addObject:tmpId]; + tmpId = va_arg(ap,id); + } + while(tmpId); va_end(ap); - [self setObject:object_ + [self setObject:object forKeysArray:array]; }; //------------------------------------------------------------------------------ --(id)objectForKeys:(id)keys_,... +-(id)objectForKeys:(id)keys,... { NSMutableArray* array=nil; va_list ap; id tmpId; array = [NSMutableArray array]; - va_start(ap, keys_); + va_start(ap, keys); - tmpId = keys_; - do { - [array addObject:tmpId]; - tmpId = va_arg(ap,id); - } - while ( tmpId ); + tmpId = keys; + do + { + [array addObject:tmpId]; + tmpId = va_arg(ap,id); + } + while(tmpId); va_end(ap); @@ -139,61 +147,61 @@ static char rcsId[] = "$Id$"; }; //------------------------------------------------------------------------------ --(void)setObject:(id)object_ - forKeysArray:(NSArray*)keys_ +-(void)setObject:(id)object + forKeysArray:(NSArray*)keys { - [dict setObject:object_ - forKey:keys_]; + [_dict setObject:object + forKey:keys]; }; //------------------------------------------------------------------------------ --(id)objectForKeysArray:(NSArray*)keys_ +-(id)objectForKeysArray:(NSArray*)keys { - return [dict objectForKey:keys_]; + return [_dict objectForKey:keys]; }; //------------------------------------------------------------------------------ --(NSArray*)objectsForKeysArrays:(NSArray*)keys_ - notFoundMarker:(id)notFoundMarker_ +-(NSArray*)objectsForKeysArrays:(NSArray*)keys + notFoundMarker:(id)notFoundMarker { - return [dict objectsForKeys:keys_ - notFoundMarker:notFoundMarker_]; + return [_dict objectsForKeys:keys + notFoundMarker:notFoundMarker]; }; //------------------------------------------------------------------------------ -(NSArray*)allValues { - return [dict allValues]; + return [_dict allValues]; }; //------------------------------------------------------------------------------ -(NSArray*)allKeys { - return [dict allKeys]; + return [_dict allKeys]; }; //------------------------------------------------------------------------------ --(void)makeObjectsPerformSelector:(SEL)selector_ +-(void)makeObjectsPerformSelector:(SEL)selector { - [dict makeObjectsPerformSelector:selector_]; + [_dict makeObjectsPerformSelector:selector]; }; //------------------------------------------------------------------------------ --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object_ +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object { - [dict makeObjectsPerformSelector:selector_ - withObject:object_]; + [_dict makeObjectsPerformSelector:selector + withObject:object]; }; //------------------------------------------------------------------------------ --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_ +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object1 + withObject:(id)object2 { - [dict makeObjectsPerformSelector:selector_ - withObject:object1_ - withObject:object2_]; + [_dict makeObjectsPerformSelector:selector + withObject:object1 + withObject:object2]; }; @end diff --git a/GSWeb.framework/GSWPageDefElement.h b/GSWeb.framework/GSWPageDefElement.h index 866762e..e238769 100644 --- a/GSWeb.framework/GSWPageDefElement.h +++ b/GSWeb.framework/GSWPageDefElement.h @@ -1,11 +1,16 @@ -/* GSWPageDefElement.h - GSWeb: Class GSWPageDefElement - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWPageDefElement.h - GSWeb: Class GSWPageDefElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,24 +35,24 @@ //==================================================================== @interface GSWPageDefElement: NSObject { - NSString* elementName; - NSString* className; - NSMutableDictionary* associations; + NSString* _elementName; + NSString* _className; + NSMutableDictionary* _associations; }; -(NSString*)description; -(id)init; -(void)dealloc; -(id)copyWithZone:(NSZone *)zone; --(id)initWithCoder:(NSCoder*)code_; --(void)encodeWithCoder:(NSCoder*)code_; +-(id)initWithCoder:(NSCoder*)code; +-(void)encodeWithCoder:(NSCoder*)code; -(NSString*)elementName; --(void)setElementName:(NSString*)_name; +-(void)setElementName:(NSString*)aNname; -(NSString*)className; --(void)setClassName:(NSString*)_name; +-(void)setClassName:(NSString*)aNname; -(NSDictionary*)associations; --(void)setAssociation:(GSWAssociation*)_association - forKey:(NSString*)_key; +-(void)setAssociation:(GSWAssociation*)association + forKey:(NSString*)key; @end #endif //_GSWPageDefElement_h__ diff --git a/GSWeb.framework/GSWPageDefElement.m b/GSWeb.framework/GSWPageDefElement.m index 1474a36..21b0af2 100644 --- a/GSWeb.framework/GSWPageDefElement.m +++ b/GSWeb.framework/GSWPageDefElement.m @@ -1,11 +1,16 @@ -/* GSWPageDefElement.m - GSWeb: Class GSWPageDefElement - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Jan 1999 +/** GSWPageDefElement.m - GSWeb: Class GSWPageDefElement + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -35,8 +41,8 @@ static char rcsId[] = "$Id$"; -(id)init { if ((self=[super init])) - { - }; + { + }; return self; }; @@ -45,11 +51,11 @@ static char rcsId[] = "$Id$"; { // NSDebugFLLog(@"low",@"Dealloc GSWPageDefElement=%p",(void*)self); // GSWLogC("Dealloc GSWPageDefElement: elementName"); - DESTROY(elementName); + DESTROY(_elementName); // GSWLogC("Dealloc GSWPageDefElement: className"); - DESTROY(className); + DESTROY(_className); // GSWLogC("Dealloc GSWPageDefElement: associations"); - DESTROY(associations); + DESTROY(_associations); [super dealloc]; // GSWLogC("End Dealloc GSWPageDefElement"); } @@ -58,84 +64,84 @@ static char rcsId[] = "$Id$"; -(id)copyWithZone:(NSZone*)zone { GSWPageDefElement* clone = [[isa allocWithZone:zone] init]; - ASSIGNCOPY(clone->elementName,elementName); - ASSIGNCOPY(clone->className,className); - ASSIGNCOPY(clone->associations,associations); + ASSIGNCOPY(clone->_elementName,_elementName); + ASSIGNCOPY(clone->_className,_className); + ASSIGNCOPY(clone->_associations,_associations); return clone; }; //-------------------------------------------------------------------- --(id)initWithCoder:(NSCoder*)coder_ +-(id)initWithCoder:(NSCoder*)coder { if ((self = [super init])) - { - [coder_ decodeValueOfObjCType:@encode(id) - at:&elementName]; - [coder_ decodeValueOfObjCType:@encode(id) - at:&className]; - [coder_ decodeValueOfObjCType:@encode(id) - at:&associations]; - }; + { + [coder decodeValueOfObjCType:@encode(id) + at:&_elementName]; + [coder decodeValueOfObjCType:@encode(id) + at:&_className]; + [coder decodeValueOfObjCType:@encode(id) + at:&_associations]; + }; return self; }; //-------------------------------------------------------------------- --(void)encodeWithCoder:(NSCoder*)coder_ +-(void)encodeWithCoder:(NSCoder*)coder { - [coder_ encodeObject:elementName]; - [coder_ encodeObject:className]; - [coder_ encodeObject:associations]; + [coder encodeObject:_elementName]; + [coder encodeObject:_className]; + [coder encodeObject:_associations]; }; //-------------------------------------------------------------------- -(NSString*)elementName { - return elementName; + return _elementName; }; //-------------------------------------------------------------------- --(void)setElementName:(NSString*)_name +-(void)setElementName:(NSString*)aName { - ASSIGNCOPY(elementName,_name); + ASSIGNCOPY(_elementName,aName); }; //-------------------------------------------------------------------- -(NSString*)className { - return className; + return _className; }; //-------------------------------------------------------------------- --(void)setClassName:(NSString*)_name +-(void)setClassName:(NSString*)aName { - ASSIGNCOPY(className,_name); + ASSIGNCOPY(_className,aName); }; //-------------------------------------------------------------------- -(NSDictionary*)associations { - return associations; + return _associations; }; //-------------------------------------------------------------------- --(void)setAssociation:(GSWAssociation*)_association - forKey:(NSString*)_key +-(void)setAssociation:(GSWAssociation*)association + forKey:(NSString*)key { - if (!associations) - associations=[NSMutableDictionary new]; - [associations setObject:_association - forKey:_key]; + if (!_associations) + _associations=[NSMutableDictionary new]; + [_associations setObject:association + forKey:key]; }; //-------------------------------------------------------------------- -(NSString*)description { return [NSString stringWithFormat:@"<%@ %p elementName:[%@] className:[%@] associations:\n%@", - [self class], - (void*)self, - elementName, - className, - associations]; + [self class], + (void*)self, + _elementName, + _className, + _associations]; }; @end diff --git a/GSWeb.framework/GSWPageDefParserExt.h b/GSWeb.framework/GSWPageDefParserExt.h index 6524fd9..3c3ca84 100644 --- a/GSWeb.framework/GSWPageDefParserExt.h +++ b/GSWeb.framework/GSWPageDefParserExt.h @@ -1,12 +1,16 @@ -/* GSWPageDefParserExt.h - GSWeb: Class GSWPageElementParser: Categories +/** GSWPageDefParserExt.h - GSWeb: Class GSWPageDefParserExt - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -32,14 +37,14 @@ -(NSDictionary*)elements; -(NSArray*)includes; -(void)dealloc; --(void)reportErrorWithException:(NSException*)_exception; --(void)reportError:(NSString*)_text; --(void)reportWarning:(NSString*)_text; +-(void)reportErrorWithException:(NSException*)exception; +-(void)reportError:(NSString*)text; +-(void)reportWarning:(NSString*)text; -(BOOL)isError; -(BOOL)isWarning; -(NSArray*)errors; -(NSArray*)warnings; --(NSString*)unescapedString:(NSString*)string_; +-(NSString*)unescapedString:(NSString*)string; @end #endif //_GSWPageDefParserExt_h__ diff --git a/GSWeb.framework/GSWPageDefParserExt.m b/GSWeb.framework/GSWPageDefParserExt.m index dfcffff..59f14d0 100644 --- a/GSWeb.framework/GSWPageDefParserExt.m +++ b/GSWeb.framework/GSWPageDefParserExt.m @@ -1,12 +1,16 @@ -/* GSWPageDefParserExt.m - GSWeb: Class GSWPageDefParser: Categories +/** GSWPageDefParserExt.m - GSWeb: Class GSWPageDefParserExt - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -20,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -57,37 +62,37 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(void)reportErrorWithException:(NSException*)_exception +-(void)reportErrorWithException:(NSException*)exception { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", - [_exception description], - [_exception reason]]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Exception: %@ (Reason:%@)", + [exception description], + [exception reason]]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportError:(NSString*)_text +-(void)reportError:(NSString*)text { - NSString* _error=nil; + NSString* error=nil; if (!errors) - errors=[NSMutableArray new]; - _error=[NSString stringWithFormat:@"Parsing Error: %@", - _text]; - [errors addObject:_error]; + errors=[NSMutableArray new]; + error=[NSString stringWithFormat:@"Parsing Error: %@", + text]; + [errors addObject:error]; }; //-------------------------------------------------------------------- --(void)reportWarning:(NSString*)_text +-(void)reportWarning:(NSString*)text { - NSString* _warning=nil; + NSString* warning=nil; if (!warnings) - warnings=[NSMutableArray new]; - _warning=[NSString stringWithFormat:@"Parsing Warning: %@", - _text]; - [warnings addObject:_warning]; + warnings=[NSMutableArray new]; + warning=[NSString stringWithFormat:@"Parsing Warning: %@", + text]; + [warnings addObject:warning]; }; //-------------------------------------------------------------------- @@ -115,24 +120,24 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(NSString*)unescapedString:(NSString*)string_ +-(NSString*)unescapedString:(NSString*)aString { //TODO - string_=[string_ stringByReplacingString:@"\\n" + aString=[aString stringByReplacingString:@"\\n" withString:@"\n"]; - string_=[string_ stringByReplacingString:@"\\r" + aString=[aString stringByReplacingString:@"\\r" withString:@"\r"]; - string_=[string_ stringByReplacingString:@"\\t" + aString=[aString stringByReplacingString:@"\\t" withString:@"\t"]; - string_=[string_ stringByReplacingString:@"\\b" + aString=[aString stringByReplacingString:@"\\b" withString:@"\b"]; - string_=[string_ stringByReplacingString:@"\\f" + aString=[aString stringByReplacingString:@"\\f" withString:@"\f"]; - string_=[string_ stringByReplacingString:@"\\\"" + aString=[aString stringByReplacingString:@"\\\"" withString:@"\""]; - string_=[string_ stringByReplacingString:@"\\\'" + aString=[aString stringByReplacingString:@"\\\'" withString:@"\'"]; - return string_; + return aString; }; @end diff --git a/GSWeb.framework/GSWParam.h b/GSWeb.framework/GSWParam.h index 0cbe29d..f1611b5 100644 --- a/GSWeb.framework/GSWParam.h +++ b/GSWeb.framework/GSWParam.h @@ -2,7 +2,7 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Jan 1999 $Revision$ diff --git a/GSWeb.framework/GSWParam.m b/GSWeb.framework/GSWParam.m index bdfcd28..379a4e8 100644 --- a/GSWeb.framework/GSWParam.m +++ b/GSWeb.framework/GSWParam.m @@ -1,11 +1,16 @@ -/* GSWParam.m - GSWeb: Class GSWParam - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWParam.m - GSWeb: Class GSWParam + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -28,12 +34,12 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWParam --(id) initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ - target:(id)target_ - key:(NSString*)key_ - treatNilValueAsGSWNull:(BOOL)treatNilValueAsGSWNull_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements + target:(id)target + key:(NSString*)key +treatNilValueAsGSWNull:(BOOL)treatNilValueAsGSWNull { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -41,9 +47,9 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - contentElements:(NSArray*)elements_ +-(id)initWithName:(NSString*)aName + associations:(NSDictionary*)associations + contentElements:(NSArray*)elements { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -75,8 +81,8 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWParam (GSWParamA) --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_ +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -87,15 +93,15 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation GSWParam (GSWParamB) --(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)appendGSWebObjectsAssociationsToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(id)valueInComponent:(id)component_ +-(id)valueInComponent:(id)component { LOGObjectFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWProjectBundle.h b/GSWeb.framework/GSWProjectBundle.h index 4e239ba..4d61ea1 100644 --- a/GSWeb.framework/GSWProjectBundle.h +++ b/GSWeb.framework/GSWProjectBundle.h @@ -1,11 +1,16 @@ -/* GSWProjectBundle.h - GSWeb: Class GSWProjectBundle - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWProjectBundle - GSWeb: Class GSWProjectBundle + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,20 +36,20 @@ //==================================================================== @interface GSWProjectBundle : GSWDeployedBundle { - NSString* projectName; - NSDictionary* subprojects; - NSDictionary* pbProjectDictionary; + NSString* _projectName; + NSDictionary* _subprojects; + NSDictionary* _pbProjectDictionary; }; --(id)initWithPath:(NSString*)path_; +-(id)initWithPath:(NSString*)aPath; -(void)dealloc; -(NSString*)description; --(NSArray*)lockedPathsForResourcesOfType:(id)type_; --(NSArray*)lockedPathsForResourcesInSubprojectsOfType:(id)type_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_; --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_; +-(NSArray*)lockedPathsForResourcesOfType:(id)aType; +-(NSArray*)lockedPathsForResourcesInSubprojectsOfType:(id)aType; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage; +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages; -(NSDictionary*)subprojects; -(BOOL)isFramework; -(GSWDeployedBundle*)projectBundle; @@ -54,8 +60,8 @@ @interface GSWProjectBundle (GSWProjectBundle) -+(GSWDeployedBundle*)projectBundleForProjectNamed:(NSString*)name_ - isFramework:(BOOL)isFramework_; ++(GSWDeployedBundle*)projectBundleForProjectNamed:(NSString*)aName + isFramework:(BOOL)isFramework; @end diff --git a/GSWeb.framework/GSWProjectBundle.m b/GSWeb.framework/GSWProjectBundle.m index 0e198c4..bf26342 100644 --- a/GSWeb.framework/GSWProjectBundle.m +++ b/GSWeb.framework/GSWProjectBundle.m @@ -1,4 +1,5 @@ /** GSWProjectBundle.m - GSWeb: Class GSWProjectBundle + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon @@ -33,16 +34,14 @@ static char rcsId[] = "$Id$"; #include #include - - //==================================================================== @implementation GSWProjectBundle --(id)initWithPath:(NSString*)path_ +-(id)initWithPath:(NSString*)aPath { LOGObjectFnStart(); - NSDebugMLLog(@"bundles",@"path_=%@",path_); - if ((self=[super initWithPath:path_])) + NSDebugMLLog(@"bundles",@"aPath=%@",aPath); + if ((self=[super initWithPath:aPath])) { //TODO }; @@ -53,9 +52,9 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(void)dealloc { - DESTROY(projectName); - DESTROY(subprojects); - DESTROY(pbProjectDictionary); + DESTROY(_projectName); + DESTROY(_subprojects); + DESTROY(_pbProjectDictionary); [super dealloc]; }; @@ -63,51 +62,51 @@ static char rcsId[] = "$Id$"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - bundlePath:[%@] relativePaths:[%@] projectName:[%@] subprojects:[%@] pbProjectDictionary:[%@]>", - object_get_class_name(self), - (void*)self, - bundlePath, - relativePathsCache, - projectName, - subprojects, - pbProjectDictionary]; + object_get_class_name(self), + (void*)self, + _bundlePath, + _relativePathsCache, + _projectName, + _subprojects, + _pbProjectDictionary]; }; //-------------------------------------------------------------------- --(NSArray*)lockedPathsForResourcesOfType:(id)type_ +-(NSArray*)lockedPathsForResourcesOfType:(id)aType { LOGObjectFnNotImplemented(); //TODOFN - return [super lockedPathsForResourcesOfType:type_]; + return [super lockedPathsForResourcesOfType:aType]; }; //-------------------------------------------------------------------- --(NSArray*)lockedPathsForResourcesInSubprojectsOfType:(id)type_ +-(NSArray*)lockedPathsForResourcesInSubprojectsOfType:(id)aType { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguage:(NSString*)language_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguage:(NSString*)aLanguage { LOGObjectFnNotImplemented(); //TODOFN - return [super lockedRelativePathForResourceNamed:name_ - forLanguage:language_]; + return [super lockedRelativePathForResourceNamed:aName + forLanguage:aLanguage]; }; //-------------------------------------------------------------------- --(NSString*)lockedRelativePathForResourceNamed:(NSString*)name_ - forLanguages:(NSArray*)languages_ +-(NSString*)lockedRelativePathForResourceNamed:(NSString*)aName + forLanguages:(NSArray*)someLanguages { LOGObjectFnNotImplemented(); //TODOFN - return [super lockedRelativePathForResourceNamed:name_ - forLanguages:languages_]; + return [super lockedRelativePathForResourceNamed:aName + forLanguages:someLanguages]; }; //-------------------------------------------------------------------- -(NSDictionary*)subprojects { - return subprojects; + return _subprojects; }; //-------------------------------------------------------------------- @@ -134,98 +133,99 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(NSString*)projectName { - return projectName; + return _projectName; }; //-------------------------------------------------------------------- -(NSDictionary*)_pbProjectDictionary { - return pbProjectDictionary; + return _pbProjectDictionary; }; @end //==================================================================== @implementation GSWProjectBundle (GSWProjectBundle) -+(GSWDeployedBundle*)projectBundleForProjectNamed:(NSString*)name_ - isFramework:(BOOL)isFramework_ ++(GSWDeployedBundle*)projectBundleForProjectNamed:(NSString*)aName + isFramework:(BOOL)isFramework { //OK //name:ObjCTest3 - GSWDeployedBundle* _projectBundle=nil; - GSWDeployedBundle* _aBundle=nil; - NSArray* _projectSearchPath=nil; - NSMutableArray* _projectsBundles=nil; - NSEnumerator* _projectEnum = nil; - NSEnumerator* _projectSearchPathEnum=nil; - NSString* _path=nil; + GSWDeployedBundle* projectBundle=nil; + GSWDeployedBundle* aBundle=nil; + NSArray* projectSearchPath=nil; + NSMutableArray* projectsBundles=nil; + NSEnumerator* projectEnum = nil; + NSEnumerator* projectSearchPathEnum=nil; + NSString* path=nil; LOGClassFnStart(); - NSDebugMLLog(@"bundles",@"name_:%@",name_); - NSDebugMLLog(@"bundles",@"isFramework_=%s",(isFramework_ ? "YES" : "NO")); + NSDebugMLLog(@"bundles",@"aName:%@",aName); + NSDebugMLLog(@"bundles",@"isFramework=%s",(isFramework ? "YES" : "NO")); - _projectSearchPath=[GSWApplication projectSearchPath]; // ("H:\\Wotests") - NSDebugMLLog(@"bundles",@"_projectSearchPath:%@",_projectSearchPath); - _projectsBundles=[NSMutableArray array]; + projectSearchPath=[GSWApplication projectSearchPath]; // ("H:\\Wotests") + NSDebugMLLog(@"bundles",@"projectSearchPath:%@",projectSearchPath); + projectsBundles=[NSMutableArray array]; - _projectSearchPathEnum = [_projectSearchPath objectEnumerator]; - while ((_path = [_projectSearchPathEnum nextObject])) - { - NSDirectoryEnumerator* dirEnum=nil; - NSString* filePath=nil; - NSFileManager* fileManager=[NSFileManager defaultManager]; - dirEnum = [fileManager enumeratorAtPath:_path]; - while ((filePath = [dirEnum nextObject])) - { - NSDictionary* attributes = [dirEnum fileAttributes]; - NSString* fileType = [attributes objectForKey:NSFileType]; - filePath=[_path stringByAppendingFormat:@"/%@",filePath]; - NSDebugMLLog(@"bundles",@"filePath:%@",filePath); -// NSDebugMLLog(@"bundles",@"attributes:%@",attributes); -// NSDebugMLLog(@"bundles",@"fileType:%@",fileType); - if ([fileType isEqual:NSFileTypeDirectory]) - { - BOOL _tmpBundleIsFramework=NO; - NSString* _tmpBundleProjectName=nil; - GSWDeployedBundle* _tmpBundle=[GSWProjectBundle bundleWithPath:filePath]; - NSDebugMLLog(@"bundles",@"_tmpBundle:%@",_tmpBundle); - _tmpBundleProjectName=[_tmpBundle projectName]; - NSDebugMLLog(@"bundles",@"_tmpBundleProjectName:%@",_tmpBundleProjectName); - _tmpBundleIsFramework=[_tmpBundle isFramework]; - NSDebugMLLog(@"bundles",@"_tmpBundleIsFramework=%s",(_tmpBundleIsFramework ? "YES" : "NO")); + projectSearchPathEnum = [projectSearchPath objectEnumerator]; + while ((path = [projectSearchPathEnum nextObject])) + { + NSDirectoryEnumerator* dirEnum=nil; + NSString* filePath=nil; + NSFileManager* fileManager=[NSFileManager defaultManager]; + dirEnum = [fileManager enumeratorAtPath:path]; + while ((filePath = [dirEnum nextObject])) + { + NSDictionary* attributes = [dirEnum fileAttributes]; + NSString* fileType = [attributes objectForKey:NSFileType]; + filePath=[path stringByAppendingFormat:@"/%@",filePath]; + NSDebugMLLog(@"bundles",@"filePath:%@",filePath); + // NSDebugMLLog(@"bundles",@"attributes:%@",attributes); + // NSDebugMLLog(@"bundles",@"fileType:%@",fileType); + if ([fileType isEqual:NSFileTypeDirectory]) + { + BOOL tmpBundleIsFramework=NO; + NSString* tmpBundleProjectName=nil; + GSWDeployedBundle* tmpBundle=(GSWDeployedBundle*)[GSWProjectBundle bundleWithPath:filePath]; + NSDebugMLLog(@"bundles",@"tmpBundle:%@",tmpBundle); + tmpBundleProjectName=[tmpBundle projectName]; + NSDebugMLLog(@"bundles",@"tmpBundleProjectName:%@",tmpBundleProjectName); + tmpBundleIsFramework=[tmpBundle isFramework]; + NSDebugMLLog(@"bundles",@"tmpBundleIsFramework=%s", + (tmpBundleIsFramework ? "YES" : "NO")); //Why projectName... - if ((isFramework_ && _tmpBundleIsFramework) - ||(!isFramework_ && !_tmpBundleIsFramework)) - { - NSDebugMLLog(@"bundles",@"adding _tmpBundle:%@",_tmpBundleProjectName); - [_projectsBundles addObject:_tmpBundle]; - }; - }; - }; - }; - _projectEnum =[_projectsBundles objectEnumerator]; - while(!_projectBundle && (_aBundle = [_projectEnum nextObject])) - { - NSString* suffix1=isFramework_ ? GSFrameworkPSuffix : GSWApplicationPSuffix[GSWebNamingConv]; - NSString* suffix2=isFramework_ ? GSFrameworkPSuffix : GSWApplicationPSuffix[GSWebNamingConvInversed]; - NSDebugMLLog(@"bundles",@"suffix1:%@ suffix2",suffix1,suffix2); - NSDebugMLLog(@"bundles",@"_aBundle:%@",_aBundle); + if ((isFramework && tmpBundleIsFramework) + ||(!isFramework && !tmpBundleIsFramework)) + { + NSDebugMLLog(@"bundles",@"adding tmpBundle:%@",tmpBundleProjectName); + [projectsBundles addObject:tmpBundle]; + }; + }; + }; + }; + projectEnum =[projectsBundles objectEnumerator]; + while(!projectBundle && (aBundle = [projectEnum nextObject])) + { + NSString* suffix1=isFramework ? GSFrameworkPSuffix : GSWApplicationPSuffix[GSWebNamingConv]; + NSString* suffix2=isFramework ? GSFrameworkPSuffix : GSWApplicationPSuffix[GSWebNamingConvInversed]; + NSDebugMLLog(@"bundles",@"suffix1:%@ suffix2",suffix1,suffix2); + NSDebugMLLog(@"bundles",@"aBundle:%@",aBundle); - if ([[_aBundle bundlePath]hasSuffix:suffix1] - || [[_aBundle bundlePath]hasSuffix:suffix2] - || [[_aBundle bundlePath]hasSuffix:@".debug"]) - { - NSString* _tmpName=[_aBundle projectName]; - NSDebugMLLog(@"bundles",@"_tmpName:%@",_tmpName); - if ([_tmpName isEqual:name_]) - { - _projectBundle=_aBundle; - NSDebugMLLog(@"bundles",@"_projectBundle:%@",_projectBundle); - }; - }; - }; - NSDebugMLLog(@"bundles",@"_projectBundle:%@",_projectBundle); + if ([[aBundle bundlePath]hasSuffix:suffix1] + || [[aBundle bundlePath]hasSuffix:suffix2] + || [[aBundle bundlePath]hasSuffix:@".debug"]) + { + NSString* tmpName=[aBundle projectName]; + NSDebugMLLog(@"bundles",@"tmpName:%@",tmpName); + if ([tmpName isEqual:aName]) + { + projectBundle=aBundle; + NSDebugMLLog(@"bundles",@"projectBundle:%@",projectBundle); + }; + }; + }; + NSDebugMLLog(@"bundles",@"projectBundle:%@",projectBundle); LOGClassFnStop(); - return _projectBundle; + return projectBundle; }; @end diff --git a/GSWeb.framework/GSWQuickTime.h b/GSWeb.framework/GSWQuickTime.h index 9003937..66ea37f 100644 --- a/GSWeb.framework/GSWQuickTime.h +++ b/GSWeb.framework/GSWQuickTime.h @@ -1,11 +1,18 @@ -/* GSWQuickTime.h - GSWeb: Class GSWQuickTime - Copyright (C) 2000 Free Software Foundation, Inc. +/** GSWQuickTime.h - GSWeb: Class GSWQuickTime + + Copyright (C) 2000-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 2000 + Written by: Manuel Guesdon + Date: Jan 200 + $Revision$ + $Date$ + + + This file is part of the GNUstep Web 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 @@ -19,7 +26,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -30,57 +38,57 @@ //==================================================================== @interface GSWNestedList: GSWDynamicElement { - NSMutableDictionary* associations; - GSWAssociation* src; - GSWAssociation* filename; - GSWAssociation* hotspotList; - GSWAssociation* framework; - GSWAssociation* width; - GSWAssociation* height; - GSWAssociation* action; - GSWAssociation* selection; - GSWAssociation* loop; - GSWAssociation* volume; - GSWAssociation* scale; - GSWAssociation* pluginsPage; - GSWAssociation* pluginsPageName; - GSWAssociation* href; - GSWAssociation* pageName; - GSWAssociation* bgcolor; - GSWAssociation* target; - GSWAssociation* pan; - GSWAssociation* tilt; - GSWAssociation* fov; - GSWAssociation* node; - GSWAssociation* correction; - GSWAssociation* cache; - GSWAssociation* autoplay; - GSWAssociation* autostart; - GSWAssociation* hidden; - GSWAssociation* playEveryFrame; - GSWAssociation* controller; - GSWAssociation* prefixHost; + NSMutableDictionary* _associations; + GSWAssociation* _src; + GSWAssociation* _filename; + GSWAssociation* _hotspotList; + GSWAssociation* _framework; + GSWAssociation* _width; + GSWAssociation* _height; + GSWAssociation* _action; + GSWAssociation* _selection; + GSWAssociation* _loop; + GSWAssociation* _volume; + GSWAssociation* _scale; + GSWAssociation* _pluginsPage; + GSWAssociation* _pluginsPageName; + GSWAssociation* _href; + GSWAssociation* _pageName; + GSWAssociation* _bgcolor; + GSWAssociation* _target; + GSWAssociation* _pan; + GSWAssociation* _tilt; + GSWAssociation* _fov; + GSWAssociation* _node; + GSWAssociation* _correction; + GSWAssociation* _cache; + GSWAssociation* _autoplay; + GSWAssociation* _autostart; + GSWAssociation* _hidden; + GSWAssociation* _playEveryFrame; + GSWAssociation* _controller; + GSWAssociation* _prefixHost; }; --(GSWElement*)invokeActionForRequest:(GSWRequest*)request_ - inContext:(GSWContext*)context_; --(void)appendToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)addHRefToResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(GSWElement*)invokeActionForRequest:(GSWRequest*)aRequest + inContext:(GSWContext*)aContext; +-(void)appendToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; +-(void)addHRefToResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; -(id)_generateURL:(id)u; -(id)_prefixedURL:(id)u - inContext:(GSWContext*)context_; --(void)addToResponse:(GSWResponse*)response_ - tag:(id)tag_ - value:(id)value_; + inContext:(GSWContext*)aContext; +-(void)addToResponse:(GSWResponse*)aResponse + tag:(id)tag + value:(id)value; -(void)dealloc; -(id)init; --(id)initWithName:(NSString*)name_ - associations:(NSDictionary*)associations_ - template:(GSWElement*)templateElement_; --(BOOL)booleanValueOfBinding:(id)binding_ - inComponent:(id)component_; +-(id)initWithName:(NSString*)name + associations:(NSDictionary*)associations + template:(GSWElement*)templateElement; +-(BOOL)booleanValueOfBinding:(id)binding + inComponent:(id)component; @end #endif //_GSWQuickTime_h__ diff --git a/GSWeb.framework/GSWRequestHandler.h b/GSWeb.framework/GSWRequestHandler.h index 0886410..5cca70c 100644 --- a/GSWeb.framework/GSWRequestHandler.h +++ b/GSWeb.framework/GSWRequestHandler.h @@ -1,11 +1,16 @@ -/* GSWRequestHandler.h - GSWeb: Class GSWRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Feb 1999 +/** GSWRequestHandler.h - GSWeb: Class GSWRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -29,13 +35,13 @@ //==================================================================== @interface GSWRequestHandler : NSObject { - NSRecursiveLock* selfLock; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; + int _selfLockn; #endif }; --(GSWResponse*)handleRequest:(GSWRequest*)request_; +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest; -(void)lock; -(void)unlock; diff --git a/GSWeb.framework/GSWRequestHandler.m b/GSWeb.framework/GSWRequestHandler.m index eab1c1b..71b837a 100644 --- a/GSWeb.framework/GSWRequestHandler.m +++ b/GSWeb.framework/GSWRequestHandler.m @@ -1,11 +1,16 @@ -/* GSWRequestHandler.m - GSWeb: Class GSWRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Feb 1999 +/** GSWRequestHandler.m - GSWeb: Class GSWRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,7 +35,7 @@ static char rcsId[] = "$Id$"; @implementation GSWRequestHandler //-------------------------------------------------------------------- --(GSWResponse*)handleRequest:(GSWRequest*)request_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest { LOGObjectFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWResourceRequestHandler.h b/GSWeb.framework/GSWResourceRequestHandler.h index a5505e5..0bbd77d 100644 --- a/GSWeb.framework/GSWResourceRequestHandler.h +++ b/GSWeb.framework/GSWResourceRequestHandler.h @@ -1,11 +1,16 @@ -/* GSWResourceRequestHandler.h - GSWeb: Class GSWResourceRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Feb 1999 +/** GSWResourceRequestHandler.h - GSWeb: Class GSWResourceRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,12 +37,12 @@ { }; --(GSWResponse*)handleRequest:(GSWRequest*)request_; --(GSWResponse*)_responseForJavaClassAtPath:(NSString*)_path; --(GSWResponse*)_responseForDataAtPath:(NSString*)_path; --(GSWResponse*)_responseForDataCachedWithKey:(NSString*)_key; --(GSWResponse*)_generateResponseForData:(NSData*)_data - mimeType:(NSString*)_mimeType; +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest; +-(GSWResponse*)_responseForJavaClassAtPath:(NSString*)aPath; +-(GSWResponse*)_responseForDataAtPath:(NSString*)aPath; +-(GSWResponse*)_responseForDataCachedWithKey:(NSString*)aKey; +-(GSWResponse*)_generateResponseForData:(NSData*)aData + mimeType:(NSString*)mimeType; @end diff --git a/GSWeb.framework/GSWResourceRequestHandler.m b/GSWeb.framework/GSWResourceRequestHandler.m index 53b50cc..edf0d7f 100644 --- a/GSWeb.framework/GSWResourceRequestHandler.m +++ b/GSWeb.framework/GSWResourceRequestHandler.m @@ -1,11 +1,16 @@ -/* GSWResourceRequestHandler.m - GSWeb: Class GSWResourceRequestHandler - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Feb 1999 +/** GSWResourceRequestHandler.m - GSWeb: Class GSWResourceRequestHandler + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Feb 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,74 +35,74 @@ static char rcsId[] = "$Id$"; @implementation GSWResourceRequestHandler //-------------------------------------------------------------------- --(GSWResponse*)handleRequest:(GSWRequest*)request_ +-(GSWResponse*)handleRequest:(GSWRequest*)aRequest { //OK - // /cgi/GSWeb.exe/ObjCTest3.gswa/wr?gswdata=0 - GSWResponse* _response=nil; - NSString* _gswdata=nil; - NSDictionary* _elements=nil; + // /GSWeb/ObjCTest3.gswa/wr?gswdata=0 + GSWResponse* response=nil; + NSString* gswdata=nil; + NSDictionary* elements=nil; LOGObjectFnStart(); - _elements=[request_ uriOrFormOrCookiesElements]; - NSDebugMLog(@"_elements=%@",_elements); - _gswdata=[_elements objectForKey:GSWKey_Data[GSWebNamingConv]]; - NSDebugMLog(@"_gswdata=%@",_gswdata); - if (_gswdata) - _response=[self _responseForDataCachedWithKey:_gswdata]; + elements=[aRequest uriOrFormOrCookiesElements]; + NSDebugMLog(@"elements=%@",elements); + gswdata=[elements objectForKey:GSWKey_Data[GSWebNamingConv]]; + NSDebugMLog(@"gswdata=%@",gswdata); + if (gswdata) + response=[self _responseForDataCachedWithKey:gswdata]; else - { - ExceptionRaise0(@"GSWResourceRequestHandler",@"No data key in request"); - LOGError0(@"");//TODO - }; - NSDebugMLog(@"_response=%@",_response); - [_response _finalizeInContext:nil]; + { + ExceptionRaise0(@"GSWResourceRequestHandler",@"No data key in request"); + LOGError0(@"");//TODO + }; + NSDebugMLog(@"response=%@",response); + [response _finalizeInContext:nil]; LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(GSWResponse*)_responseForJavaClassAtPath:(NSString*)_path +-(GSWResponse*)_responseForJavaClassAtPath:(NSString*)aPath { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(GSWResponse*)_responseForDataAtPath:(NSString*)_path +-(GSWResponse*)_responseForDataAtPath:(NSString*)aPath { LOGObjectFnNotImplemented(); //TODOFN return nil; }; //-------------------------------------------------------------------- --(GSWResponse*)_responseForDataCachedWithKey:(NSString*)_key +-(GSWResponse*)_responseForDataCachedWithKey:(NSString*)aKey { //OK - GSWResponse* _response=nil; - GSWResourceManager* _resourceManager=nil; - GSWURLValuedElementData* _data=nil; + GSWResponse* response=nil; + GSWResourceManager* resourceManager=nil; + GSWURLValuedElementData* data=nil; LOGObjectFnStart(); - NSDebugMLog(@"_key=%@",_key); - _response=[[GSWResponse new]autorelease]; - _resourceManager=[[GSWApplication application] resourceManager]; - _data=[_resourceManager _cachedDataForKey:_key]; - NSDebugMLog(@"_data=%@",_data); - if (_data) - [_data appendToResponse:_response - inContext:nil]; + NSDebugMLog(@"aKey=%@",aKey); + response=[[GSWResponse new]autorelease]; + resourceManager=[[GSWApplication application] resourceManager]; + data=[resourceManager _cachedDataForKey:aKey]; + NSDebugMLog(@"data=%@",data); + if (data) + [data appendToResponse:response + inContext:nil]; else - { - LOGSeriousError(@"No data for _key %@", - _key); - //TODO - }; + { + LOGSeriousError(@"No data for _key %@", + key); + //TODO + }; LOGObjectFnStop(); - return _response; + return response; }; //-------------------------------------------------------------------- --(GSWResponse*)_generateResponseForData:(NSData*)_data - mimeType:(NSString*)_mimeType +-(GSWResponse*)_generateResponseForData:(NSData*)aData + mimeType:(NSString*)mimeType { LOGObjectFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWSessionTimeOutManager.h b/GSWeb.framework/GSWSessionTimeOutManager.h index 6230b7e..9baf6ec 100644 --- a/GSWeb.framework/GSWSessionTimeOutManager.h +++ b/GSWeb.framework/GSWSessionTimeOutManager.h @@ -2,7 +2,7 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Mar 1999 $Revision$ diff --git a/GSWeb.framework/GSWSessionTimeOutManager.m b/GSWeb.framework/GSWSessionTimeOutManager.m index abca2c5..f506c23 100644 --- a/GSWeb.framework/GSWSessionTimeOutManager.m +++ b/GSWeb.framework/GSWSessionTimeOutManager.m @@ -2,7 +2,7 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon + Written by: Manuel Guesdon Date: Mar 1999 $Revision$ diff --git a/GSWeb.framework/GSWStatisticsStore.h b/GSWeb.framework/GSWStatisticsStore.h index e9ce3f5..7460ca3 100644 --- a/GSWeb.framework/GSWStatisticsStore.h +++ b/GSWeb.framework/GSWStatisticsStore.h @@ -1,11 +1,16 @@ -/* GSWStatisticsStore.h - GSWeb: Class GSWStatisticsStore - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWStatisticsStore.h - GSWeb: Class GSWStatisticsStore + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,9 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -// $Id$ + +**/ #ifndef _GSWStatisticsStore_h__ #define _GSWStatisticsStore_h__ @@ -29,46 +33,46 @@ @interface GSWStatisticsStore : NSObject { - NSRecursiveLock* selfLock; + NSRecursiveLock* _selfLock; #ifndef NDEBUG - int selfLockn; + int _selfLockn; #endif - int transactionMovingAverageSampleCount; - int sessionMovingAverageSampleCount; - int transactionsCount; - int lastStatsTransactionsCount; - int directActionTransactionsCount; - int componentActionTransactionsCount; - int sessionsCount; - int lastStatsSessionsCount; - int maxActiveSessionsCount; - NSDate* maxActiveSessionsDate; - float averageRequestsPerSession; - double averageSessionLife; - NSArray* lastSessionStatistics; - double movingAverageSessionLife; - float movingAverageRequestsPerSession; - int movingAverageSessionsCount; - NSDate* startDate; - NSDate* lastStatsDate; - double lastWillHandleRequestTimeInterval; - double lastDidHandleRequestTimeInterval; - double totalIdleTimeInterval; - double totalTransactionTimeInterval; - double totalDATransactionTimeInterval; - double totalCATransactionTimeInterval; - double movingIdleTimeInterval; - double movingTransactionTimeInterval; - int movingAverageTransactionsCount; - NSDictionary* initializationMemory; - NSMutableDictionary* pagesStatistics; - NSString* currentPage; - NSMutableDictionary* pathsStatistics; - NSString* logPath; - double logRotation; - NSDate* logCreationDate; - NSString* password; - NSMutableDictionary* directActionStatistics; + int _transactionMovingAverageSampleCount; + int _sessionMovingAverageSampleCount; + int _transactionsCount; + int _lastStatsTransactionsCount; + int _directActionTransactionsCount; + int _componentActionTransactionsCount; + int _sessionsCount; + int _lastStatsSessionsCount; + int _maxActiveSessionsCount; + NSDate* _maxActiveSessionsDate; + float _averageRequestsPerSession; + double _averageSessionLife; + NSArray* _lastSessionStatistics; + double _movingAverageSessionLife; + float _movingAverageRequestsPerSession; + int _movingAverageSessionsCount; + NSDate* _startDate; + NSDate* _lastStatsDate; + double _lastWillHandleRequestTimeInterval; + double _lastDidHandleRequestTimeInterval; + double _totalIdleTimeInterval; + double _totalTransactionTimeInterval; + double _totalDATransactionTimeInterval; + double _totalCATransactionTimeInterval; + double _movingIdleTimeInterval; + double _movingTransactionTimeInterval; + int _movingAverageTransactionsCount; + NSDictionary* _initializationMemory; + NSMutableDictionary* _pagesStatistics; + NSString* _currentPage; + NSMutableDictionary* _pathsStatistics; + NSString* _logPath; + double _logRotation; + NSDate* _logCreationDate; + NSString* _password; + NSMutableDictionary* _directActionStatistics; }; -(id)init; @@ -78,22 +82,22 @@ -(void)lock; -(id)statistics; -(int)sessionMovingAverageSampleSize; --(void)setSessionMovingAverageSampleSize:(int)size_; +-(void)setSessionMovingAverageSampleSize:(int)aSize; -(int)transactionMovingAverageSampleSize; --(void)setTransactionMovingAverageSampleSize:(int)size_; +-(void)setTransactionMovingAverageSampleSize:(int)aSize; @end @interface GSWStatisticsStore (GSWStatisticsStoreA) -(void)_purgePathsStatistics; --(void)_updatePathsStatisticsWithPaths:(id)paths_; --(void)_updatePagesStatisticsForPage:(id)page_ - timeInterval:(NSTimeInterval)timeInterval_; --(void)_updateDAStatisticsForActionNamed:(id)name_ - timeInterval:(NSTimeInterval)timeInterval_; --(void)_sessionTerminating:(id)session_; --(void)_applicationCreatedSession:(GSWSession*)session_; +-(void)_updatePathsStatisticsWithPaths:(id)paths; +-(void)_updatePagesStatisticsForPage:(id)page + timeInterval:(NSTimeInterval)timeInterval; +-(void)_updateDAStatisticsForActionNamed:(id)name + timeInterval:(NSTimeInterval)timeInterval; +-(void)_sessionTerminating:(id)session; +-(void)_applicationCreatedSession:(GSWSession*)session; -(void)_applicationDidHandleComponentActionRequest; --(void)_applicationDidHandleDirectActionRequestWithActionNamed:(id)name_; +-(void)_applicationDidHandleDirectActionRequestWithActionNamed:(id)name; -(double)_applicationDidHandleRequest; -(void)_applicationWillHandleDirectActionRequest; -(void)_applicationWillHandleComponentActionRequest; @@ -101,22 +105,22 @@ @end @interface GSWStatisticsStore (GSWStatisticsStoreB) --(NSString*)descriptionForResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; --(void)recordStatisticsForResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(NSString*)descriptionForResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; +-(void)recordStatisticsForResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; @end @interface GSWStatisticsStore (GSWStatisticsStoreC) --(void)logString:(id)string_; +-(void)logString:(id)string; -(double)logFileRotationFrequencyInDays; -(NSString*)logFile; --(void) setLogFile:(NSString*)logFile_ +-(void) setLogFile:(NSString*)logFile rotationFrequencyInDays:(double)rotationFrequency; --(id)formatDescription:(id)description_ - forResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_; +-(id)formatDescription:(id)description + forResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext; @end @interface GSWStatisticsStore (GSWStatisticsStoreD) @@ -146,14 +150,14 @@ @end @interface GSWStatisticsStore (GSWStatisticsStoreE) --(BOOL)validateLogin:(id)login_ - forSession:(id)session_; --(void)setPassword:(NSString*)password_; +-(BOOL)validateLogin:(id)login + forSession:(id)session; +-(void)setPassword:(NSString*)password; @end @interface GSWStatisticsStore (GSWStatisticsStoreF) --(BOOL)validateLogin:(id)login_; +-(BOOL)validateLogin:(id)login; @end @interface GSWStatisticsStore (GSWStatisticsStoreG) @@ -162,6 +166,6 @@ @end @interface GSWStatisticsStore (GSWStatisticsStoreH) -+(id)timeIntervalDescription:(double)timeInterval_; ++(id)timeIntervalDescription:(double)timeInterval; @end #endif //_GSWStatisticsStore_h__ diff --git a/GSWeb.framework/GSWStatisticsStore.m b/GSWeb.framework/GSWStatisticsStore.m index 32d32a0..ffb3f30 100644 --- a/GSWeb.framework/GSWStatisticsStore.m +++ b/GSWeb.framework/GSWStatisticsStore.m @@ -1,11 +1,16 @@ -/* GSWStatisticsStore.m - GSWeb: Class GSWStatisticsStore - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWStatisticsStore.m - GSWeb: Class GSWStatisticsStore + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -36,11 +42,11 @@ static char rcsId[] = "$Id$"; //OK if ((self=[super init])) { - transactionMovingAverageSampleCount = 100; - sessionMovingAverageSampleCount = 10; - ASSIGN(startDate, [NSDate date]); - ASSIGN(initializationMemory, [self _memoryUsage]); - selfLock = [NSRecursiveLock new]; + _transactionMovingAverageSampleCount = 100; + _sessionMovingAverageSampleCount = 10; + ASSIGN(_startDate, [NSDate date]); + ASSIGN(_initializationMemory, [self _memoryUsage]); + _selfLock = [NSRecursiveLock new]; }; return self; }; @@ -50,20 +56,20 @@ static char rcsId[] = "$Id$"; { GSWLogC("Dealloc GSWStatisticsStore"); GSWLogC("Dealloc GSWStatisticsStore: selfLock"); - DESTROY(selfLock); + DESTROY(_selfLock); GSWLogC("Dealloc GSWStatisticsStore: maxActiveSessionsDate"); - DESTROY(maxActiveSessionsDate); - DESTROY(lastSessionStatistics); - DESTROY(startDate); - DESTROY(lastStatsDate); - DESTROY(initializationMemory); - DESTROY(pagesStatistics); - DESTROY(currentPage); - DESTROY(pathsStatistics); - DESTROY(logPath); - DESTROY(logCreationDate); - DESTROY(password); - DESTROY(directActionStatistics); + DESTROY(_maxActiveSessionsDate); + DESTROY(_lastSessionStatistics); + DESTROY(_startDate); + DESTROY(_lastStatsDate); + DESTROY(_initializationMemory); + DESTROY(_pagesStatistics); + DESTROY(_currentPage); + DESTROY(_pathsStatistics); + DESTROY(_logPath); + DESTROY(_logCreationDate); + DESTROY(_password); + DESTROY(_directActionStatistics); GSWLogC("Dealloc GSWStatisticsStore Super"); [super dealloc]; GSWLogC("End Dealloc GSWStatisticsStore"); @@ -73,12 +79,12 @@ static char rcsId[] = "$Id$"; -(void)unlock { LOGObjectFnStart(); - NSDebugMLog(@"selfLockn=%d",selfLockn); - TmpUnlock(selfLock); + NSDebugMLog(@"selfLockn=%d",_selfLockn); + TmpUnlock(_selfLock); #ifndef NDEBUG - selfLockn--; + _selfLockn--; #endif - NSDebugMLog(@"selfLockn=%d",selfLockn); + NSDebugMLog(@"selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; @@ -86,12 +92,12 @@ static char rcsId[] = "$Id$"; -(void)lock { LOGObjectFnStart(); - NSDebugMLog(@"selfLockn=%d",selfLockn); - TmpLockBeforeDate(selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); + NSDebugMLog(@"selfLockn=%d",_selfLockn); + TmpLockBeforeDate(_selfLock,[NSDate dateWithTimeIntervalSinceNow:GSLOCK_DELAY_S]); #ifndef NDEBUG - selfLockn++; + _selfLockn++; #endif - NSDebugMLog(@"selfLockn=%d",selfLockn); + NSDebugMLog(@"selfLockn=%d",_selfLockn); LOGObjectFnStop(); }; @@ -107,14 +113,14 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return sessionMovingAverageSampleCount; + return _sessionMovingAverageSampleCount; }; //-------------------------------------------------------------------- --(void)setSessionMovingAverageSampleSize:(int)size_ +-(void)setSessionMovingAverageSampleSize:(int)aSize { LOGObjectFnStart(); - sessionMovingAverageSampleCount=size_; + _sessionMovingAverageSampleCount=aSize; LOGObjectFnStop(); }; @@ -123,14 +129,14 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return transactionMovingAverageSampleCount; + return _transactionMovingAverageSampleCount; }; //-------------------------------------------------------------------- --(void)setTransactionMovingAverageSampleSize:(int)size_ +-(void)setTransactionMovingAverageSampleSize:(int)aSize { LOGObjectFnStart(); - transactionMovingAverageSampleCount=size_; + _transactionMovingAverageSampleCount=aSize; LOGObjectFnStop(); }; @@ -146,198 +152,204 @@ static char rcsId[] = "$Id$"; LOGObjectFnStart(); [self lock]; NS_DURING - { - LOGObjectFnNotImplemented(); //TODOFN - } + { + LOGObjectFnNotImplemented(); //TODOFN + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_updatePathsStatisticsWithPaths:(id)paths_ +-(void)_updatePathsStatisticsWithPaths:(id)paths { //OK LOGObjectFnStart(); [self lock]; NS_DURING - { - [self _purgePathsStatistics]; - LOGObjectFnNotImplemented(); //TODOFN - } + { + [self _purgePathsStatistics]; + LOGObjectFnNotImplemented(); //TODOFN + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_updatePagesStatisticsForPage:(id)page_ - timeInterval:(NSTimeInterval)timeInterval_ +-(void)_updatePagesStatisticsForPage:(id)aPage + timeInterval:(NSTimeInterval)aTimeInterval { //OK - NSMutableDictionary* _pageStats=nil; - NSNumber* _AvgRespTime=nil; - NSNumber* _MinRespTime=nil; - NSNumber* _MaxRespTime=nil; - NSNumber* _Served=nil; - double _AvgRespTimeValue=0; - double _MinRespTimeValue=0; - double _MaxRespTimeValue=0; - int _ServedValue=0; + NSMutableDictionary* pageStats=nil; + NSNumber* AvgRespTime=nil; + NSNumber* MinRespTime=nil; + NSNumber* MaxRespTime=nil; + NSNumber* Served=nil; + double AvgRespTimeValue=0; + double MinRespTimeValue=0; + double MaxRespTimeValue=0; + int ServedValue=0; LOGObjectFnStart(); [self lock]; NS_DURING - { - NSDebugMLog(@"page_=%@",page_); - if (!pagesStatistics) - pagesStatistics=[NSMutableDictionary new]; - else - _pageStats=[pagesStatistics objectForKey:page_]; - NSDebugMLog(@"pagesStatistics=%@",pagesStatistics); - NSDebugMLog(@"_pageStats=%@",_pageStats); - if (_pageStats) - { - _AvgRespTime=[_pageStats objectForKey:@"Avg Resp. Time"]; - _MinRespTime=[_pageStats objectForKey:@"Min Resp. Time"]; - _MaxRespTime=[_pageStats objectForKey:@"Max Resp. Time"]; - _Served=[_pageStats objectForKey:@"Served"]; + { + NSDebugMLog(@"aPage=%@",aPage); + if (!_pagesStatistics) + _pagesStatistics=[NSMutableDictionary new]; + else + pageStats=[_pagesStatistics objectForKey:aPage]; + NSDebugMLog(@"pagesStatistics=%@",_pagesStatistics); + NSDebugMLog(@"pageStats=%@",pageStats); + if (pageStats) + { + AvgRespTime=[pageStats objectForKey:@"Avg Resp. Time"]; + MinRespTime=[pageStats objectForKey:@"Min Resp. Time"]; + MaxRespTime=[pageStats objectForKey:@"Max Resp. Time"]; + Served=[pageStats objectForKey:@"Served"]; - _ServedValue=[_Served intValue]; - if (_MinRespTime) - { - _MinRespTimeValue=[_MinRespTime doubleValue]; - _MinRespTimeValue=min(_MinRespTimeValue,timeInterval_); - } - else - _MinRespTimeValue=timeInterval_; - if (_MaxRespTime) - { - _MaxRespTimeValue=[_MaxRespTime doubleValue]; - _MaxRespTimeValue=max(_MaxRespTimeValue,timeInterval_); - } - else - _MaxRespTimeValue=timeInterval_; - if (_AvgRespTime) - { - _AvgRespTimeValue=[_AvgRespTime doubleValue]; - _AvgRespTimeValue=((_AvgRespTimeValue*_ServedValue)+timeInterval_)/(_ServedValue+1); - } - else - _AvgRespTimeValue=timeInterval_; - _Served++; - } - else - { - _pageStats=[NSMutableDictionary dictionary]; - [pagesStatistics setObject:_pageStats - forKey:page_]; - _AvgRespTimeValue=timeInterval_; - _MinRespTimeValue=timeInterval_; - _MaxRespTimeValue=timeInterval_; - _ServedValue=1; - }; - _AvgRespTime=[NSNumber numberWithDouble:_AvgRespTimeValue]; - _MinRespTime=[NSNumber numberWithDouble:_MinRespTimeValue]; - _MaxRespTime=[NSNumber numberWithDouble:_MaxRespTimeValue]; - _Served=[NSNumber numberWithInt:_ServedValue]; - NSDebugMLog(@"_AvgRespTime=%@",_AvgRespTime); - NSDebugMLog(@"_MinRespTime=%@",_MinRespTime); - NSDebugMLog(@"_MaxRespTime=%@",_MaxRespTime); - NSDebugMLog(@"_Served=%@",_Served); - [_pageStats setObject:_AvgRespTime - forKey:@"Avg Resp. Time"]; - [_pageStats setObject:_MinRespTime - forKey:@"Min Resp. Time"]; - [_pageStats setObject:_MaxRespTime - forKey:@"Max Resp. Time"]; - [_pageStats setObject:_Served - forKey:@"Served"]; - } + ServedValue=[Served intValue]; + if (MinRespTime) + { + MinRespTimeValue=[MinRespTime doubleValue]; + MinRespTimeValue=min(MinRespTimeValue,aTimeInterval); + } + else + MinRespTimeValue=aTimeInterval; + if (MaxRespTime) + { + MaxRespTimeValue=[MaxRespTime doubleValue]; + MaxRespTimeValue=max(MaxRespTimeValue,aTimeInterval); + } + else + MaxRespTimeValue=aTimeInterval; + if (AvgRespTime) + { + AvgRespTimeValue=[AvgRespTime doubleValue]; + AvgRespTimeValue=((AvgRespTimeValue*ServedValue)+aTimeInterval)/(ServedValue+1); + } + else + AvgRespTimeValue=aTimeInterval; + Served++; + } + else + { + pageStats=[NSMutableDictionary dictionary]; + [_pagesStatistics setObject:pageStats + forKey:aPage]; + AvgRespTimeValue=aTimeInterval; + MinRespTimeValue=aTimeInterval; + MaxRespTimeValue=aTimeInterval; + ServedValue=1; + }; + AvgRespTime=[NSNumber numberWithDouble:AvgRespTimeValue]; + MinRespTime=[NSNumber numberWithDouble:MinRespTimeValue]; + MaxRespTime=[NSNumber numberWithDouble:MaxRespTimeValue]; + Served=[NSNumber numberWithInt:ServedValue]; + NSDebugMLog(@"AvgRespTime=%@",AvgRespTime); + NSDebugMLog(@"MinRespTime=%@",MinRespTime); + NSDebugMLog(@"MaxRespTime=%@",MaxRespTime); + NSDebugMLog(@"Served=%@",Served); + [pageStats setObject:AvgRespTime + forKey:@"Avg Resp. Time"]; + [pageStats setObject:MinRespTime + forKey:@"Min Resp. Time"]; + [pageStats setObject:MaxRespTime + forKey:@"Max Resp. Time"]; + [pageStats setObject:Served + forKey:@"Served"]; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_updateDAStatisticsForActionNamed:(id)name_ - timeInterval:(NSTimeInterval)timeInterval_ +-(void)_updateDAStatisticsForActionNamed:(id)aName + timeInterval:(NSTimeInterval)aTimeInterval { LOGObjectFnNotImplemented(); //TODOFN }; //-------------------------------------------------------------------- --(void)_sessionTerminating:(id)session_ +-(void)_sessionTerminating:(id)aSession { //OK LOGObjectFnStart(); [self lock]; NS_DURING - { - int _activeSessionsCount=[GSWApp _activeSessionsCount]; - NSArray* _statistics=[session_ statistics]; - NSDate* _sessionBirthDate=nil; - NSTimeInterval _sessionTimeOut=0; - int _sessionRequestCounter=0; - [self _updatePathsStatisticsWithPaths:_statistics]; - _sessionBirthDate=[session_ _birthDate]; - _sessionTimeOut=[session_ timeOut]; - _sessionRequestCounter=[session_ _requestCounter]; - //TODOFN - } + { + int activeSessionsCount=[GSWApp _activeSessionsCount]; + NSArray* statistics=[aSession statistics]; + NSDate* sessionBirthDate=nil; + NSTimeInterval sessionTimeOut=0; + int sessionRequestCounter=0; + [self _updatePathsStatisticsWithPaths:statistics]; + sessionBirthDate=[aSession _birthDate]; + sessionTimeOut=[aSession timeOut]; + sessionRequestCounter=[aSession _requestCounter]; + //TODOFN + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_applicationCreatedSession:(GSWSession*)session_ +-(void)_applicationCreatedSession:(GSWSession*)aSession { //OK - int _activeSessionsCount=0; + int activeSessionsCount=0; LOGObjectFnStart(); [self lock]; NS_DURING - { - _activeSessionsCount=[[GSWApplication application] _activeSessionsCount]; - ASSIGN(maxActiveSessionsDate,[NSDate date]); - maxActiveSessionsCount=max(_activeSessionsCount,maxActiveSessionsCount); - sessionsCount++; //ou _activeSessionsCount - } + { + activeSessionsCount=[[GSWApplication application] _activeSessionsCount]; + ASSIGN(_maxActiveSessionsDate,[NSDate date]); + _maxActiveSessionsCount=max(activeSessionsCount,_maxActiveSessionsCount); + _sessionsCount++; //ou activeSessionsCount + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -347,31 +359,33 @@ static char rcsId[] = "$Id$"; -(void)_applicationDidHandleComponentActionRequest { //OK - double _timeInterval=0; + double timeInterval=0; LOGObjectFnStart(); [self lock]; NS_DURING - { - _timeInterval=[self _applicationDidHandleRequest]; - NSDebugMLog(@"currentPage=%@",currentPage); - if (currentPage)//TODO no current page if no session (error page,...) - [self _updatePagesStatisticsForPage:currentPage - timeInterval:_timeInterval]; - } + { + timeInterval=[self _applicationDidHandleRequest]; + NSDebugMLog(@"currentPage=%@",_currentPage); + if (_currentPage)//TODO no current page if no session (error page,...) + [self _updatePagesStatisticsForPage:_currentPage + timeInterval:timeInterval]; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(void)_applicationDidHandleDirectActionRequestWithActionNamed:(id)name_ +-(void)_applicationDidHandleDirectActionRequestWithActionNamed:(id)aName { LOGObjectFnNotImplemented(); //TODOFN }; @@ -381,11 +395,11 @@ static char rcsId[] = "$Id$"; { //OK LOGObjectFnNotImplemented(); //TODOFN - //lastDidHandleRequestTimeInterval=115.005370 (ancien=53.516954) - //totalTransactionTimeInterval=double DOUBLE:61.488416 (ancien=0) - //movingTransactionTimeInterval=double DOUBLE:61.488416 (ancien=0) + //_lastDidHandleRequestTimeInterval=115.005370 (ancien=53.516954) + //_totalTransactionTimeInterval=double DOUBLE:61.488416 (ancien=0) + //_movingTransactionTimeInterval=double DOUBLE:61.488416 (ancien=0) - return movingTransactionTimeInterval; //??? 61.488416: ou _totalTransactionTimeInterval - precedent + return _movingTransactionTimeInterval; //??? 61.488416: ou _totalTransactionTimeInterval - precedent }; //-------------------------------------------------------------------- @@ -395,17 +409,19 @@ static char rcsId[] = "$Id$"; LOGObjectFnStart(); [self lock]; NS_DURING - { - directActionTransactionsCount++; - [self _applicationWillHandleRequest]; - } + { + _directActionTransactionsCount++; + [self _applicationWillHandleRequest]; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -418,17 +434,19 @@ static char rcsId[] = "$Id$"; LOGObjectFnStart(); [self lock]; NS_DURING - { - componentActionTransactionsCount++; - [self _applicationWillHandleRequest]; - } + { + _componentActionTransactionsCount++; + [self _applicationWillHandleRequest]; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -439,13 +457,13 @@ static char rcsId[] = "$Id$"; { //OK LOGObjectFnNotImplemented(); //TODOFN - transactionsCount++; + _transactionsCount++; /* lastWillHandleRequestTimeInterval=double DOUBLE:53.516954 [RC=4294967295] totalIdleTimeInterval=double DOUBLE:53.516954 [RC=4294967295] movingIdleTimeInterval=double DOUBLE:53.516954 [RC=4294967295] */ - movingAverageTransactionsCount++; + _movingAverageTransactionsCount++; }; @end @@ -454,59 +472,63 @@ static char rcsId[] = "$Id$"; @implementation GSWStatisticsStore (GSWStatisticsStoreB) //-------------------------------------------------------------------- --(NSString*)descriptionForResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(NSString*)descriptionForResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { //OK - GSWComponent* _page=nil; - NSString* _description=nil; + GSWComponent* page=nil; + NSString* description=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { - _page=[context_ page]; - _description=[_page descriptionForResponse:response_ - inContext:context_]; - } + { + page=[aContext page]; + description=[page descriptionForResponse:aResponse + inContext:aContext]; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _description; + return description; }; //-------------------------------------------------------------------- --(void)recordStatisticsForResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(void)recordStatisticsForResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { //OK - GSWComponent* _page=nil; - NSString* _pageName=nil; + GSWComponent* page=nil; + NSString* pageName=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { - _page=[context_ page]; - NSDebugMLog(@"_page=%@",_page); - _pageName=[_page name]; - NSDebugMLog(@"_pageName=%@",_pageName); - ASSIGN(currentPage,_pageName); - NSDebugMLog(@"currentPage=%@",currentPage); - [self _memoryUsage];//TODO Delete because it's Just for Test ! - } + { + page=[aContext page]; + NSDebugMLog(@"page=%@",page); + pageName=[page name]; + NSDebugMLog(@"pageName=%@",pageName); + ASSIGN(_currentPage,pageName); + NSDebugMLog(@"_currentPage=%@",_currentPage); + [self _memoryUsage];//TODO Delete because it's Just for Test ! + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); @@ -518,7 +540,7 @@ static char rcsId[] = "$Id$"; @implementation GSWStatisticsStore (GSWStatisticsStoreC) //-------------------------------------------------------------------- --(void)logString:(id)string_ +-(void)logString:(id)aString { LOGObjectFnNotImplemented(); //TODOFN }; @@ -528,47 +550,49 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return logRotation; + return _logRotation; }; //-------------------------------------------------------------------- -(NSString*)logFile { //OK - NSString* _logFile=nil; + NSString* logFile=nil; LOGObjectFnStart(); [self lock]; NS_DURING - { - _logFile=logPath; - } + { + logFile=_logPath; + } NS_HANDLER - { - NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]",localException,[localException reason],__FILE__,__LINE__); - //TODO - [self unlock]; - [localException raise]; - } + { + NSDebugMLog(@"EXCEPTION:%@ (%@) [%s %d]", + localException,[localException reason], + __FILE__,__LINE__); + //TODO + [self unlock]; + [localException raise]; + } NS_ENDHANDLER; [self unlock]; LOGObjectFnStop(); - return _logFile; + return logFile; }; //-------------------------------------------------------------------- --(void) setLogFile:(id)logFile_ - rotationFrequencyInDays:(double)rotationFrequency +-(void) setLogFile:(id)logFile + rotationFrequencyInDays:(double)rotationFrequency { LOGObjectFnStart(); - ASSIGN(logPath,logFile_); - logRotation=rotationFrequency; + ASSIGN(_logPath,logFile); + _logRotation=rotationFrequency; LOGObjectFnStop(); }; //-------------------------------------------------------------------- --(id)formatDescription:(id)description_ - forResponse:(GSWResponse*)response_ - inContext:(GSWContext*)context_ +-(id)formatDescription:(id)description + forResponse:(GSWResponse*)aResponse + inContext:(GSWContext*)aContext { LOGObjectFnNotImplemented(); //TODOFN return nil; @@ -584,7 +608,7 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return password; + return _password; }; //-------------------------------------------------------------------- @@ -592,7 +616,7 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return pathsStatistics; + return _pathsStatistics; }; //-------------------------------------------------------------------- @@ -600,7 +624,7 @@ static char rcsId[] = "$Id$"; { LOGObjectFnStart(); LOGObjectFnStop(); - return pagesStatistics; + return _pagesStatistics; }; //-------------------------------------------------------------------- @@ -613,49 +637,49 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(NSDictionary*)_memoryUsage { - struct rusage _rusage; + struct rusage rusageStruct; int i=0; LOGObjectFnStart(); //Use NSRealMemoryAvailable ?? for(i=0;i<2;i++) - { - memset(&_rusage,0,sizeof(_rusage)); - if (getrusage(i>0 ? RUSAGE_CHILDREN : RUSAGE_SELF,&_rusage)!=0) - { - LOGError(@"getrusage faled %d",errno); - } - else - { - NSTimeInterval _userTime=NSTimeIntervalFromTimeVal(&_rusage.ru_utime); - NSTimeInterval _systemTime=NSTimeIntervalFromTimeVal(&_rusage.ru_stime); - NSDebugMLog(@"_userTime=%ld",(long)_userTime); - NSDebugMLog(@"_systemTime=%ld",(long)_systemTime); - NSDebugMLog(@"ru_maxrss=%ld",_rusage.ru_maxrss); /* maximum resident set size */ - NSDebugMLog(@"ru_ixrss=%ld",_rusage.ru_ixrss); /* integral shared memory size */ - NSDebugMLog(@"ru_idrss=%ld",_rusage.ru_idrss); /* integral unshared data size */ - NSDebugMLog(@"ru_isrss=%ld",_rusage.ru_isrss); /* integral unshared stack size */ - NSDebugMLog(@"ru_minflt=%ld",_rusage.ru_minflt); /* page reclaims */ - NSDebugMLog(@"ru_minflt bytes=%ld",_rusage.ru_minflt*getpagesize()); /* page reclaims */ - NSDebugMLog(@"ru_majflt=%ld",_rusage.ru_majflt); /* page faults */ - NSDebugMLog(@"ru_majflt bytes=%ld",_rusage.ru_majflt*getpagesize()); /* page faults */ - NSDebugMLog(@"ru_nswap=%ld",_rusage.ru_nswap); /* swaps */ - NSDebugMLog(@"ru_inblock=%ld",_rusage.ru_inblock); /* block input operations */ - NSDebugMLog(@"ru_oublock=%ld",_rusage.ru_oublock); /* block output operations */ - NSDebugMLog(@"ru_msgsnd=%ld",_rusage.ru_msgsnd); /* messages sent */ - NSDebugMLog(@"ru_msgrcv=%ld",_rusage.ru_msgrcv); /* messages received */ - NSDebugMLog(@"ru_nsignals=%ld",_rusage.ru_nsignals); /* signals received */ - NSDebugMLog(@"ru_nvcsw=%ld",_rusage.ru_nvcsw); /* voluntary context switches */ - NSDebugMLog(@"ru_nivcsw=%ld",_rusage.ru_nivcsw); /* involuntary context switches */ - }; - }; + { + memset(&rusageStruct,0,sizeof(rusageStruct)); + if (getrusage(i>0 ? RUSAGE_CHILDREN : RUSAGE_SELF,&rusageStruct)!=0) + { + LOGError(@"getrusage faled %d",errno); + } + else + { + NSTimeInterval userTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_utime); + NSTimeInterval systemTime=NSTimeIntervalFromTimeVal(&rusageStruct.ru_stime); + NSDebugMLog(@"userTime=%ld",(long)userTime); + NSDebugMLog(@"systemTime=%ld",(long)systemTime); + NSDebugMLog(@"ru_maxrss=%ld",rusageStruct.ru_maxrss); /* maximum resident set size */ + NSDebugMLog(@"ru_ixrss=%ld",rusageStruct.ru_ixrss); /* integral shared memory size */ + NSDebugMLog(@"ru_idrss=%ld",rusageStruct.ru_idrss); /* integral unshared data size */ + NSDebugMLog(@"ru_isrss=%ld",rusageStruct.ru_isrss); /* integral unshared stack size */ + NSDebugMLog(@"ru_minflt=%ld",rusageStruct.ru_minflt); /* page reclaims */ + NSDebugMLog(@"ru_minflt bytes=%ld",rusageStruct.ru_minflt*getpagesize()); /* page reclaims */ + NSDebugMLog(@"ru_majflt=%ld",rusageStruct.ru_majflt); /* page faults */ + NSDebugMLog(@"ru_majflt bytes=%ld",rusageStruct.ru_majflt*getpagesize()); /* page faults */ + NSDebugMLog(@"ru_nswap=%ld",rusageStruct.ru_nswap); /* swaps */ + NSDebugMLog(@"ru_inblock=%ld",rusageStruct.ru_inblock); /* block input operations */ + NSDebugMLog(@"ru_oublock=%ld",rusageStruct.ru_oublock); /* block output operations */ + NSDebugMLog(@"ru_msgsnd=%ld",rusageStruct.ru_msgsnd); /* messages sent */ + NSDebugMLog(@"ru_msgrcv=%ld",rusageStruct.ru_msgrcv); /* messages received */ + NSDebugMLog(@"ru_nsignals=%ld",rusageStruct.ru_nsignals); /* signals received */ + NSDebugMLog(@"ru_nvcsw=%ld",rusageStruct.ru_nvcsw); /* voluntary context switches */ + NSDebugMLog(@"ru_nivcsw=%ld",rusageStruct.ru_nivcsw); /* involuntary context switches */ + }; + }; { - proc_t P; - memset(&P,0,sizeof(proc_t)); - pidstat(getpid(),&P); - pidstatm(getpid(),&P); + proc_t P; + memset(&P,0,sizeof(proc_t)); + pidstat(getpid(),&P); + pidstatm(getpid(),&P); }; NSDebugMLog(@"ProcInfo:%@",[GSWProcFSProcInfo filledProcInfo]); - + //{Committed = 14184448; Reserved = 19025920; } /* sysinfo(struct sysinfo *info); @@ -699,7 +723,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return movingAverageSessionLife; + return _movingAverageSessionLife; }; //-------------------------------------------------------------------- @@ -707,7 +731,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return averageSessionLife; + return _averageSessionLife; }; //-------------------------------------------------------------------- @@ -715,7 +739,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return movingAverageRequestsPerSession; + return _movingAverageRequestsPerSession; }; //-------------------------------------------------------------------- @@ -723,7 +747,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return averageRequestsPerSession; + return _averageRequestsPerSession; }; //-------------------------------------------------------------------- @@ -731,7 +755,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return maxActiveSessionsDate; + return _maxActiveSessionsDate; }; //-------------------------------------------------------------------- @@ -739,7 +763,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return maxActiveSessionsCount; + return _maxActiveSessionsCount; }; //-------------------------------------------------------------------- @@ -747,61 +771,61 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return sessionsCount; + return _sessionsCount; }; //-------------------------------------------------------------------- -(double)_movingAverageTransactionTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return movingTransactionTimeInterval/movingAverageTransactionsCount; //? + return _movingTransactionTimeInterval/_movingAverageTransactionsCount; //? }; //-------------------------------------------------------------------- -(double)_movingAverageIdleTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return movingIdleTimeInterval/movingAverageTransactionsCount;//?? + return _movingIdleTimeInterval/_movingAverageTransactionsCount;//?? }; //-------------------------------------------------------------------- -(double)_averageCATransactionTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return totalCATransactionTimeInterval/movingAverageTransactionsCount; //?? + return _totalCATransactionTimeInterval/_movingAverageTransactionsCount; //?? }; //-------------------------------------------------------------------- -(double)_averageDATransactionTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return totalDATransactionTimeInterval/movingAverageTransactionsCount; //?? + return _totalDATransactionTimeInterval/_movingAverageTransactionsCount; //?? }; //-------------------------------------------------------------------- -(double)_averageTransactionTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return totalTransactionTimeInterval/movingAverageTransactionsCount; //? + return _totalTransactionTimeInterval/_movingAverageTransactionsCount; //? }; //-------------------------------------------------------------------- -(double)_averageIdleTime { LOGObjectFnStart(); - NSAssert(movingAverageTransactionsCount,@"movingAverageTransactionsCount==0"); + NSAssert(_movingAverageTransactionsCount!=0,@"movingAverageTransactionsCount==0"); LOGObjectFnStop(); - return totalIdleTimeInterval/movingAverageTransactionsCount;//?? + return _totalIdleTimeInterval/_movingAverageTransactionsCount;//?? }; //-------------------------------------------------------------------- @@ -809,7 +833,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return directActionTransactionsCount; + return _directActionTransactionsCount; }; //-------------------------------------------------------------------- @@ -817,7 +841,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return componentActionTransactionsCount; + return _componentActionTransactionsCount; }; //-------------------------------------------------------------------- @@ -825,7 +849,7 @@ s { LOGObjectFnStart(); LOGObjectFnStop(); - return transactionsCount; + return _transactionsCount; }; @end @@ -834,18 +858,18 @@ s @implementation GSWStatisticsStore (GSWStatisticsStoreE) //-------------------------------------------------------------------- --(BOOL)validateLogin:(id)login_ - forSession:(id)session_ +-(BOOL)validateLogin:(id)aLogin + forSession:(id)aSession { LOGObjectFnNotImplemented(); //TODOFN return NO; }; //-------------------------------------------------------------------- --(void)setPassword:(NSString*)password_ +-(void)setPassword:(NSString*)aPassword { LOGObjectFnStart(); - ASSIGN(password,password_); + ASSIGN(_password,aPassword); LOGObjectFnStop(); }; @@ -854,7 +878,7 @@ s //==================================================================== @implementation GSWStatisticsStore (GSWStatisticsStoreF) //-------------------------------------------------------------------- --(BOOL)validateLogin:(id)login_ +-(BOOL)validateLogin:(id)aLogin { LOGObjectFnNotImplemented(); //TODOFN return NO; @@ -876,7 +900,7 @@ s @implementation GSWStatisticsStore (GSWStatisticsStoreH) //-------------------------------------------------------------------- -+(id)timeIntervalDescription:(double)timeInterval_ ++(id)timeIntervalDescription:(double)aTimeInterval { LOGClassFnNotImplemented(); //TODOFN return nil; diff --git a/GSWeb.framework/GSWStats.h b/GSWeb.framework/GSWStats.h index 43d0df9..8ac3f3f 100644 --- a/GSWeb.framework/GSWStats.h +++ b/GSWeb.framework/GSWStats.h @@ -1,11 +1,16 @@ -/* GSWStats.h - GSWeb: Class GSWStats - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWStats.h - GSWeb: Class GSWStats + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ diff --git a/GSWeb.framework/GSWStats.m b/GSWeb.framework/GSWStats.m index d47e8e8..1924f97 100644 --- a/GSWeb.framework/GSWStats.m +++ b/GSWeb.framework/GSWStats.m @@ -1,11 +1,16 @@ -/* GSWStats.m - GSWeb: Class GSWStats - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWStats.m - GSWeb: Class GSWStats + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -29,8 +35,8 @@ static char rcsId[] = "$Id$"; @implementation GSWStats -(id)defaultAction { - GSWComponent* _component=[self pageWithName:@"GSWStatsPage"]; - return _component; + GSWComponent* component=[self pageWithName:@"GSWStatsPage"]; + return component; }; @end diff --git a/GSWeb.framework/GSWTemplateParser.h b/GSWeb.framework/GSWTemplateParser.h index cd654e0..b0300ab 100644 --- a/GSWeb.framework/GSWTemplateParser.h +++ b/GSWeb.framework/GSWTemplateParser.h @@ -1,11 +1,16 @@ -/* GSWTemplateParser.h - GSWeb: Class GSWTemplateParser - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWTemplateParser - GSWeb: Class GSWTemplateParser + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -43,53 +49,53 @@ int tagN; } -+(GSWElement*)templateNamed:(NSString*)name_ - inFrameworkNamed:(NSString*)frameworkName_ ++(GSWElement*)templateNamed:(NSString*)aName + inFrameworkNamed:(NSString*)aFrameworkName withParserClassName:(NSString*)parserClassName withString:(NSString*)HTMLString encoding:(NSStringEncoding)encoding fromPath:(NSString*)HTMLPath definitionsString:(NSString*)pageDefString - languages:(NSArray*)languages_ - definitionPath:(NSString*)definitionPath_; -+(GSWElement*)templateNamed:(NSString*)name_ - inFrameworkNamed:(NSString*)frameworkName_ + languages:(NSArray*)someLanguages + definitionPath:(NSString*)aDefinitionPath; ++(GSWElement*)templateNamed:(NSString*)aName + inFrameworkNamed:(NSString*)aFrameworkName withParserClass:(Class)parserClass withString:(NSString*)HTMLString encoding:(NSStringEncoding)encoding fromPath:(NSString*)HTMLPath definitionsString:(NSString*)pageDefString - languages:(NSArray*)languages_ - definitionPath:(NSString*)definitionPath_; + languages:(NSArray*)someLanguages + definitionPath:(NSString*)aDefinitionPath; +(void)setDefaultParserClassName:(NSString*)parserClassName; +(NSString*)defaultParserClassName; +(Class)defaultParserClass; --(id)initWithTemplateName:(NSString*)name_ - inFrameworkName:(NSString*)frameworkName_ +-(id)initWithTemplateName:(NSString*)aName + inFrameworkName:(NSString*)aFrameworkName withString:(NSString*)HTMLString - encoding:(NSStringEncoding)encoding_ + encoding:(NSStringEncoding)anEncoding fromPath:(NSString*)HTMLPath withDefinitionsString:(NSString*)pageDefString - fromPath:(NSString*)definitionPath_ - forLanguages:(NSArray*)languages_; + fromPath:(NSString*)aDefinitionPath + forLanguages:(NSArray*)someLanguages; -(void)dealloc; -(NSString*)logPrefix; -(GSWElement*)template; -(NSArray*)templateElements; -(NSDictionary*)definitions; --(NSDictionary*)parseDefinitionsString:(NSString*)localDefinitionstring_ - named:(NSString*)localDefinitionName_ - inFrameworkNamed:(NSString*)localFrameworkName_ +-(NSDictionary*)parseDefinitionsString:(NSString*)localDefinitionstring + named:(NSString*)localDefinitionName + inFrameworkNamed:(NSString*)localFrameworkName processedFiles:(NSMutableSet*)processedFiles; --(NSDictionary*)parseDefinitionInclude:(NSString*)includeName_ - fromFrameworkNamed:(NSString*)fromFrameworkName_ +-(NSDictionary*)parseDefinitionInclude:(NSString*)includeName + fromFrameworkNamed:(NSString*)fromFrameworkName processedFiles:(NSMutableSet*)processedFiles; --(NSDictionary*)processIncludes:(NSArray*)definitionsIncludes_ - named:(NSString*)localDefinitionsName_ - inFrameworkNamed:(NSString*)localFrameworkName_ +-(NSDictionary*)processIncludes:(NSArray*)definitionsIncludes + named:(NSString*)localDefinitionsName + inFrameworkNamed:(NSString*)localFrameworkName processedFiles:(NSMutableSet*)processedFiles; @end diff --git a/GSWeb.framework/GSWTemplateParser.m b/GSWeb.framework/GSWTemplateParser.m index 67cebb8..4178fa4 100644 --- a/GSWeb.framework/GSWTemplateParser.m +++ b/GSWeb.framework/GSWTemplateParser.m @@ -2,8 +2,8 @@ Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Mar 1999 + Written by: Manuel Guesdon + Date: Mar 1999 $Revision$ $Date$ @@ -72,67 +72,67 @@ Class GSWTemplateParser_DefaultParserClass=Nil; }; //-------------------------------------------------------------------- -+(GSWElement*)templateNamed:(NSString*)name_ - inFrameworkNamed:(NSString*)frameworkName_ ++(GSWElement*)templateNamed:(NSString*)aName + inFrameworkNamed:(NSString*)aFrameworkName withParserClassName:(NSString*)parserClassName withString:(NSString*)HTMLString - encoding:(NSStringEncoding)encoding_ + encoding:(NSStringEncoding)anEncoding fromPath:(NSString*)HTMLPath definitionsString:(NSString*)pageDefString - languages:(NSArray*)languages_ - definitionPath:(NSString*)definitionPath_ + languages:(NSArray*)someLanguages + definitionPath:(NSString*)aDefinitionPath { GSWElement* resultTemplate=nil; Class parserClass=Nil; LOGClassFnStart(); - NSDebugMLLog(@"GSWTemplateParser",@"definitionPath_=%@",definitionPath_); + NSDebugMLLog(@"GSWTemplateParser",@"aDefinitionPath=%@",aDefinitionPath); if (parserClassName) { parserClass=NSClassFromString(parserClassName); NSAssert1(parserClass,@"No Parser class named %@",parserClassName); }; - resultTemplate=[self templateNamed:name_ - inFrameworkNamed:frameworkName_ + resultTemplate=[self templateNamed:aName + inFrameworkNamed:aFrameworkName withParserClass:parserClass withString:HTMLString - encoding:encoding_ + encoding:anEncoding fromPath:HTMLPath definitionsString:pageDefString - languages:languages_ - definitionPath:definitionPath_]; + languages:someLanguages + definitionPath:aDefinitionPath]; LOGClassFnStop(); return resultTemplate; }; //-------------------------------------------------------------------- -+(GSWElement*)templateNamed:(NSString*)name_ - inFrameworkNamed:(NSString*)frameworkName_ ++(GSWElement*)templateNamed:(NSString*)aName + inFrameworkNamed:(NSString*)aFrameworkName withParserClass:(Class)parserClass withString:(NSString*)HTMLString - encoding:(NSStringEncoding)encoding_ + encoding:(NSStringEncoding)anEncoding fromPath:(NSString*)HTMLPath definitionsString:(NSString*)pageDefString - languages:(NSArray*)languages_ - definitionPath:(NSString*)definitionPath_ + languages:(NSArray*)someLanguages + definitionPath:(NSString*)aDefinitionPath { GSWElement* resultTemplate=nil; GSWTemplateParser* templateParser=nil; LOGClassFnStart(); - NSDebugMLLog(@"GSWTemplateParser",@"template named:%@ frameworkName:%@ pageDefString=%@",name_,frameworkName_,pageDefString); - NSDebugMLLog(@"GSWTemplateParser",@"definitionPath_=%@",definitionPath_); + NSDebugMLLog(@"GSWTemplateParser",@"template named:%@ frameworkName:%@ pageDefString=%@",aName,aFrameworkName,pageDefString); + NSDebugMLLog(@"GSWTemplateParser",@"aDefinitionPath=%@",aDefinitionPath); if (!parserClass) { parserClass=[self defaultParserClass]; NSAssert(parserClass,@"No defaultParser Class"); }; - templateParser=[[[parserClass alloc] initWithTemplateName:name_ - inFrameworkName:frameworkName_ + templateParser=[[[parserClass alloc] initWithTemplateName:aName + inFrameworkName:aFrameworkName withString:HTMLString - encoding:encoding_ + encoding:anEncoding fromPath:HTMLPath withDefinitionsString:pageDefString - fromPath:definitionPath_ - forLanguages:languages_] autorelease]; + fromPath:aDefinitionPath + forLanguages:someLanguages] autorelease]; if (templateParser) resultTemplate=[templateParser template]; LOGClassFnStop(); @@ -140,25 +140,25 @@ Class GSWTemplateParser_DefaultParserClass=Nil; }; //-------------------------------------------------------------------- --(id)initWithTemplateName:(NSString*)name_ - inFrameworkName:(NSString*)frameworkName_ +-(id)initWithTemplateName:(NSString*)aName + inFrameworkName:(NSString*)aFrameworkName withString:(NSString*)HTMLString - encoding:(NSStringEncoding)encoding_ + encoding:(NSStringEncoding)anEncoding fromPath:(NSString*)HTMLPath withDefinitionsString:(NSString*)pageDefString - fromPath:(NSString*)definitionPath_ - forLanguages:(NSArray*)languages_ + fromPath:(NSString*)aDefinitionPath + forLanguages:(NSArray*)someLanguages { if ((self=[self init])) { - ASSIGN(_templateName,name_); - ASSIGN(_frameworkName,frameworkName_); + ASSIGN(_templateName,aName); + ASSIGN(_frameworkName,aFrameworkName); ASSIGN(_string,HTMLString); - _stringEncoding=encoding_; + _stringEncoding=anEncoding; ASSIGN(_stringPath,HTMLPath); ASSIGN(_definitionsString,pageDefString); - ASSIGN(_languages,languages_); - ASSIGN(_definitionFilePath,definitionPath_); + ASSIGN(_languages,someLanguages); + ASSIGN(_definitionFilePath,aDefinitionPath); }; return self; }; @@ -210,7 +210,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; NSEnumerator* _enum = [definitionsElements objectEnumerator]; id _obj=nil; NSString* _className=nil; - NSDebugMLLog(@"GSWTemplateParser",@"template named:%@ definitionsElements=%@",name_,definitionsElements); + NSDebugMLLog(@"GSWTemplateParser",@"template named:%@ definitionsElements=%@",aName,definitionsElements); while ((_obj = [_enum nextObject])) { _className=[_obj className]; @@ -300,9 +300,9 @@ Class GSWTemplateParser_DefaultParserClass=Nil; }; //-------------------------------------------------------------------- --(NSDictionary*)parseDefinitionsString:(NSString*)localDefinitionstring_ - named:(NSString*)localDefinitionName_ - inFrameworkNamed:(NSString*)localFrameworkName_ +-(NSDictionary*)parseDefinitionsString:(NSString*)aLocalDefinitionString + named:(NSString*)aLocalDefinitionName + inFrameworkNamed:(NSString*)aLocalFrameworkName processedFiles:(NSMutableSet*)processedFiles { NSDictionary* returnedLocalDefinitions=nil; @@ -316,7 +316,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; GSWPageDefParser* definitionsParser=nil; LOGObjectFnStart(); arpParse=[NSAutoreleasePool new]; - definitionsStream=[[ANTLRTextInputStreamString newWithString:localDefinitionstring_] + definitionsStream=[[ANTLRTextInputStreamString newWithString:aLocalDefinitionString] autorelease]; definitionsLexer=[[[GSWPageDefLexer alloc]initWithTextStream:definitionsStream] autorelease]; @@ -325,8 +325,8 @@ Class GSWTemplateParser_DefaultParserClass=Nil; autorelease]; NSDebugMLLog(@"GSWTemplateParser",@"processedFiles=%@",processedFiles); NSDebugMLLog(@"GSWTemplateParser",@"name:%@ definitionsString=%@", - localDefinitionName_, - localDefinitionstring_); + aLocalDefinitionName, + aLocalDefinitionString); NS_DURING { NSDebugMLLog0(@"low",@"Call definitionsParser"); @@ -339,9 +339,9 @@ Class GSWTemplateParser_DefaultParserClass=Nil; ExceptionRaise(@"GSWTemplateParser", @"%@ Errors in Definitions parsing template named %@: %@\nString:\n%@", [self logPrefix], - localDefinitionName_, + aLocalDefinitionName, [definitionsParser errors], - localDefinitionstring_); + aLocalDefinitionString); }; NSDebugMLLog0(@"low",@"Call [definitionsParser elements]"); tmpDefinitions=[[[definitionsParser elements] mutableCopy] autorelease]; @@ -354,7 +354,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; { LOGError(@"%@ name:%@ Definitions Parse failed!", [self logPrefix], - localDefinitionName_); + aLocalDefinitionName); localException=ExceptionByAddingUserInfoObjectFrameInfo(localException, @"%@ In [definitionsParser document]...", [self logPrefix]); @@ -378,12 +378,12 @@ Class GSWTemplateParser_DefaultParserClass=Nil; if (localDefinitions) { NSDebugMLLog(@"GSWTemplateParser",@"definitionsIncludes:%@\n",definitionsIncludes); - NSDebugMLLog(@"GSWTemplateParser",@"localDefinitionName_:%@\n",localDefinitionName_); - NSDebugMLLog(@"GSWTemplateParser",@"localFrameworkName_:%@\n",localFrameworkName_); + NSDebugMLLog(@"GSWTemplateParser",@"aLocalDefinitionName:%@\n",aLocalDefinitionName); + NSDebugMLLog(@"GSWTemplateParser",@"aLocalFrameworkName:%@\n",aLocalFrameworkName); NSDebugMLLog(@"GSWTemplateParser",@"processedFiles:%@\n",processedFiles); tmpDefinitions=[self processIncludes:definitionsIncludes - named:localDefinitionName_ - inFrameworkNamed:localFrameworkName_ + named:aLocalDefinitionName + inFrameworkNamed:aLocalFrameworkName processedFiles:processedFiles]; NSDebugMLLog(@"GSWTemplateParser",@"tmpDefinitions:%@\n",tmpDefinitions); if (tmpDefinitions) @@ -393,7 +393,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; localDefinitions=nil; LOGError(@"%@ Template name:%@ componentDefinition parse failed for definitionsIncludes:%@", [self logPrefix], - localDefinitionName_, + aLocalDefinitionName, definitionsIncludes); }; NSDebugMLLog(@"GSWTemplateParser",@"localDefinitions:%@\n",localDefinitions); @@ -406,8 +406,8 @@ Class GSWTemplateParser_DefaultParserClass=Nil; }; //-------------------------------------------------------------------- --(NSDictionary*)parseDefinitionInclude:(NSString*)includeName_ - fromFrameworkNamed:(NSString*)fromFrameworkName_ +-(NSDictionary*)parseDefinitionInclude:(NSString*)anIncludeName + fromFrameworkNamed:(NSString*)fromFrameworkName processedFiles:(NSMutableSet*)processedFiles { NSDictionary* returnedLocalDefinitions=nil; @@ -415,99 +415,99 @@ Class GSWTemplateParser_DefaultParserClass=Nil; NSDictionary* tmpDefinitions=nil; NSString* localFrameworkName=nil; NSString* localDefinitionName=nil; - NSString* _language=nil; - NSString* _resourceName=nil; + NSString* language=nil; + NSString* resourceName=nil; NSString* localDefinitionResourceName=nil; - GSWResourceManager* _resourceManager=nil; - NSString* _path=nil; + GSWResourceManager* resourceManager=nil; + NSString* path=nil; int iLanguage=0; int iName=0; LOGObjectFnStart(); - NSDebugMLLog(@"gswcomponents",@"includeName_=%@",includeName_); - _resourceManager=[GSWApp resourceManager]; - localDefinitionName=[includeName_ lastPathComponent]; - localFrameworkName=[includeName_ stringByDeletingLastPathComponent]; + NSDebugMLLog(@"gswcomponents",@"anIncludeName=%@",anIncludeName); + resourceManager=[GSWApp resourceManager]; + localDefinitionName=[anIncludeName lastPathComponent]; + localFrameworkName=[anIncludeName stringByDeletingLastPathComponent]; NSDebugMLLog(@"gswcomponents",@"localFrameworkName=%@",localFrameworkName); - NSDebugMLLog(@"gswcomponents",@"fromFrameworkName_=%@",fromFrameworkName_); + NSDebugMLLog(@"gswcomponents",@"fromFrameworkName=%@",fromFrameworkName); if ([localFrameworkName length]==0) - localFrameworkName=fromFrameworkName_; + localFrameworkName=fromFrameworkName; NSDebugMLLog(@"gswcomponents",@"localFrameworkName=%@",localFrameworkName); - for(iLanguage=0;iLanguage<=[_languages count] && !_path;iLanguage++) + for(iLanguage=0;iLanguage<=[_languages count] && !path;iLanguage++) { if (iLanguage<[_languages count]) - _language=[_languages objectAtIndex:iLanguage]; + language=[_languages objectAtIndex:iLanguage]; else - _language=nil; - for(iName=0;!_path && iName<2;iName++) + language=nil; + for(iName=0;!path && iName<2;iName++) { - _resourceName=[localDefinitionName stringByAppendingString:GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; + resourceName=[localDefinitionName stringByAppendingString:GSWPagePSuffix[GSWebNamingConvForRound(iName)]]; localDefinitionResourceName=[localDefinitionName stringByAppendingString:GSWComponentDefinitionPSuffix[GSWebNamingConvForRound(iName)]]; - NSDebugMLLog(@"gswcomponents",@"_resourceName=%@ localDefinitionResourceName=%@ localDefinitionName=%@", - _resourceName, + NSDebugMLLog(@"gswcomponents",@"resourceName=%@ localDefinitionResourceName=%@ localDefinitionName=%@", + resourceName, localDefinitionResourceName, localDefinitionName); - NSDebugMLLog(@"gswcomponents",@"Search %@ Language=%@",_resourceName,_language); - _path=[_resourceManager pathForResourceNamed:_resourceName + NSDebugMLLog(@"gswcomponents",@"Search %@ Language=%@",resourceName,language); + path=[resourceManager pathForResourceNamed:resourceName inFramework:localFrameworkName - language:_language]; - NSDebugMLLog(@"gswcomponents",@"Search In Page Component: _language=%@ _path=%@ processedFiles=%@", - _language, - _path, + language:language]; + NSDebugMLLog(@"gswcomponents",@"Search In Page Component: language=%@ path=%@ processedFiles=%@", + language, + path, processedFiles); - if (_path) + if (path) { - _path=[_path stringByAppendingPathComponent:localDefinitionResourceName]; - NSDebugMLLog(@"gswcomponents",@"Found %@ Language=%@ : %@",_resourceName,_language,_path); - if ([processedFiles containsObject:_path]) + path=[path stringByAppendingPathComponent:localDefinitionResourceName]; + NSDebugMLLog(@"gswcomponents",@"Found %@ Language=%@ : %@",resourceName,language,path); + if ([processedFiles containsObject:path]) { - NSDebugMLLog(@"gswcomponents",@"path=%@ already processed",_path); - _path=nil; - if (_language) + NSDebugMLLog(@"gswcomponents",@"path=%@ already processed",path); + path=nil; + if (language) iLanguage=[_languages count]-1;//For directly go to no language search so we don't include (for exemple) an English file for a french file }; }; - if (!_path) + if (!path) { - NSDebugMLLog(@"gswcomponents",@"Direct Search %@ Language=%@",localDefinitionResourceName,_language); - _path=[_resourceManager pathForResourceNamed:localDefinitionResourceName + NSDebugMLLog(@"gswcomponents",@"Direct Search %@ Language=%@",localDefinitionResourceName,language); + path=[resourceManager pathForResourceNamed:localDefinitionResourceName inFramework:localFrameworkName - language:_language]; - if (_path) + language:language]; + if (path) { - NSDebugMLLog(@"gswcomponents",@"Direct Found %@ Language=%@ : %@",localDefinitionResourceName,_language,_path); - if ([processedFiles containsObject:_path]) + NSDebugMLLog(@"gswcomponents",@"Direct Found %@ Language=%@ : %@",localDefinitionResourceName,language,path); + if ([processedFiles containsObject:path]) { - NSDebugMLLog(@"gswcomponents",@"path=%@ already processed",_path); - _path=nil; - if (_language) + NSDebugMLLog(@"gswcomponents",@"path=%@ already processed",path); + path=nil; + if (language) iLanguage=[_languages count]-1;//For directly go to no language search so we don't include (for exemple) an English file for a french file }; }; - NSDebugMLLog(@"gswcomponents",@"Direct Search in Component Definition _language=%@ _path=%@ (processedFiles=%@)", - _language, - _path, + NSDebugMLLog(@"gswcomponents",@"Direct Search in Component Definition language=%@ path=%@ (processedFiles=%@)", + language, + path, processedFiles); }; - NSDebugMLLog(@"gswcomponents",@"Search In Page Component: _language=%@ _path=%@ processedFiles=%@", - _language, - _path, + NSDebugMLLog(@"gswcomponents",@"Search In Page Component: language=%@ path=%@ processedFiles=%@", + language, + path, processedFiles); }; }; - if (_path) + if (path) { - NSString* _pageDefString=nil; - NSDebugMLLog(@"GSWTemplateParser",@"_path=%@",_path); - [processedFiles addObject:_path]; + NSString* pageDefString=nil; + NSDebugMLLog(@"GSWTemplateParser",@"path=%@",path); + [processedFiles addObject:path]; //NSString* pageDefPath=[path stringByAppendingString:_definitionPath]; //TODO use encoding ! - _pageDefString=[NSString stringWithContentsOfFile:_path]; - NSDebugMLLog(@"GSWTemplateParser",@"path=%@: _pageDefString:%@\n",_path,_pageDefString); - if (_pageDefString) + pageDefString=[NSString stringWithContentsOfFile:path]; + NSDebugMLLog(@"GSWTemplateParser",@"path=%@: pageDefString:%@\n",path,pageDefString); + if (pageDefString) { - tmpDefinitions=[self parseDefinitionsString:_pageDefString - named:includeName_ + tmpDefinitions=[self parseDefinitionsString:pageDefString + named:anIncludeName inFrameworkNamed:localFrameworkName processedFiles:processedFiles]; NSDebugMLLog(@"GSWTemplateParser",@"tmpDefinitions:%@\n",tmpDefinitions); @@ -517,7 +517,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; { LOGError(@"%@ Template componentDefinition parse failed for included file:%@ in framework:%@ (processedFiles=%@)", [self logPrefix], - includeName_, + anIncludeName, localFrameworkName, processedFiles); }; @@ -528,7 +528,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; ExceptionRaise(@"GSWTemplateParser", @"%@ Can't load included component definition named:%@ in framework:%@ (processedFiles=%@)", [self logPrefix], - includeName_, + anIncludeName, localFrameworkName, processedFiles); }; @@ -538,7 +538,7 @@ Class GSWTemplateParser_DefaultParserClass=Nil; ExceptionRaise(@"GSWTemplateParser", @"%@ Can't find included component definition named:%@ in framework:%@ (processedFiles=%@)", [self logPrefix], - includeName_, + anIncludeName, localFrameworkName, processedFiles); }; @@ -550,45 +550,45 @@ Class GSWTemplateParser_DefaultParserClass=Nil; }; //-------------------------------------------------------------------- --(NSDictionary*)processIncludes:(NSArray*)definitionsIncludes_ - named:(NSString*)localDefinitionsName_ - inFrameworkNamed:(NSString*)localFrameworkName_ +-(NSDictionary*)processIncludes:(NSArray*)someDefinitionsIncludes + named:(NSString*)aLocalDefinitionsName + inFrameworkNamed:(NSString*)aLocalFrameworkName processedFiles:(NSMutableSet*)processedFiles { - int _count=0; + int count=0; NSDictionary* returnedLocalDefinitions=nil; NSMutableDictionary* localDefinitions=nil; LOGObjectFnStart(); - NSDebugMLLog(@"GSWTemplateParser",@"name:%@ frameworkName_=%@ definitionsIncludes_=%@", - localDefinitionsName_, - localFrameworkName_, - definitionsIncludes_); - localDefinitions=[NSMutableDictionary dictionary]; - _count=[definitionsIncludes_ count]; - if (_count>0) + NSDebugMLLog(@"GSWTemplateParser",@"name:%@ aFrameworkName=%@ someDefinitionsIncludes=%@", + aLocalDefinitionsName, + aLocalFrameworkName, + someDefinitionsIncludes); + localDefinitions=(NSMutableDictionary*)[NSMutableDictionary dictionary]; + count=[someDefinitionsIncludes count]; + if (count>0) { NSDictionary* tmpDefinitions=nil; int i=0; - NSString* _includeName=nil; - for(i=_count-1;localDefinitions && i>=0;i--) + NSString* includeName=nil; + for(i=count-1;localDefinitions && i>=0;i--) { - _includeName=[definitionsIncludes_ objectAtIndex:i]; - NSDebugMLLog(@"GSWTemplateParser",@"Template componentDefinition _includeName:%@", - _includeName); - tmpDefinitions=[self parseDefinitionInclude:_includeName - fromFrameworkNamed:localFrameworkName_ + includeName=[someDefinitionsIncludes objectAtIndex:i]; + NSDebugMLLog(@"GSWTemplateParser",@"Template componentDefinition includeName:%@", + includeName); + tmpDefinitions=[self parseDefinitionInclude:includeName + fromFrameworkNamed:aLocalFrameworkName processedFiles:processedFiles]; - NSDebugMLLog(@"GSWTemplateParser",@"Template componentDefinition _includeName:%@ tmpDefinitions=%@", - _includeName, + NSDebugMLLog(@"GSWTemplateParser",@"Template componentDefinition includeName:%@ tmpDefinitions=%@", + includeName, tmpDefinitions); if (tmpDefinitions) [localDefinitions addDefaultEntriesFromDictionary:tmpDefinitions]; else { localDefinitions=nil; - LOGError(@"%@ Template componentDefinition parse failed for _includeName:%@", + LOGError(@"%@ Template componentDefinition parse failed for includeName:%@", [self logPrefix], - _includeName); + includeName); }; }; }; diff --git a/GSWeb.framework/GSWTemplateParserANTLR.h b/GSWeb.framework/GSWTemplateParserANTLR.h index 3e68d03..0568b8f 100644 --- a/GSWeb.framework/GSWTemplateParserANTLR.h +++ b/GSWeb.framework/GSWTemplateParserANTLR.h @@ -1,11 +1,16 @@ -/* GSWTemplateParserANTLR.h - GSWeb: Class GSWTemplateParserANTLR - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWTemplateParserANTLR.h - GSWeb: Class GSWTemplateParserANTLR + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -46,12 +52,12 @@ }; -(void)dealloc; -(NSArray*)templateElements; --(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)_AST - stopOnTagNamed:(NSString*)_stopTagName; +-(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)AST + stopOnTagNamed:(NSString*)stopTagName; --(BOOL)parseTag:(ANTLRDefAST)_AST; --(NSString*)getTagNameFor:(ANTLRDefAST)_AST; --(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)_AST; +-(BOOL)parseTag:(ANTLRDefAST)AST; +-(NSString*)getTagNameFor:(ANTLRDefAST)AST; +-(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)AST; @end #endif //_GSWTemplateParserANTLR_h__ diff --git a/GSWeb.framework/GSWTemplateParserANTLR.m b/GSWeb.framework/GSWTemplateParserANTLR.m index f45395e..16246a2 100644 --- a/GSWeb.framework/GSWTemplateParserANTLR.m +++ b/GSWeb.framework/GSWTemplateParserANTLR.m @@ -1,11 +1,16 @@ -/* GSWTemplateParserANTLR.m - GSWeb: Class GSWTemplateParserANTLR - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Mar 1999 +/** GSWTemplateParserANTLR.h - GSWeb: Class GSWTemplateParserANTLR + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -152,18 +158,18 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(BOOL)parseTag:(ANTLRDefAST)_AST +-(BOOL)parseTag:(ANTLRDefAST)anAST { BOOL htmlAttrParseOK=YES; - NSString* tagName=[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + NSString* tagName=[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack LOGClassFnStart(); if (!tagName - && ([_AST tokenType]==GSWHTMLTokenType_OPENTAG - || [_AST tokenType]==GSWHTMLTokenType_CLOSETAG)) + && ([anAST tokenType]==GSWHTMLTokenType_OPENTAG + || [anAST tokenType]==GSWHTMLTokenType_CLOSETAG)) { NSAutoreleasePool* arpParse=nil; ANTLRTextInputStreamString* _tagStream=[[[ANTLRTextInputStreamString alloc] - initWithString:[_AST text]] + initWithString:[anAST text]] autorelease]; GSWHTMLAttrLexer* htmlAttrLexer=[[[GSWHTMLAttrLexer alloc] initWithTextStream:_tagStream] @@ -173,7 +179,7 @@ static char rcsId[] = "$Id$"; autorelease]; NSString* tagName=nil; NSDictionary* tagAttrs=nil; - NSDebugMLLog(@"low",@"PARSE:[%@]",[_AST text]); + NSDebugMLLog(@"low",@"PARSE:[%@]",[anAST text]); NSDebugMLLog(@"low",@"stream:[%@]",_tagStream); htmlAttrParseOK=NO; arpParse=[NSAutoreleasePool new]; @@ -197,7 +203,7 @@ static char rcsId[] = "$Id$"; NS_HANDLER { htmlAttrParseOK=NO; - LOGError(@"PARSE PB:[%@]",[_AST text]);//TODO + LOGError(@"PARSE PB:[%@]",[anAST text]);//TODO localException=ExceptionByAddingUserInfoObjectFrameInfo0(localException, @"In [_tagParser tag]..."); [localException raise]; @@ -217,7 +223,7 @@ static char rcsId[] = "$Id$"; DESTROY(arpParse); NSDebugMLLog0(@"low",@"DESTROYED(arpParse)\n"); - NSDebugMLLog(@"low",@"END PARSE:[%@]",[_AST text]); + NSDebugMLLog(@"low",@"END PARSE:[%@]",[anAST text]); if (htmlAttrParseOK && tagName) { @@ -227,17 +233,17 @@ static char rcsId[] = "$Id$"; NSDebugMLLog(@"low",@"Add tagName:[%@]", tagName); [_tagsNames setObject:tagName - forKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + forKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack NSDebugMLLog(@"low",@"Verify tagName=%@", - [_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]); //TODO bad hack + [_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]); //TODO bad hack NSDebugMLLog(@"low",@"Add tagsAttrs:[%@]", tagAttrs); if (tagAttrs) { [_tagsAttrs setObject:tagAttrs - forKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + forKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack NSDebugMLLog(@"low",@"Verify tagAttrs=%@", - [_tagsAttrs objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]); //TODO bad hack + [_tagsAttrs objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)anAST]]); //TODO bad hack }; }; }; @@ -246,16 +252,18 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(NSString*)getTagNameFor:(ANTLRDefAST)_AST +-(NSString*)getTagNameFor:(ANTLRDefAST)anAST { - NSString* tagName=[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + NSString* tagName=[_tagsNames objectForKey: + [NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack LOGClassFnStart(); - NSDebugMLLog(@"low",@"[%@]",[_AST text]); + NSDebugMLLog(@"low",@"[%@]",[anAST text]); if (!tagName) { - BOOL htmlAttrParseOK=[self parseTag:_AST]; + BOOL htmlAttrParseOK=[self parseTag:anAST]; if (htmlAttrParseOK) - tagName=[_tagsNames objectForKey:[NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + tagName=[_tagsNames objectForKey: + [NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack }; NSDebugMLLog(@"low",@"tagName:[%@]",tagName); LOGClassFnStop(); @@ -263,18 +271,18 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)_AST +-(NSDictionary*)getTagAttrsFor:(ANTLRDefAST)anAST { NSDictionary* tagAttrs=[_tagsAttrs objectForKey: - [NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + [NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack LOGClassFnStart(); - NSDebugMLLog(@"low",@"[%@]",[_AST text]); + NSDebugMLLog(@"low",@"[%@]",[anAST text]); if (!tagAttrs) { - BOOL htmlAttrParseOK=[self parseTag:_AST]; + BOOL htmlAttrParseOK=[self parseTag:anAST]; if (htmlAttrParseOK) tagAttrs=[_tagsAttrs objectForKey: - [NSNumber numberWithUnsignedLong:(unsigned long)_AST]]; //TODO bad hack + [NSNumber numberWithUnsignedLong:(unsigned long)anAST]]; //TODO bad hack }; NSDebugMLLog(@"low",@"tagAttrs:[%@]",tagAttrs); LOGClassFnStop(); @@ -282,34 +290,34 @@ static char rcsId[] = "$Id$"; }; //-------------------------------------------------------------------- --(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)_AST - stopOnTagNamed:(NSString*)_stopTagName +-(NSArray*)createElementsStartingWithAST:(ANTLRDefAST*)anAST + stopOnTagNamed:(NSString*)stopTagName { - NSMutableArray* _elements=[NSMutableArray array]; - ANTLRDefAST _currentAST=*_AST; + NSMutableArray* elements=[NSMutableArray array]; + ANTLRDefAST currentAST=*anAST; BOOL end=NO; BOOL inHTMLBareString=NO; NSMutableString* htmlBareString=nil; LOGClassFnStart(); - NSDebugMLLog(@"low",@"_stopTagName:[%@]",_stopTagName); - while(_currentAST && !end) + NSDebugMLLog(@"low",@"stopTagName:[%@]",stopTagName); + while(currentAST && !end) { GSWElement* element=nil; NSString* tagName=nil; NSDictionary* tagAttrs=nil; BOOL stopBareString=NO; - NSDebugMLLog(@"low",@"[_currentAST: text=[%@] Type=%d", - [_currentAST text], - [_currentAST tokenType]); + NSDebugMLLog(@"low",@"[currentAST: text=[%@] Type=%d", + [currentAST text], + [currentAST tokenType]); NSDebugMLLog(@"low",@"end=%s inHTMLBareString=%s stopBareString=%s", end ? "YES" : "NO", inHTMLBareString ? "YES" : "NO", stopBareString ? "YES" : "NO"); - if ([_currentAST tokenType]==GSWHTMLTokenType_OPENTAG - || [_currentAST tokenType]==GSWHTMLTokenType_CLOSETAG) + if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG + || [currentAST tokenType]==GSWHTMLTokenType_CLOSETAG) { - tagName=[self getTagNameFor:_currentAST]; + tagName=[self getTagNameFor:currentAST]; NSDebugMLLog(@"low",@"Result tagName:[%@]",tagName); if (!tagName) { @@ -317,11 +325,11 @@ static char rcsId[] = "$Id$"; } else { - NSDebugMLLog(@"low",@"[_currentAST tokenType]=%d",(int)[_currentAST tokenType]); - if ([_currentAST tokenType]==GSWHTMLTokenType_OPENTAG) + NSDebugMLLog(@"low",@"[currentAST tokenType]=%d",(int)[currentAST tokenType]); + if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG) { NSDebugMLLog0(@"low",@"Found Open Tag"); - tagAttrs=[self getTagAttrsFor:_currentAST]; + tagAttrs=[self getTagAttrsFor:currentAST]; NSDebugMLLog(@"low",@"tagAttrs=%@",tagAttrs); if ([tagName caseInsensitiveCompare:GSWTag_Name[GSWNAMES_INDEX]]==NSOrderedSame || [tagName caseInsensitiveCompare:GSWTag_Name[WONAMES_INDEX]]==NSOrderedSame) @@ -336,7 +344,7 @@ static char rcsId[] = "$Id$"; } else { - ANTLRDefAST nextAST=[_currentAST nextSibling]; + ANTLRDefAST nextAST=[currentAST nextSibling]; NSString* name=[tagAttrs objectForKey:@"name"]; NSDebugMLLog0(@"low",@"Process GSWeb Tag"); NSDebugMLLog(@"low",@"GSWeb Tag: name:[%@]", @@ -344,7 +352,7 @@ static char rcsId[] = "$Id$"; if (!name) { LOGError(@"No name for Element:%@", - [_currentAST text]);//TODO + [currentAST text]);//TODO ExceptionRaise(@"GSWTemplateParser", @"GSWTemlateParser: no name for GNUstepWeb tag in template named %@", _templateName); @@ -425,28 +433,28 @@ static char rcsId[] = "$Id$"; _templateName); }; }; - _currentAST=nextAST; + currentAST=nextAST; }; }; } else { - if (_stopTagName - && [tagName caseInsensitiveCompare:_stopTagName]==NSOrderedSame) + if (stopTagName + && [tagName caseInsensitiveCompare:stopTagName]==NSOrderedSame) { - NSDebugMLLog(@"low",@"_stopTagName found: %@",_stopTagName); + NSDebugMLLog(@"low",@"stopTagName found: %@",stopTagName); end=YES; stopBareString=YES; - _currentAST=[_currentAST nextSibling]; + currentAST=[currentAST nextSibling]; }; }; }; } - else if ([_currentAST tokenType]==GSWHTMLTokenType_COMMENT) + else if ([currentAST tokenType]==GSWHTMLTokenType_COMMENT) { stopBareString=YES; - element=[GSWHTMLComment elementWithString:[_currentAST text]]; - _currentAST=[_currentAST nextSibling]; + element=[GSWHTMLComment elementWithString:[currentAST text]]; + currentAST=[currentAST nextSibling]; } NSDebugMLLog(@"low",@"end=%s inHTMLBareString=%s stopBareString=%s", end ? "YES" : "NO", @@ -461,17 +469,17 @@ static char rcsId[] = "$Id$"; inHTMLBareString=YES; htmlBareString=[[NSMutableString new] autorelease]; }; - NSDebugMLLog(@"low",@"inHTMLBareString: adding [%@]",[_currentAST text]); - if ([_currentAST tokenType]==GSWHTMLTokenType_OPENTAG) - [htmlBareString appendFormat:@"<%@>",[_currentAST text]]; - else if ([_currentAST tokenType]==GSWHTMLTokenType_CLOSETAG) - [htmlBareString appendFormat:@"",[_currentAST text]]; + NSDebugMLLog(@"low",@"inHTMLBareString: adding [%@]",[currentAST text]); + if ([currentAST tokenType]==GSWHTMLTokenType_OPENTAG) + [htmlBareString appendFormat:@"<%@>",[currentAST text]]; + else if ([currentAST tokenType]==GSWHTMLTokenType_CLOSETAG) + [htmlBareString appendFormat:@"",[currentAST text]]; else - [htmlBareString appendString:[_currentAST text]]; + [htmlBareString appendString:[currentAST text]]; NSDebugMLLog(@"low",@"htmlBareString: ==> [%@]",htmlBareString); - _currentAST=[_currentAST nextSibling]; + currentAST=[currentAST nextSibling]; }; - if (inHTMLBareString && (stopBareString || !_currentAST)) + if (inHTMLBareString && (stopBareString || !currentAST)) { NSDebugMLLog0(@"low",@"inHTMLBareString && stopBareString"); NSDebugMLLog(@"low",@"CREATE GSWHTMLBareString:\n%@",htmlBareString); @@ -483,17 +491,17 @@ static char rcsId[] = "$Id$"; if (element) { NSDebugMLLog(@"low",@"element to add: element=[%@]",element); - [_elements addObject:element]; + [elements addObject:element]; element=nil; }; NSDebugMLLog(@"low",@"element:%@",element); NSDebugMLLog(@"low",@"inHTMLBareString:%d",(int)inHTMLBareString); NSDebugMLLog(@"low",@"htmlBareString:%@",htmlBareString); }; - *_AST=_currentAST; - NSDebugMLLog(@"low",@"_elements]:%@",_elements); + *anAST=currentAST; + NSDebugMLLog(@"low",@"elements]:%@",elements); LOGClassFnStop(); - return _elements; + return elements; }; @end diff --git a/GSWeb.framework/GSWTemplateParserXML.h b/GSWeb.framework/GSWTemplateParserXML.h index 36b2654..c0e056f 100644 --- a/GSWeb.framework/GSWTemplateParserXML.h +++ b/GSWeb.framework/GSWTemplateParserXML.h @@ -1,11 +1,16 @@ -/* GSWTemplateParserXML.h - GSWeb: Class GSWTemplateParserXML - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** GSWTemplateParserXML.h - GSWeb: Class GSWTemplateParserXML + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Mar 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -47,7 +53,7 @@ +(void)setCachedDTDContent:(NSString*)externalContent forKey:(NSString*)url; +(id)handlerWithTemplateParser:(GSWTemplateParser*)templateParser; --(id)initWithTemplateParser:(GSWTemplateParser*)templateParser_; +-(id)initWithTemplateParser:(GSWTemplateParser*)templateParser; -(id)init; -(xmlParserInputPtr)resolveEntity:(NSString*)publicIdEntity systemID:(NSString*)systemIdEntity; diff --git a/GSWeb.framework/GSWTemplateParserXML.m b/GSWeb.framework/GSWTemplateParserXML.m index 83732d7..dc2ab00 100644 --- a/GSWeb.framework/GSWTemplateParserXML.m +++ b/GSWeb.framework/GSWTemplateParserXML.m @@ -1,8 +1,9 @@ /** GSWTemplateParserXML.m - GSWeb: Class GSWTemplateParserXML + Copyright (C) 1999-2002 Free Software Foundation, Inc. Written by: Manuel Guesdon - Date: Mar 1999 + Date: Mar 1999 $Revision$ $Date$ @@ -121,9 +122,9 @@ static NSMutableDictionary* DTDCache=nil; }; //-------------------------------------------------------------------- -+(id)handlerWithTemplateParser:(GSWTemplateParser*)templateParser_ ++(id)handlerWithTemplateParser:(GSWTemplateParser*)templateParser { - return AUTORELEASE([[self alloc] initWithTemplateParser:templateParser_]); + return AUTORELEASE([[self alloc] initWithTemplateParser:templateParser]); }; extern void externalSubset (void *ctx, @@ -132,11 +133,11 @@ extern void externalSubset (void *ctx, const xmlChar *SystemID); //-------------------------------------------------------------------- --(id)initWithTemplateParser:(GSWTemplateParser*)templateParser_ +-(id)initWithTemplateParser:(GSWTemplateParser*)templateParser { if ((self=[self init])) { - _templateParser=templateParser_; + _templateParser=templateParser; //NSLog(@"my sax lib=%p",lib); if (lib) { diff --git a/GSWeb.framework/GSWUtils.h b/GSWeb.framework/GSWUtils.h index 7fbd35e..39bb94d 100644 --- a/GSWeb.framework/GSWUtils.h +++ b/GSWeb.framework/GSWUtils.h @@ -1,11 +1,16 @@ -/* utils.h - utils - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Jan 1999 +/** GSWUtils.m - GSWeb: Utilities + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,10 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ + +// $Id$ #ifndef _GSWebUtils_h__ #define _GSWebUtils_h__ @@ -95,7 +103,7 @@ void ValidationExceptionRaiseFn0(const char *func, { ValidationExceptionRaiseFn0(__PRETTY_FUNCTION__, __FILE__, __LINE__,name_,message_,format_); } extern BOOL boolValueFor(id id_); -extern BOOL boolValueWithDefaultFor(id id_,BOOL default_); +extern BOOL boolValueWithDefaultFor(id id_,BOOL defaultValue); //extern BOOLNB boolNbFor(BOOL value_); extern BOOL isHeaderKeysEqual(NSString* headerKey,NSString* testKey); extern BOOL SBIsEqual(id id1,id id2); @@ -179,7 +187,7 @@ extern NSData* HexStringToData(NSString* _string); //==================================================================== @interface NSException (NSBuild) +(NSException*)exceptionWithName:(NSString *)name - format:(NSString *)format,...; + format:(NSString *)format,...; @end @@ -198,22 +206,22 @@ extern NSData* HexStringToData(NSString* _string); //==================================================================== @interface NSException (NSExceptionUserInfoAdd) --(NSException*)exceptionByAddingUserInfo:(NSDictionary*)userInfo_; --(NSException*)exceptionByAddingUserInfoKey:(id)key_ - format:(NSString*)format_,...; --(NSException*)exceptionByAddingToUserInfoKey:(id)key_ - format:(NSString*)format_,...; --(NSException*)exceptionByAddingUserInfoFrameInfo:(NSString*)frameInfo_; --(NSException*)exceptionByAddingUserInfoFrameInfoFormat:(NSString*)format_,...; --(NSException*)exceptionByAddingUserInfoFrameInfoObject:(id)obj_ - sel:(SEL)sel_ - file:(const char*)file_ - line:(int)line_ - format:(NSString*)format_,...; --(NSException*)exceptionByAddingUserInfoFrameInfoFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ - format:(NSString*)format_,...; +-(NSException*)exceptionByAddingUserInfo:(NSDictionary*)userInfo; +-(NSException*)exceptionByAddingUserInfoKey:(id)key + format:(NSString*)format,...; +-(NSException*)exceptionByAddingToUserInfoKey:(id)key + format:(NSString*)format,...; +-(NSException*)exceptionByAddingUserInfoFrameInfo:(NSString*)frameInfo; +-(NSException*)exceptionByAddingUserInfoFrameInfoFormat:(NSString*)format,...; +-(NSException*)exceptionByAddingUserInfoFrameInfoObject:(id)obj + sel:(SEL)sel + file:(const char*)file + line:(int)line + format:(NSString*)format,...; +-(NSException*)exceptionByAddingUserInfoFrameInfoFunction:(const char*)fn + file:(const char*)file + line:(int)line + format:(NSString*)format,...; -(BOOL)isValidationException; @end @@ -224,41 +232,41 @@ extern NSData* HexStringToData(NSString* _string); //==================================================================== @interface NSDictionary (SBDictionary) --(id) objectForKey:(id)_key - withDefaultObject:(id)_default; -+(id) dictionaryWithDictionary:(NSDictionary*)dictionary_ - andDefaultEntriesFromDictionary:(NSDictionary*)dictionaryDefaults_; --(id)dictionaryBySettingObject:(id)object_ - forKey:(id)key_; --(id)dictionaryByAddingEntriesFromDictionary:(NSDictionary*)dictionary_; +-(id) objectForKey:(id)key + withDefaultObject:(id)defaultObject; ++(id) dictionaryWithDictionary:(NSDictionary*)dictionary + andDefaultEntriesFromDictionary:(NSDictionary*)dictionaryDefaults; +-(id)dictionaryBySettingObject:(id)object + forKey:(id)key; +-(id)dictionaryByAddingEntriesFromDictionary:(NSDictionary*)dictionary; @end //==================================================================== @interface NSMutableDictionary (SBMutableDictionary) --(void)setDefaultObject:(id)object_ - forKey:(id)key_; --(void)addDefaultEntriesFromDictionary:(NSDictionary*)dictionary_; +-(void)setDefaultObject:(id)object + forKey:(id)key; +-(void)addDefaultEntriesFromDictionary:(NSDictionary*)dictionary; @end //==================================================================== @interface NSMutableOrderedArray: NSMutableArray { - NSMutableArray *array; - SEL compareSelector; + NSMutableArray* _array; + SEL _compareSelector; }; -(id)initWithCompareSelector:(SEL)compareSelector; --(void)addObject:(id)object_; --(void)addObjectsFromArray:(NSArray*)array_; --(void)insertObject:(id)object_ - atIndex:(unsigned int)index_; --(void)replaceObjectAtIndex:(unsigned int)index_ - withObject:(id)object_; --(void)replaceObjectsInRange:(NSRange)range_ - withObjectsFromArray:(NSArray*)array_; --(void)replaceObjectsInRange:(NSRange)range_ - withObjectsFromArray:(NSArray*)array_ - range:(NSRange)arrayRange_; --(void)setArray:(NSArray*)array_; +-(void)addObject:(id)object; +-(void)addObjectsFromArray:(NSArray*)array; +-(void)insertObject:(id)object + atIndex:(unsigned int)index; +-(void)replaceObjectAtIndex:(unsigned int)index + withObject:(id)object; +-(void)replaceObjectsInRange:(NSRange)range + withObjectsFromArray:(NSArray*)array; +-(void)replaceObjectsInRange:(NSRange)range + withObjectsFromArray:(NSArray*)array + range:(NSRange)arrayRange; +-(void)setArray:(NSArray*)array; @end //==================================================================== @@ -274,10 +282,10 @@ extern NSData* HexStringToData(NSString* _string); +(NSString*)className; -(id)performSelectorIfPossible:(SEL)aSelector; -(id)performSelectorIfPossible:(SEL)aSelector - withObject:(id)anObject; + withObject:(id)anObject; -(id)performSelectorIfPossible:(SEL)aSelector - withObject:(id)object1 - withObject:(id)object2; + withObject:(id)object1 + withObject:(id)object2; @end //==================================================================== @@ -286,155 +294,162 @@ extern NSData* HexStringToData(NSString* _string); @end //==================================================================== -#define TmpLock(_lock_) [(_lock_) tmplockFromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] -#define TmpTryLockBeforeDate(_lock_,_limit_) [(_lock_) tmptryLockBeforeDate:(_limit_) fromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] -#define TmpLockBeforeDate(_lock_,_limit_) [(_lock_) tmplockBeforeDate:(_limit_) fromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] -#define TmpUnlock(_lock_) [(_lock_) tmpunlockFromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] +#define TmpLock(_lock_) [(_lock_) tmplockFromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] +#define TmpTryLockBeforeDate(_lock_,_limit_) [(_lock_) tmptryLockBeforeDate:(_limit_) fromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] +#define TmpLockBeforeDate(_lock_,_limit_) [(_lock_) tmplockBeforeDate:(_limit_) fromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] +#define TmpUnlock(_lock_) [(_lock_) tmpunlockFromFunction:__PRETTY_FUNCTION__ file:__FILE__ line:__LINE__] //==================================================================== @interface NSLock (NSLockBD) -(BOOL)isLocked; -(BOOL)tmplock; --(BOOL)tmplockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(BOOL)tmplockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(BOOL)tmptryLock; --(BOOL)tmptryLockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(BOOL)tmptryLockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(BOOL)tmptryLockBeforeDate:(NSDate*)limit; -(BOOL)tmptryLockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(BOOL)tmplockBeforeDate:(NSDate*)limit; -(BOOL)tmplockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(void)tmpunlock; --(void)tmpunlockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(void)tmpunlockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; @end //==================================================================== @interface NSRecursiveLock (NSLockBD) -(BOOL)isLocked; -(BOOL)tmplock; --(BOOL)tmplockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(BOOL)tmplockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(BOOL)tmptryLock; --(BOOL)tmptryLockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(BOOL)tmptryLockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; + -(BOOL)tmptryLockBeforeDate:(NSDate*)limit; -(BOOL)tmptryLockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line; -(BOOL)tmplockBeforeDate:(NSDate*)limit; -(BOOL)tmplockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line; -(void)tmpunlock; --(void)tmpunlockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(void)tmpunlockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; @end //==================================================================== @interface NSArray (NSPerformSelectorWith2Objects) --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_; +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object1 + withObject:(id)object2; + -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector; -(void)makeObjectsPerformIfPossible:(SEL)aSelector; -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument; + withObject:(id)argument; -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument1 - withObject:(id)argument2; + withObject:(id)argument1 + withObject:(id)argument2; -(void)makeObjectsPerformIfPossible:(SEL)aSelector - withObject:(id)argument; + withObject:(id)argument; @end //==================================================================== @interface NSDictionary (NSPerformSelector) --(void)makeObjectsPerformSelector:(SEL)selector_; --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object_; --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_; +-(void)makeObjectsPerformSelector:(SEL)selector; +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object; +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object_ + withObject:(id)object2; -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector; -(void)makeObjectsPerformIfPossible:(SEL)aSelector; -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument; + withObject:(id)argument; -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument1 - withObject:(id)argument2; + withObject:(id)argument1 + withObject:(id)argument2; -(void)makeObjectsPerformIfPossible:(SEL)aSelector - withObject:(id)argument; + withObject:(id)argument; @end //==================================================================== @interface NSDictionary (FromNSArray) -+(id)dictionaryWithArray:(NSArray*)array_ - onSelector:(SEL)sel_; -+(id)dictionaryWithArray:(NSArray*)array_ - onSelector:(SEL)sel_ - withObject:(id)object; ++(id)dictionaryWithArray:(NSArray*)array + onSelector:(SEL)sel; ++(id)dictionaryWithArray:(NSArray*)array + onSelector:(SEL)sel + withObject:(id)object; @end //==================================================================== @interface NSNumber (SBNumber) -+(NSNumber*)maxValueOf:(NSNumber*)_val0 - and:(NSNumber*)_val1; -+(NSNumber*)minValueOf:(NSNumber*)_val0 - and:(NSNumber*)_val1; ++(NSNumber*)maxValueOf:(NSNumber*)val0 + and:(NSNumber*)val1; ++(NSNumber*)minValueOf:(NSNumber*)val0 + and:(NSNumber*)val1; @end //==================================================================== @interface NSData (SBNSData) -(NSRange)rangeOfData:(NSData*)data; -(NSRange)rangeOfData:(NSData*)data - options:(unsigned)mask; + options:(unsigned)mask; -(NSRange)rangeOfData:(NSData *)aData - options:(unsigned)mask - range:(NSRange)aRange; --(NSArray*)componentsSeparatedByData:(NSData*)separator_; --(NSData*)dataByDeletingFirstBytesCount:(unsigned int)bytesCount_; --(NSData*)dataByDeletingLastBytesCount:(unsigned int)bytesCount_; + options:(unsigned)mask + range:(NSRange)aRange; +-(NSArray*)componentsSeparatedByData:(NSData*)separator; +-(NSData*)dataByDeletingFirstBytesCount:(unsigned int)bytesCount; +-(NSData*)dataByDeletingLastBytesCount:(unsigned int)bytesCount; @end //==================================================================== @interface NSMutableData (SBNSData) --(void)deleteFirstBytesCount:(unsigned int)bytesCount_; --(void)deleteLastBytesCount:(unsigned int)bytesCount_; +-(void)deleteFirstBytesCount:(unsigned int)bytesCount; +-(void)deleteLastBytesCount:(unsigned int)bytesCount; @end //==================================================================== typedef enum _NSNumFmtType { NSNumFmtType__Unknown = 0, - NSNumFmtType__Int = 1, + NSNumFmtType__Int = 1, NSNumFmtType__Float = 2, } NSNumFmtType; @interface NSFooNumberFormatter : NSFormatter { - NSNumFmtType type; + NSNumFmtType _type; }; --(id)initType:(NSNumFmtType)type_; +-(id)initType:(NSNumFmtType)type; -(NSString*)stringForObjectValue:(id)anObject; -(BOOL)getObjectValue:(id*)anObject - forString:(NSString*)string - errorDescription:(NSString**)error; + forString:(NSString*)string + errorDescription:(NSString**)error; @end #endif // _GSWebUtils_h__ diff --git a/GSWeb.framework/GSWUtils.m b/GSWeb.framework/GSWUtils.m index c69d501..7162602 100644 --- a/GSWeb.framework/GSWUtils.m +++ b/GSWeb.framework/GSWUtils.m @@ -1,11 +1,16 @@ -/* utils.m - utils - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Jan 1999 +/** GSWUtils.m - GSWeb: Utilities + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -44,60 +50,60 @@ BOOL ClassIsKindOfClass(Class classA,Class classB) }; //-------------------------------------------------------------------- -BOOL boolValueFor(id id_) +BOOL boolValueFor(id anObject) { - if (id_) - { - if (/*id_==BNYES ||*/ id_==NSTYES) - return YES; - else if (/*id_==BNNO ||*/ id_==NSTNO) - return NO; - else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0) - return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); - else if ([id_ respondsToSelector:@selector(boolValue)] && [id_ boolValue]) - return YES; - else if ([id_ respondsToSelector:@selector(intValue)] && [id_ intValue]) - return YES; - //BOOL is unisgned char - else if ([id_ respondsToSelector:@selector(unsignedCharValue)] && [id_ unsignedCharValue]) - return YES; - else - return NO; - } + if (anObject) + { + if (/*anObject==BNYES ||*/ anObject==NSTYES) + return YES; + else if (/*anObject==BNNO ||*/ anObject==NSTNO) + return NO; + else if (/*[anObject conformsTo:@protocol(NSString)]*/ [anObject isKindOfClass:[NSString class]] && [anObject length]>0) + return ([anObject caseInsensitiveCompare: @"NO"]!=NSOrderedSame); + else if ([anObject respondsToSelector:@selector(boolValue)] && [anObject boolValue]) + return YES; + else if ([anObject respondsToSelector:@selector(intValue)] && [anObject intValue]) + return YES; + //BOOL is unisgned char + else if ([anObject respondsToSelector:@selector(unsignedCharValue)] && [anObject unsignedCharValue]) + return YES; + else + return NO; + } else - return NO; + return NO; }; //-------------------------------------------------------------------- -BOOL boolValueWithDefaultFor(id id_,BOOL default_) +BOOL boolValueWithDefaultFor(id anObject,BOOL defaultValue) { - if (id_) - { - if (/*id_==BNYES ||*/ id_==NSTYES) - return YES; - else if (/*id_==BNNO ||*/ id_==NSTNO) - return NO; -//@protocol NSString - else if (/*[id_ conformsTo:@protocol(NSString)]*/ [id_ isKindOfClass:[NSString class]] && [id_ length]>0) - return ([id_ caseInsensitiveCompare: @"NO"]!=NSOrderedSame); - else if ([id_ respondsToSelector:@selector(boolValue)]) - return ([id_ boolValue]!=NO); - else if ([id_ respondsToSelector:@selector(intValue)]) - return ([id_ intValue]!=0); - else if ([id_ respondsToSelector:@selector(unsignedCharValue)]) //BOOL is unsigned char - return ([id_ unsignedCharValue]!=0); - else - return default_; - } + if (anObject) + { + if (/*anObject==BNYES ||*/ anObject==NSTYES) + return YES; + else if (/*anObject==BNNO ||*/ anObject==NSTNO) + return NO; + //@protocol NSString + else if (/*[anObject conformsTo:@protocol(NSString)]*/ [anObject isKindOfClass:[NSString class]] && [anObject length]>0) + return ([anObject caseInsensitiveCompare: @"NO"]!=NSOrderedSame); + else if ([anObject respondsToSelector:@selector(boolValue)]) + return ([anObject boolValue]!=NO); + else if ([anObject respondsToSelector:@selector(intValue)]) + return ([anObject intValue]!=0); + else if ([anObject respondsToSelector:@selector(unsignedCharValue)]) //BOOL is unsigned char + return ([anObject unsignedCharValue]!=0); + else + return defaultValue; + } else - return NO; + return NO; }; /* //-------------------------------------------------------------------- -BOOLNB boolNbFor(BOOL value_) +BOOLNB boolNbFor(BOOL value) { - return (value_ ? BNYES : BNNO); + return (value ? BNYES : BNNO); }; */ @@ -111,36 +117,36 @@ BOOL isHeaderKeysEqual(NSString* headerKey,NSString* testKey) //-------------------------------------------------------------------- BOOL SBIsEqual(id id1,id id2) { - BOOL _equal=NO; + BOOL equal=NO; if (id1==id2) - _equal=YES; + equal=YES; else if (id1) - { - if (id2) - _equal=[id1 isEqual:id2]; - }; - return _equal; + { + if (id2) + equal=[id1 isEqual:id2]; + }; + return equal; }; //-------------------------------------------------------------------- BOOL SBIsValueEqual(id id1,id id2) { - BOOL _equal=SBIsEqual(id1,id2); - if (!_equal + BOOL equal=SBIsEqual(id1,id2); + if (!equal && [id1 class]!=[id2 class]) { if ([id1 isKindOfClass:[NSString class]]) { - NSString* _id2String=[NSString stringWithObject:id2]; - _equal=[id1 isEqualToString:_id2String]; + NSString* id2String=[NSString stringWithObject:id2]; + equal=[id1 isEqualToString:id2String]; } else if ([id2 isKindOfClass:[NSString class]]) { - NSString* _id1String=[NSString stringWithObject:id1]; - _equal=[id2 isEqualToString:_id1String]; + NSString* id1String=[NSString stringWithObject:id1]; + equal=[id2 isEqualToString:id1String]; }; }; - return _equal; + return equal; }; //-------------------------------------------------------------------- @@ -162,15 +168,15 @@ id GetTmpName(NSString* dir,NSString* prefix) id result=nil; char *pszTmpFile=tempnam([dir cString],[prefix cString]); if (!pszTmpFile) - { - //TODO - //result=NewError(1,@"Can't get TmpFile",0,0,0); - } + { + //TODO + //result=NewError(1,@"Can't get TmpFile",0,0,0); + } else - { - result=[NSString stringWithCString:pszTmpFile]; - free(pszTmpFile); - }; + { + result=[NSString stringWithCString:pszTmpFile]; + free(pszTmpFile); + }; return result; }; @@ -194,280 +200,283 @@ NSTimeInterval NSTimeIntervalFromTimeVal(struct timeval* tv) return interval; }; -NSString* pidproccontent(NSString* _path) +NSString* pidproccontent(NSString* path) { - NSString* _content=nil; - char thePath[BUFSIZ*2]; - FILE *theFile = 0; - if ([_path getFileSystemRepresentation:thePath - maxLength:sizeof(thePath)-1] == NO) + NSString* content=nil; + char thePath[BUFSIZ*2]; + FILE* theFile = 0; + if ([path getFileSystemRepresentation:thePath + maxLength:sizeof(thePath)-1] == NO) { - LOGSeriousError(@"Open (%@) attempt failed - bad path", - _path); + LOGSeriousError(@"Open (%@) attempt failed - bad path", + path); } else - { + { #if defined(__WIN32__) - theFile = fopen(thePath, "rb"); + theFile = fopen(thePath, "rb"); #else - theFile = fopen(thePath, "r"); + theFile = fopen(thePath, "r"); #endif - if (theFile == NULL) /* We failed to open the file. */ - { - LOGSeriousError(@"Open (%s) attempt failed - %s", thePath, strerror(errno)); - } - else - { - char buff[1024]=""; - if (!fgets(buff,1024,theFile)) - { - LOGSeriousError(@"Read (%s) attempt failed",thePath); - } - else - { - _content=[NSString stringWithCString:buff]; - }; - fclose(theFile); - }; - }; - return _content; + if (theFile == NULL) /* We failed to open the file. */ + { + LOGSeriousError(@"Open (%s) attempt failed - %s", + thePath, strerror(errno)); + } + else + { + char buff[1024]=""; + if (!fgets(buff,1024,theFile)) + { + LOGSeriousError(@"Read (%s) attempt failed",thePath); + } + else + { + content=[NSString stringWithCString:buff]; + }; + fclose(theFile); + }; + }; + return content; }; void pidstat(pid_t pid, proc_t* P) { - NSString* _filename=[NSString stringWithFormat:@"/proc/%d/stat",(int)pid]; - NSString* pidstat=pidproccontent(_filename); + NSString* filename=[NSString stringWithFormat:@"/proc/%d/stat",(int)pid]; + NSString* pidstat=pidproccontent(filename); NSDebugFLog(@"pidstat=%@",pidstat); - NSDebugFLog(@"_filename=%@",_filename); + NSDebugFLog(@"filename=%@",filename); NSDebugFLog(@"pid=%d",(int)pid); if (pidstat) - { - NSRange _cmdEnd=[pidstat rangeOfString:@") "]; - if (_cmdEnd.length>0) - { - NSString* _pid_cmd=[pidstat substringToIndex:_cmdEnd.location]; - NSDebugFLog(@"_pid_cmd=%@",_pid_cmd); - if (_cmdEnd.location+_cmdEnd.length<[pidstat length]) - { - NSString* _stats=[pidstat substringFromIndex:_cmdEnd.location+_cmdEnd.length]; - /* - char* tmp = strrchr(S, ')'); // split into "PID (cmd" and "" - *tmp = '\0'; // replace trailing ')' with NUL - // parse these two strings separately, skipping the leading "(". - memset(P->cmd, 0, sizeof P->cmd); // clear even though *P xcalloc'd ?! - sscanf(S, "%d (%39c", &P->pid, P->cmd); - */ - const char* _statsChars=[_stats cString]; - NSDebugFLog(@"_stats=%@",_stats); - sscanf(_statsChars, - "%c %d %d %d %d %d %lu %lu %lu %lu %lu %ld %ld %ld %ld %d " - "%d %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %LX %LX %LX %LX %lu", - &P->state, &P->ppid, &P->pgrp, &P->session, &P->tty, &P->tpgid, - &P->flags, &P->min_flt, &P->cmin_flt, &P->maj_flt, &P->cmaj_flt, - &P->utime, &P->stime, &P->cutime, &P->cstime, &P->priority, &P->nice, - &P->timeout, &P->it_real_value, &P->start_time, &P->vsize, &P->rss, - &P->rss_rlim, &P->start_code, &P->end_code, &P->start_stack, - &P->kstk_esp, &P->kstk_eip, &P->signal, &P->blocked, &P->sigignore, - &P->sigcatch, &P->wchan); - if (P->tty == 0) - P->tty = -1; // the old notty val, update elsewhere bef. moving to 0 -/* if (linux_version_code < LINUX_VERSION(1,3,39)) - { - P->priority = 2*15 - P->priority; // map old meanings to new - P->nice = 15 - P->nice; - } - if (linux_version_code < LINUX_VERSION(1,1,30) && P->tty != -1) - P->tty = 4*0x100 + P->tty; // when tty wasn't full devno -*/ - NSDebugFLog(@"P->vsize=%lu",P->vsize); - NSDebugFLog(@"P->rss=%lu",P->rss); - }; - }; - }; + { + NSRange cmdEnd=[pidstat rangeOfString:@") "]; + if (cmdEnd.length>0) + { + NSString* pid_cmd=[pidstat substringToIndex:cmdEnd.location]; + NSDebugFLog(@"pid_cmd=%@",pid_cmd); + if (cmdEnd.location+cmdEnd.length<[pidstat length]) + { + NSString* stats=[pidstat substringFromIndex:cmdEnd.location+cmdEnd.length]; + /* + char* tmp = strrchr(S, ')'); // split into "PID (cmd" and "" + *tmp = '\0'; // replace trailing ')' with NUL + // parse these two strings separately, skipping the leading "(". + memset(P->cmd, 0, sizeof P->cmd); // clear even though *P xcalloc'd ?! + sscanf(S, "%d (%39c", &P->pid, P->cmd); + */ + const char* statsChars=[stats cString]; + NSDebugFLog(@"stats=%@",stats); + sscanf(statsChars, + "%c %d %d %d %d %d %lu %lu %lu %lu %lu %ld %ld %ld %ld %d " + "%d %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %LX %LX %LX %LX %lu", + &P->state, &P->ppid, &P->pgrp, &P->session, &P->tty, &P->tpgid, + &P->flags, &P->min_flt, &P->cmin_flt, &P->maj_flt, &P->cmaj_flt, + &P->utime, &P->stime, &P->cutime, &P->cstime, &P->priority, &P->nice, + &P->timeout, &P->it_real_value, &P->start_time, &P->vsize, &P->rss, + &P->rss_rlim, &P->start_code, &P->end_code, &P->start_stack, + &P->kstk_esp, &P->kstk_eip, &P->signal, &P->blocked, &P->sigignore, + &P->sigcatch, &P->wchan); + if (P->tty == 0) + P->tty = -1; // the old notty val, update elsewhere bef. moving to 0 + /* if (linux_version_code < LINUX_VERSION(1,3,39)) + { + P->priority = 2*15 - P->priority; // map old meanings to new + P->nice = 15 - P->nice; + } + if (linux_version_code < LINUX_VERSION(1,1,30) && P->tty != -1) + P->tty = 4*0x100 + P->tty; // when tty wasn't full devno + */ + NSDebugFLog(@"P->vsize=%lu",P->vsize); + NSDebugFLog(@"P->rss=%lu",P->rss); + }; + }; + }; }; void pidstatm(pid_t pid, proc_t* P) { - NSString* _filename=[NSString stringWithFormat:@"/proc/%d/statm",(int)pid]; - NSString* pidstat=pidproccontent(_filename); + NSString* filename=[NSString stringWithFormat:@"/proc/%d/statm",(int)pid]; + NSString* pidstat=pidproccontent(filename); NSDebugFLog(@"pidstat=%@",pidstat); - NSDebugFLog(@"_filename=%@",_filename); + NSDebugFLog(@"filename=%@",filename); NSDebugFLog(@"pid=%d",(int)pid); if (pidstat) - { - const char* _statsChars=[pidstat cString]; - NSDebugFLog(@"pidstat=%@",pidstat); - sscanf(_statsChars, "%ld %ld %ld %ld %ld %ld %ld", - &P->size, &P->resident, &P->share, - &P->trs, &P->lrs, &P->drs, &P->dt); - NSDebugFLog(@"P->size=%ld",P->size); - NSDebugFLog(@"P->resident=%ld",P->resident); - NSDebugFLog(@"P->share=%ld",P->share); - NSDebugFLog(@"P->trs=%ld",P->trs); - NSDebugFLog(@"P->lrs=%ld",P->lrs); - NSDebugFLog(@"P->drs=%ld",P->drs); - NSDebugFLog(@"P->dt=%ld",P->dt); - }; + { + const char* statsChars=[pidstat cString]; + NSDebugFLog(@"pidstat=%@",pidstat); + sscanf(statsChars, "%ld %ld %ld %ld %ld %ld %ld", + &P->size, &P->resident, &P->share, + &P->trs, &P->lrs, &P->drs, &P->dt); + NSDebugFLog(@"P->size=%ld",P->size); + NSDebugFLog(@"P->resident=%ld",P->resident); + NSDebugFLog(@"P->share=%ld",P->share); + NSDebugFLog(@"P->trs=%ld",P->trs); + NSDebugFLog(@"P->lrs=%ld",P->lrs); + NSDebugFLog(@"P->drs=%ld",P->drs); + NSDebugFLog(@"P->dt=%ld",P->dt); + }; }; //-------------------------------------------------------------------- void StackTraceIFND() { - NSString* _stackTraceString=[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"/tmp/%@.stacktrace", - globalApplicationClassName]]; - if ([_stackTraceString intValue]) - { - StackTrace(); - }; + NSString* stackTraceString=[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"/tmp/%@.stacktrace", + globalApplicationClassName]]; + if ([stackTraceString intValue]) + { + StackTrace(); + }; }; //-------------------------------------------------------------------- void DebugBreakpointIFND() { - NSString* _breakString=[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"/tmp/%@.break", - globalApplicationClassName]]; - if ([_breakString intValue]) - { - DebugBreakpoint(); - }; + NSString* breakString=[NSString stringWithContentsOfFile:[NSString stringWithFormat:@"/tmp/%@.break", + globalApplicationClassName]]; + if ([breakString intValue]) + { + DebugBreakpoint(); + }; }; //-------------------------------------------------------------------- void ExceptionRaiseFn(const char *func, - const char *file, - int line, - NSString* name_, - NSString* format_, - ...) + const char *file, + int line, + NSString* name, + NSString* format, + ...) { NSString* fmt = [NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", - func,line,file,name_,format_]; + func,line,file,name,format]; NSString* string= nil; va_list args; - va_start(args,format_); + va_start(args,format); string=[NSString stringWithFormat:fmt - arguments:args]; + arguments:args]; va_end(args); NSLog(@"%@",string); StackTraceIFND(); DebugBreakpointIFND(); - [NSException raise:name_ format:@"%@",string]; + [NSException raise:name + format:@"%@",string]; }; //-------------------------------------------------------------------- void ExceptionRaiseFn0(const char *func, - const char *file, - int line, - NSString* name_, - NSString* format_) + const char *file, + int line, + NSString* name, + NSString* format) { NSString* string = [NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", - func,line,file,name_,format_]; + func,line,file,name,format]; NSLog(@"%@",string); StackTraceIFND(); DebugBreakpointIFND(); - [NSException raise:name_ format:@"%@",string]; + [NSException raise:name + format:@"%@",string]; }; //-------------------------------------------------------------------- void ValidationExceptionRaiseFn(const char *func, - const char *file, - int line, - NSString* name_, - NSString* message_, - NSString* format_, - ...) + const char *file, + int line, + NSString* name, + NSString* message, + NSString* format, + ...) { - NSException* _exception=nil; - NSString* fmt = [NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", - func,line,file,name_,format_]; - NSString* string= nil; + NSException* exception=nil; + NSString* fmt=[NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", + func,line,file,name,format]; + NSString* string=nil; va_list args; - va_start(args,format_); + va_start(args,format); string=[NSString stringWithFormat:fmt - arguments:args]; + arguments:args]; va_end(args); NSLog(@"%@",string); - _exception=[NSException exceptionWithName:name_ - reason:string - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES],@"isValidationException", - message_,@"message", - nil,nil]]; + exception=[NSException exceptionWithName:name + reason:string + userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithBool:YES],@"isValidationException", + message,@"message", + nil,nil]]; StackTraceIFND(); DebugBreakpointIFND(); - [_exception raise]; + [exception raise]; }; //-------------------------------------------------------------------- void ValidationExceptionRaiseFn0(const char *func, - const char *file, - int line, - NSString* name_, - NSString* message_, - NSString* format_) + const char *file, + int line, + NSString* name, + NSString* message, + NSString* format) { - NSException* _exception=nil; - NSString* string = [NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", - func,line,file,name_,format_]; + NSException* exception=nil; + NSString* string=[NSString stringWithFormat:@"File %s: %d. In %s EXCEPTION %@: %@", + func,line,file,name,format]; NSLog(@"%@",string); - _exception=[NSException exceptionWithName:name_ - reason:format_ - userInfo:[NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:YES],@"isValidationException", - message_,@"message", - nil,nil]]; + exception=[NSException exceptionWithName:name + reason:format + userInfo:[NSDictionary dictionaryWithObjectsAndKeys: + [NSNumber numberWithBool:YES],@"isValidationException", + message,@"message", + nil,nil]]; StackTraceIFND(); DebugBreakpointIFND(); - [_exception raise]; + [exception raise]; }; //==================================================================== @implementation NSException (NSBuild) -+(NSException*)exceptionWithName:(NSString *)name - format:(NSString *)format,... ++(NSException*)exceptionWithName:(NSString*)name + format:(NSString*)format,... { - NSException* _exception=nil; + NSException* exception=nil; NSString* reason=nil; va_list args; va_start(args,format); - reason = [NSString stringWithFormat:format - arguments:args]; + reason=[NSString stringWithFormat:format + arguments:args]; va_end(args); - _exception=[self exceptionWithName:name - reason:reason - userInfo: nil]; - return _exception; + exception=[self exceptionWithName:name + reason:reason + userInfo: nil]; + return exception; }; @end //==================================================================== @implementation NSException (NSExceptionUserInfoAdd) --(NSException*)exceptionByAddingUserInfo:(NSDictionary*)userInfo_ +-(NSException*)exceptionByAddingUserInfo:(NSDictionary*)aUserInfo { - NSMutableDictionary* _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; - [_userInfo addEntriesFromDictionary:userInfo_]; + NSMutableDictionary* userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; + [userInfo addEntriesFromDictionary:aUserInfo]; return [[self class]exceptionWithName:[self name] - reason:[self reason] - userInfo:_userInfo]; + reason:[self reason] + userInfo:userInfo]; }; --(NSException*)exceptionByAddingToUserInfoKey:(id)key_ - format:(NSString*)format_,... +-(NSException*)exceptionByAddingToUserInfoKey:(id)key + format:(NSString*)format,... { NSException* exception=nil; - NSString* _userInfoString=nil; - NSMutableDictionary* _userInfo=nil; + NSString* userInfoString=nil; + NSMutableDictionary* userInfo=nil; va_list args; LOGObjectFnStart(); - _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; - va_start(args,format_); - _userInfoString = [NSString stringWithFormat:format_ - arguments:args]; + userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; + va_start(args,format); + userInfoString = [NSString stringWithFormat:format + arguments:args]; va_end(args); { - id curArray = [_userInfo objectForKey:key_]; - id newArray=[NSMutableArray arrayWithObject:_userInfoString]; + id curArray = [userInfo objectForKey:key]; + id newArray=[NSMutableArray arrayWithObject:userInfoString]; if (!curArray) { curArray = [NSMutableArray array]; @@ -479,100 +488,100 @@ void ValidationExceptionRaiseFn0(const char *func, [curArray addObject:tempObject]; } [newArray addObjectsFromArray:curArray]; - [_userInfo setObject:newArray forKey:key_]; + [userInfo setObject:newArray forKey:key]; } exception=[[self class]exceptionWithName:[self name] reason:[self reason] - userInfo:_userInfo]; + userInfo:userInfo]; LOGObjectFnStop(); return exception; }; --(NSException*)exceptionByAddingUserInfoKey:(id)key_ - format:(NSString*)format_,... +-(NSException*)exceptionByAddingUserInfoKey:(id)key + format:(NSString*)format,... { NSException* exception=nil; - NSString* _userInfoString=nil; - NSMutableDictionary* _userInfo=nil; + NSString* userInfoString=nil; + NSMutableDictionary* userInfo=nil; va_list args; LOGObjectFnStart(); - _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; - va_start(args,format_); - _userInfoString = [NSString stringWithFormat:format_ - arguments:args]; + userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; + va_start(args,format); + userInfoString = [NSString stringWithFormat:format + arguments:args]; va_end(args); - [_userInfo setObject:_userInfoString - forKey:key_]; + [userInfo setObject:userInfoString + forKey:key]; exception=[[self class]exceptionWithName:[self name] reason:[self reason] - userInfo:_userInfo]; + userInfo:userInfo]; LOGObjectFnStop(); return exception; }; --(NSException*)exceptionByAddingUserInfoFrameInfo:(NSString*)frameInfo_ +-(NSException*)exceptionByAddingUserInfoFrameInfo:(NSString*)frameInfo { NSException* exception=nil; - NSMutableDictionary* _userInfo=nil; - NSArray* _frameInfoArray=nil; + NSMutableDictionary* userInfo=nil; + NSArray* frameInfoArray=nil; LOGObjectFnStart(); - _userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; - _frameInfoArray=[_userInfo objectForKey:@"FrameInfo"]; - if (_frameInfoArray) - _frameInfoArray=[_frameInfoArray arrayByAddingObject:frameInfo_]; + userInfo=[NSMutableDictionary dictionaryWithDictionary:[self userInfo]]; + frameInfoArray=[userInfo objectForKey:@"FrameInfo"]; + if (frameInfoArray) + frameInfoArray=[frameInfoArray arrayByAddingObject:frameInfo]; else - _frameInfoArray=[NSArray arrayWithObject:frameInfo_]; - [_userInfo setObject:_frameInfoArray - forKey:@"FrameInfo"]; + frameInfoArray=[NSArray arrayWithObject:frameInfo]; + [userInfo setObject:frameInfoArray + forKey:@"FrameInfo"]; exception=[[self class]exceptionWithName:[self name] - reason:[self reason] - userInfo:_userInfo]; + reason:[self reason] + userInfo:userInfo]; LOGObjectFnStop(); return exception; }; --(NSException*)exceptionByAddingUserInfoFrameInfoFormat:(NSString*)format_,... +-(NSException*)exceptionByAddingUserInfoFrameInfoFormat:(NSString*)format,... { NSException* exception=nil; - NSString* _frameInfo=nil; + NSString* frameInfo=nil; va_list args; LOGObjectFnStart(); - va_start(args,format_); - _frameInfo = [NSString stringWithFormat:format_ - arguments:args]; + va_start(args,format); + frameInfo = [NSString stringWithFormat:format + arguments:args]; va_end(args); - exception=[self exceptionByAddingUserInfoFrameInfo:_frameInfo]; + exception=[self exceptionByAddingUserInfoFrameInfo:frameInfo]; LOGObjectFnStop(); return exception; }; --(NSException*)exceptionByAddingUserInfoFrameInfoObject:(id)obj_ - sel:(SEL)sel_ - file:(const char*)file_ - line:(int)line_ - format:(NSString*)format_,... +-(NSException*)exceptionByAddingUserInfoFrameInfoObject:(id)obj + sel:(SEL)sel + file:(const char*)file + line:(int)line + format:(NSString*)format,... { NSException* exception=nil; - Class cls = (Class)obj_; + Class cls = (Class)obj; char c = '+'; NSString* fmt=nil; NSString* string= nil; va_list args; LOGObjectFnStart(); - if ([obj_ isInstance] == YES) + if ([obj isInstance] == YES) { c = '-'; - cls = [obj_ class]; + cls = [obj class]; }; fmt = [NSString stringWithFormat: @"%s: %d. In [%@ %c%@] %@", - file_, - line_, + file, + line, NSStringFromClass(cls), c, - NSStringFromSelector(sel_), - format_]; - va_start(args,format_); + NSStringFromSelector(sel), + format]; + va_start(args,format); string=[NSString stringWithFormat:fmt arguments:args]; va_end(args); @@ -581,19 +590,19 @@ void ValidationExceptionRaiseFn0(const char *func, return exception; }; --(NSException*)exceptionByAddingUserInfoFrameInfoFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ - format:(NSString*)format_,... +-(NSException*)exceptionByAddingUserInfoFrameInfoFunction:(const char*)fn + file:(const char*)file + line:(int)line + format:(NSString*)format,... { NSException* exception=nil; NSString* fmt =nil; NSString* string= nil; va_list args; LOGObjectFnStart(); - va_start(args,format_); + va_start(args,format); fmt = [NSString stringWithFormat:@"%s: %d. In %s %@: %@", - file_,line_,fn_,format_]; + file,line,fn,format]; string=[NSString stringWithFormat:fmt arguments:args]; va_end(args); @@ -604,8 +613,8 @@ void ValidationExceptionRaiseFn0(const char *func, -(BOOL)isValidationException { - BOOL _isValidationException=boolValueWithDefaultFor([[self userInfo] objectForKey:@"isValidationException"],NO); - return _isValidationException; + BOOL isValidationException=boolValueWithDefaultFor([[self userInfo] objectForKey:@"isValidationException"],NO); + return isValidationException; }; @end @@ -630,12 +639,12 @@ void ValidationExceptionRaiseFn0(const char *func, @implementation NSMutableOrderedArray: NSMutableArray //-------------------------------------------------------------------- -- (id)initWithCompareSelector:(SEL)compareSelector_ +- (id)initWithCompareSelector:(SEL)compareSelector { if ((self=[super init])) { - array = [[NSMutableArray array] retain]; - compareSelector=compareSelector_; + _array = [NSMutableArray new]; + _compareSelector=compareSelector; } return self; @@ -643,69 +652,71 @@ void ValidationExceptionRaiseFn0(const char *func, - (id)initWithCapacity:(unsigned)cap { - array = [[NSMutableArray array] retain]; - compareSelector=NULL; - + if ((self=[super init])) + { + _array = [NSMutableArray new]; + _compareSelector=NULL; + }; return self; } - (unsigned)count { - return [array count]; + return [_array count]; } - (id)objectAtIndex:(unsigned)i { - return [array objectAtIndex:i]; + return [_array objectAtIndex:i]; } - (void)removeObjectAtIndex:(unsigned)i { - [array removeObjectAtIndex:i]; + [_array removeObjectAtIndex:i]; } - (void)release { - [array release]; - compareSelector=NULL; + DESTROY(_array); + _compareSelector=NULL; [super dealloc]; } //-------------------------------------------------------------------- --(void)addObject:(id)object_ +-(void)addObject:(id)object { //TODO better method int i=0; - NSComparisonResult _result=NSOrderedSame; + NSComparisonResult result=NSOrderedSame; - for(i=0;_result!=NSOrderedDescending && i<[array count];i++) + for(i=0;result!=NSOrderedDescending && i<[_array count];i++) { - _result=(NSComparisonResult)[object_ performSelector:compareSelector - withObject:[array objectAtIndex:i]]; + result=(NSComparisonResult)[object performSelector:_compareSelector + withObject:[_array objectAtIndex:i]]; - if (_result==NSOrderedDescending) - [array insertObject:object_ - atIndex:i]; + if (result==NSOrderedDescending) + [_array insertObject:object + atIndex:i]; }; - if (_result!=NSOrderedDescending) - [array addObject:object_]; + if (result!=NSOrderedDescending) + [_array addObject:object]; }; //-------------------------------------------------------------------- --(void)addObjectsFromArray:(NSArray*)array_ +-(void)addObjectsFromArray:(NSArray*)array { int i; - for(i=0;i<[array_ count];i++) + for(i=0;i<[array count];i++) { - [array addObject:[array_ objectAtIndex:i]]; + [_array addObject:[array objectAtIndex:i]]; }; }; //-------------------------------------------------------------------- --(void)insertObject:(id)object_ - atIndex:(unsigned int)index_ +-(void)insertObject:(id)object + atIndex:(unsigned int)index { LOGException0(@"NSMutableOrderedArray doesn't support this fn"); @@ -714,8 +725,8 @@ void ValidationExceptionRaiseFn0(const char *func, }; //-------------------------------------------------------------------- --(void)replaceObjectAtIndex:(unsigned int)index_ - withObject:(id)object_ +-(void)replaceObjectAtIndex:(unsigned int)index + withObject:(id)object { LOGException0(@"NSMutableOrderedArray doesn't support this fn"); @@ -724,8 +735,8 @@ void ValidationExceptionRaiseFn0(const char *func, }; //-------------------------------------------------------------------- --(void)replaceObjectsInRange:(NSRange)range_ - withObjectsFromArray:(NSArray*)array_ +-(void)replaceObjectsInRange:(NSRange)range + withObjectsFromArray:(NSArray*)array { LOGException0(@"NSMutableOrderedArray doesn't support this fn"); @@ -734,9 +745,9 @@ void ValidationExceptionRaiseFn0(const char *func, }; //-------------------------------------------------------------------- --(void)replaceObjectsInRange:(NSRange)range_ - withObjectsFromArray:(NSArray*)array_ - range:(NSRange)arrayRange_ +-(void)replaceObjectsInRange:(NSRange)range + withObjectsFromArray:(NSArray*)array + range:(NSRange)arrayRange { LOGException0(@"NSMutableOrderedArray doesn't support this fn"); @@ -745,9 +756,9 @@ void ValidationExceptionRaiseFn0(const char *func, }; //-------------------------------------------------------------------- --(void)setArray:(NSArray*)array_ +-(void)setArray:(NSArray*)array { - [array setArray:[array_ sortedArrayUsingSelector:compareSelector]]; + [_array setArray:[array sortedArrayUsingSelector:_compareSelector]]; }; @end @@ -757,19 +768,19 @@ void ValidationExceptionRaiseFn0(const char *func, //-------------------------------------------------------------------- -(NSString*)bundleName { - NSString* _bundlePath=nil; - NSString* _name=nil; + NSString* bundlePath=nil; + NSString* name=nil; LOGObjectFnStart(); - _bundlePath=[self bundlePath]; - NSDebugMLLog(@"low",@"_bundlePath=%@",_bundlePath); - _bundlePath=[_bundlePath stringGoodPath]; - NSDebugMLLog(@"low",@"_bundlePath=%@",_bundlePath); - _name=[_bundlePath lastPathComponent]; - NSDebugMLLog(@"low",@"_name=%@",_name); - _name=[_name stringByDeletingPathExtension]; - NSDebugMLLog(@"low",@"_name=%@",_name); + bundlePath=[self bundlePath]; + NSDebugMLLog(@"low",@"bundlePath=%@",bundlePath); + bundlePath=[bundlePath stringGoodPath]; + NSDebugMLLog(@"low",@"bundlePath=%@",bundlePath); + name=[bundlePath lastPathComponent]; + NSDebugMLLog(@"low",@"name=%@",name); + name=[name stringByDeletingPathExtension]; + NSDebugMLLog(@"low",@"name=%@",name); LOGObjectFnStop(); - return _name; + return name; }; @end @@ -804,39 +815,39 @@ void ValidationExceptionRaiseFn0(const char *func, -(id)performSelectorIfPossible:(SEL)aSelector { if ([self respondsToSelector:aSelector]) - return [self performSelector:aSelector]; + return [self performSelector:aSelector]; else - return nil; + return nil; }; //-------------------------------------------------------------------- -(id)performSelectorIfPossible:(SEL)aSelector - withObject:(id)anObject + withObject:(id)anObject { if ([self respondsToSelector:aSelector]) - return [self performSelector:aSelector - withObject:anObject]; + return [self performSelector:aSelector + withObject:anObject]; else - return nil; + return nil; }; //-------------------------------------------------------------------- -(id)performSelectorIfPossible:(SEL)aSelector - withObject:(id)object1 - withObject:(id)object2 + withObject:(id)object1 + withObject:(id)object2 { if ([self respondsToSelector:aSelector]) - return [self performSelector:aSelector - withObject:object1 - withObject:object2]; + return [self performSelector:aSelector + withObject:object1 + withObject:object2]; else - return nil; + return nil; }; @end -extern struct PTHREAD_HANDLE * nub_get_active_thread( void ); +extern struct PTHREAD_HANDLE* nub_get_active_thread(void); NSString *NSLockException = @"NSLockException"; @@ -846,17 +857,17 @@ NSString *NSLockException = @"NSLockException"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - ", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //-------------------------------------------------------------------- -(BOOL)isLocked { - BOOL _isLocked=YES; + BOOL isLocked=YES; if ([self tmptryLock]) { - _isLocked=NO; + isLocked=NO; [self tmpunlock]; } else @@ -865,22 +876,22 @@ NSString *NSLockException = @"NSLockException"; (void*)_mutex->owner, (void*)objc_thread_id()); }; - return _isLocked; + return isLocked; }; //-------------------------------------------------------------------- -(BOOL)tmplock { return [self tmplockFromFunction:NULL - file:NULL - line:-1]; + file:NULL + line:-1]; }; //-------------------------------------------------------------------- --(BOOL)tmplockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ +-(BOOL)tmplockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; @@ -895,21 +906,21 @@ NSString *NSLockException = @"NSLockException"; // NSDebugMLLog(@"low",@"locked=%d",(int)locked); if (locked) - { -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - } + { + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + } else - { - LOGException(@"NSLockException lock: failed to lock mutex. Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"lock: failed to lock mutex. Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; + { + LOGException(@"NSLockException lock: failed to lock mutex. Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"lock: failed to lock mutex. Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; // LOGObjectFnStop(); return locked; }; @@ -923,9 +934,9 @@ NSString *NSLockException = @"NSLockException"; }; //-------------------------------------------------------------------- --(BOOL)tmptryLockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ +-(BOOL)tmptryLockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; @@ -936,7 +947,7 @@ NSString *NSLockException = @"NSLockException"; if (result != 0 && result!=1) locked=NO; else - locked=YES; + locked=YES; // LOGObjectFnStop(); return locked; }; @@ -945,16 +956,16 @@ NSString *NSLockException = @"NSLockException"; -(BOOL)tmptryLockBeforeDate:(NSDate*)limit { return [self tmptryLockBeforeDate:limit - fromFunction:NULL - file:NULL - line:-1]; + fromFunction:NULL + file:NULL + line:-1]; }; //-------------------------------------------------------------------- -(BOOL)tmptryLockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; @@ -965,35 +976,35 @@ NSString *NSLockException = @"NSLockException"; if (result != 0 && result!=1) locked=NO; else - locked=YES; - -// NSDebugMLLog(@"low",@"[NSDate date]=%@ limit=%@",[NSDate date],limit); + locked=YES; + + // NSDebugMLLog(@"low",@"[NSDate date]=%@ limit=%@",[NSDate date],limit); while (!locked && [[NSDate date]compare:limit]==NSOrderedAscending) - { -// NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); - usleep(100); -// NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result != 0 && result!=1) - locked=NO; - else - locked=YES; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); + { + //NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); + usleep(100); + //NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result != 0 && result!=1) + locked=NO; + else + locked=YES; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); if (locked) - { -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - } + { + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + } else - { - NSDebugMLog(@"NSLock tmptryLockBeforeDate lock: failed to lock mutex before %@. Called from %s in %s %d", - limit, - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - }; -// LOGObjectFnStop(); + { + NSDebugMLog(@"NSLock tmptryLockBeforeDate lock: failed to lock mutex before %@. Called from %s in %s %d", + limit, + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + }; + // LOGObjectFnStop(); return locked; }; @@ -1008,9 +1019,9 @@ NSString *NSLockException = @"NSLockException"; //-------------------------------------------------------------------- -(BOOL)tmplockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; @@ -1025,36 +1036,36 @@ NSString *NSLockException = @"NSLockException"; // NSDebugMLLog(@"low",@"[NSDate date]=%@ limit=%@",[NSDate date],limit); while (!locked && [[NSDate date]compare:limit]==NSOrderedAscending) - { -// NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); - usleep(100); -// NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result != 0 && result!=1) - locked=NO; - else - locked=YES; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); + { + //NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); + usleep(100); + //NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result != 0 && result!=1) + locked=NO; + else + locked=YES; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); if (locked) - { -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - } + { + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + } else - { - LOGException(@"NSLockException lock: failed to lock mutex before date %@. Called from %s in %s %d", - limit, - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"lock: failed to lock mutex before date %@. Called from %s in %s %d", - limit, - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; + { + LOGException(@"NSLockException lock: failed to lock mutex before date %@. Called from %s in %s %d", + limit, + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"lock: failed to lock mutex before date %@. Called from %s in %s %d", + limit, + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; // LOGObjectFnStop(); return locked; }; @@ -1063,50 +1074,50 @@ NSString *NSLockException = @"NSLockException"; -(void)tmpunlock { [self tmpunlockFromFunction:NULL - file:NULL - line:-1]; + file:NULL + line:-1]; }; //-------------------------------------------------------------------- --(void)tmpunlockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(void)tmpunlockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; { int result=0; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (_mutex->owner!=objc_thread_id()) - { - LOGException(@"NSLockException unlock: failed to unlock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"unlock: failed to lock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - } + { + LOGException(@"NSLockException unlock: failed to unlock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"unlock: failed to lock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + } else - { - result=objc_mutex_unlock(_mutex); -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result != 0) - { -// NSDebugMLLog(@"low",@"UNLOCK PROBLEM"); - LOGException(@"NSLockException unlock: failed to unlock mutex (result!=0). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"unlock: failed to lock mutex (result!=0). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; - }; -// LOGObjectFnStop(); + { + result=objc_mutex_unlock(_mutex); + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result != 0) + { + //NSDebugMLLog(@"low",@"UNLOCK PROBLEM"); + LOGException(@"NSLockException unlock: failed to unlock mutex (result!=0). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"unlock: failed to lock mutex (result!=0). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; + }; + // LOGObjectFnStop(); }; @end @@ -1118,77 +1129,77 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - ", - object_get_class_name(self), - (void*)self]; + object_get_class_name(self), + (void*)self]; }; //-------------------------------------------------------------------- -(BOOL)isLocked { - BOOL _isLocked=YES; + BOOL isLocked=YES; if ([self tmptryLock]) - { - _isLocked=NO; - [self unlock]; - }; - return _isLocked; + { + isLocked=NO; + [self unlock]; + }; + return isLocked; }; //-------------------------------------------------------------------- -(BOOL)tmplock { return [self tmplockFromFunction:NULL - file:NULL - line:-1]; + file:NULL + line:-1]; }; //-------------------------------------------------------------------- --(BOOL)tmplockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ +-(BOOL)tmplockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - { - locked=NO; - LOGException(@"NSLockException lock: failed to lock mutex (result==-1). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"lock: failed to lock mutex (result==-1). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - } - else - { - locked=YES; - // NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - }; - } + { + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + { + locked=NO; + LOGException(@"NSLockException lock: failed to lock mutex (result==-1). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"lock: failed to lock mutex (result==-1). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + } + else + { + locked=YES; + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + }; + } else - { - LOGException(@"NSLockException lock: failed to lock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"lock: failed to lock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); -// LOGObjectFnStop(); + { + LOGException(@"NSLockException lock: failed to lock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"lock: failed to lock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); + // LOGObjectFnStop(); return locked; }; @@ -1196,35 +1207,35 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; -(BOOL)tmptryLock { return [self tmptryLockFromFunction:NULL - file:NULL - line:-1]; + file:NULL + line:-1]; }; //-------------------------------------------------------------------- --(BOOL)tmptryLockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ +-(BOOL)tmptryLockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; int result=0; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - { - locked=NO; - } - else - { - locked=YES; - }; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); -// LOGObjectFnStop(); + { + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + { + locked=NO; + } + else + { + locked=YES; + }; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); + // LOGObjectFnStop(); return locked; }; @@ -1232,16 +1243,16 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; -(BOOL)tmptryLockBeforeDate:(NSDate*)limit { return [self tmptryLockBeforeDate:limit - fromFunction:NULL - file:NULL - line:-1]; + fromFunction:NULL + file:NULL + line:-1]; }; //-------------------------------------------------------------------- -(BOOL)tmptryLockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; BOOL notOwner=NO; @@ -1249,50 +1260,50 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - notOwner=NO; - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - locked=NO; - else - locked=YES; - } + { + notOwner=NO; + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + locked=NO; + else + locked=YES; + } else - notOwner=YES; + notOwner=YES; while (!locked && [[NSDate date]compare:limit]==NSOrderedAscending) - { -// NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); - usleep(100); -// NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - notOwner=NO; - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - locked=NO; - else - locked=YES; - } - else - notOwner=YES; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); + { + //NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); + usleep(100); + //NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + if (!_mutex->owner || _mutex->owner==objc_thread_id()) + { + notOwner=NO; + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + locked=NO; + else + locked=YES; + } + else + notOwner=YES; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); if (locked) - { -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - } + { + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + } else - { - NSDebugMLog(@"NSLock tmptryLockBeforeDate lock: failed to lock mutex before %@ (%s). Called from %s in %s %d", - limit, - notOwner ? "Not Owner" : "result==-1", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - }; -// LOGObjectFnStop(); + { + NSDebugMLog(@"NSLock tmptryLockBeforeDate lock: failed to lock mutex before %@ (%s). Called from %s in %s %d", + limit, + notOwner ? "Not Owner" : "result==-1", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + }; + // LOGObjectFnStop(); return locked; }; @@ -1300,16 +1311,16 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; -(BOOL)tmplockBeforeDate:(NSDate*)limit { return [self tmplockBeforeDate:limit - fromFunction:NULL - file:NULL - line:-1]; + fromFunction:NULL + file:NULL + line:-1]; }; //-------------------------------------------------------------------- -(BOOL)tmplockBeforeDate:(NSDate*)limit - fromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_ + fromFunction:(const char*)fn + file:(const char*)file + line:(int)line { BOOL locked=NO; BOOL notOwner=NO; @@ -1317,57 +1328,57 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - notOwner=NO; - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - locked=NO; - else - locked=YES; - } + { + notOwner=NO; + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + locked=NO; + else + locked=YES; + } else - notOwner=YES; - + notOwner=YES; + while (!locked && [[NSDate date]compare:limit]==NSOrderedAscending) - { -// NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); - usleep(100); -// NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - if (!_mutex->owner || _mutex->owner==objc_thread_id()) - { - notOwner=NO; - result=objc_mutex_trylock(_mutex); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - locked=NO; - else - locked=YES; - } - else - notOwner=YES; - }; -// NSDebugMLLog(@"low",@"locked=%d",(int)locked); + { + //NSDebugMLLog(@"low",@"tmplockBeforeDate wait"); + usleep(100); + //NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + if (!_mutex->owner || _mutex->owner==objc_thread_id()) + { + notOwner=NO; + result=objc_mutex_trylock(_mutex); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + locked=NO; + else + locked=YES; + } + else + notOwner=YES; + }; + // NSDebugMLLog(@"low",@"locked=%d",(int)locked); if (locked) - { -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); - } + { + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + } else - { - LOGException(@"NSLockException lock: failed to lock mutex before date %@ (%s). Called from %s in %s %d", - limit, - notOwner ? "Not Owner" : "result==-1", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"lock: failed to lock mutex before date %@ (%s). Called from %s in %s %d", - limit, - notOwner ? "Not Owner" : "result==-1", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; + { + LOGException(@"NSLockException lock: failed to lock mutex before date %@ (%s). Called from %s in %s %d", + limit, + notOwner ? "Not Owner" : "result==-1", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"lock: failed to lock mutex before date %@ (%s). Called from %s in %s %d", + limit, + notOwner ? "Not Owner" : "result==-1", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; // LOGObjectFnStop(); return locked; }; @@ -1376,64 +1387,64 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; -(void)tmpunlock { [self tmpunlockFromFunction:NULL - file:NULL - line:-1]; + file:NULL + line:-1]; }; //-------------------------------------------------------------------- --(void)tmpunlockFromFunction:(const char*)fn_ - file:(const char*)file_ - line:(int)line_; +-(void)tmpunlockFromFunction:(const char*)fn + file:(const char*)file + line:(int)line; { int result=0; // LOGObjectFnStart(); // NSDebugMLLog(@"low",@"BEF _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); if (_mutex->owner!=objc_thread_id()) - { - LOGException(@"NSLockException unlock: failed to unlock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"unlock: failed to lock mutex (not owner). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - } + { + LOGException(@"NSLockException unlock: failed to unlock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"unlock: failed to lock mutex (not owner). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + } else - { - result=objc_mutex_unlock(_mutex); -// NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); -// NSDebugMLLog(@"low",@"result=%d",result); - if (result == -1) - { - LOGException(@"NSLockException unlock: failed to unlock mutex (result==-1). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_); - [NSException raise:NSLockException - format:@"unlock: failed to lock mutex (result==-1). Called from %s in %s %d", - fn_ ? fn_ : "Unknown", - file_ ? file_ : "Unknown", - line_]; - }; - }; -// LOGObjectFnStop(); + { + result=objc_mutex_unlock(_mutex); + //NSDebugMLLog(@"low",@"AFT _mutex->owner=%p objc_thread_id()=%p",(void*)_mutex->owner,(void*)objc_thread_id()); + //NSDebugMLLog(@"low",@"result=%d",result); + if (result == -1) + { + LOGException(@"NSLockException unlock: failed to unlock mutex (result==-1). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line); + [NSException raise:NSLockException + format:@"unlock: failed to lock mutex (result==-1). Called from %s in %s %d", + fn ? fn : "Unknown", + file ? file : "Unknown", + line]; + }; + }; + // LOGObjectFnStop(); }; @end //==================================================================== @implementation NSArray (NSPerformSelectorWith2Objects) //-------------------------------------------------------------------- --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_ +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object1 + withObject:(id)object2 { unsigned i = [self count]; while (i-- > 0) - [[self objectAtIndex:i]performSelector:selector_ - withObject:object1_ - withObject:object2_]; + [[self objectAtIndex:i]performSelector:selector + withObject:object1 + withObject:object2]; }; //-------------------------------------------------------------------- @@ -1452,32 +1463,32 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; //-------------------------------------------------------------------- -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument + withObject:(id)argument { unsigned i = [self count]; while (i-->0) [[self objectAtIndex: i] performSelectorIfPossible:aSelector - withObject:argument]; + withObject:argument]; } //-------------------------------------------------------------------- -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)argument1 - withObject:(id)argument2 + withObject:(id)argument1 + withObject:(id)argument2 { unsigned i = [self count]; while (i-->0) [[self objectAtIndex: i] performSelectorIfPossible:aSelector - withObject:argument1 - withObject:argument2]; + withObject:argument1 + withObject:argument2]; } //-------------------------------------------------------------------- -(void)makeObjectsPerformIfPossible:(SEL)aSelector - withObject:(id)argument + withObject:(id)argument { - [self makeObjectsPerformSelectorIfPossible:aSelector - withObject: argument]; + [self makeObjectsPerformSelectorIfPossible:aSelector + withObject: argument]; } @@ -1487,74 +1498,74 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException"; @implementation NSDictionary (NSPerformSelector) //-------------------------------------------------------------------- --(void)makeObjectsPerformSelector:(SEL)selector_ +-(void)makeObjectsPerformSelector:(SEL)selector { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelector:selector_]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelector:selector]; }; //-------------------------------------------------------------------- --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object_ +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelector:selector_ - withObject:object_]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelector:selector + withObject:object]; }; //-------------------------------------------------------------------- --(void)makeObjectsPerformSelector:(SEL)selector_ - withObject:(id)object1_ - withObject:(id)object2_ +-(void)makeObjectsPerformSelector:(SEL)selector + withObject:(id)object1 + withObject:(id)object2 { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelector:selector_ - withObject:object1_ - withObject:object2_]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelector:selector + withObject:object1 + withObject:object2]; }; //-------------------------------------------------------------------- -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelectorIfPossible:aSelector]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelectorIfPossible:aSelector]; }; //-------------------------------------------------------------------- -(void)makeObjectsPerformIfPossible:(SEL)aSelector { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelectorIfPossible:aSelector]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelectorIfPossible:aSelector]; }; //-------------------------------------------------------------------- -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)object_ + withObject:(id)object { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelectorIfPossible:aSelector - withObject:object_]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelectorIfPossible:aSelector + withObject:object]; }; //-------------------------------------------------------------------- -(void)makeObjectsPerformIfPossible:(SEL)aSelector - withObject:(id)argument + withObject:(id)argument { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelectorIfPossible:aSelector - withObject:argument]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelectorIfPossible:aSelector + withObject:argument]; }; //-------------------------------------------------------------------- -(void)makeObjectsPerformSelectorIfPossible:(SEL)aSelector - withObject:(id)object1_ - withObject:(id)object2_ + withObject:(id)object1 + withObject:(id)object2 { - NSArray* _array=[self allValues]; - [_array makeObjectsPerformSelectorIfPossible:aSelector - withObject:object1_ - withObject:object2_]; + NSArray* array=[self allValues]; + [array makeObjectsPerformSelectorIfPossible:aSelector + withObject:object1 + withObject:object2]; }; @@ -1567,7 +1578,7 @@ NSString* GSWGetDefaultDocRoot() NSDictionary* gsweb=[userDefaults objectForKey:@"GSWeb"]; NSString* rootDoc=[gsweb objectForKey:@"rootDoc"]; if (!rootDoc) - rootDoc=[NSString stringWithString:@"/home/httpd/gsweb"]; + rootDoc=[NSString stringWithString:@"/home/httpd/gsweb"]; return rootDoc; }; @@ -1579,56 +1590,56 @@ NSString* DataToHexString(NSData* data) { unsigned int size=[data length]; if (size) - { - const unsigned char* pData=(const unsigned char*)[data bytes]; - if (pData) - { - NSMutableString* string=[[NSMutableString new] autorelease]; - int i=0; - for(i=0;i0) - { - const char* pString=(const char*)[[_string uppercaseString]cString]; - if (pString) - { - NSMutableData* data=[NSMutableData dataWithLength:size/2]; - unsigned char* pData=(unsigned char*)[data bytes]; - int i=0; - for(i=0;i='0' && pString[i*2]<='9') - pData[i]=(pString[i*2]-'0') << 4; - else if (pString[i*2]>='A' && pString[i*2]<='F') - pData[i]=(pString[i*2]-'A') << 4; - else - { - NSCAssert(NO,@"Bad hex String"); - }; - if (pString[i*2+1]>='0' && pString[i*2+1]<='9') - pData[i]=pData[i]|(pString[i*2+1]-'0'); - else if (pString[i*2+1]>='A' && pString[i*2+1]<='F') - pData[i]=pData[i]|(pString[i*2+1]-'A'); - else - { - NSCAssert(NO,@"Bad hex String"); - }; - }; - return data; - }; - }; + { + const char* pString=(const char*)[[string uppercaseString]cString]; + if (pString) + { + NSMutableData* data=[NSMutableData dataWithLength:size/2]; + unsigned char* pData=(unsigned char*)[data bytes]; + int i=0; + for(i=0;i='0' && pString[i*2]<='9') + pData[i]=(pString[i*2]-'0') << 4; + else if (pString[i*2]>='A' && pString[i*2]<='F') + pData[i]=(pString[i*2]-'A') << 4; + else + { + NSCAssert(NO,@"Bad hex String"); + }; + if (pString[i*2+1]>='0' && pString[i*2+1]<='9') + pData[i]=pData[i]|(pString[i*2+1]-'0'); + else if (pString[i*2+1]>='A' && pString[i*2+1]<='F') + pData[i]=pData[i]|(pString[i*2+1]-'A'); + else + { + NSCAssert(NO,@"Bad hex String"); + }; + }; + return data; + }; + }; return nil; }; @@ -1636,54 +1647,54 @@ NSData* HexStringToData(NSString* _string) @implementation NSDictionary (SBDictionary) //-------------------------------------------------------------------- --(id) objectForKey:(id)_key - withDefaultObject:(id)_default +-(id) objectForKey:(id)key + withDefaultObject:(id)defaultObject { - id object=[self objectForKey:_key]; + id object=[self objectForKey:key]; if (object) - return object; + return object; else - return _default; + return defaultObject; }; //-------------------------------------------------------------------- -+(id) dictionaryWithDictionary:(NSDictionary*)dictionary_ - andDefaultEntriesFromDictionary:(NSDictionary*)dictionaryDefaults_ ++(id) dictionaryWithDictionary:(NSDictionary*)dictionary + andDefaultEntriesFromDictionary:(NSDictionary*)dictionaryDefaults { - NSMutableDictionary* _dict=nil; - if (dictionary_) - { - _dict=[[dictionary_ mutableCopy]autorelease]; -// NSDebugFLog(@"_dict=%@",_dict); - [_dict addDefaultEntriesFromDictionary:dictionaryDefaults_]; -// NSDebugFLog(@"_dict=%@",_dict); - _dict=[NSDictionary dictionaryWithDictionary:_dict]; -// NSDebugFLog(@"_dict=%@",_dict); - } + NSMutableDictionary* dict=nil; + if (dictionary) + { + dict=[[dictionary mutableCopy]autorelease]; + //NSDebugFLog(@"_dict=%@",_dict); + [dict addDefaultEntriesFromDictionary:dictionaryDefaults]; + //NSDebugFLog(@"_dict=%@",_dict); + dict=[NSDictionary dictionaryWithDictionary:dict]; + //NSDebugFLog(@"_dict=%@",_dict); + } else - _dict=[NSDictionary dictionaryWithDictionary:dictionaryDefaults_]; -// NSDebugFLog(@"_dict=%@",_dict); - return _dict; + dict=[NSDictionary dictionaryWithDictionary:dictionaryDefaults]; + // NSDebugFLog(@"dict=%@",dict); + return dict; }; //-------------------------------------------------------------------- --(id)dictionaryBySettingObject:(id)object_ - forKey:(id)key_ +-(id)dictionaryBySettingObject:(id)object + forKey:(id)key { - NSMutableDictionary* _dict=[[self mutableCopy]autorelease]; - [_dict setObject:object_ - forKey:key_]; - _dict=[NSDictionary dictionaryWithDictionary:_dict]; - return _dict; + NSMutableDictionary* dict=[[self mutableCopy]autorelease]; + [dict setObject:object + forKey:key]; + dict=[NSDictionary dictionaryWithDictionary:dict]; + return dict; }; //-------------------------------------------------------------------- --(id)dictionaryByAddingEntriesFromDictionary:(NSDictionary*)dictionary_ +-(id)dictionaryByAddingEntriesFromDictionary:(NSDictionary*)dictionary { - NSMutableDictionary* _dict=[[self mutableCopy]autorelease]; - [_dict addEntriesFromDictionary:dictionary_]; - _dict=[NSDictionary dictionaryWithDictionary:_dict]; - return _dict; + NSMutableDictionary* dict=[[self mutableCopy]autorelease]; + [dict addEntriesFromDictionary:dictionary]; + dict=[NSDictionary dictionaryWithDictionary:dict]; + return dict; }; @end @@ -1692,22 +1703,22 @@ NSData* HexStringToData(NSString* _string) @implementation NSMutableDictionary (SBMutableDictionary) //-------------------------------------------------------------------- --(void)setDefaultObject:(id)object_ - forKey:(id)key_ +-(void)setDefaultObject:(id)object + forKey:(id)key { - if (![self objectForKey:key_]) - [self setObject:object_ - forKey:key_]; + if (![self objectForKey:key]) + [self setObject:object + forKey:key]; }; //-------------------------------------------------------------------- --(void)addDefaultEntriesFromDictionary:(NSDictionary*)dictionary_ +-(void)addDefaultEntriesFromDictionary:(NSDictionary*)dictionary { - id _key=nil; - NSEnumerator* _enum = [dictionary_ keyEnumerator]; - while ((_key = [_enum nextObject])) - [self setDefaultObject:[dictionary_ objectForKey:_key] - forKey:_key]; + id key=nil; + NSEnumerator* anEnum = [dictionary keyEnumerator]; + while ((key=[anEnum nextObject])) + [self setDefaultObject:[dictionary objectForKey:key] + forKey:key]; }; @end @@ -1719,15 +1730,15 @@ NSData* HexStringToData(NSString* _string) //-------------------------------------------------------------------- -(NSString*)stringGoodPath { - NSString* _good=[self stringByStandardizingPath]; - while([_good hasSuffix:@"/."]) - { - if ([_good length]>2) - _good=[_good stringWithoutSuffix:@"/."]; - else - _good=[NSString stringWithString:@"/"]; - }; - return _good; + NSString* good=[self stringByStandardizingPath]; + while([good hasSuffix:@"/."]) + { + if ([good length]>2) + good=[good stringWithoutSuffix:@"/."]; + else + good=[NSString stringWithString:@"/"]; + }; + return good; }; @end @@ -1738,15 +1749,15 @@ NSData* HexStringToData(NSString* _string) -(NSString*)description { return [NSString stringWithFormat:@"<%s %p - searchList:\n%@\n persDomains:\n%@\n tempDomains:\n%@\n changedDomains:\n%@\n dictionaryRep:\n%@\n defaultsDatabase:\n%@\n tickingTimer:\n%@\n>", - object_get_class_name(self), - (void*)self, - _searchList, - _persDomains, - _tempDomains, - _changedDomains, - _dictionaryRep, - _defaultsDatabase, - _tickingTimer]; + object_get_class_name(self), + (void*)self, + _searchList, + _persDomains, + _tempDomains, + _changedDomains, + _dictionaryRep, + _defaultsDatabase, + _tickingTimer]; }; @end @@ -1755,47 +1766,47 @@ NSData* HexStringToData(NSString* _string) @implementation NSDictionary (FromNSArray) //-------------------------------------------------------------------- -+(id)dictionaryWithArray:(NSArray*)array_ - onSelector:(SEL)sel_ ++(id)dictionaryWithArray:(NSArray*)array + onSelector:(SEL)sel { - NSMutableDictionary* _dict=[NSMutableDictionary dictionary]; - int _count=[array_ count]; + NSMutableDictionary* dict=[NSMutableDictionary dictionary]; + int count=[array count]; int i=0; - id _object=nil; - id _key=nil; - for(i=0;i<_count;i++) - { - //TODO optimiser - _object=[array_ objectAtIndex:i]; - _key=[_object performSelector:sel_]; - NSAssert1(_key,@"NSDictionary dictionaryWithArray: no key for object:%@",_object); - [_dict setObject:_object - forKey:_key]; - }; - return [self dictionaryWithDictionary:_dict]; + id object=nil; + id key=nil; + for(i=0;i_selfLength) - [NSException raise:NSInvalidArgumentException format:@"Bad Range (%d,%d) for self length %d", - aRange.location, - aRange.length, - _selfLength]; - else if (_aDataLength>0) - { - BOOL _reverse=((mask&NSBackwardsSearch)==NSBackwardsSearch); - BOOL _anchored=((mask&NSAnchoredSearch)==NSAnchoredSearch); - const void* _bytes=[self bytes]; - const void* _aDataBytes=[aData bytes]; - NSDebugFLog(@"_reverse=%d",(int)_reverse); - NSDebugFLog(@"_anchored=%d",(int)_anchored); - if (_anchored) - { - // Can be found ? - if (_aDataLength<=aRange.length) - { - if (_reverse) - { - NSDebugFLog(@"cmp at %d length %d", - aRange.location-_aDataLength, - _aDataLength); - if (memcmp(_bytes+aRange.location-_aDataLength, - _aDataBytes, - _aDataLength)==0) - { - NSDebugFLog0(@"FOUND"); - _range=NSMakeRange(_selfLength-_aDataLength,_aDataLength); - }; - } - else - { - NSDebugFLog(@"cmp at %d length %d", - aRange.location, - _aDataLength); - if (memcmp(_bytes+aRange.location, - _aDataBytes, - _aDataLength)) - { - NSDebugFLog0(@"FOUND"); - _range=NSMakeRange(0,_aDataLength); - }; - }; - }; - } - else - { - if (_reverse) - { - int i=0; - int _first=(aRange.location+_aDataLength); - NSDebugFLog(@"cmp at %d downto index: %d", - aRange.location+aRange.length-1, - _first); - for(i=aRange.location+aRange.length-1;i>=_first && _range.length==0;i--) - { - if (((unsigned char*)_bytes)[i]==((unsigned char*)_aDataBytes)[_aDataLength-1]) - { - NSDebugFLog(@"FOUND Last Char at %d",i); - if (memcmp(_bytes+i-_aDataLength,_aDataBytes,_aDataLength)==0) - { - _range=NSMakeRange(i-_aDataLength,_aDataLength); - NSDebugFLog(@"FOUND at %d",i-_aDataLength); - }; - }; - }; - } - else - { - int i=0; - int _last=aRange.location+aRange.length-_aDataLength; - NSDebugFLog(@"cmp at %d upto index: %d", - aRange.location, - _last); - for(i=aRange.location;i<=_last && _range.length==0;i++) - { - if (((unsigned char*)_bytes)[i]==((unsigned char*)_aDataBytes)[0]) - { - NSDebugFLog(@"FOUND First Char at %d",i); - if (memcmp(_bytes+i,_aDataBytes,_aDataLength)==0) - { - _range=NSMakeRange(i,_aDataLength); - NSDebugFLog(@"FOUND at %d",i); - }; - }; - }; - }; - }; - }; - } + { + int aDataLength=[aData length]; + int selfLength=[self length]; + NSDebugFLog(@"aDataLength=%d",aDataLength); + NSDebugFLog(@"selfLength=%d",selfLength); + if (aRange.location+aRange.length>selfLength) + [NSException raise:NSInvalidArgumentException format:@"Bad Range (%d,%d) for self length %d", + aRange.location, + aRange.length, + selfLength]; + else if (aDataLength>0) + { + BOOL reverse=((mask&NSBackwardsSearch)==NSBackwardsSearch); + BOOL anchored=((mask&NSAnchoredSearch)==NSAnchoredSearch); + const void* selfBytes=[self bytes]; + const void* aDataBytes=[aData bytes]; + NSDebugFLog(@"reverse=%d",(int)reverse); + NSDebugFLog(@"anchored=%d",(int)anchored); + if (anchored) + { + // Can be found ? + if (aDataLength<=aRange.length) + { + if (reverse) + { + NSDebugFLog(@"cmp at %d length %d", + aRange.location-aDataLength, + aDataLength); + if (memcmp(selfBytes+aRange.location-aDataLength, + aDataBytes, + aDataLength)==0) + { + NSDebugFLog0(@"FOUND"); + range=NSMakeRange(selfLength-aDataLength,aDataLength); + }; + } + else + { + NSDebugFLog(@"cmp at %d length %d", + aRange.location, + aDataLength); + if (memcmp(selfBytes+aRange.location, + aDataBytes, + aDataLength)) + { + NSDebugFLog0(@"FOUND"); + range=NSMakeRange(0,aDataLength); + }; + }; + }; + } + else + { + if (reverse) + { + int i=0; + int first=(aRange.location+aDataLength); + NSDebugFLog(@"cmp at %d downto index: %d", + aRange.location+aRange.length-1, + first); + for(i=aRange.location+aRange.length-1;i>=first && range.length==0;i--) + { + if (((unsigned char*)selfBytes)[i]==((unsigned char*)aDataBytes)[aDataLength-1]) + { + NSDebugFLog(@"FOUND Last Char at %d",i); + if (memcmp(selfBytes+i-aDataLength,aDataBytes,aDataLength)==0) + { + range=NSMakeRange(i-aDataLength,aDataLength); + NSDebugFLog(@"FOUND at %d",i-aDataLength); + }; + }; + }; + } + else + { + int i=0; + int last=aRange.location+aRange.length-aDataLength; + NSDebugFLog(@"cmp at %d upto index: %d", + aRange.location, + last); + for(i=aRange.location;i<=last && range.length==0;i++) + { + if (((unsigned char*)selfBytes)[i]==((unsigned char*)aDataBytes)[0]) + { + NSDebugFLog(@"FOUND First Char at %d",i); + if (memcmp(selfBytes+i,aDataBytes,aDataLength)==0) + { + range=NSMakeRange(i,aDataLength); + NSDebugFLog(@"FOUND at %d",i); + }; + }; + }; + }; + }; + }; + } else - [NSException raise:NSInvalidArgumentException format: @"range of nil"]; - return _range; + [NSException raise:NSInvalidArgumentException + format: @"range of nil"]; + return range; } //-------------------------------------------------------------------- --(NSArray*)componentsSeparatedByData:(NSData*)separator_ +-(NSArray*)componentsSeparatedByData:(NSData*)aSeparator { NSRange search, complete; NSRange found; NSData* tmpData=nil; NSMutableArray *array = [NSMutableArray array]; - NSDebugFLog(@"separator_ %@ length=%d",separator_,[separator_ length]); + NSDebugFLog(@"aSeparator %@ length=%d",aSeparator,[aSeparator length]); NSDebugFLog(@"self length=%d",[self length]); search=NSMakeRange(0, [self length]); complete=search; - found=[self rangeOfData:separator_]; + found=[self rangeOfData:aSeparator]; NSDebugFLog(@"found=(%u,%u)",found.location,found.length); while (found.length) { @@ -1993,7 +2005,7 @@ NSData* HexStringToData(NSString* _string) [array addObject:tmpData]; search = NSMakeRange (found.location + found.length, complete.length - found.location - found.length); - found = [self rangeOfData:separator_ + found = [self rangeOfData:aSeparator options: 0 range:search]; } @@ -2005,18 +2017,18 @@ NSData* HexStringToData(NSString* _string) }; //-------------------------------------------------------------------- --(NSData*)dataByDeletingFirstBytesCount:(unsigned int)bytesCount_ +-(NSData*)dataByDeletingFirstBytesCount:(unsigned int)bytesCount { NSMutableData* tmpdata=[self mutableCopy]; - [tmpdata deleteFirstBytesCount:bytesCount_]; + [tmpdata deleteFirstBytesCount:bytesCount]; return [NSData dataWithData:tmpdata]; }; //-------------------------------------------------------------------- --(NSData*)dataByDeletingLastBytesCount:(unsigned int)bytesCount_ +-(NSData*)dataByDeletingLastBytesCount:(unsigned int)bytesCount { NSMutableData* tmpdata=[self mutableCopy]; - [tmpdata deleteLastBytesCount:bytesCount_]; + [tmpdata deleteLastBytesCount:bytesCount]; return [NSData dataWithData:tmpdata]; }; @@ -2026,22 +2038,26 @@ NSData* HexStringToData(NSString* _string) @implementation NSMutableData (SBNSData) //-------------------------------------------------------------------- --(void)deleteFirstBytesCount:(unsigned int)bytesCount_ +-(void)deleteFirstBytesCount:(unsigned int)bytesCount { - void* _mutableBytes=NULL; - unsigned int _length=[self length]; - NSAssert2(_length>=bytesCount_,@"Can't delete %d first bytes from a data of length %d",bytesCount_,_length); - _mutableBytes=[self mutableBytes]; - memmove(_mutableBytes,_mutableBytes+bytesCount_,bytesCount_); - [self setLength:_length-bytesCount_]; + void* mutableBytes=NULL; + unsigned int length=[self length]; + NSAssert2(length>=bytesCount, + @"Can't delete %d first bytes from a data of length %d", + bytesCount,length); + mutableBytes=[self mutableBytes]; + memmove(mutableBytes,mutableBytes+bytesCount,bytesCount); + [self setLength:length-bytesCount]; }; //-------------------------------------------------------------------- --(void)deleteLastBytesCount:(unsigned int)bytesCount_; +-(void)deleteLastBytesCount:(unsigned int)bytesCount; { - unsigned int _length=[self length]; - NSAssert2(_length>=bytesCount_,@"Can't delete %d last bytes from a data of length %d",bytesCount_,_length); - [self setLength:_length-bytesCount_]; + unsigned int length=[self length]; + NSAssert2(length>=bytesCount, + @"Can't delete %d last bytes from a data of length %d", + bytesCount,length); + [self setLength:length-bytesCount]; }; @end @@ -2050,98 +2066,98 @@ NSData* HexStringToData(NSString* _string) @implementation NSFooNumberFormatter //-------------------------------------------------------------------- --(id)initType:(NSNumFmtType)type_ +-(id)initType:(NSNumFmtType)type { if ((self=[super init])) - { - type=type_; - }; + { + _type=type; + }; return self; }; //-------------------------------------------------------------------- -(NSString*)stringForObjectValue:(id)anObject { - NSString* _string=nil; + NSString* string=nil; if ([anObject isKindOfClass:[NSString class]]) - _string=anObject; + string=anObject; else if (anObject) - { - switch(type) - { - case NSNumFmtType__Int: - if ([anObject isKindOfClass:[NSNumber class]]) - { - int _value=[anObject intValue]; - _string=[NSString stringWithFormat:@"%d",_value]; - } - else if ([anObject respondsToSelector:@selector(intValue)]) - { - int _value=[anObject intValue]; - _string=[NSString stringWithFormat:@"%d",_value]; - } - else if ([anObject respondsToSelector:@selector(floatValue)]) - { - int _value=(int)[anObject floatValue]; - _string=[NSString stringWithFormat:@"%d",_value]; - } - else if ([anObject respondsToSelector:@selector(doubleValue)]) - { - int _value=(int)[anObject doubleValue]; - _string=[NSString stringWithFormat:@"%d",_value]; - } - else - { - LOGSeriousError(@"Can't convert %@ of class %@ to string", - anObject, - [anObject class]); - _string=@"***"; - }; - break; - case NSNumFmtType__Float: - if ([anObject isKindOfClass:[NSNumber class]]) - { - double _value=[anObject doubleValue]; - _string=[NSString stringWithFormat:@"%.2f",_value]; - } - else if ([anObject respondsToSelector:@selector(intValue)]) - { - int _value=[anObject intValue]; - _string=[NSString stringWithFormat:@"%d.00",_value]; - } - else if ([anObject respondsToSelector:@selector(floatValue)]) - { - double _value=(double)[anObject floatValue]; - _string=[NSString stringWithFormat:@"%.2f",_value]; - } - else if ([anObject respondsToSelector:@selector(doubleValue)]) - { - double _value=[anObject doubleValue]; - _string=[NSString stringWithFormat:@"%.2f",_value]; - } - else - { - LOGSeriousError(@"Can't convert %@ of class %@ to string", - anObject, - [anObject class]); - _string=@"***"; - }; - break; - case NSNumFmtType__Unknown: - default: - LOGSeriousError(@"Unknown type %d to convert %@ to string", - (int)type, - anObject); - _string=@"***"; - break; - }; - }; - return _string; + { + switch(_type) + { + case NSNumFmtType__Int: + if ([anObject isKindOfClass:[NSNumber class]]) + { + int value=[anObject intValue]; + string=[NSString stringWithFormat:@"%d",value]; + } + else if ([anObject respondsToSelector:@selector(intValue)]) + { + int value=[anObject intValue]; + string=[NSString stringWithFormat:@"%d",value]; + } + else if ([anObject respondsToSelector:@selector(floatValue)]) + { + int value=(int)[anObject floatValue]; + string=[NSString stringWithFormat:@"%d",value]; + } + else if ([anObject respondsToSelector:@selector(doubleValue)]) + { + int value=(int)[anObject doubleValue]; + string=[NSString stringWithFormat:@"%d",value]; + } + else + { + LOGSeriousError(@"Can't convert %@ of class %@ to string", + anObject, + [anObject class]); + string=@"***"; + }; + break; + case NSNumFmtType__Float: + if ([anObject isKindOfClass:[NSNumber class]]) + { + double value=[anObject doubleValue]; + string=[NSString stringWithFormat:@"%.2f",value]; + } + else if ([anObject respondsToSelector:@selector(intValue)]) + { + int value=[anObject intValue]; + string=[NSString stringWithFormat:@"%d.00",value]; + } + else if ([anObject respondsToSelector:@selector(floatValue)]) + { + double value=(double)[anObject floatValue]; + string=[NSString stringWithFormat:@"%.2f",value]; + } + else if ([anObject respondsToSelector:@selector(doubleValue)]) + { + double value=[anObject doubleValue]; + string=[NSString stringWithFormat:@"%.2f",value]; + } + else + { + LOGSeriousError(@"Can't convert %@ of class %@ to string", + anObject, + [anObject class]); + string=@"***"; + }; + break; + case NSNumFmtType__Unknown: + default: + LOGSeriousError(@"Unknown type %d to convert %@ to string", + (int)type, + anObject); + string=@"***"; + break; + }; + }; + return string; }; //-------------------------------------------------------------------- -(BOOL)getObjectValue:(id*)anObject - forString:(NSString*)string + forString:(NSString*)string errorDescription:(NSString**)error { BOOL ok=NO; @@ -2149,24 +2165,24 @@ NSData* HexStringToData(NSString* _string) NSAssert(error,@"No error* to return"); *anObject=nil; *error=nil; - switch(type) - { - case NSNumFmtType__Int: - *anObject=[NSNumber numberWithInt:[string intValue]]; - ok=YES; - break; - case NSNumFmtType__Float: - *anObject=[NSNumber numberWithFloat:[string floatValue]]; - ok=YES; - break; - case NSNumFmtType__Unknown: - default: - LOGSeriousError(@"Unknown type %d to convert from string %@", - (int)type, - string); - *error = @"Unknown type"; - break; - }; + switch(_type) + { + case NSNumFmtType__Int: + *anObject=[NSNumber numberWithInt:[string intValue]]; + ok=YES; + break; + case NSNumFmtType__Float: + *anObject=[NSNumber numberWithFloat:[string floatValue]]; + ok=YES; + break; + case NSNumFmtType__Unknown: + default: + LOGSeriousError(@"Unknown type %d to convert from string %@", + (int)_type, + string); + *error = @"Unknown type"; + break; + }; return ok; }; diff --git a/GSWeb.framework/GSWWOCompatibility.h b/GSWeb.framework/GSWWOCompatibility.h index a5b0600..66f74d5 100644 --- a/GSWeb.framework/GSWWOCompatibility.h +++ b/GSWeb.framework/GSWWOCompatibility.h @@ -1,11 +1,16 @@ -/* GSWWOCompatibility.h - GSWeb: GSWWOCompatibility - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Dec 2000 +/** GSWWOCompatibility.h - GSWeb: GSWWOCompatibility + + Copyright (C) 2000-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Dec 2000 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ diff --git a/GSWeb.framework/GSWWOCompatibility.m b/GSWeb.framework/GSWWOCompatibility.m index 2cd10c1..48cdd75 100644 --- a/GSWeb.framework/GSWWOCompatibility.m +++ b/GSWeb.framework/GSWWOCompatibility.m @@ -1,11 +1,16 @@ -/* GSWWOCompatibility.m - GSWeb: GSWWOCompatibility - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon - Date: Dec 2000 +/** GSWWOCompatibility.m - GSWeb: GSWWOCompatibility + + Copyright (C) 2000-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon + Date: Dec 2000 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; #include diff --git a/GSWeb.framework/GSWeb.h b/GSWeb.framework/GSWeb.h index afe5482..2e4731e 100644 --- a/GSWeb.framework/GSWeb.h +++ b/GSWeb.framework/GSWeb.h @@ -1,11 +1,18 @@ -/* GSWeb.h - GSWeb - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWeb.h - GSWeb + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + + + This file is part of the GNUstep Web 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 @@ -19,7 +26,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ diff --git a/GSWeb.framework/GSWeb.m b/GSWeb.framework/GSWeb.m index bdb1ba9..14784a1 100644 --- a/GSWeb.framework/GSWeb.m +++ b/GSWeb.framework/GSWeb.m @@ -1,11 +1,18 @@ -/* GSWeb.m - GSWeb - Copyright (C) 1999 Free Software Foundation, Inc. +/** GSWeb.m - GSWeb + + Copyright (C) 1999-2002 Free Software Foundation, Inc. - Written by: Manuel Guesdon - Date: Jan 1999 + Written by: Manuel Guesdon + Date: Jan 1999 + $Revision$ + $Date$ + + + This file is part of the GNUstep Web 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 @@ -19,7 +26,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; diff --git a/GSWeb.framework/NSNonBlockingFileHandle.h b/GSWeb.framework/NSNonBlockingFileHandle.h index 9d8a50b..edd074c 100644 --- a/GSWeb.framework/NSNonBlockingFileHandle.h +++ b/GSWeb.framework/NSNonBlockingFileHandle.h @@ -1,11 +1,16 @@ -/* NSNonBlockingFileHandle.h - NSNonBlockingFileHandle - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSNonBlockingFileHandle.h - GSWeb: NSNonBlockingFileHandle + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ diff --git a/GSWeb.framework/NSNonBlockingFileHandle.m b/GSWeb.framework/NSNonBlockingFileHandle.m index 2a3a75b..4f3472b 100644 --- a/GSWeb.framework/NSNonBlockingFileHandle.m +++ b/GSWeb.framework/NSNonBlockingFileHandle.m @@ -1,11 +1,16 @@ -/* NSNonBlockingFileHandle.m - NSNonBlockingFileHandle - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSNonBlockingFileHandle.m - GSWeb: NSNonBlockingFileHandle + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ #include #include @@ -53,11 +59,11 @@ // Does not block if there is no data; returns nil instead. -(NSData*)availableDataNonBlocking { - NSData* _data=nil; + NSData* data=nil; LOGObjectFnStart(); - _data=[self readDataOfLengthNonBlocking: UINT_MAX]; + data=[self readDataOfLengthNonBlocking: UINT_MAX]; LOGObjectFnStop(); - return _data; + return data; }; // Returns an NSData object containing all of the currently available data. @@ -65,26 +71,26 @@ // Cover for #{-availableDataNonBlocking}. -(NSData*)readDataToEndOfFileNonBlocking { - NSData* _data=nil; + NSData* data=nil; LOGObjectFnStart(); - _data=[self readDataOfLengthNonBlocking: UINT_MAX]; + data=[self readDataOfLengthNonBlocking: UINT_MAX]; LOGObjectFnStop(); - return _data; + return data; }; -(unsigned int)_availableByteCountNonBlocking { - int numBytes; + int numBytes=0; int fd = 0; LOGObjectFnStart(); fd=[self fileDescriptor]; - if(ioctl(fd, FIONREAD, (char *) &numBytes) == -1) - { - LOGException0(@"NSFileHandleOperationException ioctl() Err"); - [NSException raise: NSFileHandleOperationException - format: @"ioctl() Err # %d", (int)errno]; - }; + if (ioctl(fd, FIONREAD, (char *) &numBytes) == -1) + { + LOGException0(@"NSFileHandleOperationException ioctl() Err"); + [NSException raise: NSFileHandleOperationException + format: @"ioctl() Err # %d", (int)errno]; + }; LOGObjectFnStop(); return numBytes; }; @@ -94,7 +100,7 @@ -(NSData*)readDataOfLengthNonBlocking:(unsigned int)length { NSData* data=nil; - unsigned int readLength; + unsigned int readLength=0; LOGObjectFnStart(); readLength = [self _availableByteCountNonBlocking]; diff --git a/GSWeb.framework/NSString+HTML.h b/GSWeb.framework/NSString+HTML.h index 39945c9..ea86d01 100644 --- a/GSWeb.framework/NSString+HTML.h +++ b/GSWeb.framework/NSString+HTML.h @@ -1,11 +1,16 @@ -/* NSString+HTML.h - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSString+HTML.h - GSWeb: NSString / HTML + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -31,13 +37,13 @@ -(NSString*)htmlPlus2Space; -(NSString*)decodeURL; -(NSString*)encodeURL; --(NSString*)encodeURLWithValid:(NSString*)_valid; +-(NSString*)encodeURLWithValid:(NSString*)valid; -(NSDictionary*)dictionaryQueryString; --(NSDictionary*)dictionaryWithSep1:(NSString*)p_pstrSep1 - withSep2:(NSString*)p_pstrSep2 - withOptionUnescape:(BOOL)_unescape; --(BOOL)ismapCoordx:(int*)x_ - y:(int*)y_; +-(NSDictionary*)dictionaryWithSep1:(NSString*)sep1 + withSep2:(NSString*)sep2 + withOptionUnescape:(BOOL)unescape; +-(BOOL)ismapCoordx:(int*)x + y:(int*)y; -(NSString*)stringByEscapingHTMLString; -(NSString*)stringByEscapingHTMLAttributeValue; -(NSString*)stringByConvertingToHTMLEntities; diff --git a/GSWeb.framework/NSString+HTML.m b/GSWeb.framework/NSString+HTML.m index 8254b79..eaa8a4d 100644 --- a/GSWeb.framework/NSString+HTML.m +++ b/GSWeb.framework/NSString+HTML.m @@ -1,11 +1,16 @@ -/* NSString+HTML.m - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSString+HTML.m - GSWeb: NSString / HTML + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -136,59 +142,59 @@ static NSArray* htmlChars=nil; void initHtmlChars() { if (!normalChars) - { - normalChars=[[NSArray arrayWithObjects: - @"&", - @">", - @"<", - @"\"", - @"£", - @"|", - @"°", - @"é", - @"ç", - @"à", - @"â", - @"ã", - @"è", - @"ê", - @"ì", - @"î", - @"ñ", - @"ô", - @"õ", - @"ù", - @"û", - nil - ] retain]; - }; + { + normalChars=[[NSArray arrayWithObjects: + @"&", + @">", + @"<", + @"\"", + @"£", + @"|", + @"°", + @"é", + @"ç", + @"à", + @"â", + @"ã", + @"è", + @"ê", + @"ì", + @"î", + @"ñ", + @"ô", + @"õ", + @"ù", + @"û", + nil + ] retain]; + }; if (!htmlChars) - { - htmlChars=[[NSArray arrayWithObjects: - @"&", - @">", - @"<", - @""", - @"£", - @"¦", - @"°", - @"é", - @"ç", - @"à", - @"â", - @"ã", - @"è", - @"ê", - @"ì", - @"î", - @"ñ", - @"ô", - @"õ", - @"ù", - @"û", - nil - ] retain]; - }; + { + htmlChars=[[NSArray arrayWithObjects: + @"&", + @">", + @"<", + @""", + @"£", + @"¦", + @"°", + @"é", + @"ç", + @"à", + @"â", + @"ã", + @"è", + @"ê", + @"ì", + @"î", + @"ñ", + @"ô", + @"õ", + @"ù", + @"û", + nil + ] retain]; + }; }; //==================================================================== @@ -198,7 +204,7 @@ void initHtmlChars() -(NSString*)htmlPlus2Space { return [self stringByReplacingString:@"+" - withString:@" "]; + withString:@" "]; }; //-------------------------------------------------------------------- @@ -211,46 +217,46 @@ void initHtmlChars() -(NSString*)decodeURL { //TODO speed - unichar* _unichars=NULL; - unichar _uniChar=0; - NSString* _void=nil; + unichar* unichars=NULL; + unichar uniChar=0; + NSString* voidString=nil; NSString* temp=nil; const char* p=NULL; int uniCharsIndex=0; NSDebugMLLog(@"low",@"self=%@",self); - _void=[self htmlPlus2Space]; - NSDebugMLLog(@"low",@"_void=%@",_void); - _unichars=_fastMallocBuffer(sizeof(unichar)*([_void length]+1)); - NSDebugMLLog(@"low",@"[_void cString]=%s",[_void cString]); - for (p=[_void cString];p && *p;p++) + voidString=[self htmlPlus2Space]; + NSDebugMLLog(@"low",@"voidString=%@",voidString); + unichars=_fastMallocBuffer(sizeof(unichar)*([voidString length]+1)); + NSDebugMLLog(@"low",@"[voidString cString]=%s",[voidString cString]); + for (p=[voidString cString];p && *p;p++) { - if (*p == '%') + if (*p == '%') { - // - // 2 hex digits follow... - // - int i=0; - _uniChar=0; - for (i=0;p[1] && i<2;i++) + // + // 2 hex digits follow... + // + int i=0; + uniChar=0; + for (i=0;p[1] && i<2;i++) { - p++; - NSDebugMLLog(@"low",@"*p=%c %u",(char)*p,(unsigned int)*p); - _uniChar <<= 4; - NSDebugMLLog(@"low",@"_uniChar=%x",(unsigned int)_uniChar); - if (isdigit(*p)) - _uniChar+=*p-'0'; - else - _uniChar+=toupper(*p)-'A'+10; - NSDebugMLLog(@"low",@"_uniChar=%x",(unsigned int)_uniChar); + p++; + NSDebugMLLog(@"low",@"*p=%c %u",(char)*p,(unsigned int)*p); + uniChar <<= 4; + NSDebugMLLog(@"low",@"uniChar=%x",(unsigned int)uniChar); + if (isdigit(*p)) + uniChar+=*p-'0'; + else + uniChar+=toupper(*p)-'A'+10; + NSDebugMLLog(@"low",@"uniChar=%x",(unsigned int)uniChar); }; } - else - _uniChar=(unsigned char)*p; - _unichars[uniCharsIndex]=_uniChar; - uniCharsIndex++; + else + uniChar=(unsigned char)*p; + unichars[uniCharsIndex]=uniChar; + uniCharsIndex++; }; - temp=[NSString stringWithCharacters:_unichars - length:uniCharsIndex]; + temp=[NSString stringWithCharacters:unichars + length:uniCharsIndex]; NSDebugMLLog(@"low",@"temp=%@",temp); NSDebugMLLog(@"low",@"temp data=%@",[temp dataUsingEncoding:NSISOLatin1StringEncoding]); return temp; @@ -270,120 +276,121 @@ void initHtmlChars() }; //-------------------------------------------------------------------- --(NSString*)encodeURLWithValid:(NSString*)_valid +-(NSString*)encodeURLWithValid:(NSString*)validString { NSMutableString* temp=[NSMutableString stringWithCapacity:[self length]]; const char* p=NULL; - const char* valid=[_valid cString]; + const char* valid=[validString cString]; static char *digits = "0123456789ABCDEF"; for (p =[self cString]; p && *p; p++) { - if (isdigit(*p) || isalpha(*p) || (valid && strchr(valid, *p))) - [temp appendFormat:@"%c",*p]; - else - [temp appendFormat:@"%%%c%c",digits[(*p >> 4) & 0x0f],digits[*p & 0x0f]]; + if (isdigit(*p) || isalpha(*p) || (valid && strchr(valid, *p))) + [temp appendFormat:@"%c",*p]; + else + [temp appendFormat:@"%%%c%c",digits[(*p >> 4) & 0x0f],digits[*p & 0x0f]]; }; - return [NSString stringWithString:temp]; + return [NSString stringWithString:temp]; } //-------------------------------------------------------------------- -(NSDictionary*)dictionaryQueryString { return [self dictionaryWithSep1:@"&" - withSep2:@"=" - withOptionUnescape:YES]; + withSep2:@"=" + withOptionUnescape:YES]; }; //-------------------------------------------------------------------- --(NSDictionary*)dictionaryWithSep1:(NSString*)p_pstrSep1 - withSep2:(NSString*)p_pstrSep2 - withOptionUnescape:(BOOL)_unescape +-(NSDictionary*)dictionaryWithSep1:(NSString*)sep1 + withSep2:(NSString*)sep2 + withOptionUnescape:(BOOL)unescape { - NSMutableDictionary* pDico=nil; - if ([self length]>0) - { - NSArray* listItems = [self componentsSeparatedByString:p_pstrSep1]; - int iCount=0; - pDico=[NSMutableDictionary dictionary]; - for(iCount=0;iCount<[listItems count];iCount++) - { - if ([[listItems objectAtIndex:iCount] length]>0) - { - NSArray* listParam = [[listItems objectAtIndex:iCount] componentsSeparatedByString:p_pstrSep2]; - id key=nil; - id value=nil; - if ([listParam count]==1) - { - key=[listParam objectAtIndex:0]; - if (_unescape) - key=[key decodeURL]; - } - else if ([listParam count]==2) - { - key=[listParam objectAtIndex:0]; - value=[listParam objectAtIndex:1]; - if (_unescape) - { - key=[key decodeURL]; - value=[value decodeURL]; - }; - }; - if (key) - { - id newValue=nil; - id prevValue=[pDico objectForKey:key]; - if (!value) - value=[NSString string]; - if (prevValue) - newValue=[prevValue arrayByAddingObject:value]; - else - newValue=[NSArray arrayWithObject:value]; - [pDico setObject:newValue - forKey: key]; - }; - }; - }; - pDico=[NSDictionary dictionaryWithDictionary:pDico]; - }; - return pDico; + NSMutableDictionary* pDico=nil; + if ([self length]>0) + { + NSArray* listItems = [self componentsSeparatedByString:sep1]; + int iCount=0; + pDico=(NSMutableDictionary*)[NSMutableDictionary dictionary]; + for(iCount=0;iCount<[listItems count];iCount++) + { + if ([[listItems objectAtIndex:iCount] length]>0) + { + NSArray* listParam = [[listItems objectAtIndex:iCount] componentsSeparatedByString:sep2]; + id key=nil; + id value=nil; + if ([listParam count]==1) + { + key=[listParam objectAtIndex:0]; + if (unescape) + key=[key decodeURL]; + } + else if ([listParam count]==2) + { + key=[listParam objectAtIndex:0]; + value=[listParam objectAtIndex:1]; + if (unescape) + { + key=[key decodeURL]; + value=[value decodeURL]; + }; + }; + if (key) + { + id newValue=nil; + id prevValue=[pDico objectForKey:key]; + if (!value) + value=[NSString string]; + if (prevValue) + newValue=[prevValue arrayByAddingObject:value]; + else + newValue=[NSArray arrayWithObject:value]; + [pDico setObject:newValue + forKey: key]; + }; + }; + }; + pDico=[NSDictionary dictionaryWithDictionary:pDico]; + }; + return pDico; }; //-------------------------------------------------------------------- --(BOOL)ismapCoordx:(int*)x_ - y:(int*)y_ +-(BOOL)ismapCoordx:(int*)x + y:(int*)y { - BOOL _ok=NO; - NSScanner* _scanner=[NSScanner scannerWithString:self]; - if ([_scanner scanInt:x_]) - { - if (x_) - { - NSDebugMLLog(@"low",@"x=%d",*x_); - }; - if ([_scanner scanString:@"," intoString:NULL]) - { - if ([_scanner scanInt:y_]) - { - if (y_) - { - NSDebugMLLog(@"low",@"y=%d",*y_); - }; - NSDebugMLLog(@"low",@"[_scanner isAtEnd]=%d",(int)[_scanner isAtEnd]); - if ([_scanner isAtEnd]) - { - _ok=YES; - }; - }; - }; - }; - if (!_ok) - { - if (x_) - *x_=INT_MAX; - if (y_) - *y_=INT_MAX; - }; - return _ok; + BOOL ok=NO; + NSScanner* scanner=[NSScanner scannerWithString:self]; + if ([scanner scanInt:x]) + { + if (x) + { + NSDebugMLLog(@"low",@"x=%d",*x); + }; + if ([scanner scanString:@"," + intoString:NULL]) + { + if ([scanner scanInt:y]) + { + if (y) + { + NSDebugMLLog(@"low",@"y=%d",*y); + }; + NSDebugMLLog(@"low",@"[scanner isAtEnd]=%d",(int)[scanner isAtEnd]); + if ([scanner isAtEnd]) + { + ok=YES; + }; + }; + }; + }; + if (!ok) + { + if (x) + *x=INT_MAX; + if (y) + *y=INT_MAX; + }; + return ok; }; //-------------------------------------------------------------------- @@ -392,15 +399,15 @@ void initHtmlChars() //TODO speed NSString* str=nil; if ([self length]>0) - { - NSMutableString* tmp=[self mutableCopy]; - [tmp replaceString:@"&" withString:@"&"]; - [tmp replaceString:@"\"" withString:@"""]; - [tmp replaceString:@"<" withString:@"<"]; - [tmp replaceString:@">" withString:@">"]; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + NSMutableString* tmp=[self mutableCopy]; + [tmp replaceString:@"&" withString:@"&"]; + [tmp replaceString:@"\"" withString:@"""]; + [tmp replaceString:@"<" withString:@"<"]; + [tmp replaceString:@">" withString:@">"]; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; @@ -410,18 +417,18 @@ void initHtmlChars() //TODO speed NSString* str=nil; if ([self length]>0) - { - NSMutableString* tmp=[self mutableCopy]; - [tmp replaceString:@"&" withString:@"&"]; - [tmp replaceString:@"\"" withString:@"""]; - [tmp replaceString:@"<" withString:@"<"]; - [tmp replaceString:@">" withString:@">"]; - [tmp replaceString:@"\t" withString:@" "]; - [tmp replaceString:@"\n" withString:@" "]; - [tmp replaceString:@"\r" withString:@" "]; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + NSMutableString* tmp=[self mutableCopy]; + [tmp replaceString:@"&" withString:@"&"]; + [tmp replaceString:@"\"" withString:@"""]; + [tmp replaceString:@"<" withString:@"<"]; + [tmp replaceString:@">" withString:@">"]; + [tmp replaceString:@"\t" withString:@" "]; + [tmp replaceString:@"\n" withString:@" "]; + [tmp replaceString:@"\r" withString:@" "]; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; @@ -431,19 +438,19 @@ void initHtmlChars() //TODO speed NSString* str=nil; if ([self length]>0) - { - int i=0; - NSMutableString* tmp=[self mutableCopy]; - if (!normalChars) - initHtmlChars(); - for(i=0;i<[normalChars count];i++) - { - [tmp replaceString:[normalChars objectAtIndex:i] - withString:[htmlChars objectAtIndex:i]]; - }; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + int i=0; + NSMutableString* tmp=[self mutableCopy]; + if (!normalChars) + initHtmlChars(); + for(i=0;i<[normalChars count];i++) + { + [tmp replaceString:[normalChars objectAtIndex:i] + withString:[htmlChars objectAtIndex:i]]; + }; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; @@ -452,19 +459,19 @@ void initHtmlChars() { NSString* str=nil; if ([self length]>0) - { - int i=0; - NSMutableString* tmp=[self mutableCopy]; - if (!normalChars) - initHtmlChars(); - for(i=0;i<[normalChars count];i++) - { - [tmp replaceString:[htmlChars objectAtIndex:i] - withString:[normalChars objectAtIndex:i]]; - }; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + int i=0; + NSMutableString* tmp=[self mutableCopy]; + if (!normalChars) + initHtmlChars(); + for(i=0;i<[normalChars count];i++) + { + [tmp replaceString:[htmlChars objectAtIndex:i] + withString:[normalChars objectAtIndex:i]]; + }; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; @@ -473,15 +480,15 @@ void initHtmlChars() { NSString* str=nil; if ([self length]>0) - { - //TODO speed - NSMutableString* tmp=[[self stringByConvertingToHTMLEntities] mutableCopy]; - [tmp replaceString:@"\r\n" withString:@"
"]; - [tmp replaceString:@"\r" withString:@"
"]; - [tmp replaceString:@"\n" withString:@"
"]; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + //TODO speed + NSMutableString* tmp=[[self stringByConvertingToHTMLEntities] mutableCopy]; + [tmp replaceString:@"\r\n" withString:@"
"]; + [tmp replaceString:@"\r" withString:@"
"]; + [tmp replaceString:@"\n" withString:@"
"]; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; @@ -490,13 +497,13 @@ void initHtmlChars() { NSString* str=nil; if ([self length]>0) - { - //TODO speed - NSMutableString* tmp=[[self stringByConvertingFromHTMLEntities] mutableCopy]; - [tmp replaceString:@"
" withString:@"\n"]; - str = AUTORELEASE([tmp copy]); - RELEASE(tmp); - }; + { + //TODO speed + NSMutableString* tmp=[[self stringByConvertingFromHTMLEntities] mutableCopy]; + [tmp replaceString:@"
" withString:@"\n"]; + str = AUTORELEASE([tmp copy]); + RELEASE(tmp); + }; return str; }; diff --git a/GSWeb.framework/NSString+Trimming.h b/GSWeb.framework/NSString+Trimming.h index f49c696..7489585 100644 --- a/GSWeb.framework/NSString+Trimming.h +++ b/GSWeb.framework/NSString+Trimming.h @@ -1,11 +1,16 @@ -/* NSString+Trimming.h - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSString+Trimming.h - GSWeb: Class NSString with Trimming + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ // $Id$ @@ -32,17 +38,17 @@ -(BOOL)isAFloatNumber; -(BOOL)isAnIntegerNumber; #ifdef LONG_LONG_MAX --(BOOL)isAnIntegerNumberWithMin:(long long)min_ - max:(long long)max_; +-(BOOL)isAnIntegerNumberWithMin:(long long)min + max:(long long)max; #else --(BOOL)isAnIntegerNumberWithMin:(long)min_ - max:(long)max_; +-(BOOL)isAnIntegerNumberWithMin:(long)min + max:(long)max; #endif -(BOOL)isAnUnsignedIntegerNumber; #ifdef LONG_LONG_MAX --(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max_; +-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max; #else --(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max_; +-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max; #endif -(BOOL)isStartingWithNumber; -(long)longValue; @@ -53,37 +59,37 @@ //==================================================================== @interface NSString (UniqueIdString) -+(NSString*)stringUniqueIdWithLength:(int)_lentgh; ++(NSString*)stringUniqueIdWithLength:(int)length; @end //==================================================================== @interface NSString (stringWithObject) -+(NSString*)stringWithObject:(id)object_; ++(NSString*)stringWithObject:(id)object; @end //==================================================================== @interface NSString (uniqueFileName) -+(NSString*)stringForUniqueFilenameInDirectory:(NSString*)directory_ - withPrefix:(NSString*)prefix_ - withSuffix:(NSString*)suffix_; ++(NSString*)stringForUniqueFilenameInDirectory:(NSString*)directory + withPrefix:(NSString*)prefix + withSuffix:(NSString*)suffix; @end //==================================================================== @interface NSString (Qutotes) --(BOOL)hasPrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_; --(NSString*)stringWithoutPrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_; --(BOOL)isQuotedWith:(NSString*)quote_; --(NSString*)stringWithoutQuote:(NSString*)quote_; +-(BOOL)hasPrefix:(NSString*)prefix + andSuffix:(NSString*)suffix; +-(NSString*)stringWithoutPrefix:(NSString*)prefix + andSuffix:(NSString*)suffix; +-(BOOL)isQuotedWith:(NSString*)quote; +-(NSString*)stringWithoutQuote:(NSString*)quote; @end //==================================================================== @interface NSMutableString (Qutotes) --(void)removePrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_; --(void)removeQuote:(NSString*)quote_; +-(void)removePrefix:(NSString*)prefix + andSuffix:(NSString*)suffix; +-(void)removeQuote:(NSString*)quote; @end #endif //_NSString_Trimming_h__ diff --git a/GSWeb.framework/NSString+Trimming.m b/GSWeb.framework/NSString+Trimming.m index 705e55c..2924cfc 100644 --- a/GSWeb.framework/NSString+Trimming.m +++ b/GSWeb.framework/NSString+Trimming.m @@ -1,11 +1,16 @@ -/* NSString+Trimming.m - Copyright (C) 1999 Free Software Foundation, Inc. - - Written by: Manuel Guesdon +/** NSString+Trimming.m - GSWeb: Class NSString with Trimming + + Copyright (C) 1999-2002 Free Software Foundation, Inc. + + Written by: Manuel Guesdon Date: Jan 1999 + $Revision$ + $Date$ + This file is part of the GNUstep Web 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 @@ -19,7 +24,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ + +**/ static char rcsId[] = "$Id$"; @@ -40,7 +46,7 @@ static char rcsId[] = "$Id$"; //TODOV NSRange nonNumberRange; NSMutableCharacterSet* nonNumberCS=[[NSCharacterSet decimalDigitCharacterSet] - mutableCopy]; + mutableCopy]; [nonNumberCS addCharactersInString:@".Ee-+"]; [nonNumberCS invert]; nonNumberRange = [self rangeOfCharacterFromSet:nonNumberCS]; @@ -53,7 +59,7 @@ static char rcsId[] = "$Id$"; //TODOV NSRange nonNumberRange; NSMutableCharacterSet* nonNumberCS=[[NSCharacterSet decimalDigitCharacterSet] - mutableCopy]; + mutableCopy]; [nonNumberCS addCharactersInString:@".-+"]; [nonNumberCS invert]; nonNumberRange = [self rangeOfCharacterFromSet:nonNumberCS]; @@ -62,24 +68,24 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- #ifdef LONG_LONG_MAX --(BOOL)isAnIntegerNumberWithMin:(long long)min_ - max:(long long)max_ +-(BOOL)isAnIntegerNumberWithMin:(long long)min + max:(long long)max #else --(BOOL)isAnIntegerNumberWithMin:(long)min_ - max:(long)max_ +-(BOOL)isAnIntegerNumberWithMin:(long)min + max:(long)max #endif { if ([self isAnIntegerNumber]) - { - //TODO - long _v=[self longValue]; - if (_v>=min_ && _v<=max_) - return YES; - else - return NO; - } + { + //TODO + long v=[self longValue]; + if (v>=min && v<=max) + return YES; + else + return NO; + } else - return NO; + return NO; }; //-------------------------------------------------------------------- @@ -88,7 +94,7 @@ static char rcsId[] = "$Id$"; //TODOV NSRange nonNumberRange; NSMutableCharacterSet* nonNumberCS=[[NSCharacterSet decimalDigitCharacterSet] - mutableCopy]; + mutableCopy]; [nonNumberCS addCharactersInString:@".+"]; [nonNumberCS invert]; nonNumberRange = [self rangeOfCharacterFromSet:nonNumberCS]; @@ -97,22 +103,22 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- #ifdef LONG_LONG_MAX --(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max_ +-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long long)max #else --(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max_ +-(BOOL)isAnUnsignedIntegerNumberWithMax:(unsigned long)max #endif { if ([self isAnUnsignedIntegerNumber]) - { - //TODO - unsigned long _v=[self ulongValue]; - if (_v<=max_) - return YES; - else - return NO; - } + { + //TODO + unsigned long v=[self ulongValue]; + if (v<=max) + return YES; + else + return NO; + } else - return NO; + return NO; }; //-------------------------------------------------------------------- @@ -121,7 +127,7 @@ static char rcsId[] = "$Id$"; //TODOV NSRange numberRange; NSMutableCharacterSet* numberCS=[[NSCharacterSet decimalDigitCharacterSet] - mutableCopy]; + mutableCopy]; [numberCS addCharactersInString:@".-+"]; numberRange = [self rangeOfCharacterFromSet:numberCS]; return (numberRange.location==0 && numberRange.length>0); @@ -142,10 +148,10 @@ static char rcsId[] = "$Id$"; //-------------------------------------------------------------------- -(long long)longLongValue { - long long _v=0; - NSScanner* _scanner = [NSScanner scannerWithString:self]; - [_scanner scanLongLong:&_v]; - return _v; + long long v=0; + NSScanner* scanner = [NSScanner scannerWithString:self]; + [scanner scanLongLong:&v]; + return v; } @end @@ -153,7 +159,7 @@ static char rcsId[] = "$Id$"; //==================================================================== @implementation NSString (UniqueIdString) //-------------------------------------------------------------------- -+(NSString*)stringUniqueIdWithLength:(int)_lentgh ++(NSString*)stringUniqueIdWithLength:(int)length { int i=0; NSTimeInterval ti=[[NSDate date]timeIntervalSinceReferenceDate]; @@ -161,9 +167,9 @@ static char rcsId[] = "$Id$"; NSMutableData* data=nil; void* pData=NULL; NSString* dataHex=nil; - int intLength=(_lentgh/sizeof(int))-sizeof(ti); + int intLength=(length/sizeof(int))-sizeof(ti); if (intLength<0) - intLength=0; + intLength=0; size=sizeof(ti)+intLength*sizeof(int); data=[NSMutableData dataWithLength:size]; pData=[data mutableBytes]; @@ -171,10 +177,10 @@ static char rcsId[] = "$Id$"; *((NSTimeInterval*)pData)=ti;//TODO: NSSwapHostLongToBig(ti); pData+=sizeof(ti); for(i=0;i0 && !_filename) - { - NSString* _unique=[NSString stringUniqueIdWithLength:16]; - _filename=[NSString stringWithFormat:@"%@_%@_%@",prefix_,_unique,suffix_]; - if ([_directoryContents containsObject:_filename]) - _filename=nil; - }; - }; - if (_filename) - _filename=[directory_ stringByAppendingPathComponent:_filename]; + { + int attempts=16; + while(attempts-->0 && !filename) + { + NSString* unique=[NSString stringUniqueIdWithLength:16]; + filename=[NSString stringWithFormat:@"%@_%@_%@",prefix,unique,suffix]; + if ([directoryContents containsObject:filename]) + filename=nil; + }; + }; + if (filename) + filename=[directory stringByAppendingPathComponent:filename]; LOGObjectFnStop(); - return _filename; + return filename; }; @end @@ -248,30 +254,30 @@ static char rcsId[] = "$Id$"; @implementation NSString (Qutotes) //-------------------------------------------------------------------- --(BOOL)hasPrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_ +-(BOOL)hasPrefix:(NSString*)prefix + andSuffix:(NSString*)suffix { - return [self hasPrefix:prefix_] && [self hasSuffix:suffix_]; + return [self hasPrefix:prefix] && [self hasSuffix:suffix]; }; //-------------------------------------------------------------------- --(NSString*)stringWithoutPrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_ +-(NSString*)stringWithoutPrefix:(NSString*)prefix + andSuffix:(NSString*)suffix { - return [[self stringWithoutPrefix:prefix_]stringWithoutSuffix:suffix_]; + return [[self stringWithoutPrefix:prefix]stringWithoutSuffix:suffix]; }; //-------------------------------------------------------------------- --(BOOL)isQuotedWith:(NSString*)quote_ +-(BOOL)isQuotedWith:(NSString*)quote { - return [self hasPrefix:quote_ - andSuffix:quote_]; + return [self hasPrefix:quote + andSuffix:quote]; }; //-------------------------------------------------------------------- --(NSString*)stringWithoutQuote:(NSString*)quote_ +-(NSString*)stringWithoutQuote:(NSString*)quote { - return [self stringWithoutPrefix:quote_ - andSuffix:quote_]; + return [self stringWithoutPrefix:quote + andSuffix:quote]; }; @end @@ -279,18 +285,18 @@ static char rcsId[] = "$Id$"; @implementation NSMutableString (Qutotes) //-------------------------------------------------------------------- --(void)removePrefix:(NSString*)prefix_ - andSuffix:(NSString*)suffix_ +-(void)removePrefix:(NSString*)prefix + andSuffix:(NSString*)suffix { - [self removePrefix:prefix_]; - [self removeSuffix:suffix_]; + [self removePrefix:prefix]; + [self removeSuffix:suffix]; }; //-------------------------------------------------------------------- --(void)removeQuote:(NSString*)quote_ +-(void)removeQuote:(NSString*)quote { - [self removePrefix:quote_ - andSuffix:quote_]; + [self removePrefix:quote + andSuffix:quote]; }; @end