OSASAMPLE.c

#include OSASample.h
#include OSAStruct.h
/*-------------------------------------------------------------------------
* Function Name: OSA_ReportInfoOut
* Parameters: OSASAMPLE_STRUCT * Pointer to OSA Sample Structure
* OSA_REPORT_INFO * Pointer to Report Info structure
* Exceptions: None
* Return Value: None
* Description: Output data from the Report Info structure
*------------------------------------------------------------------------- */
void OSA_ReportInfoOut(POSASAMPLE_STRUCT pOSAStruct, POSA_REPORT_INFO pOSAReportInfo)
{
/* Check for valid parameter values. If pointers are void, return. */
if (!pOSAStruct || !pOSAStruct->fpOutput || !pOSAReportInfo)
{
return;
}
/* Print values to the output file */
fprintf(pOSAStruct->fpOutput, ****** REPORT INFO ******\n\n);
jde Fprintf(pOSAStruct->fpOutput), ("Report: % s\n",) pOSAReportInfo->szReport);
fprintf(pOSAStruct->fpOutput, Version: %s\n, pOSAReportInfo->szVersion);
fprintf(pOSAStruct->fpOutput, MachineKey: %s\n, pOSAReportInfo->
                        szMachineKey);
fprintf(pOSAStruct->fpOutput, Environment: %s\n, pOSAReportInfo->szEnhv);
fprintf(pOSAStruct->fpOutput, User: %s\n, pOSAReportInfo->szUser);
fprintf(pOSAStruct->fpOutput, Release: %s\n, pOSAReportInfo->
                       szOneWorldRelease);
fprintf(pOSAStruct->fpOutput, Time: %s\n, pOSAReportInfo->szReportTime);
fprintf(pOSAStruct->fpOutput, Date: %s\n, pOSAReportInfo->szDateToday);
fprintf(pOSAStruct->fpOutput, Local Code Page: %d\n, pOSAReportInfo->
                          nLocalCodePage);
fprintf(pOSAStruct->fpOutput, Remote Code Page: %d\n, pOSAReportInfo->
                           nRemoteCodePage);
fprintf(pOSAStruct->fpOutput, Local Operating System: %d\n,
             pOSAReportInfo->nLocalOperatingSystem);
fprintf(pOSAStruct->fpOutput, Remote Operating System: %d\n,
             pOSAReportInfo->nRemoteOperatingSystem);
fprintf(pOSAStruct->fpOutput, Printer: %s\n, pOSAReportInfo->szPrinter);
fprintf(pOSAStruct->fpOutput, Page Height: %d\n,
             pOSAReportInfo->ulPageSizeVertical);
fprintf(pOSAStruct->fpOutput, Page Width: %d\n,
             pOSAReportInfo->ulPageSizeHorizontal);
fprintf(pOSAStruct->fpOutput, Number Of Copies: %d\n,
             pOSAReportInfo->ulNumberOfCopies);
fprintf(pOSAStruct->fpOutput, Paper Source: %d\n,
             pOSAReportInfo->ulPaperSource);
fprintf(pOSAStruct->fpOutput, Orientation: %d\n,
             pOSAReportInfo->nPageOrientation);
fprintf(pOSAStruct->fpOutput, Lines Per Inch: %d\n,
             pOSAReportInfo->nPrinterLinesPerInch);
fprintf(pOSAStruct->fpOutput, Default Font Size: %d\n,
             pOSAReportInfo->nPrinterDefaultFontSize);
fprintf(pOSAStruct->fpOutput, Printer Type: %s\n,
             pOSAReportInfo->szPDLProgram);
fprintf(pOSAStruct->fpOutput, Decimal Separator: %s\n,
             pOSAReportInfo->szDecimalString);
fprintf(pOSAStruct->fpOutput, Thousands Separator: %c\n,
             pOSAReportInfo->cThousandsSeparator);
