VSCTOP.H

#ifdef WIN32 
#define WINDOWS
#endif

#ifdef _WINDOWS /* MS C 7.0 predefined */
#ifndef WIN32
#define WINDOWS
#define WIN16
#endif
#endif

#ifdef WINDOWS
#pragma message("Windows")
#endif

#ifdef WIN16
#pragma message("Win16")
#endif

#ifdef WIN32
#pragma message("Win32")
#endif

/*
| Include windows and scc definitions
*/

#include "entry.h"
#include "stdlib.h"
#include <windows.h>

typedef signed char *LPCHAR;
typedef signed short *LPSHORT;

typedef DWORD HIOFILE;
#define HUGE


#define xseek _llseek
#define xtell _ltell
#define xopen _lopen
#define xclose _lclose
#define xread _lread

// #include "sccfi.h"

/*
|
| Typedef for FI information and get structure
|
*/

typedef struct FIINFOtag
{
WORD fiId;/* FI Id */
WORD fiFlags; /* flags for the Id */
BYTE fiName[26]; /* name of the Id, for example "WordPerfect 5.0" */
} FIINFO;

typedef struct FIGETSTRUCTtag
{
HANDLE gsRes;
WORD gsIndex;
} FIGETSTRUCT;

#include "sodefs.h"

#ifdef WINDOWS
#define DECLSOVOID (SO_ENTRYMOD *)()
#endif /*WINDOWS*/

/*
|Include viewer's data types and typedef HPROC
*/

#include VwInclude

typedef struct PROCtag
{
VwStreamDynamicTypeVwData;
SORTNSSoRtns;
DWORDUser1;
DWORDUser2;
LONGlTellOffset;
} NEAR * HPROC;

#include "vwdefs.h"

/*
|Do functions prototypes for Vw functions
*/

externFILTER_DESCVwStreamIdName[];

#ifdef VwStreamStaticType
externVwStreamStaticType VwStreamStaticName;
#endif

#ifdef VwStreamOpenFunc
#undef VwStreamOpenFunc
#define VwStreamOpenFuncVwStreamOpen
VW_ENTRYSC SHORT VW_ENTRYMODVwStreamOpenFunc(SOFILE, SHORT, BYTE VWPTR *, SOFILTERINFO VWPTR * ,HPROC);
#endif

#ifdef VwStreamCloseFunc

#undef VwStreamCloseFunc
#define VwStreamCloseFuncVwStreamClose
VW_ENTRYSC VOID VW_ENTRYMODVwStreamCloseFunc(SOFILE, HPROC);

#else

#undef VwStreamCloseFunc
#define VwStreamCloseFuncVwStreamClose
VW_ENTRYSC VOID VW_ENTRYMODVwStreamCloseFunc(SOFILE, HPROC);
VW_ENTRYSC VOID VW_ENTRYMOD VwStreamCloseFunc(hFile,hProc)
SOFILEhFile;
HPROChProc;
{
}

#endif

#ifdef VwStreamSectionFunc
#undef VwStreamSectionFunc
#define VwStreamSectionFuncVwStreamSection
VW_ENTRYSC SHORT VW_ENTRYMODVwStreamSectionFunc(SOFILE, HPROC);
#endif

#ifdef VwStreamReadFunc
#undef VwStreamReadFunc
#define VwStreamReadFuncVwStreamRead
VW_ENTRYSC SHORT VW_ENTRYMODVwStreamReadFunc(SOFILE, HPROC);
#endif

#ifdef VwStreamReadRecordFunc

#undef VwStreamReadRecordFunc
#define VwStreamReadRecordFuncVwStreamReadRecord
VW_ENTRYSC VOID VW_ENTRYMODVwStreamReadRecordFunc(SOFILE, DWORD, HPROC);

#else

#define VwStreamReadRecordFuncVwStreamReadRecord
VW_ENTRYSC VOID VW_ENTRYMOD VwStreamReadRecordFunc(SOFILE, DWORD, HPROC);
VW_ENTRYSC VOID VW_ENTRYMOD VwStreamReadRecordFunc(hFile,dwData,hProc)
SOFILEhFile;
DWORDdwData;
HPROChProc;
{
}

#endif

#ifdef VwDoSpecialFunc

#undef VwDoSpecialFunc
#define VwDoSpecialFuncVwDoSpecial
VW_ENTRYSC VOID VW_ENTRYMODVwDoSpecialFunc(SOFILE,DWORD,DWORD,DWORD,DWORD,DWORD,HPROC);

#else

#define VwDoSpecialFuncVwDoSpecial
VW_ENTRYSC VOID VW_ENTRYMODVwDoSpecialFunc(SOFILE,DWORD,DWORD,DWORD,DWORD,DWORD,HPROC);
VW_ENTRYSC VOID VW_ENTRYMOD VwDoSpecialFunc(hFile, dw1,dw2,dw3,dw4,dw5,hProc)
SOFILEhFile;
DWORDdw1;
DWORDdw2;
DWORDdw3;
DWORDdw4;
DWORDdw5;
HPROChProc;
{
}
#endif

#ifdef VwStreamTellFunc
#undef VwStreamTellFunc
#define VwStreamTellFuncVwStreamTell
VW_ENTRYSC SHORT VW_ENTRYMODVwStreamTellFunc(SOFILE, HPROC);
#endif

