190 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			190 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| /* c4trans.h   (c)Copyright Sequiter Software Inc., 1988-1996.  All rights reserved. */
 | |
| 
 | |
| #ifndef S4OFF_TRAN
 | |
|    #define TRAN4ENTRY_LEN unsigned long
 | |
| #endif  /* S4OFF_TRAN */
 | |
| 
 | |
| #ifdef S4SERVER
 | |
|    #ifndef S4OFF_TRAN
 | |
|       #ifndef S4OFF_WRITE
 | |
|          #define S4TRAN_DEFINED
 | |
|          #ifdef S4INLINE
 | |
|             #define code4tranStart( c4 )        ( tran4lowStart( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 0 ) )
 | |
|             #define code4tranStartSingle( c4 )  ( tran4lowStart( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 0 ) )
 | |
|             #define code4tranCommit( c4 )       ( tran4lowCommit( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 1, 1 ) )
 | |
|             #define code4tranCommitSingle( c4 )  ( tran4lowCommit( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 1, 0 ) )
 | |
|             #define code4tranRollback( c4 )     ( tran4lowRollback( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 1 ) )
 | |
|             #define code4tranRollbackSingle( c4 )     ( tran4lowRollback( &((c4)->currentClient->trans), connection4id( (c4)->currentClient->connection ), 0 ) )
 | |
|             #define code4tranStatus( c4 ) ( (c4)->currentClient->trans.currentTranStatus )
 | |
|             #define code4tranStatusSet( c4, val ) ( (c4)->currentClient->trans.currentTranStatus = (val) )
 | |
|          #else
 | |
|             int S4FUNCTION code4tranCommit( CODE4 S4PTR * ) ;
 | |
|             int S4FUNCTION code4tranStart( CODE4 S4PTR * ) ;
 | |
|             int S4FUNCTION code4tranStartSingle( CODE4 S4PTR * ) ;
 | |
|             int S4FUNCTION code4tranRollback( CODE4 S4PTR * ) ;
 | |
|             int S4FUNCTION code4tranStatus( CODE4 * ) ;
 | |
|             int S4FUNCTION code4tranStatusSet( CODE4 *, const int val ) ;
 | |
|          #endif
 | |
|       #endif
 | |
|    #endif
 | |
|    #ifdef S4TRAN_DEFINED
 | |
|       #undef S4TRAN_DEFINED
 | |
|    #else
 | |
|       #define code4tranCommit( c4 ) ( 0 )
 | |
|       #define code4tranStart( c4 ) ( 0 )
 | |
|       #define code4tranRollback( c4 ) ( 0 )
 | |
|       #define code4tranStatus( c4 ) ( r4inactive )
 | |
|    #endif
 | |
| #else
 | |
|    #ifdef __cplusplus
 | |
|       extern "C" {
 | |
|    #endif
 | |
|    /* exported for utilities */
 | |
|    int S4FUNCTION code4tranInit( CODE4 S4PTR * ) ;
 | |
|    S4EXPORT int S4FUNCTION code4tranCommit( CODE4 S4PTR * ) ;
 | |
|    S4EXPORT int S4FUNCTION code4tranStart( CODE4 S4PTR * ) ;
 | |
|    S4EXPORT int S4FUNCTION code4tranRollback( CODE4 S4PTR * ) ;
 | |
|    #ifdef S4OFF_TRAN
 | |
|       #ifdef S4CLIENT
 | |
|          #define code4tranStatus( c4 ) ( (c4)->c4trans.trans.currentTranStatus )
 | |
|       #else
 | |
|          #define code4tranStatus( c4 ) ( 0 )
 | |
|       #endif
 | |
|    #else
 | |
|       #ifndef S4OFF_WRITE
 | |
|          int S4FUNCTION code4tranStartSingle( CODE4 S4PTR * ) ;
 | |
|          #ifdef S4INLINE
 | |
|             #define code4tranStatus( c4 ) ( (c4)->c4trans.trans.currentTranStatus )
 | |
|             #define code4tranStatusSet( c4, val ) ( (c4)->c4trans.trans.currentTranStatus = (val) )
 | |
|          #else
 | |
|             S4EXPORT int S4FUNCTION code4tranStatusSet( CODE4 *, const int val ) ;
 | |
|          #endif
 | |
|       #endif
 | |
|    #endif
 | |
|    #ifndef S4INLINE
 | |
|       #ifdef S4CLIENT
 | |
|          int code4tranInit2( CODE4 *, const char *, const char * ) ;
 | |
|          void code4tranInitUndo( CODE4 * ) ;
 | |
|       #endif
 | |
|    #endif
 | |
|    #ifdef S4STAND_ALONE
 | |
|       S4EXPORT int S4FUNCTION code4tranInit2( CODE4 S4PTR *, const char S4PTR *, const char S4PTR * ) ;
 | |
|       void code4tranInitUndo( CODE4 * ) ;
 | |
|    #endif
 | |
|    #ifdef __cplusplus
 | |
|       }
 | |