fprintf(pOSAStruct->fpOutput, Date Format: %s\n, pOSAReportInfo->
szDateFormat);
fprintf(pOSAStruct->fpOutput, Date Separator: %c\n, pOSAReportInfo->
cDateSeparator);
fprintf(pOSAStruct->fpOutput, Report Title: %s\n, pOSAReportInfo->
szReportTitle);
fprintf(pOSAStruct->fpOutput, Company Name: %s\n, pOSAReportInfo->
szCompanyName);
fprintf(pOSAStruct->fpOutput, Job Number: %d\n, pOSAReportInfo->ulJobNum);
fprintf(pOSAStruct->fpOutput, Current Page Number: %d\n,
pOSAReportInfo->ulCurrentPageNumber);
fprintf(pOSAStruct->fpOutput, Actual Page Number: %d\n,
pOSAReportInfo->ulActualCurrentPageNumber);
fprintf(pOSAStruct->fpOutput, UBE File Name: %s\n, pOSAReportInfo->
szUBEFileName);
fprintf(pOSAStruct->fpOutput, OSA File Name: %s\n, pOSAReportInfo->
szOSAFileName);
fprintf(pOSAStruct->fpOutput, Number of Sections: %d\n, pOSAReportInfo->
ulNumberOfSections);
fprintf(pOSAStruct->fpOutput, \n****** END REPORT INFO ******\n);
return;
}
/*-------------------------------------------------------------------------
* Function Name: OSA_SectionInfoOut
* Parameters: OSASAMPLE_STRUCT * Pointer to OSA Sample Structure
* OSA_SECTION_INFO * Pointer to Section Info structure
* Exceptions: None
* Return Value: None
* Description: Output data from the Section Info structure
*------------------------------------------------------------------------- */
void OSA_SectionInfoOut(POSASAMPLE_STRUCT pOSAStruct, POSA_SECTION_INFO
pOSASectionInfo)
{
/* Check for valid parameter values. If pointers are void, return. */
if (!pOSAStruct || !pOSAStruct->fpOutput || !pOSASectionInfo)
{
return;
}
fprintf(pOSAStruct->fpOutput, \n\t****** SECTION INFO ******\n\n);
fprintf(pOSAStruct->fpOutput, \tSection Name: %s\n, pOSASectionInfo->
szSectionName);
fprintf(pOSAStruct->fpOutput, \tSection Type: %s\n, pOSASectionInfo->
szSectionType);
fprintf(pOSAStruct->fpOutput, \tBusiness View Name: %s\n, pOSASectionInfo->
szBusinessViewName);
fprintf(pOSAStruct->fpOutput, \tSection ID: %d\n, pOSASectionInfo->
idSection);
fprintf(pOSAStruct->fpOutput, \tParent Section ID: %d\n, pOSASectionInfo->
idParentSection);
fprintf(pOSAStruct->fpOutput, \tNumber of Objects: %d\n, pOSASectionInfo->
ulNumberOfObjects);
fprintf(pOSAStruct->fpOutput, \tRecord Fetch Count: %d\n, pOSASectionInfo->
ulRecordFetchCount);
fprintf(pOSAStruct->fpOutput, \n\t****** END SECTION INFO ******\n);
return;
}
/*-------------------------------------------------------------------------
* Function Name: OSA_ObjectInfoOut
* Parameters: OSASAMPLE_STRUCT * Pointer to OSA Sample Structure
* OSA_OBJECT_INFO * Pointer to Object Info structure
* unsigned short int Flag to control output of Item Info
* Exceptions: None
* Return Value: None
* Description: Output data from the Object Info and Item Info structures
*------------------------------------------------------------------------- */
void OSA_ObjectInfoOut(POSASAMPLE_STRUCT pOSAStruct,
POSA_OBJECT_INFO pOSAObjectInfo,
unsigned short int nPrintItemInfo)
{
/* Check for valid parameter values. If pointers are void, return. */
if (!pOSAStruct || !pOSAStruct->fpOutput || !pOSAObjectInfo)
{
return;
}
fprintf(pOSAStruct->fpOutput, \n\t\t****** OBJECT INFO ******\n\n);
fprintf(pOSAStruct->fpOutput, \t\tData Dictionary Item: %s\n,
pOSAObjectInfo->szDataDictionaryAlias);
fprintf(pOSAStruct->fpOutput, \t\tObject Name: %s\n, pOSAObjectInfo->
szObjectName);
fprintf(pOSAStruct->fpOutput, \t\tObject ID: %d\n, pOSAObjectInfo->idObject);
fprintf(pOSAStruct->fpOutput, \t\tSection ID: %d\n, pOSAObjectInfo->
idSection);
fprintf(pOSAStruct->fpOutput, \t\tRow ID: %d\n, pOSAObjectInfo->idRow);
fprintf(pOSAStruct->fpOutput, \t\tObject Type: %s\n, pOSAObjectInfo->
szObjectType);
fprintf(pOSAStruct->fpOutput, \t\tObject Length: %d\n, pOSAObjectInfo->
nLength);
fprintf(pOSAStruct->fpOutput, \t\tOneWorld Data Type: %d\n, pOSAObjectInfo->
idEverestType);
fprintf(pOSAStruct->fpOutput, \t\tGeneral Data Type: %c\n, pOSAObjectInfo->
cDataType);
fprintf(pOSAStruct->fpOutput, \n\t\t****** END OBJECT INFO ******\n);
/* Only output Item Info if the parameter indicates to do so */
if (nPrintItemInfo)
{
POSA_ITEM_INFO pOSAItemInfo = &(pOSAObjectInfo->zOSAItemInfo);
fprintf(pOSAStruct->fpOutput, \n\t\t****** ITEM INFO ******\n\n);
fprintf(pOSAStruct->fpOutput, \t\tOccurence Count: %d\n, pOSAItemInfo->
ulOccurenceCount);
fprintf(pOSAStruct->fpOutput, \t\tRecord Fetch Count: %d\n, pOSAItemInfo->
ulRecordFetchCount);
fprintf(pOSAStruct->fpOutput, \t\tNumber Of Lines: %d\n, pOSAItemInfo->
ulNumPDFLines);
fprintf(pOSAStruct->fpOutput, \t\tReprinting: %d\n, pOSAItemInfo->
nReprinting);
fprintf(pOSAStruct->fpOutput, \t\tUnderline Thickness: %d\n, pOSAItemInfo->
nUnderlineThickness);
fprintf(pOSAStruct->fpOutput, \t\tUnderline Margin: %d\n, pOSAItemInfo->
nUnderlineMargin);
fprintf(pOSAStruct->fpOutput, \t\tColor Reference: %d\n, pOSAItemInfo->
ColorRef);
fprintf(pOSAStruct->fpOutput, \t\tFont Face Name: %s\n, pOSAItemInfo->
zFontInfo.lfFaceName);
fprintf(pOSAStruct->fpOutput, \t\tFont Point Size: %d\n, pOSAItemInfo->
zFontInfo.nPointSize);
fprintf(pOSAStruct->fpOutput, \t\tAdobe Font Name: %s\n, pOSAItemInfo->
zFontInfo.szAdobeFontName);
fprintf(pOSAStruct->fpOutput, \t\tDisplay Style: %d\n, pOSAItemInfo->
nDisplayStyle);
fprintf(pOSAStruct->fpOutput, \t\tObject Start X: %f\n, pOSAItemInfo->
fObjectHorizontalPosition);
fprintf(pOSAStruct->fpOutput, \t\tObject Start Y: %f\n, pOSAItemInfo->
fObjectVerticalPosition);
fprintf(pOSAStruct->fpOutput, \t\tObject End X: %f\n, pOSAItemInfo->
fObjectEndingHorizontalPosition);
fprintf(pOSAStruct->fpOutput, \t\tObject End Y: %f\n, pOSAItemInfo->
fObjectEndingVerticalPosition);
fprintf(pOSAStruct->fpOutput, \t\tValue Start X: %f\n, pOSAItemInfo->
fValueHorizontalPosition);
fprintf(pOSAStruct->fpOutput, \t\tValue Start Y: %f\n, pOSAItemInfo->
fValueVerticalPosition);
fprintf(pOSAStruct->fpOutput, \t\tValue End X: %f\n, pOSAItemInfo->
fValueEndingHorizontalPosition);
fprintf(pOSAStruct->fpOutput, \t\tValue End Y: %f\n, pOSAItemInfo->
fValueEndingVerticalPosition);
fprintf(pOSAStruct->fpOutput, \t\tValue Text: %s\n, pOSAItemInfo->szValue);
fprintf(pOSAStruct->fpOutput, \t\tFull Object Text: %s\n, pOSAItemInfo->
szFullText);
fprintf(pOSAStruct->fpOutput, \n\t\t****** END ITEM INFO ******\n);
}
else
{
fprintf(pOSAStruct->fpOutput, \n\t\t****** No Item Info At This Point ******
\n);
}
return;
}
/*-------------------------------------------------------------------------
* Function Name: OSA_LinkInfoOut
* Parameters: OSASAMPLE_STRUCT * Pointer to OSA Sample Structure
* OSA_LINK_INFO * Pointer to array of Link Info structures
* unsigned long The number of elements in the Link Info array
* Exceptions: None
* Return Value: None
* Description: Output data from the Link Info structures, if any.
*------------------------------------------------------------------------- */
void OSA_LinkInfoOut(POSASAMPLE_STRUCT pOSAStruct,
POSA_LINK_INFO pOSALinkInfo,
unsigned long ulNumberOfLinks)
{
unsigned short i =0;
/* Check for valid parameter values. If pointers are void, return. */
if (!pOSAStruct || !pOSAStruct->fpOutput)
{
return;
}
/* Check for valid parameter values. If pointer is void or array is empty,
output a message and return. */
if (!pOSALinkInfo || !ulNumberOfLinks)
{
fprintf(pOSAStruct->fpOutput, \n** No Link Information **\n);
return;
}
fprintf(pOSAStruct->fpOutput, \n****** LINK INFO ******\n\n);
for (i=0; i<ulNumberOfLinks; i++)
{
fprintf(pOSAStruct->fpOutput, Lower Left X: %f\n, pOSALinkInfo[i].
fLowerLeftHorizontal);
fprintf(pOSAStruct->fpOutput, Lower Left Y: %f\n, pOSALinkInfo[i].
fLowerLeftVertical);
fprintf(pOSAStruct->fpOutput, Upper Right X: %f\n, pOSALinkInfo[i].
fUpperRightHorizontal);
fprintf(pOSAStruct->fpOutput, Upper Right Y: %f\n, pOSALinkInfo[i].
fUpperRightVertical);
fprintf(pOSAStruct->fpOutput, Application Name: %s\n, pOSALinkInfo[i].
szApplication);
fprintf(pOSAStruct->fpOutput, Form Name: %s\n, pOSALinkInfo[i].szForm);
fprintf(pOSAStruct->fpOutput, Parameter String: %s\n\n, pOSALinkInfo[i].
szParms);
}
fprintf(pOSAStruct->fpOutput, \n****** END LINK INFO ******\n);
return;
}
/*-------------------------------------------------------------------------
* Function Name: OSA_FontInfoOut
* Parameters: OSASAMPLE_STRUCT * Pointer to OSA Sample Structure
* OSA_FONT_INFO * Pointer to Font Info structure
* Exceptions: None
* Return Value: None
* Description: Output data from the Font Info structure
*------------------------------------------------------------------------- */
void OSA_FontInfoOut(POSASAMPLE_STRUCT pOSAStruct,
POSA_FONT_INFO pFontInfo)
{
/* Check for valid parameter values. If pointers are void, return. */
if (!pOSAStruct || !pOSAStruct->fpOutput || !pFontInfo)
{
return;
}
fprintf(pOSAStruct->fpOutput, \n****** FONT INFO ******\n\n);
fprintf(pOSAStruct->fpOutput, Font Face Name: %s\n, pFontInfo->lfFaceName);
fprintf(pOSAStruct->fpOutput, Font Point Size: %d\n, pFontInfo->nPointSize);
fprintf(pOSAStruct->fpOutput, Adobe Font Name: %s\n, pFontInfo->
szAdobeFontName);
fprintf(pOSAStruct->fpOutput, \n****** END FONT INFO ******\n);
return;
}
/*-----------------------------------------------------------------------*/
 Function Name: OSA_OpenOutputFile