#ifdef VwStreamSeekFunc
#undef VwStreamSeekFunc
#define VwStreamSeekFuncVwStreamSeek
VW_ENTRYSC SHORT VW_ENTRYMODVwStreamSeekFunc(SOFILE, HPROC);
#endif

#ifdef VwGetInfoFunc
#undef VwGetInfoFunc
#define VwGetInfoFuncVwGetInfo
VW_ENTRYSC BOOL VW_ENTRYMODVwGetInfoFunc(VOID VWPTR *, WORD, HPROC);
#endif

#ifdef VwGetRtnsFunc
#undef VwGetRtnsFunc
#define VwGetRtnsFuncVwGetRtns
VW_ENTRYSC VOID VW_ENTRYMOD VwGetRtnsFunc(VWRTNS VWPTR *, WORD);
#endif

#ifdef VwGetDataFunc
#undef VwGetDataFunc
#define VwGetDataFuncVwGetData
VW_ENTRYSC VOID VW_ENTRYMODVwGetDataFunc(VwStreamSaveType VWPTR *, HPROC);
#endif

#ifdef VwSetDataFunc
#undef VwSetDataFunc
#define VwSetDataFuncVwSetData
VW_ENTRYSC VOID VW_ENTRYMODVwSetDataFunc(VwStreamSaveType VWPTR *, HPROC);
#endif

#ifdef VwStreamSectionType

#ifdef VwGetSectionDataFunc
#undef VwGetSectionDataFunc
#define VwGetSectionDataFuncVwGetSectionData
VW_ENTRYSC VOID VW_ENTRYMODVwGetSectionDataFunc(VwStreamSectionType VWPTR *, HPROC);
#endif

#ifdef VwSetSectionDataFunc
#undef VwSetSectionDataFunc
#define VwSetSectionDataFuncVwSetSectionData
VW_ENTRYSC VOID VW_ENTRYMODVwSetSectionDataFunc(VwStreamSectionType VWPTR *, HPROC);
#endif

#else

#ifdef VwGetSectionDataFunc
#undef VwGetSectionDataFunc
#endif
#define VwGetSectionDataFuncVwGetSectionData
VW_ENTRYSC VOID VW_ENTRYMODVwGetSectionDataFunc(VOID VWPTR *, HPROC);

#ifdef VwSetSectionDataFunc
#undef VwSetSectionDataFunc
#endif
#define VwSetSectionDataFuncVwSetSectionData
VW_ENTRYSC VOID VW_ENTRYMODVwSetSectionDataFunc(VOID VWPTR *, HPROC);

#endif

#ifdef VwLocalUpFunc
#undef VwLocalUpFunc
#define VwLocalUpFuncVwLocalUp
VW_ENTRYSC VOID VW_ENTRYMODVwLocalUpFunc(HIOFILE, SOFILE VWPTR *, HPROC);
#endif

#ifdef VwLocalDownFunc
#undef VwLocalDownFunc
#define VwLocalDownFuncVwLocalDown
VW_ENTRYSC VOID VW_ENTRYMODVwLocalDownFunc(SOFILE, HIOFILE VWPTR *, HPROC);
#endif

#ifdef VwAllocProcFunc
#undef VwAllocProcFunc
#define VwAllocProcFuncVwAllocProc
VW_ENTRYSC HPROC VW_ENTRYMODVwAllocProcFunc(VOID);
#endif

#ifdef VwFreeProcFunc
#undef VwFreeProcFunc
#define VwFreeProcFuncVwFreeProc
VW_ENTRYSC VOID VW_ENTRYMODVwFreeProcFunc(HPROC);
#endif

#define VwSetUserFuncVwSetUser
VW_ENTRYSC VOID VW_ENTRYMOD VwSetUserFunc(DWORD,DWORD,HPROC);

#define VwSetSoRtnFuncVwSetSoRtn
VW_ENTRYSC VOID VW_ENTRYMOD VwSetSoRtnFunc(SHORT, DECLSO, HPROC);

#ifdef VwStreamStaticType
#define InitVwStreamStaticName
#endif

#define Proc (hProc->VwData)

/*
| Make some standard library functions available
*/

#ifdef WIN16

void far * far _cdecl _fmemmove(void far *, const void far *,unsigned int);
void far * far _cdecl _fmemcpy(void far *, const void far *,unsigned int);
void far * far _cdecl _fmemset(void far *, int, unsigned int);
int _cdecl atoi(const char *);
long _cdecl atol(const char *);
int Vatoi(char far *);
long Vatol(char far *);

#define strcmplstrcmp
#define strcmpilstrcmpi
#define strcpylstrcpy
#define strcatlstrcat
#define strlenlstrlen
#define memcpy_fmemcpy
#define memset_fmemset
#define memmove_fmemmove

int Vatoi(pStr)
char far * pStr;
{
static char locStr[20];

lstrcpy(locStr,pStr);
return(atoi(locStr));
}

long Vatol(pStr)
char far * pStr;
{
static char locStr[20];

lstrcpy(locStr,pStr);
return(atol(locStr));
}

#define atoi(s)Vatoi((char far *) s)
#define atol(s)Vatol((char far *) s)