|    #endif
 | |
| #endif  /* S4SERVER */
 | |
| 
 | |
| #ifndef S4OFF_WRITE
 | |
|    #ifndef S4CLIENT
 | |
|       #ifndef S4OFF_TRAN
 | |
|          /* #define TRAN4CREATE    1  Not supported*/
 | |
|          #define TRAN4OPEN      1
 | |
|          #define TRAN4OPEN_TEMP 2
 | |
|          #define TRAN4CLOSE     3
 | |
|          #define TRAN4START     4
 | |
|          /* #define TRAN4COMMIT    5  Not supported*/
 | |
|          #define TRAN4COMPLETE  6
 | |
|          #define TRAN4ROLLBACK  7
 | |
|          #define TRAN4WRITE     8
 | |
|          #define TRAN4APPEND    9
 | |
|          #define TRAN4VOID     10
 | |
|          /* #define TRAN4CREATE_TEMP    11  Not Supported*/
 | |
|          #define TRAN4PACK     12
 | |
|          #define TRAN4ZAP      13
 | |
|          #define TRAN4INIT     15
 | |
|          #define TRAN4SHUTDOWN 16
 | |
|          #define TRAN4BACKEDUP 17
 | |
|          #define TRAN4INIT_UNDO 18
 | |
| 
 | |
|          #define E4_LOG_IFS "Log File - invalid file status"
 | |
|          #define TRAN4FORWARDS  1
 | |
|          #define TRAN4BACKWARDS 2
 | |
|          #define TRAN4LOCK_BASE      1000000000
 | |
|          #define TRAN4LOCK_SERVER    TRAN4LOCK_BASE+0
 | |
|          #define TRAN4LOCK_MULTIPLE  TRAN4LOCK_BASE+1
 | |
|          #define TRAN4LOCK_BACKUP    TRAN4LOCK_BASE+2
 | |
|          #define TRAN4LOCK_RESTORE   TRAN4LOCK_BASE+3
 | |
|          #define TRAN4LOCK_FIX       TRAN4LOCK_BASE+4
 | |
|          #define TRAN4VERSION_NUM 1
 | |
| 
 | |
|          #ifdef S4STAND_ALONE
 | |
|             #define TRAN4LOCK_USERS     TRAN4LOCK_BASE+1000
 | |
|             #define TRAN4MAX_USERS      1000
 | |
|          #endif
 | |
|       #endif  /* S4OFF_TRAN */
 | |
|    #endif  /* not S4CLIENT */
 | |
| 
 | |
|    #ifdef __cplusplus
 | |