* Parameters: OSA_REPORT_INFO * Pointer to Report Info Structure
* OSASAMPLE_STRUCT * Pointer to OSA Sample Structure 
* Exceptions: None
* Return Value: None
* Description: Create the file which will contain the sample output
*------------------------------------------------------------------------- */
void OSA_OpenOutputFile (POSA_REPORT_INFO pOSAReportInfo, POSASAMPLE_STRUCT pOSAStruct)
{
/* Formulate the output file name based on information from Report Info. */
strcpy(pOSAReportInfo->szOSAFileName, pOSAReport Info->szUBEFileName);
#if defined JDENV_AS400
/* On IBM i, the UBE file name is of the form LIBRARY/PRINTQUEUE(F99999), where 99999 is the job number. We will just switch an O for the F to indicate an OSA file. */
pStrPtr = strrchr( pOSAReportInfo- >szOSAFileName,'F' );
*pStrPtr = 'O';
#else
/* On platforms other than IBM i, just replace the PDF file extension with OSA. */ 
if( !strstr( pOSAReportInfo->sz OSAFileName,.pdf ) )
{
/* If there is no .pdf extension, just tack on a .osa extension */
  strcat( pOSAReportInfo->szOSAFileName, .osa );
}
else
{  sprintf( strstr( pOSAReportInfo->szOSAFileName, .pdf ), .osa); 
}
#endif
/* Open the OSA file for output. */
pOSAStruct->fpOutput= fopen(pOSAReportInfo->szOSAFileName, w+b);
if (!pOSAStruct->fpOutput)
{
/* If the file could not be opened, send an error message
 back to the UBE log */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = 1;
}
sprintf(pOSAReportInfo->szLogMessage, Could not
 open OSA file: %s\n,
pOSAReportInfo->szOSAFileName);
return;
}
return;}
/*------------------------------------------------------------------------*/
/* Name: OSASample_StartDoc */
/* Parameters: OSA_REPORT_INFO* */
/* Exceptions: None */
/* ReturnValue: None */
/* Description: Open the output file, */
/* Output Report, Section and Object */
/* properties. */
/*------------------------------------------------------------------------*/
EXTERNC APIEXPORT void CDECL OSASample_StartDoc(OSA_REPORT_INFO*pOSAReportInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
POSA_SECTION_INFO pOSASectionInfo = NULL;
POSA_OBJECT_INFO pOSAObjectInfo = NULL;
char *pStrPtr NULL;
unsigned long i = 0;
unsigned long j = 0;
if(!pOSAReportInfo )
{return;
}
/* Allocate memory to hold severity value.
Deallocated in OSASample_EndDoc */
if (!pOSAReportInfo->pnLogMessageSeverity)
{
pOSAReportInfo->pnLogMessageSeverity = malloc(sizeof( unsigned short));
}
if (pOSAReportInfo->pnLogMessageSeverity)
{
pOSAReportInfo->pnLogMessageSeverity[0] = 0;
}
/* Create the common structure for passing values between functions,
if it has not been created before this point. */
if (!pOSAReportInfo->pExternalDataPointer)
{
pOSAStruct = malloc(sizeof( OSASAMPLE_STRUCT));
if (pOSAStruct)
{
memset(pOSAStruct, 0, sizeof(OSASAMPLE_STRUCT));
}else
{
strcpy(pOSAReportInfo->szLogMessage, OSA: Could not allocate External Data
Pointer.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
}
/* Record the pointer as the external data pointer in Report Info. */
pOSAReportInfo->pExternalDataPointer=pOSAStruct;
}
/* If the external data pointer does not exist, execution
cannot go on. Set severity to the highest value, assign a message for the
log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at End
Doc.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;}
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Create output file if it has not been created yet */
if (!pOSAStruct->fpOutput)
{
OSA_OpenOutputFile (pOSAReportInfo, pOSAStruct);
if (pOSAReportInfo->pnLogMessageSeverity[0] > 0)
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, ****** START DOC EXECUTION POINT ******\n\n);
/* Output Report Info to file. */
OSA_ReportInfoOut(pOSAStruct, pOSAReportInfo);
/* Output Section Info to file. */
if (!pOSAReportInfo->pOSASectionInfo || !pOSAReportInfo->ulNumberOfSections)
{
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = 2;
}
sprintf(pOSAReportInfo->szLogMessage, No Section Info present.\n);
return;
}
pOSASectionInfo = pOSAReportInfo->pOSASectionInfo;
for (i=0; i<pOSAReportInfo->ulNumberOfSections; i++)
{
OSA_SectionInfoOut(pOSAStruct, pOSASectionInfo);
/* Output Object Info to file. */
if (!pOSASectionInfo->pOSAObjectInfo || !pOSASectionInfo->ulNumberOfObjects)
{
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = 3;
}
sprintf(pOSAReportInfo->szLogMessage,
No Object Info present for Section %s.\n,
pOSASectionInfo->szSectionName);
return;
}
pOSAObjectInfo = pOSASectionInfo->pOSAObjectInfo;
for (j=0; j<pOSASectionInfo->ulNumberOfObjects; j++)
{
OSA_ObjectInfoOut(pOSAStruct, pOSAObjectInfo, 0); /* Do not print Item Info at this time. */
pOSAObjectInfo++;
}
pOSASectionInfo++;
}
}/*----------------------------------------------------------------------- */
/* Name: OSASample_EndDoc */
/* Parameters: OSA_REPORT_INFO*/
/* Exceptions: None */
/* Return Value: None */
/* Description: Open the output file, */
/* Output Report, Section and Object */
/* properties. */
/*----------------------------------------------------------------------- */