#define itoa(num,str,x)_itoa(num,str,x)
#define ltoa(num,str,x)_ltoa(num,str,x)

#define SUAlloc(size,hProc)GlobalAlloc(GMEM_MOVEABLE,size)
#define SUFree(handle,hProc)GlobalFree(handle)
#define SULock(handle,hProc)((VOID FAR *) GlobalLock(handle))
#define SUUnlock(handle,hProc)GlobalUnlock(handle)
#define SUReAlloc(handle,size,hProc)GlobalReAlloc(handle,size,0)

#define SUSeekEntry(hF,hProc)

#endif /*WIN16*/

#ifdef WIN32

#define SUAlloc(size,hProc)GlobalAlloc(GMEM_MOVEABLE,size)
#define SUFree(handle,hProc)GlobalFree(handle)
#define SULock(handle,hProc)((VOID FAR *) GlobalLock(handle))
#define SUUnlock(handle,hProc)GlobalUnlock(handle)
#define SUReAlloc(handle,size,hProc)GlobalReAlloc(handle,size,0)

#define SUSeekEntry(hF,hProc)

#endif /*WIN32*/

#ifdef WINDOWS

VW_ENTRYSC HPROC VW_ENTRYMOD VwAllocProcFunc()
{
HANDLEhData;

if ((hData = LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT,sizeof(struct PROCtag))) == NULL)
return(NULL);
else
return((HPROC)LocalLock(hData));
}

VW_ENTRYSC VOID VW_ENTRYMOD VwFreeProcFunc(hProc)
HPROChProc;
{
HANDLEhData;

#ifdef WIN16
if ((hData = LocalHandle((WORD)(VOID NEAR *)hProc)) != NULL)
LocalFree(hData);
#endif /*WIN16*/

#ifdef WIN32
if ((hData = LocalHandle((LPVOID)hProc)) != NULL)
LocalFree(hData);
#endif /*WIN32*/

}

#endif /*WINDOWS*/


VW_ENTRYSC BOOL VW_ENTRYMOD VwGetInfoFunc(pInfo,wInfoId,hProc)
VOID VWPTR *pInfo;
WORDwInfoId;
HPROChProc;
{
BOOLlocRet;
WORDlocIndex;

locRet = TRUE;

switch (wInfoId)
{
case VWINFO_CHECK:
*(DWORD VWPTR *)pInfo = 0x12345678;
break;

case VWINFO_SAVESIZE:
#ifdef VwStreamSaveType
*(WORD VWPTR *)pInfo = sizeof(VwStreamSaveType);
#else
*(WORD VWPTR *)pInfo = 0;
#endif
break;

case VWINFO_DYNAMICSIZE:
#ifdef VwStreamDynamicType
*(WORD VWPTR *)pInfo = sizeof(VwStreamDynamicType);
#else
*(WORD VWPTR *)pInfo = 0;
#endif
break;

case VWINFO_STATICSIZE:
#ifdef VwStreamStaticType
*(WORD VWPTR *)pInfo = sizeof(VwStreamStaticType);
#else
*(WORD VWPTR *)pInfo = 0;
#endif
break;

case VWINFO_SPECLEVEL:
*(WORD VWPTR *)pInfo = 400;
break;

case VWINFO_FILTERLEVEL:
*(WORD VWPTR *)pInfo = 410;
break;

case VWINFO_IDCOUNT:
*(WORD VWPTR *)pInfo = VwStreamIdCount;
break;

case VWINFO_IDS:
for (locIndex = 0; locIndex < VwStreamIdCount; locIndex++)
{
((WORD VWPTR *)pInfo)[locIndex] = VwStreamIdName[locIndex].FilterId;
}
break;

case VWINFO_DATE:
strcpy((BYTE VWPTR *)pInfo,__DATE__);
break;

case VWINFO_TIME:
strcpy((BYTE VWPTR *)pInfo,__TIME__);
break;

case VWINFO_USERSAVESIZE:
#ifdef VwStreamUserSaveType
*(WORD VWPTR *)pInfo = sizeof(VwStreamUserSaveType);
#else
*(WORD VWPTR *)pInfo = 0;
#endif
break;

case VWINFO_SECTIONSAVESIZE:
#ifdef VwStreamSectionType
*(WORD VWPTR *)pInfo = sizeof(VwStreamSectionType);
#else
*(WORD VWPTR *)pInfo = 0;
#endif
break;

default:
locRet = FALSE;
break;
}

return(locRet);
}

VW_ENTRYSC VOID VW_ENTRYMOD VwGetDataFunc(pSaveData,hProc)
VwStreamSaveType VWPTR *pSaveData;
HPROChProc;
{
*pSaveData = Proc.VwStreamSaveName;
}

VW_ENTRYSC VOID VW_ENTRYMOD VwSetDataFunc(pSaveData,hProc)
VwStreamSaveType VWPTR *pSaveData;
HPROChProc;
{
Proc.VwStreamSaveName = *pSaveData;
}

#ifdef VwStreamSectionType

VW_ENTRYSC VOID VW_ENTRYMOD VwGetSectionDataFunc(pSectionData,hProc)
VwStreamSectionType VWPTR *pSectionData;
HPROChProc;
{
*pSectionData = Proc.VwStreamSectionName;
}