|       extern "C" {
 | |
|    #endif
 | |
|    #ifndef S4OFF_TRAN
 | |
|       #ifndef S4CLIENT
 | |
|          int  tran4fileCreate( TRAN4FILE *, const char * ) ;
 | |
|          int  tran4active( CODE4 *, DATA4 * ) ;
 | |
|          int  tran4addUser( TRAN4 *, const long, const char *, const unsigned short int ) ;
 | |
|          /* log file examination functionality */
 | |
|          int  S4FUNCTION tran4fileAppend( TRAN4FILE S4PTR *, LOG4HEADER S4PTR *, void S4PTR * ) ;  /* a null pointer means use internal value */
 | |
|          int  S4FUNCTION tran4fileBottom( TRAN4FILE S4PTR *, TRAN4 S4PTR * ) ;
 | |
|          int  S4FUNCTION tran4fileSkip( TRAN4FILE S4PTR *, TRAN4 S4PTR *, const int ) ;
 | |
|          int  S4FUNCTION tran4fileTop( TRAN4FILE S4PTR *, TRAN4 S4PTR * ) ;
 | |
|          int  code4tranInitUndoLow( TRAN4 *, const long ) ;
 | |
|          int  S4FUNCTION tran4set(  TRAN4 S4PTR *, const int, const long, const long, const int, const unsigned int, const long, const long ) ;
 | |
|          int  S4FUNCTION tran4putData(  TRAN4 S4PTR *, void *, unsigned ) ;
 | |
|          /* log file examination functionality */
 | |
|          #ifndef S4INLINE
 | |
|             int  S4FUNCTION tran4bottom( TRAN4 S4PTR * ) ;
 | |
|             unsigned long S4FUNCTION tran4clientDataId( TRAN4 S4PTR * ) ;
 | |
|             long S4FUNCTION tran4clientId( TRAN4 S4PTR * ) ;
 | |
|             long S4FUNCTION tran4id( TRAN4 S4PTR * ) ;
 | |
|             unsigned S4FUNCTION tran4len( TRAN4 S4PTR * ) ;
 | |
|             unsigned long S4FUNCTION tran4serverDataId( TRAN4 S4PTR * ) ;
 | |
|             int  S4FUNCTION tran4skip( TRAN4 S4PTR *, int ) ;
 | |
|             int  S4FUNCTION tran4top( TRAN4 S4PTR * ) ;
 | |
|             int  S4FUNCTION tran4type( TRAN4 S4PTR * ) ;
 | |
|          #endif
 | |
|          void * S4FUNCTION tran4getData( TRAN4 S4PTR *, const long pos  ) ;
 | |
|       #endif  /* not S4CLIENT */
 | |
|    #endif  /* S4OFF_TRAN */
 | |
| 
 | |
|    #ifndef S4OFF_TRAN
 | |
|       #ifndef S4CLIENT
 | |
|          #ifdef S4DISTRIBUTED
 | |
|             int tran4lowComplete( TRAN4 *, long ) ;
 | |
|          #endif
 | |
|          S4EXPORT int S4FUNCTION tran4lowAppend( TRAN4 *, void * ) ;
 | |
|          S4EXPORT int S4FUNCTION tran4lowCommit( TRAN4 *, long, unsigned short int, int ) ;
 | |
|          S4EXPORT int S4FUNCTION tran4lowRollback( TRAN4 *, long, const int ) ;
 | |
|          S4EXPORT int S4FUNCTION tran4lowStart( TRAN4 *, long, int ) ;
 | |
|          int tran4lowUnappend( TRAN4 * ) ;
 | |
|          int tran4lowUnwrite( TRAN4 * ) ;
 | |
|       #endif  /* S4CLIENT */
 | |
|    #endif  /* S4OFF_TRAN */
 | |
|    #ifdef __cplusplus
 | |
|       }
 | |
|    #endif
 | |
| 
 | |
| #endif /* S4OFF_WRITE */
 | |
| 
 | |
| #ifndef S4CLIENT
 | |
|    int tran4closeAll( struct TRAN4St * ) ;
 | |
|    #ifndef S4SINGLE
 | |
|       #ifdef S4SERVER
 | |
|          int tran4lock( TRAN4 * ) ;
 | |
|       #endif
 | |
|       int  S4FUNCTION code4tranLockTransactions( CODE4TRANS S4PTR *, long ) ;
 | |
|       int  S4FUNCTION code4tranUnlockTransactions( CODE4TRANS S4PTR *, long ) ;
 | |
|    #endif  /* S4SINGLE */
 | |
| #endif  /* S4CLIENT */
 | |
| DATA4 *tran4data( struct TRAN4St *, const long, const long ) ;
 | |
| DATA4 *tran4dataName( struct TRAN4St *, const char *, const long, const int ) ;
 | |
| 
 | |
| #ifdef E4ANALYZE
 | |
|    int  tran4verify( TRAN4 *, int ) ;
 | |
| #endif  /* E4ANALYZE */
 | |
| 
 | |
| int  code4tranInitLow( TRAN4 *, CODE4TRANS * ) ;
 | |
| int  code4transInit( CODE4TRANS *, CODE4 * ) ;
 | |
| int  S4FUNCTION code4transInitUndo( CODE4TRANS S4PTR * ) ;
 |