EXTERNC APIEXPORT void CDECL OSASample_EndDoc(OSA_REPORT_INFO* pOSAReportInfo
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely), then
return */
if(!pOSAReportInfo )
{return;
}
/* If the external data pointer does not exist execution
cannot go on. Set severity to the highest value, assign a message for the
log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at End
Doc.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Close Output File */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** END DOC EXECUTION POINT ******);
if (pOSAStruct->fpOutput)
{
fclose (pOSAStruct->fpOutput);
}
/* Delete the structure created to hold the external data */
free (pOSAStruct);
if (pOSAReportInfo->pnLogMessageSeverity)
free(pOSAReportInfo->pnLogMessageSeverity);
pOSAReportInfo->pExternalDataPointer = NULL;
return;
}
/*----------------------------------------------------------------------- */
/* Name: OSASample_StartPage */
/* Parameters: OSA_REPORT_INFO* */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Report Info to output file. */
/*----------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_StartPage(OSA_REPORT_INFO*
pOSAReportInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely), then return */
if(!pOSAReportInfo )
{
return;}
/* If the external data pointer does not exist, execution cannot go on. Set severity to the highest value, assign a message for the log and return */ 
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at Start Page.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Start Page.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** START PAGE EXECUTION POINT ******\n);
OSA_ReportInfoOut(pOSAStruct, pOSAReportInfo);
return;
}
/*----------------------------------------------------------------------- */
/* Name: OSASample_EndPage */
/* Parameters: OSA_REPORT_INFO*, OSA_LINK_INFO*, unsigned long */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Report Info and Link Info */
/* */
/*----------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_EndPage(POSA_REPORT_INFO
pOSAReportInfo,
POSA_LINK_INFO pOSALinkInfo,
unsigned long ulNumberOfLinks)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely), then return */
if(!pOSAReportInfo )
{
return;
}
/* If the external data pointer does not exist executioncannot go on. Set severity to the highest value, assign a message for the log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at End Page.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at End Page.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** END PAGE EXECUTION POINT ******\n);
OSA_ReportInfoOut(pOSAStruct, pOSAReportInfo);
/* Output Link Info */
OSA_LinkInfoOut(pOSAStruct, pOSALinkInfo, ulNumberOfLinks);
return;
}
/*----------------------------------------------------------------------- */
/* Name: OSASample_SetFont */
/* Parameters: OSA_REPORT_INFO*, OSA_FONT_INFO* */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Font Info */
/* */
/*----------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_SetFont(POSA_REPORT_INFO
pOSAReportInfo,
POSA_FONT_INFO pOSAFontInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely),then return */
if(!pOSAReportInfo )
{
return;
}
/* Allocate memory to hold severity value. Deallocated in OSASample_EndDoc */
if (!pOSAReportInfo->pnLogMessageSeverity)
{
pOSAReportInfo->pnLogMessageSeverity = malloc(sizeof( unsigned short));
}
if (pOSAReportInfo->pnLogMessageSeverity)
{
pOSAReportInfo->pnLogMessageSeverity[0] = 0;
}
/* Create the common structure for passing values between functions,if it has not been created before this point. */
if (!pOSAReportInfo->pExternalDataPointer)
{
pOSAStruct = malloc(sizeof( OSASAMPLE_STRUCT));
if (pOSAStruct)
{
memset(pOSAStruct, 0, sizeof(OSASAMPLE_STRUCT));
}
else
{
strcpy(pOSAReportInfo->szLogMessage, OSA: Could not allocate External
Data Pointer.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
d*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
}
/* Record the pointer as the⇒
 external data pointer in Report Info.*/
pOSAReportInfo->pExternalDataPointer=p⇒
OSAStruct;
}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Create output file if it has not been created yet */
if (!pOSAStruct->fpOutput)
{
OSA_OpenOutputFile (pOSAReportInfo, pOSAStruct);
if (pOSAReportInfo->pnLogMessageSeverity[0] > 0)
return;
}
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Set Font.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** SET FONT EXECUTION POINT ******\n);
OSA_FontInfoOut(pOSAStruct, pOSAFontInfo);
return;
}
/*----------------------------------------------------------------------- */
/* Name: OSASample_SetColor */
/* Parameters: OSA_REPORT_INFO*, unsigned long int */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Color Reference Number */
/* */
/*----------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_SetColor(POSA_REPORT_INFO
pOSAReportInfo,
unsigned long int zColorRef)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely),then return */
if(!pOSAReportInfo )
{
return;
}
/* If the external data pointer does not exist execution cannot go on. Set severity to the highest value, assign a message for the log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at Set Color.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Set
Color.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** SET COLOR: %d ******\n, zColorRef);
return;
}
/*------------------------------------------------------------------------- */
/* Name: OSASample_TextOut */
/* Parameters: OSA_REPORT_INFO*, OSA_OBJECT_INFO* */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Font Info */
/* */
/*------------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_TextOut(POSA_REPORT_⇒
INFO
pOSAReportInfo,
POSA_OBJECT_INFO pOSAObjectInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely),
then return */
if(!pOSAReportInfo )
{
return;
}
/* If the external data pointer does not exist execution cannot go on. Set severity to the highest value, assign a message for the log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at Text Out.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Text Out.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** TEXT OUT EXECUTION POINT ******\n);OSA_ObjectInfoOut(pOSAStruct, pOSAObjectInfo, 1);
return;
}
/*---------------------------------------------------------------------- */
/* Name: OSASample_Underline */
/* Parameters: OSA_REPORT_INFO*, OSA_OBJECT_INFO* */
/* Exceptions: None */
/* Return Value: None */
/* Description: Output Font Info */
/* */
/*---------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_DrawUnderline(POSA_REPORT_INFO
pOSAReportInfo,
POSA_OBJECT_INFO pOSAObjectInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely), then return */
if(!pOSAReportInfo )
{
return;
}/* If the external data pointer does not exist execution cannot go on. Set severity  to the highest value, assign a message for the log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at Draw Underline.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Output Report Info */pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!p⇒
OSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Draw
Underline.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** DRAW UNDERLINE EXECUTION POINT
******\n);
OSA_ObjectInfoOut(pOSAStruct, pOSAObjectInfo, 1);
return;
}
/*---------------------------------------------------------------------- */
/* Name: OSASample_DrawObject */
/*⇒
 Parameters: OSA_REPORT_INFO*, OSA_OBJECT_INFO* */