VW_ENTRYSC VOID VW_ENTRYMOD VwSetSectionDataFunc(pSectionData,hProc)
VwStreamSectionType VWPTR *pSectionData;
HPROChProc;
{
Proc.VwStreamSectionName = *pSectionData;
}

#else

VW_ENTRYSC VOID VW_ENTRYMOD VwGetSectionDataFunc(pSectionData,hProc)
VOID VWPTR *pSectionData;
HPROChProc;
{
}

VW_ENTRYSC VOID VW_ENTRYMOD VwSetSectionDataFunc(pSectionData,hProc)
VOID VWPTR *pSectionData;
HPROChProc;
{
}

#endif

VOID FAR SODummy()
{
}

VW_ENTRYSC VOID VW_ENTRYMOD VwLocalUpFunc(hFile,phFile,hProc)
HIOFILEhFile;
SOFILE VWPTR *phFile;
HPROChProc;
{
*phFile = (SOFILE)hFile;

#ifdef WINDOWS
#define CAST(VOID FAR *)
#define CAST2(VOID FAR *)
#endif /*WINDOWS*/

hProc->SoRtns.SOPutChar = CAST SODummy;
hProc->SoRtns.SOPutCharX = CAST SODummy;
hProc->SoRtns.SOPutSpecialCharX = CAST SODummy;
hProc->SoRtns.SOPutCharAttr = CAST SODummy;
hProc->SoRtns.SOPutCharHeight = CAST SODummy;
hProc->SoRtns.SOPutParaAlign = CAST SODummy;
hProc->SoRtns.SOPutParaIndents = CAST SODummy;
hProc->SoRtns.SOStartTabStops = CAST SODummy;
hProc->SoRtns.SOEndTabStops = CAST SODummy;
hProc->SoRtns.SOPutTabStop = CAST SODummy;
hProc->SoRtns.SOPutMargins = CAST SODummy;
hProc->SoRtns.SOPutSubdocInfo = CAST SODummy;
hProc->SoRtns.SOPutBreak = CAST2 SODummy;
hProc->SoRtns.SOPutDataCell = CAST SODummy;
hProc->SoRtns.SOPutTextCell = CAST SODummy;
hProc->SoRtns.SOPutMoreText = CAST SODummy;
hProc->SoRtns.SOPutField = CAST SODummy;
hProc->SoRtns.SOPutVarField = CAST SODummy;
hProc->SoRtns.SOPutMoreVarField = CAST SODummy;
hProc->SoRtns.SOStartColumnInfo = CAST SODummy;
hProc->SoRtns.SOStartFieldInfo = CAST SODummy;
hProc->SoRtns.SOPutColumnInfo = CAST SODummy;
hProc->SoRtns.SOPutFieldInfo = CAST SODummy;
hProc->SoRtns.SOEndColumnInfo = CAST SODummy;
hProc->SoRtns.SOEndFieldInfo = CAST SODummy;
hProc->SoRtns.SOPutSectionType = CAST SODummy;
hProc->SoRtns.SOPutSectionName = CAST SODummy;
hProc->SoRtns.SOSetDateBase = CAST SODummy;
hProc->SoRtns.SOBailOut = CAST SODummy;
hProc->SoRtns.SOTagBegin = CAST SODummy;
hProc->SoRtns.SOTagEnd = CAST SODummy;
hProc->SoRtns.SOGetInfo = CAST SODummy;
hProc->SoRtns.SOPutString = CAST SODummy;
hProc->SoRtns.SUUserSaveData = CAST2 SODummy;
hProc->SoRtns.SUUserRetrieveData = CAST2 SODummy;
hProc->SoRtns.SOPutBitmapHeader = CAST SODummy;
hProc->SoRtns.SOStartPalette = CAST SODummy;
hProc->SoRtns.SOPutPaletteEntry = CAST SODummy;
hProc->SoRtns.SOEndPalette = CAST SODummy;
hProc->SoRtns.SOPutScanLineData = CAST2 SODummy;
hProc->SoRtns.SOStartFontTable = CAST SODummy;
hProc->SoRtns.SOPutFontTableEntry = CAST SODummy;
hProc->SoRtns.SOEndFontTable = CAST SODummy;
hProc->SoRtns.SOPutCharFontById = CAST SODummy;
hProc->SoRtns.SOPutCharFontByName = CAST SODummy;
hProc->SoRtns.SOPutParaSpacing = CAST SODummy;
hProc->SoRtns.SOPutArchiveField = CAST SODummy;
hProc->SoRtns.SOStartHdrInfo = CAST SODummy;
hProc->SoRtns.SOEndHdrInfo = CAST SODummy;
hProc->SoRtns.SOPutHdrEntry = CAST SODummy;
hProc->SoRtns.SOPutVectorHeader = CAST SODummy;
hProc->SoRtns.SOVectorObject = CAST SODummy;
hProc->SoRtns.SOVectorAttr = CAST SODummy;
hProc->SoRtns.SOBeginTable = CAST SODummy;
hProc->SoRtns.SOEndTable = CAST SODummy;
hProc->SoRtns.SOPutTableRowFormat = CAST SODummy;
hProc->SoRtns.SOPutTableCellInfo = CAST SODummy;
hProc->SoRtns.SOPutGraphicObject = CAST SODummy;
hProc->SoRtns.SOGoToPosition = CAST SODummy;
hProc->SoRtns.SODrawLine = CAST SODummy;

#undef CAST
}


