Description
PBORCA_ConfigureSession facilitates backward compatibility with PowerBuilder 10. It increases the flexibility of the API and minimizes the changes necessary to other ORCA function signatures.
Syntax
INT PBORCA_ConfigureSession ( PBORCA hORCASession, PPBORCA_CONFIG_SESSION pSessionConfig );
Argument |
Description |
---|---|
hORCASession |
Handle to previously established ORCA session. |
pSessionConfig |
Structure that lets the ORCA client specify the behavior of subsequent requests. Settings remain in effect for the duration of the session or until you call PBORCA_ConfigureSession again. Be sure to specify all of the settings each time you call PBORCA_ConfigureSession. |
Return value
INT. Typical return codes are:
Return code |
Description |
---|---|
0 PBORCA_OK |
Operation successful |
-1 PBORCA_INVALIDPARMS |
Session not open or null pConfig pointer |
Usage
Create an instance of a PBORCA_CONFIG_SESSION structure and populate it with your configuration settings. Then call PBORCA_ConfigureSession immediately after SessionOpen. You can also call this function anytime thereafter to reset configuration properties.
typedef enum pborca_clobber { PBORCA_NOCLOBBER, PBORCA_CLOBBER, PBORCA_CLOBBER_ALWAYS PBORCA_CLOBBER_DECIDED_BY_SYSTEM } PBORCA_ENUM_FILEWRITE_OPTION; typedef enum pborca_type { PBORCA_UNICODE, PBORCA_UTF8, PBORCA_HEXASCII, PBORCA_ANSI_DBCS } PBORCA_ENCODING; typedef struct pborca_configsession { PBORCA_ENUM_FILEWRITE_OPTION eClobber; // overwrite existing file? PBORCA_ENCODING eExportEncoding; // Encoding of exported source BOOL bExportHeaders; // Format source with export header BOOL bExportIncludeBinary; // Include the binary BOOL bExportCreateFile; // Export source to a file LPTSTR pExportDirectory; // Directory for exported files PBORCA_ENCODING eImportEncoding; // Encoding of imported source BOOL bDebug; // Debug compiler directive PVOID filler2;// Reserved for future use PVOID filler3; PVOID filler4; } PBORCA_CONFIG_SESSION, FAR *PPBORCA_CONFIG_SESSION;
Member variable |
Description |
---|---|
eClobber |
Specifies when to overwrite existing files on the file system. This property is used by: PBORCA_LibraryEntryExport PBORCA_LibraryEntryExportEx PBORCA_DynamicLibraryCreate PBORCA_ExecutableCreate PBORCA_LibraryDelete You can set any of the following eClobber values for a configuration session:
|
eExportEncoding |
Specifies the source encoding used by PBORCA_LibraryEntryExport:
|
bExportHeaders |
If you set this variable to TRUE, PBORCA_LibraryEntryExport generates export headers. The default value is FALSE for backward compatibility. |
bExportIncludeBinary |
If you set this variable to TRUE, PBORCA_LibraryEntryExport generates the binary component of an object in addition to the source component. The default value is FALSE for backward compatibility. |
bExportCreateFile |
If you set this variable to TRUE, PBORCA_LibraryEntryExport exports source to a file. The generated file name is the PowerBuilder object entry name with a .sr? file extension. The default value is FALSE. |
pExportDirectory |
Directory where you export PowerBuilder objects if bExportCreateFile is TRUE. |
eImportEncoding |
Source encoding. Subsequent calls to PBORCA_CompileEntryImport and PBORCA_CompileEntryImportList expect the lpszEntrySyntax argument to contain this information. |
bDebug |
If you set this value to FALSE, the DEBUG conditional compiler directive is turned off. All subsequent methods that invoke the PowerScript compiler will use this setting when evaluating script inside DEBUG conditional compilation blocks. This setting is not used in Windows Forms targets, since PBORCA_DeployWinFormProject uses a setting in the Project object of these targets to determine whether to enable or disable the DEBUG directive. |
Examples
This example populates the PBORCA_CONFIG_SESSION structure with configuration settings:
INT ConfigureSession(LPTSTR sEncoding) { INT iErrCode = -1; lpORCA_Info->pConfig = (PPBORCA_CONFIG_SESSION) malloc(sizeof(PBORCA_CONFIG_SESSION)); memset(lpORCA_Info->pConfig, 0, sizeof(PBORCA_CONFIG_SESSION)); if (!_tcscmp(sEncoding, _TEXT("ANSI"))) { lpORCA_Info->pConfig->eExportEncoding = PBORCA_ANSI_DBCS; lpORCA_Info->pConfig->eImportEncoding = PBORCA_ANSI_DBCS; } else if (!_tcscmp(sEncoding, _TEXT("UTF8"))) { lpORCA_Info->pConfig->eExportEncoding = PBORCA_UTF8; lpORCA_Info->pConfig->eImportEncoding = PBORCA_UTF8; } else if (!_tcscmp(sEncoding, _TEXT("HEXASCII"))) { lpORCA_Info->pConfig->eExportEncoding = PBORCA_HEXASCII; lpORCA_Info->pConfig->eImportEncoding = PBORCA_HEXASCII; } else { lpORCA_Info->pConfig->eExportEncoding = PBORCA_UNICODE; lpORCA_Info->pConfig->eImportEncoding = PBORCA_UNICODE; } lpORCA_Info->pConfig->eClobber = PBORCA_CLOBBER; lpORCA_Info->pConfig->bExportHeaders = TRUE; lpORCA_Info->pConfig->bExportIncludeBinary = FALSE; lpORCA_Info->pConfig->bExportCreateFile = FALSE; lpORCA_Info->pConfig->pExportDirectory = NULL; lpORCA_Info->pConfig->bDebug = FALSE; iErrCode = PBORCA_ConfigureSession( lpORCA_Info->hORCASession, lpORCA_Info->pConfig); return iErrCode; }
See also