/* Exceptions: None */
/* Return⇒
 Value: None */
/* Description: Output Font Info */
/* */
/*---------------------------------------------------------------------- */
EXTERNC APIEXPORT void CDECL OSASample_DrawObject(POSA_REPORT_INFO
pOSAReportInfo,
POSA_OBJECT_INFO pOSAObjectInfo)
{
POSASAMPLE_STRUCT pOSAStruct = NULL;
/* If OSA does not provide the needed parameter (Highly unlikely),then return */
if(!pOSAReportInfo )
{
return;}
/* If the external data pointer does not exist execution cannot go on. Set severity to the highest value, assign a message for the log and return */
if(!pOSAReportInfo->pExternalDataPointer)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No External Data Pointer at Draw Object.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Output Report Info */
pOSAStruct=pOSAReportInfo->pExternalDataPointer;
/* Check for valid file pointer */
if (!pOSAStruct->fpOutput)
{
strcpy(pOSAReportInfo->szLogMessage, OSA: No Output File pointer at Draw Object.\n);
/* Set the correct severity to error message severity */
if (pOSAReportInfo->pnLogMessageSeverity)
{
*(pOSAReportInfo->pnLogMessageSeverity) = (unsigned short)1;
}
return;
}
/* Identify the Execution Point */
fprintf(pOSAStruct->fpOutput, \n****** DRAW OBJECT EXECUTION POINT ******\n);
OSA_ObjectInfoOut(pOSAStruct, pOSAObjectInfo, 1);
return;
}