VW_ENTRYSC VOID VW_ENTRYMOD VwLocalDownFunc(hFile,phFile,hProc)
SOFILEhFile;
HIOFILE VWPTR *phFile;
HPROChProc;
{
*phFile = (HIOFILE)hFile;
}


#ifdef WINDOWS
#define CAST(VOID FAR *)
#define CAST2(VOID FAR *)
#define CASTIO(VOID FAR *)
#define SO_PFUNCSO_ENTRYMOD *
#endif /*WINDOWS*/


VW_ENTRYSC VOID VW_ENTRYMOD VwSetSoRtnFunc(wRtn,pRtn,hProc)
SHORTwRtn;
VOID(SO_PFUNC pRtn)();
HPROChProc;
{
if (pRtn == NULL)
pRtn = SODummy;


switch (wRtn)
{
case SOPUTCHAR:
hProc->SoRtns.SOPutChar = CAST pRtn;
break;
case SOPUTCHARX:
hProc->SoRtns.SOPutCharX = CAST pRtn;
break;
case SOPUTSPECIALCHARX:
hProc->SoRtns.SOPutSpecialCharX = CAST pRtn;
break;
case SOPUTCHARATTR:
hProc->SoRtns.SOPutCharAttr = CAST pRtn;
break;
case SOPUTCHARHEIGHT:
hProc->SoRtns.SOPutCharHeight = CAST pRtn;
break;
case SOPUTPARAALIGN:
hProc->SoRtns.SOPutParaAlign = CAST pRtn;
break;
case SOPUTPARAINDENTS:
hProc->SoRtns.SOPutParaIndents = CAST pRtn;
break;
case SOSTARTTABSTOPS:
hProc->SoRtns.SOStartTabStops = CAST pRtn;
break;
case SOENDTABSTOPS:
hProc->SoRtns.SOEndTabStops = CAST pRtn;
break;
case SOPUTTABSTOP:
hProc->SoRtns.SOPutTabStop = CAST pRtn;
break;
case SOPUTMARGINS:
hProc->SoRtns.SOPutMargins = CAST pRtn;
break;
case SOPUTSUBDOCINFO:
hProc->SoRtns.SOPutSubdocInfo = CAST pRtn;
break;
case SOPUTBREAK:
hProc->SoRtns.SOPutBreak = CAST2 pRtn;
break;
caseSOPUTDATACELL:
hProc->SoRtns.SOPutDataCell = CAST pRtn;
break;
caseSOPUTTEXTCELL:
hProc->SoRtns.SOPutTextCell = CAST pRtn;
break;
caseSOPUTMORETEXT:
hProc->SoRtns.SOPutMoreText = CAST pRtn;
break;
caseSOPUTFIELD:
hProc->SoRtns.SOPutField = CAST pRtn;
break;
caseSOPUTVARFIELD:
hProc->SoRtns.SOPutVarField = CAST pRtn;
break;
caseSOPUTMOREVARFIELD:
hProc->SoRtns.SOPutMoreVarField = CAST pRtn;
break;
caseSOSTARTCOLUMNINFO:
hProc->SoRtns.SOStartColumnInfo = CAST pRtn;
break;
caseSOSTARTFIELDINFO:
hProc->SoRtns.SOStartFieldInfo = CAST pRtn;
break;
caseSOPUTCOLUMNINFO:
hProc->SoRtns.SOPutColumnInfo = CAST pRtn;
break;
caseSOPUTFIELDINFO:
hProc->SoRtns.SOPutFieldInfo = CAST pRtn;
break;
caseSOENDCOLUMNINFO:
hProc->SoRtns.SOEndColumnInfo = CAST pRtn;
break;
caseSOENDFIELDINFO:
hProc->SoRtns.SOEndFieldInfo = CAST pRtn;
break;
caseSOPUTSECTIONTYPE:
hProc->SoRtns.SOPutSectionType = CAST pRtn;
break;
caseSOPUTSECTIONNAME:
hProc->SoRtns.SOPutSectionName = CAST pRtn;
break;
caseSOSETDATEBASE:
hProc->SoRtns.SOSetDateBase = CAST pRtn;
break;
caseSOBAILOUT:
hProc->SoRtns.SOBailOut = CAST pRtn;
break;
caseSOTAGBEGIN:
hProc->SoRtns.SOTagBegin = CAST pRtn;
break;
caseSOTAGEND:
hProc->SoRtns.SOTagEnd = CAST pRtn;
break;
caseSOGETINFO:
hProc->SoRtns.SOGetInfo = CAST pRtn;
break;
caseSOPUTSTRING:
hProc->SoRtns.SOPutString = CAST pRtn;
break;
caseSUUSERSAVEDATA:
hProc->SoRtns.SUUserSaveData = CAST2 pRtn;
break;
caseSUUSERRETRIEVEDATA:
hProc->SoRtns.SUUserRetrieveData = CAST2 pRtn;
break;
caseSOPUTBITMAPHEADER:
hProc->SoRtns.SOPutBitmapHeader = CAST pRtn;
break;
caseSOSTARTPALETTE:
hProc->SoRtns.SOStartPalette = CAST pRtn;
break;
caseSOPUTPALETTEENTRY:
hProc->SoRtns.SOPutPaletteEntry = CAST pRtn;
break;
caseSOENDPALETTE:
hProc->SoRtns.SOEndPalette = CAST pRtn;
break;
caseSOPUTSCANLINEDATA:
hProc->SoRtns.SOPutScanLineData = CAST2 pRtn;
break;
caseSOSTARTFONTTABLE:
hProc->SoRtns.SOStartFontTable = CAST pRtn;
break;
caseSOPUTFONTTABLEENTRY:
hProc->SoRtns.SOPutFontTableEntry = CAST pRtn;
break;
caseSOENDFONTTABLE:
hProc->SoRtns.SOEndFontTable = CAST pRtn;
break;
caseSOPUTCHARFONTBYID:
hProc->SoRtns.SOPutCharFontById = CAST pRtn;
break;
caseSOPUTCHARFONTBYNAME:
hProc->SoRtns.SOPutCharFontByName = CAST pRtn;
break;
caseSOPUTPARASPACING:
hProc->SoRtns.SOPutParaSpacing = CAST pRtn;
break;
caseSOPUTARCHIVEFIELD:
hProc->SoRtns.SOPutArchiveField = CAST pRtn;
break;
caseSOSTARTHDRINFO:
hProc->SoRtns.SOStartHdrInfo = CAST pRtn;
break;
caseSOENDHDRINFO:
hProc->SoRtns.SOEndHdrInfo = CAST pRtn;
break;
caseSOPUTHDRENTRY:
hProc->SoRtns.SOPutHdrEntry = CAST pRtn;
break;
caseSOPUTVECTORHEADER:
hProc->SoRtns.SOPutVectorHeader = CAST pRtn;
break;
caseSOVECTOROBJECT:
hProc->SoRtns.SOVectorObject = CAST pRtn;
break;
caseSOVECTORATTR:
hProc->SoRtns.SOVectorAttr = CAST pRtn;
break;
case SOBEGINTABLE:
hProc->SoRtns.SOBeginTable = CAST pRtn;
break;
case SOENDTABLE:
hProc->SoRtns.SOEndTable = CAST pRtn;
break;
case SOPUTTABLEROWFORMAT:
hProc->SoRtns.SOPutTableRowFormat = CAST pRtn;
break;
case SOPUTTABLECELLINFO:
hProc->SoRtns.SOPutTableCellInfo = CAST pRtn;
break;
case SOPUTGRAPHICOBJECT:
hProc->SoRtns.SOPutGraphicObject = CAST pRtn;
break;
case SOGOTOPOSITION:
hProc->SoRtns.SOGoToPosition = CAST pRtn;
break;
case SODRAWLINE:
hProc->SoRtns.SODrawLine = CAST pRtn;
break;
}

#undef CAST
#undef CAST2
#undef CASTIO
}


