00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __SPRuntime__
00021 #define __SPRuntime__
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "SPTypes.h"
00031 #include "SPAdapts.h"
00032 #include "SPFiles.h"
00033 #include "SPPlugs.h"
00034 #include "SPStrngs.h"
00035 #include "SPSuites.h"
00036 #include "SPStrngs.h"
00037
00038 #include "SPHeaderBegin.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044
00045
00046
00047
00048
00049
00050
00051 #define kSPRuntimeSuite "SP Runtime Suite"
00052 #define kSPRuntimeSuiteVersion6 6
00053 #ifdef WIN_ENV
00054 #define kSPRuntimeSuiteVersion7 7
00055 #define kSPRuntimeSuiteVersion kSPRuntimeSuiteVersion7
00056 #elif defined(MAC_ENV)
00057 #define kSPRuntimeSuiteVersion kSPRuntimeSuiteVersion6
00058 #elif defined(LINUX_ENV)
00059 #define kSPRuntimeSuiteVersion kSPRuntimeSuiteVersion6
00060 #endif
00061
00062 #define SPPerfLoggingEnabled 1
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00207 typedef enum {
00210 kAddFile,
00213 kAddPlugin,
00216 kSetMessage,
00218 kSuitesAvailable,
00220 kError,
00223 kStartingupPlugin,
00226 kPreShutdownPlugin,
00229 kPostShutdownPlugin,
00231 kNoEvent = 0xffffffff
00232 } NotifyEvent;
00233
00235 typedef void *(*SPAllocateProc)( size_t size, void *hostData );
00237 typedef void (*SPFreeProc)( void *block, void *hostData );
00239 typedef void *(*SPReallocateProc)( void *block, size_t newSize, void *hostData );
00248 typedef void (*SPStartupNotifyProc)( NotifyEvent event, void *notifyData, void *hostData );
00256 typedef void (*SPShutdownNotifyProc)( NotifyEvent event, void *notifyData, void *hostData );
00258 typedef void (*SPAssertTrapProc)( const char *failMessage, void *hostData );
00260 typedef void (*SPThrowTrapProc)( SPErr error, void *hostData );
00262 typedef void (*SPDebugTrapProc)( const char *debugMessage, void *hostData );
00263
00264 typedef void (*SPWarningProc)(const char *warningMessage, void *hostData);
00265
00267 typedef SPAPI SPErr (*SPAllocateStringPoolProc)( SPStringPoolRef *pool );
00269 typedef SPAPI SPErr (*SPFreeStringPoolProc)( SPStringPoolRef stringPool );
00271 typedef SPAPI SPErr (*SPMakeWStringProc)( SPStringPoolRef stringPool, const char *string,
00272 const char **wString );
00273
00274 #if !defined(IOS_ENV)
00275
00276 typedef SPAPI SPErr (*SPGetHostAccessInfoProc)( SPPlatformAccessInfo *spHostAccessInfo );
00277 #endif // !defined(IOS_ENV)
00278
00280 typedef SPAPI SPBoolean (*SPFilterEventProc)( NotifyEvent event, const void *eventData );
00282 typedef SPAPI SPErr (*SPAddPluginsProc)( void );
00284 typedef SPAPI SPBoolean (*SPOverrideStartupProc)( SPPluginRef currentPlugin );
00285
00286
00287
00288 #ifdef WIN_ENV
00289
00290 typedef SPAPI SPErr (*SPResolveLinkProc)(const char *shortcutFile, char *resolvedPath);
00291 typedef SPAPI SPErr (*SPResolveLinkProcW)(const wchar_t*shortcutFile, wchar_t *resolvedPath);
00292 #endif
00293
00294 typedef SPAPI SPErr (*SPWideCharToPlatform)(char* destination, size_t dstSizeBytes, const ai::uint16* src, size_t srcWcharCount);
00295 typedef SPAPI SPErr (*SPPlatformToWideChar)(ai::uint16* destination, size_t dstCharCount, const char* src, size_t srcSizeBytes);
00296
00298 typedef SPAPI SPErr (*GetNativePluginAccessProc)(SPPluginRef plugin, SPAccessRef *access);
00299
00301 typedef SPAPI SPBoolean (*MemoryIsCriticalProc)( void );
00302
00303 #if SPPerfLoggingEnabled
00304
00305 typedef SPAPI void (*SPPerfLogTimerStart)(void **hostLogData, SPBoolean pauseAtStart);
00306 typedef SPAPI void(*SPPerfLogTimerPause)(void *hostLogData);
00307 typedef SPAPI void(*SPPerfLogTimerPlay)(void *hostLogData);
00308
00309 typedef SPAPI void (*SPPerfLogPut)(void *hostLogData, const char* logString1, const char* logString2);
00310 typedef SPAPI void(*SPPerfLogPutWithGivenTime)(ai::int64 givenTime, const char* logString1, const char* logString2);
00311 typedef SPAPI ai::int64(*SPGetElapsedMicroSeconds)(void *hostLogData);
00312
00313 typedef SPAPI void(*SPPerfLogTimerDestroy)(void *hostLogData);
00314 #endif
00315
00319 typedef struct SPHostProcs {
00320
00321 void *hostData;
00322
00323 SPAllocateProc extAllocate;
00324 SPFreeProc extFree;
00325 SPReallocateProc extReallocate;
00326
00327 SPAllocateProc intAllocate;
00328 SPFreeProc intFree;
00329 SPReallocateProc intReallocate;
00331 SPStartupNotifyProc startupNotify;
00333 SPShutdownNotifyProc shutdownNotify;
00334
00335 SPAssertTrapProc assertTrap;
00336 SPThrowTrapProc throwTrap;
00337 SPDebugTrapProc debugTrap;
00338 SPWarningProc warningProc;
00339
00340 SPAllocateStringPoolProc allocateStringPool;
00341 SPFreeStringPoolProc freeStringPool;
00342 SPMakeWStringProc makeWString;
00343 SPStringPoolRef appStringPool;
00344
00345 SPFilterEventProc filterEvent;
00346 SPAddPluginsProc overrideAddPlugins;
00347 SPOverrideStartupProc overridePluginStartup;
00348
00349 #ifdef WIN_ENV
00350 SPResolveLinkProc resolveLink;
00351 #endif
00352
00353 GetNativePluginAccessProc getPluginAccess;
00354
00355 #ifdef MAC_ENV
00356
00357 MemoryIsCriticalProc memoryIsCritical;
00358 #endif
00359
00360 SPAllocateProc extSubAllocate;
00361 SPFreeProc extSubFree;
00362 SPReallocateProc extSubReallocate;
00363
00364
00365 #ifdef WIN_ENV
00366 SPResolveLinkProcW resolveLinkW;
00367 #endif
00368 SPWideCharToPlatform wideCharToPlatform;
00369 SPPlatformToWideChar platformToWideChar;
00370 #if SPPerfLoggingEnabled
00371 SPPerfLogTimerStart startPerflog;
00372 SPPerfLogTimerPause pausePerfLogTimer;
00373 SPPerfLogTimerPlay playPerfLogTimer;
00374 SPPerfLogPut putPerfLog;
00375 SPPerfLogPutWithGivenTime putPerfLogWithGivenTime;
00376 SPGetElapsedMicroSeconds getElapsedMicroSeconds;
00377 SPPerfLogTimerDestroy clearHostLogData;
00378 #endif
00379 } SPHostProcs;
00380
00381
00382
00383
00384
00385
00386
00394 typedef struct SPRuntimeSuite {
00399 SPAPI SPErr (*GetRuntimeStringPool)( SPStringPoolRef *stringPool );
00404 SPAPI SPErr (*GetRuntimeSuiteList)( SPSuiteListRef *suiteList );
00409 SPAPI SPErr (*GetRuntimeFileList)( SPFileListRef *fileList );
00414 SPAPI SPErr (*GetRuntimePluginList)( SPPluginListRef *pluginList );
00419 SPAPI SPErr (*GetRuntimeAdapterList)( SPAdapterListRef *adapterList );
00430 SPAPI SPErr (*GetRuntimeHostProcs)( SPHostProcs **hostProcs );
00435 SPAPI SPErr (*GetRuntimePluginsFolder)( SPPlatformFileReference *pluginFolder );
00440 SPAPI SPErr (*GetRuntimeHostFileRef)( SPPlatformFileReference *hostFileSpec );
00441 } SPRuntimeSuite;
00442
00443
00445 SPAPI SPErr SPGetRuntimeStringPool( SPStringPoolRef *stringPool );
00447 SPAPI SPErr SPGetRuntimeSuiteList( SPSuiteListRef *suiteList );
00449 SPAPI SPErr SPGetRuntimeFileList( SPFileListRef *fileList );
00451 SPAPI SPErr SPGetRuntimePluginList( SPPluginListRef *pluginList );
00453 SPAPI SPErr SPGetRuntimeAdapterList( SPAdapterListRef *adapterList );
00455 SPAPI SPErr SPGetRuntimeHostProcs( SPHostProcs **hostProcs );
00457 SPAPI SPErr SPGetRuntimePluginsFolder( SPPlatformFileReference *pluginFolder );
00459 SPAPI SPErr SPSetRuntimePluginsFolder( SPPlatformFileReference *pluginFolder );
00461 SPAPI SPErr SPGetRuntimeHostFileRef( SPPlatformFileReference *hostFileSpec );
00462 #ifdef WIN_ENV
00463
00464 SPAPI SPErr SPGetRuntimePluginsFolder_v5( SPPlatformFileSpecification *pluginFolder );
00466 SPAPI SPErr SPGetRuntimeHostFileRef_v5( SPPlatformFileSpecification *hostFileSpec );
00467 #endif
00468
00469 typedef struct
00470 {
00471 SPAPI SPErr (*SPAcquireSuiteFunc)( SPSuiteListRef suiteList, const char *name, ai::int32 apiVersion, ai::int32 internalVersion, const void **suiteProcs );
00472 SPAPI SPErr (*SPReleaseSuiteFunc)( SPSuiteListRef suiteList, const char *name, ai::int32 apiVersion, ai::int32 internalVersion );
00473 SPErr (*spAllocateBlockFunc)( SPAllocateProc allocateProc, size_t size, const char *debug, void **block );
00474 SPErr (*spFreeBlockFunc)( SPFreeProc freeProc, void *block );
00475 SPErr (*spReallocateBlockFunc)( SPReallocateProc reallocateProc, void *block, size_t newSize, const char *debug, void **newblock );
00476 SPHostProcs *gProcs;
00477 } SPBasicFuncStruct;
00478
00480 void SetUpBasicFuncs(SPBasicFuncStruct *inStruct);
00481
00482 #ifdef __cplusplus
00483 }
00484 #endif
00485
00486 #include "SPHeaderEnd.h"
00487
00488 #endif