VW_ENTRYSC VOID VW_ENTRYMOD VwSetUserFunc(dwUser1,dwUser2,hProc)
DWORDdwUser1;
DWORDdwUser2;
HPROChProc;
{
hProc->User1 = dwUser1;
hProc->User2 = dwUser2;
}


VW_ENTRYSC VOID VW_ENTRYMOD VwGetRtnsFunc(pRtns,wLastRtn)
VWRTNS VWPTR * pRtns;
WORD wLastRtn;
{

#ifdef WINDOWS
#define FUNCTIONNAME(func) func
#define CAST(VOID FAR *)
#define CASTHPROC (VOID FAR *)
#endif /*WINDOWS*/

#ifdef VwStreamOpenFunc
pRtns->StreamOpen = FUNCTIONNAME(VwStreamOpen);
#else
pRtns->StreamOpen = NULL;
#endif

#ifdef VwStreamSectionFunc
pRtns->StreamSection = FUNCTIONNAME(VwStreamSection);
#else
pRtns->StreamSection = NULL;
#endif

#ifdef VwStreamReadFunc
pRtns->StreamRead = FUNCTIONNAME(VwStreamRead);
#else
pRtns->StreamRead = NULL;
#endif

#ifdef VwStreamTellFunc
pRtns->StreamTell = FUNCTIONNAME(VwStreamTell);
#else
pRtns->StreamTell = NULL;
#endif

#ifdef VwStreamSeekFunc
pRtns->StreamSeek= FUNCTIONNAME(VwStreamSeek);
#else
pRtns->StreamSeek= NULL;
#endif

#ifdef VwGetInfoFunc
pRtns->GetInfo = FUNCTIONNAME(VwGetInfo);
#else
pRtns->GetInfo = NULL;
#endif

#ifdef VwGetDataFunc
pRtns->GetData = CAST FUNCTIONNAME(VwGetData);
#else
pRtns->GetData = NULL;
#endif

#ifdef VwSetDataFunc
pRtns->SetData = CAST FUNCTIONNAME(VwSetData);
#else
pRtns->SetData = NULL;
#endif

#ifdef VwLocalUpFunc
pRtns->LocalUp = FUNCTIONNAME(VwLocalUp);
#else
pRtns->LocalUp = NULL;
#endif

#ifdef VwLocalDownFunc
pRtns->LocalDown = FUNCTIONNAME(VwLocalDown);
#else
pRtns->LocalDown = NULL;
#endif

#ifdef VwAllocProcFunc
pRtns->AllocProc = CASTHPROC FUNCTIONNAME(VwAllocProc);
#else
pRtns->AllocProc = NULL;
#endif

#ifdef VwFreeProcFunc
pRtns->FreeProc = FUNCTIONNAME(VwFreeProc);
#else
pRtns->FreeProc = NULL;
#endif

#ifdef VwSetUserFunc
pRtns->SetUser = FUNCTIONNAME(VwSetUser);
#else
pRtns->SetUser = NULL;
#endif

#ifdef VwSetSoRtnFunc
pRtns->SetSoRtn = FUNCTIONNAME(VwSetSoRtn);
#else
pRtns->SetSoRtn = NULL;
#endif

#ifdef VwStreamCloseFunc
pRtns->StreamClose = FUNCTIONNAME(VwStreamClose);
#else
pRtns->StreamClose = NULL;
#endif

#ifdef VwStreamSectionType
#ifdef VwGetSectionDataFunc
pRtns->GetSectionData = CAST FUNCTIONNAME(VwGetSectionData);
#else
pRtns->GetSectionData = NULL;
#endif
#else
pRtns->GetSectionData = NULL;
#endif

#ifdef VwStreamSectionType
#ifdef VwSetSectionDataFunc
pRtns->SetSectionData = CAST FUNCTIONNAME(VwSetSectionData);
#else
pRtns->SetSectionData = NULL;
#endif
#else
pRtns->SetSectionData = NULL;
#endif

#ifdef VwStreamReadRecordFunc
pRtns->StreamReadRecord = FUNCTIONNAME(VwStreamReadRecord);
#else
pRtns->StreamReadRecord = NULL;
#endif

if (wLastRtn >= VWRTN_DOSPECIAL)
{
#ifdef VwDoSpecialFunc
pRtns->DoSpecial = FUNCTIONNAME(VwDoSpecial);
#else
pRtns->DoSpecial = NULL;
#endif
}

#undef CAST
#undef FUNCTIONNAME
#undef CASTHPROC
}

/*
| Filter macro for bitmap filters
*/

#defineSetRGBPixel(pDest,pRGB){*(BYTE VWPTR *)pDest++=((BYTE VWPTR *)pRGB)[2];*(BYTE VWPTR *)pDest++=((BYTE VWPTR *)pRGB)[1];*(BYTE VWPTR *)pDest++=*((BYTE VWPTR *)pRGB);}


/*
|SO routine macros
*/

#define SOPutChar(a,hP) (hP->SoRtns.SOPutChar)(a,hP->User1,hP->User2)
#define SOPutCharX(a,b,hP) (hP->SoRtns.SOPutCharX)(a,b,hP->User1,hP->User2)
#define SOPutSpecialCharX(a,b,hP) (hP->SoRtns.SOPutSpecialCharX)(a,b,hP->User1,hP->User2)
#define SOPutCharAttr(a,b,hP) (hP->SoRtns.SOPutCharAttr)(a,b,hP->User1,hP->User2)
#define SOPutCharHeight(a,hP) (hP->SoRtns.SOPutCharHeight)(a,hP->User1,hP->User2)
#define SOPutParaAlign(a,hP) (hP->SoRtns.SOPutParaAlign)(a,hP->User1,hP->User2)
#define SOPutParaIndents(a,b,c,hP)(hP->SoRtns.SOPutParaIndents)(a,b,c,hP->User1,hP->User2)
#define SOStartTabStops(hP)(hP->SoRtns.SOStartTabStops)(hP->User1,hP->User2)
#define SOEndTabStops(hP)(hP->SoRtns.SOEndTabStops)(hP->User1,hP->User2)
#define SOPutTabStop(a,hP) (hP->SoRtns.SOPutTabStop)(a,hP->User1,hP->User2)
#define SOPutMargins(a,b,hP) (hP->SoRtns.SOPutMargins)(a,b,hP->User1,hP->User2)
#define SOPutBreak(a,b,hP) (hP->SoRtns.SOPutBreak)(a,(DWORD)(b),hP->User1,hP->User2)
#define SOPutSubdocInfo(a,b,hP) (hP->SoRtns.SOPutSubdocInfo)(a,b,hP->User1,hP->User2)
#define SOPutTextCell(a,b,c,d,hP) (hP->SoRtns.SOPutTextCell)(a,b,c,d,hP->User1,hP->User2)
#define SOPutMoreText(a,b,c,hP) (hP->SoRtns.SOPutMoreText)(a,b,c,hP->User1,hP->User2)
#define SOPutDataCell(a,hP)(hP->SoRtns.SOPutDataCell)(a,hP->User1,hP->User2)
#define SOPutField(a,hP) (hP->SoRtns.SOPutField)(a,hP->User1,hP->User2)
#define SOPutVarField(a,b,c,hP) (hP->SoRtns.SOPutVarField)(a,b,c,hP->User1,hP->User2)
#define SOPutMoreVarField(a,b,c,hP) (hP->SoRtns.SOPutMoreVarField)(a,b,c,hP->User1,hP->User2)
#define SOStartColumnInfo(hP) (hP->SoRtns.SOStartColumnInfo)(hP->User1,hP->User2)
#define SOStartFieldInfo(hP) (hP->SoRtns.SOStartFieldInfo)(hP->User1,hP->User2)
#define SOPutColumnInfo(a,hP) (hP->SoRtns.SOPutColumnInfo)(a,hP->User1,hP->User2)
#define SOPutFieldInfo(a,hP) (hP->SoRtns.SOPutFieldInfo)(a,hP->User1,hP->User2)
#define SOEndColumnInfo(hP)(hP->SoRtns.SOEndColumnInfo)(hP->User1,hP->User2)
#define SOEndFieldInfo(hP) (hP->SoRtns.SOEndFieldInfo)(hP->User1,hP->User2)
#define SOPutSectionType(a,hP) (hP->SoRtns.SOPutSectionType)(a,hP->User1,hP->User2)
#define SOPutSectionName(a,hP) (hP->SoRtns.SOPutSectionName)(a,hP->User1,hP->User2)
#define SOSetDateBase(a,b,hP) (hP->SoRtns.SOSetDateBase)(a,b,hP->User1,hP->User2)
#define SOBailOut(a,hP) (hP->SoRtns.SOBailOut)(a,hP->User1,hP->User2)
#define SOTagBegin(a,hP) (hP->SoRtns.SOTagBegin)(a,hP->User1,hP->User2)
#define SOTagEnd(hP) (hP->SoRtns.SOTagEnd)(hP->User1,hP->User2)
#define SOGetInfo(a,b,hP)(hP->SoRtns.SOGetInfo)(a,b,hP->User1,hP->User2)
#define SUUserSaveData(a,hP) (hP->SoRtns.SUUserSaveData)(a,hP->User1,hP->User2)
#define SUUserRetrieveData(a,b,hP)(hP->SoRtns.SUUserRetrieveData)(a,b,hP->User1,hP->User2)
#define SOPutBitmapHeader(a,hP) (hP->SoRtns.SOPutBitmapHeader)(a,hP->User1,hP->User2)
#define SOStartPalette(hP) (hP->SoRtns.SOStartPalette)(hP->User1,hP->User2)
#define SOPutPaletteEntry(a,b,c,hP) (hP->SoRtns.SOPutPaletteEntry)(a,b,c,hP->User1,hP->User2)
#define SOEndPalette(hP) (hP->SoRtns.SOEndPalette)(hP->User1,hP->User2)
#define SOPutScanLineData(a,hP) (hP->SoRtns.SOPutScanLineData)(a,hP->User1,hP->User2)
#define SOPutCharFontById(a,hP) (hP->SoRtns.SOPutCharFontById)(a,hP->User1,hP->User2)
#define SOPutCharFontByName(a,b,hP) (hP->SoRtns.SOPutCharFontByName)(a,b,hP->User1,hP->User2)
#define SOPutParaSpacing(a,b,c,d,hP)(hP->SoRtns.SOPutParaSpacing)(a,b,c,d,hP->User1,hP->User2)
#define SOStartFontTable(hP) (hP->SoRtns.SOStartFontTable)(hP->User1,hP->User2)
#define SOPutFontTableEntry(a,b,c,hP) (hP->SoRtns.SOPutFontTableEntry)(a,b,c,hP->User1,hP->User2)
#define SOEndFontTable(hP) (hP->SoRtns.SOEndFontTable)(hP->User1,hP->User2)
#define SOPutArchiveField(a,b,c,hP) (hP->SoRtns.SOPutArchiveField)(a,b,c,hP->User1,hP->User2)
#define SOStartHdrInfo(hP) (hP->SoRtns.SOStartHdrInfo)(hP->User1,hP->User2)
#define SOEndHdrInfo(hP) (hP->SoRtns.SOEndHdrInfo)(hP->User1,hP->User2)
#define SOPutHdrEntry(a,b,c,hP) (hP->SoRtns.SOPutHdrEntry)(a,b,c,hP->User1,hP->User2)
#define SOPutVectorHeader(a,hP) (hP->SoRtns.SOPutVectorHeader)(a,hP->User1,hP->User2)
#define SOVectorObject(a,b,c,hP) (hP->SoRtns.SOVectorObject)(a,b,c,hP->User1,hP->User2)
#define SOVectorAttr(a,b,c,hP) (hP->SoRtns.SOVectorAttr)(a,b,c,hP->User1,hP->User2)
#define SOBeginTable(hP) (hP->SoRtns.SOBeginTable)(hP->User1,hP->User2)
#define SOEndTable(hP) (hP->SoRtns.SOEndTable)(hP->User1,hP->User2)
#define SOPutTableRowFormat(a,b,c,d,e,f,hP) (hP->SoRtns.SOPutTableRowFormat)(a,b,c,d,e,f,hP->User1,hP->User2)
#define SOPutTableCellInfo(a,hP) (hP->SoRtns.SOPutTableCellInfo)(a,hP->User1,hP->User2)
#define SOPutGraphicObject(a,hP) (hP->SoRtns.SOPutGraphicObject)(a,hP->User1,hP->User2)
#define SOGoToPosition(a,hP) (hP->SoRtns.SOGoToPosition)(a,hP->User1,hP->User2)
#define SODrawLine(a,b,c,d,e,hP) (hP->SoRtns.SODrawLine)(a,b,c,d,e,hP->User1,hP->User2)