mirror of
https://github.com/fadden/ciderpress.git
synced 2024-06-03 07:29:27 +00:00
Use types with explicit sizes
Much of what the "reformat" code does involves processing data that is 8, 16, or 32 bits. We want to use size-specific types from stdint.h (e.g. uint16_t) rather than "unsigned short". This was a quick pass to replace the various "unsigned" declarations. More can be done here and elsewhere.
This commit is contained in:
parent
0deecec87c
commit
8f61f84585
|
@ -1791,7 +1791,7 @@ bail:
|
||||||
* really large files.
|
* really large files.
|
||||||
*/
|
*/
|
||||||
CString
|
CString
|
||||||
DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
|
DiskArchive::LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
||||||
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const
|
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const
|
||||||
{
|
{
|
||||||
CString errMsg;
|
CString errMsg;
|
||||||
|
@ -1836,7 +1836,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pBuf = new BYTE[fileLen];
|
*pBuf = new uint8_t[fileLen];
|
||||||
if (*pBuf == NULL) {
|
if (*pBuf == NULL) {
|
||||||
errMsg.Format(L"Unable to allocate %ld bytes for '%ls'.",
|
errMsg.Format(L"Unable to allocate %ld bytes for '%ls'.",
|
||||||
fileLen, pathName);
|
fileLen, pathName);
|
||||||
|
@ -3056,8 +3056,8 @@ DiskArchive::XferPrepare(const XferFileOptions* pXferOpts)
|
||||||
* version just tucks the pointers into NufxLib structures.)
|
* version just tucks the pointers into NufxLib structures.)
|
||||||
*/
|
*/
|
||||||
CString
|
CString
|
||||||
DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
|
DiskArchive::XferFile(FileDetails* pDetails, uint8_t** pDataBuf,
|
||||||
long dataLen, BYTE** pRsrcBuf, long rsrcLen)
|
long dataLen, uint8_t** pRsrcBuf, long rsrcLen)
|
||||||
{
|
{
|
||||||
//const int kFileTypeTXT = 0x04;
|
//const int kFileTypeTXT = 0x04;
|
||||||
DiskFS::CreateParms createParms;
|
DiskFS::CreateParms createParms;
|
||||||
|
|
|
@ -153,8 +153,8 @@ public:
|
||||||
private:
|
private:
|
||||||
virtual CString Close(void);
|
virtual CString Close(void);
|
||||||
virtual void XferPrepare(const XferFileOptions* pXferOpts);
|
virtual void XferPrepare(const XferFileOptions* pXferOpts);
|
||||||
virtual CString XferFile(FileDetails* pDetails, BYTE** pDataBuf,
|
virtual CString XferFile(FileDetails* pDetails, uint8_t** pDataBuf,
|
||||||
long dataLen, BYTE** pRsrcBuf, long rsrcLen);
|
long dataLen, uint8_t** pRsrcBuf, long rsrcLen);
|
||||||
virtual void XferAbort(CWnd* pMsgWnd);
|
virtual void XferAbort(CWnd* pMsgWnd);
|
||||||
virtual void XferFinish(CWnd* pMsgWnd);
|
virtual void XferFinish(CWnd* pMsgWnd);
|
||||||
|
|
||||||
|
@ -222,11 +222,11 @@ private:
|
||||||
NuResult HandleReplaceExisting(const A2File* pExisting,
|
NuResult HandleReplaceExisting(const A2File* pExisting,
|
||||||
FileDetails* pDetails);
|
FileDetails* pDetails);
|
||||||
CString ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL);
|
CString ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL);
|
||||||
CString LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
|
CString LoadFile(const WCHAR* pathName, uint8_t** pBuf, long* pLen,
|
||||||
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const;
|
GenericEntry::ConvertEOL conv, GenericEntry::ConvertHighASCII convHA) const;
|
||||||
DIError AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
|
DIError AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
|
||||||
const BYTE* dataBuf, long dataLen,
|
const uint8_t* dataBuf, long dataLen,
|
||||||
const BYTE* rsrcBuf, long rsrcLen) const;
|
const uint8_t* rsrcBuf, long rsrcLen) const;
|
||||||
void AddToAddDataList(FileAddData* pData);
|
void AddToAddDataList(FileAddData* pData);
|
||||||
void FreeAddDataList(void);
|
void FreeAddDataList(void);
|
||||||
void ConvertFDToCP(const FileDetails* pDetails,
|
void ConvertFDToCP(const FileDetails* pDetails,
|
||||||
|
|
|
@ -440,7 +440,7 @@ DiskEditDialog::SetSpinner(int id, long val)
|
||||||
* Convert a chunk of data into a hex dump, and stuff it into the edit control.
|
* Convert a chunk of data into a hex dump, and stuff it into the edit control.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DiskEditDialog::DisplayData(const BYTE* srcBuf, int size)
|
DiskEditDialog::DisplayData(const uint8_t* srcBuf, int size)
|
||||||
{
|
{
|
||||||
WCHAR textBuf[80 * 16 * 2];
|
WCHAR textBuf[80 * 16 * 2];
|
||||||
WCHAR* cp;
|
WCHAR* cp;
|
||||||
|
|
|
@ -49,8 +49,8 @@ public:
|
||||||
virtual int LoadData(void) = 0;
|
virtual int LoadData(void) = 0;
|
||||||
|
|
||||||
virtual void DisplayData(void) = 0;
|
virtual void DisplayData(void) = 0;
|
||||||
virtual void DisplayData(const BYTE* buf, int size);
|
virtual void DisplayData(const uint8_t* buf, int size);
|
||||||
virtual void DisplayNibbleData(const BYTE* srcBuf, int size);
|
virtual void DisplayNibbleData(const uint8_t* srcBuf, int size);
|
||||||
|
|
||||||
bool GetReadOnly(void) const { return fReadOnly; }
|
bool GetReadOnly(void) const { return fReadOnly; }
|
||||||
void SetReadOnly(bool val) { fReadOnly = val; }
|
void SetReadOnly(bool val) { fReadOnly = val; }
|
||||||
|
@ -149,7 +149,7 @@ protected:
|
||||||
|
|
||||||
long fTrack;
|
long fTrack;
|
||||||
long fSector;
|
long fSector;
|
||||||
BYTE fSectorData[kSectorSize];
|
uint8_t fSectorData[kSectorSize];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -229,7 +229,7 @@ protected:
|
||||||
afx_msg virtual void OnOpenFile(void);
|
afx_msg virtual void OnOpenFile(void);
|
||||||
|
|
||||||
long fBlock;
|
long fBlock;
|
||||||
BYTE fBlockData[kBlockSize];
|
uint8_t fBlockData[kBlockSize];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ protected:
|
||||||
afx_msg virtual void OnNibbleParms(void) { ASSERT(false); }
|
afx_msg virtual void OnNibbleParms(void) { ASSERT(false); }
|
||||||
|
|
||||||
long fTrack;
|
long fTrack;
|
||||||
BYTE fNibbleData[DiskImgLib::kTrackAllocSize];
|
uint8_t fNibbleData[DiskImgLib::kTrackAllocSize];
|
||||||
long fNibbleDataLen;
|
long fNibbleDataLen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -228,10 +228,10 @@ public:
|
||||||
|
|
||||||
// Utility functions.
|
// Utility functions.
|
||||||
const WCHAR* GetFileTypeString(void) const;
|
const WCHAR* GetFileTypeString(void) const;
|
||||||
static bool CheckHighASCII(const BYTE* buffer,
|
static bool CheckHighASCII(const uint8_t* buffer,
|
||||||
unsigned long count);
|
unsigned long count);
|
||||||
|
|
||||||
static ConvertEOL DetermineConversion(const BYTE* buffer,
|
static ConvertEOL DetermineConversion(const uint8_t* buffer,
|
||||||
long count, EOLType* pSourceType, ConvertHighASCII* pConvHA);
|
long count, EOLType* pSourceType, ConvertHighASCII* pConvHA);
|
||||||
static int GenericEntry::WriteConvert(FILE* fp, const char* buf,
|
static int GenericEntry::WriteConvert(FILE* fp, const char* buf,
|
||||||
size_t len, ConvertEOL* pConv, ConvertHighASCII* pConvHA,
|
size_t len, ConvertEOL* pConv, ConvertHighASCII* pConvHA,
|
||||||
|
@ -520,8 +520,8 @@ public:
|
||||||
|
|
||||||
// Transfer files, one at a time, into this archive from another.
|
// Transfer files, one at a time, into this archive from another.
|
||||||
virtual void XferPrepare(const XferFileOptions* pXferOpts) = 0;
|
virtual void XferPrepare(const XferFileOptions* pXferOpts) = 0;
|
||||||
virtual CString XferFile(FileDetails* pDetails, BYTE** pDataBuf,
|
virtual CString XferFile(FileDetails* pDetails, uint8_t** pDataBuf,
|
||||||
long dataLen, BYTE** pRsrcBuf, long rsrcLen) = 0;
|
long dataLen, uint8_t** pRsrcBuf, long rsrcLen) = 0;
|
||||||
virtual void XferAbort(CWnd* pMsgWnd) = 0;
|
virtual void XferAbort(CWnd* pMsgWnd) = 0;
|
||||||
virtual void XferFinish(CWnd* pMsgWnd) = 0;
|
virtual void XferFinish(CWnd* pMsgWnd) = 0;
|
||||||
static void UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime);
|
static void UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime);
|
||||||
|
|
10
app/Main.h
10
app/Main.h
|
@ -139,8 +139,8 @@ public:
|
||||||
|
|
||||||
// save a buffer of data as a file in a disk image or file archive
|
// save a buffer of data as a file in a disk image or file archive
|
||||||
static bool SaveToArchive(GenericArchive::FileDetails* pDetails,
|
static bool SaveToArchive(GenericArchive::FileDetails* pDetails,
|
||||||
const BYTE* dataBuf, long dataLen,
|
const uint8_t* dataBuf, long dataLen,
|
||||||
const BYTE* rsrcBuf, long rsrcLen,
|
const uint8_t* rsrcBuf, long rsrcLen,
|
||||||
CString& errMsg, CWnd* pDialog);
|
CString& errMsg, CWnd* pDialog);
|
||||||
|
|
||||||
static const WCHAR kOpenNuFX[];
|
static const WCHAR kOpenNuFX[];
|
||||||
|
@ -317,11 +317,11 @@ private:
|
||||||
void BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
|
void BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
|
||||||
const DiskConvertDialog& convDlg, CString* pErrMsg);
|
const DiskConvertDialog& convDlg, CString* pErrMsg);
|
||||||
int SSTOpenImage(int seqNum, DiskImg* pDiskImg);
|
int SSTOpenImage(int seqNum, DiskImg* pDiskImg);
|
||||||
int SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf,
|
int SSTLoadData(int seqNum, DiskImg* pDiskImg, uint8_t* trackBuf,
|
||||||
long* pBadCount);
|
long* pBadCount);
|
||||||
long SSTGetBufOffset(int track);
|
long SSTGetBufOffset(int track);
|
||||||
long SSTCountBadBytes(const BYTE* sctBuf, int count);
|
long SSTCountBadBytes(const uint8_t* sctBuf, int count);
|
||||||
void SSTProcessTrackData(BYTE* trackBuf);
|
void SSTProcessTrackData(uint8_t* trackBuf);
|
||||||
void VolumeCopier(bool openFile);
|
void VolumeCopier(bool openFile);
|
||||||
bool EditTwoImgProps(const WCHAR* fileName);
|
bool EditTwoImgProps(const WCHAR* fileName);
|
||||||
|
|
||||||
|
|
|
@ -1134,7 +1134,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
|
||||||
ASSERT(pDiskImg != NULL);
|
ASSERT(pDiskImg != NULL);
|
||||||
|
|
||||||
/* allocate storage for the entire disk */
|
/* allocate storage for the entire disk */
|
||||||
diskData = new BYTE[pDiskImg->GetNumBlocks() * kBlockSize];
|
diskData = new uint8_t[pDiskImg->GetNumBlocks() * kBlockSize];
|
||||||
if (diskData == NULL) {
|
if (diskData == NULL) {
|
||||||
errMsg.Format(L"Unable to allocate %d bytes.",
|
errMsg.Format(L"Unable to allocate %d bytes.",
|
||||||
pDiskImg->GetNumBlocks() * kBlockSize);
|
pDiskImg->GetNumBlocks() * kBlockSize);
|
||||||
|
@ -1988,7 +1988,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind,
|
||||||
|
|
||||||
/* create a data source for it */
|
/* create a data source for it */
|
||||||
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed,
|
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed,
|
||||||
0, (const BYTE*)buf, 0, len, ArrayDeleteHandler,
|
0, (const uint8_t*) buf, 0, len, ArrayDeleteHandler,
|
||||||
&pSource);
|
&pSource);
|
||||||
if (nerr != kNuErrNone) {
|
if (nerr != kNuErrNone) {
|
||||||
pErrMsg->Format(L"Unable to create NufxLib data source (len=%d).",
|
pErrMsg->Format(L"Unable to create NufxLib data source (len=%d).",
|
||||||
|
@ -2538,7 +2538,7 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry,
|
||||||
|
|
||||||
/* create a data source to write from */
|
/* create a data source to write from */
|
||||||
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed,
|
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed,
|
||||||
maxLen, (const BYTE*)(LPCSTR)newStr, 0,
|
maxLen, (const uint8_t*)(LPCSTR) newStr, 0,
|
||||||
newStr.GetLength(), NULL, &pSource);
|
newStr.GetLength(), NULL, &pSource);
|
||||||
if (nerr != kNuErrNone) {
|
if (nerr != kNuErrNone) {
|
||||||
errMsg.Format(L"Unable to create NufxLib data source (len=%d, maxLen=%d).",
|
errMsg.Format(L"Unable to create NufxLib data source (len=%d, maxLen=%d).",
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -1552,7 +1552,7 @@ MainWindow::OnToolsSSTMerge(void)
|
||||||
const int kBadCountThreshold = 3072;
|
const int kBadCountThreshold = 3072;
|
||||||
DiskImg srcImg0, srcImg1;
|
DiskImg srcImg0, srcImg1;
|
||||||
CString appName, saveName, saveFolder, errMsg;
|
CString appName, saveName, saveFolder, errMsg;
|
||||||
BYTE* trackBuf = NULL;
|
uint8_t* trackBuf = NULL;
|
||||||
long badCount;
|
long badCount;
|
||||||
|
|
||||||
// no need to flush -- can't really open raw SST images
|
// no need to flush -- can't really open raw SST images
|
||||||
|
@ -1563,7 +1563,7 @@ MainWindow::OnToolsSSTMerge(void)
|
||||||
|
|
||||||
appName.LoadString(IDS_MB_APP_NAME);
|
appName.LoadString(IDS_MB_APP_NAME);
|
||||||
|
|
||||||
trackBuf = new BYTE[kSSTNumTracks * kSSTTrackLen];
|
trackBuf = new uint8_t[kSSTNumTracks * kSSTTrackLen];
|
||||||
if (trackBuf == NULL)
|
if (trackBuf == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
|
@ -1774,11 +1774,11 @@ bail:
|
||||||
* Returns 0 on success, -1 on failure.
|
* Returns 0 on success, -1 on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf,
|
MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, uint8_t* trackBuf,
|
||||||
long* pBadCount)
|
long* pBadCount)
|
||||||
{
|
{
|
||||||
DIError dierr;
|
DIError dierr;
|
||||||
BYTE sctBuf[256];
|
uint8_t sctBuf[256];
|
||||||
int track, sector;
|
int track, sector;
|
||||||
long bufOffset;
|
long bufOffset;
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,17 @@
|
||||||
// are changed infrequently
|
// are changed infrequently
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
/* UNIX includes */
|
/* UNIX includes */
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -47,9 +49,6 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <atlstr.h>
|
#include <atlstr.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
@ -65,7 +64,6 @@ typedef unsigned int ssize_t;
|
||||||
#define HAVE__VSNPRINTF
|
#define HAVE__VSNPRINTF
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
|
|
||||||
|
|
||||||
//{{AFX_INSERT_LOCATION}}
|
//{{AFX_INSERT_LOCATION}}
|
||||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,16 @@
|
||||||
//#include <windows.h>
|
//#include <windows.h>
|
||||||
|
|
||||||
// C RunTime Header Files
|
// C RunTime Header Files
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <tchar.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
//#include <tchar.h>
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
#include <afxcmn.h>
|
#include <afxcmn.h>
|
||||||
#include <afxdlgs.h>
|
#include <afxdlgs.h>
|
||||||
|
|
|
@ -32,11 +32,11 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = true;
|
fUseRTF = true;
|
||||||
Chunk doc, header, footer;
|
Chunk doc, header, footer;
|
||||||
unsigned short val;
|
uint16_t val;
|
||||||
|
|
||||||
CheckGSCharConv();
|
CheckGSCharConv();
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder,
|
||||||
* Read one of the chunks of the file.
|
* Read one of the chunks of the file.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatAWGS_WP::ReadChunk(const unsigned char** pSrcBuf, long* pSrcLen,
|
ReformatAWGS_WP::ReadChunk(const uint8_t** pSrcBuf, long* pSrcLen,
|
||||||
Chunk* pChunk)
|
Chunk* pChunk)
|
||||||
{
|
{
|
||||||
/* starts with the saveArray count */
|
/* starts with the saveArray count */
|
||||||
|
@ -210,12 +210,12 @@ ReformatAWGS_WP::PrintChunk(const Chunk* pChunk)
|
||||||
{
|
{
|
||||||
const int kDefaultStatusBits = kAWGSJustifyLeft | kAWGSSingleSpace;
|
const int kDefaultStatusBits = kAWGSJustifyLeft | kAWGSSingleSpace;
|
||||||
SaveArrayEntry sae;
|
SaveArrayEntry sae;
|
||||||
const unsigned char* saveArray;
|
const uint8_t* saveArray;
|
||||||
int saCount;
|
int saCount;
|
||||||
const unsigned char* blockPtr;
|
const uint8_t* blockPtr;
|
||||||
long blockLen;
|
long blockLen;
|
||||||
const unsigned char* pRuler;
|
const uint8_t* pRuler;
|
||||||
unsigned short rulerStatusBits;
|
uint16_t rulerStatusBits;
|
||||||
|
|
||||||
saveArray = pChunk->saveArray;
|
saveArray = pChunk->saveArray;
|
||||||
saCount = pChunk->saveArrayCount;
|
saCount = pChunk->saveArrayCount;
|
||||||
|
@ -291,12 +291,11 @@ ReformatAWGS_WP::PrintChunk(const Chunk* pChunk)
|
||||||
* skip through them earlier. We don't really need to worry about running
|
* skip through them earlier. We don't really need to worry about running
|
||||||
* off the end due to a bad file.
|
* off the end due to a bad file.
|
||||||
*/
|
*/
|
||||||
const unsigned char*
|
const uint8_t*
|
||||||
ReformatAWGS_WP::FindTextBlock(const Chunk* pChunk, int blockNum)
|
ReformatAWGS_WP::FindTextBlock(const Chunk* pChunk, int blockNum)
|
||||||
{
|
{
|
||||||
const unsigned char* blockPtr = pChunk->textBlocks;
|
const uint8_t* blockPtr = pChunk->textBlocks;
|
||||||
long count = pChunk->numTextBlocks;
|
uint32_t blockSize;
|
||||||
unsigned long blockSize;
|
|
||||||
|
|
||||||
while (blockNum--) {
|
while (blockNum--) {
|
||||||
blockSize = Get32LE(blockPtr);
|
blockSize = Get32LE(blockPtr);
|
||||||
|
@ -315,12 +314,12 @@ ReformatAWGS_WP::FindTextBlock(const Chunk* pChunk, int blockNum)
|
||||||
* Returns the #of bytes consumed.
|
* Returns the #of bytes consumed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatAWGS_WP::PrintParagraph(const unsigned char* ptr, long maxLen)
|
ReformatAWGS_WP::PrintParagraph(const uint8_t* ptr, long maxLen)
|
||||||
{
|
{
|
||||||
const unsigned char* startPtr = ptr;
|
const uint8_t* startPtr = ptr;
|
||||||
unsigned short firstFont;
|
uint16_t firstFont;
|
||||||
unsigned char firstStyle, firstSize, firstColor;
|
uint8_t firstStyle, firstSize, firstColor;
|
||||||
unsigned char uch;
|
uint8_t uch;
|
||||||
|
|
||||||
if (maxLen < 7) {
|
if (maxLen < 7) {
|
||||||
LOGI("AWGS_WP GLITCH: not enough storage for para header (%d)",
|
LOGI("AWGS_WP GLITCH: not enough storage for para header (%d)",
|
||||||
|
@ -408,9 +407,9 @@ ReformatAWGS_WP::PrintParagraph(const unsigned char* ptr, long maxLen)
|
||||||
/*
|
/*
|
||||||
* Run through the SaveArray and find the highest-numbered ruler index.
|
* Run through the SaveArray and find the highest-numbered ruler index.
|
||||||
*/
|
*/
|
||||||
unsigned short
|
uint16_t
|
||||||
ReformatAWGS_WP::GetNumRulers(const unsigned char* pSaveArray,
|
ReformatAWGS_WP::GetNumRulers(const uint8_t* pSaveArray,
|
||||||
unsigned short saveArrayCount)
|
uint16_t saveArrayCount)
|
||||||
{
|
{
|
||||||
SaveArrayEntry sa;
|
SaveArrayEntry sa;
|
||||||
int maxRuler = -1;
|
int maxRuler = -1;
|
||||||
|
@ -430,7 +429,7 @@ ReformatAWGS_WP::GetNumRulers(const unsigned char* pSaveArray,
|
||||||
/* there must be at least one paragraph, so this must hold */
|
/* there must be at least one paragraph, so this must hold */
|
||||||
assert(maxRuler >= 0);
|
assert(maxRuler >= 0);
|
||||||
|
|
||||||
return (unsigned short) (maxRuler+1);
|
return (uint16_t) (maxRuler+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -439,12 +438,12 @@ ReformatAWGS_WP::GetNumRulers(const unsigned char* pSaveArray,
|
||||||
*
|
*
|
||||||
* These are stored linearly, so we just need to look at the last entry.
|
* These are stored linearly, so we just need to look at the last entry.
|
||||||
*/
|
*/
|
||||||
unsigned short
|
uint16_t
|
||||||
ReformatAWGS_WP::GetNumTextBlocks(const unsigned char* pSaveArray,
|
ReformatAWGS_WP::GetNumTextBlocks(const uint8_t* pSaveArray,
|
||||||
unsigned short saveArrayCount)
|
uint16_t saveArrayCount)
|
||||||
{
|
{
|
||||||
SaveArrayEntry sa;
|
SaveArrayEntry sa;
|
||||||
unsigned short maxTextBlock;
|
uint16_t maxTextBlock;
|
||||||
|
|
||||||
assert(saveArrayCount > 0);
|
assert(saveArrayCount > 0);
|
||||||
UnpackSaveArrayEntry(pSaveArray + (saveArrayCount-1) * kSaveArrayEntryLen,
|
UnpackSaveArrayEntry(pSaveArray + (saveArrayCount-1) * kSaveArrayEntryLen,
|
||||||
|
@ -475,14 +474,14 @@ ReformatAWGS_WP::GetNumTextBlocks(const unsigned char* pSaveArray,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (unsigned short) (maxTextBlock+1);
|
return (uint16_t) (maxTextBlock+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unpack a SaveArray entry.
|
* Unpack a SaveArray entry.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatAWGS_WP::UnpackSaveArrayEntry(const unsigned char* pSaveArray,
|
ReformatAWGS_WP::UnpackSaveArrayEntry(const uint8_t* pSaveArray,
|
||||||
SaveArrayEntry* pSAE)
|
SaveArrayEntry* pSAE)
|
||||||
{
|
{
|
||||||
pSAE->textBlock = Get16LE(pSaveArray + 0);
|
pSAE->textBlock = Get16LE(pSaveArray + 0);
|
||||||
|
@ -503,11 +502,11 @@ ReformatAWGS_WP::UnpackSaveArrayEntry(const unsigned char* pSaveArray,
|
||||||
* Returns "true" on success, "false" on failure.
|
* Returns "true" on success, "false" on failure.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatAWGS_WP::SkipTextBlocks(const unsigned char** pSrcBuf,
|
ReformatAWGS_WP::SkipTextBlocks(const uint8_t** pSrcBuf,
|
||||||
long* pSrcLen, int textBlockCount)
|
long* pSrcLen, int textBlockCount)
|
||||||
{
|
{
|
||||||
unsigned long blockSize;
|
uint32_t blockSize;
|
||||||
const unsigned char* srcBuf = *pSrcBuf;
|
const uint8_t* srcBuf = *pSrcBuf;
|
||||||
long srcLen = *pSrcLen;
|
long srcLen = *pSrcLen;
|
||||||
|
|
||||||
LOGI("Scanning %d text blocks", textBlockCount);
|
LOGI("Scanning %d text blocks", textBlockCount);
|
||||||
|
|
|
@ -29,12 +29,12 @@ private:
|
||||||
* Definition of a "SaveArray" entry.
|
* Definition of a "SaveArray" entry.
|
||||||
*/
|
*/
|
||||||
typedef struct SaveArrayEntry {
|
typedef struct SaveArrayEntry {
|
||||||
unsigned short textBlock; // Text Block number
|
uint16_t textBlock; // Text Block number
|
||||||
unsigned short offset; // add to offset of text block
|
uint16_t offset; // add to offset of text block
|
||||||
unsigned short attributes; // 0=normal text, 1=page break para
|
uint16_t attributes; // 0=normal text, 1=page break para
|
||||||
unsigned short rulerNum; // number of ruler for this para
|
uint16_t rulerNum; // number of ruler for this para
|
||||||
unsigned short pixelHeight; // height of para in pixels
|
uint16_t pixelHeight; // height of para in pixels
|
||||||
unsigned short numLines; // number of lines in this para
|
uint16_t numLines; // number of lines in this para
|
||||||
} SaveArrayEntry;
|
} SaveArrayEntry;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -42,12 +42,12 @@ private:
|
||||||
* has the same general structure.
|
* has the same general structure.
|
||||||
*/
|
*/
|
||||||
typedef struct Chunk {
|
typedef struct Chunk {
|
||||||
const unsigned char* saveArray;
|
const uint8_t* saveArray;
|
||||||
const unsigned char* rulers;
|
const uint8_t* rulers;
|
||||||
const unsigned char* textBlocks;
|
const uint8_t* textBlocks;
|
||||||
unsigned short saveArrayCount;
|
uint16_t saveArrayCount;
|
||||||
unsigned short numRulers;
|
uint16_t numRulers;
|
||||||
unsigned short numTextBlocks;
|
uint16_t numTextBlocks;
|
||||||
} Chunk;
|
} Chunk;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -74,18 +74,18 @@ private:
|
||||||
kAWGSSingleSpace = 0x01
|
kAWGSSingleSpace = 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ReadChunk(const unsigned char** pSrcBuf, long* pSrcLen,
|
bool ReadChunk(const uint8_t** pSrcBuf, long* pSrcLen,
|
||||||
Chunk* pChunk);
|
Chunk* pChunk);
|
||||||
void PrintChunk(const Chunk* pChunk);
|
void PrintChunk(const Chunk* pChunk);
|
||||||
const unsigned char* FindTextBlock(const Chunk* pChunk, int blockNum);
|
const uint8_t* FindTextBlock(const Chunk* pChunk, int blockNum);
|
||||||
int PrintParagraph(const unsigned char* ptr, long maxLen);
|
int PrintParagraph(const uint8_t* ptr, long maxLen);
|
||||||
unsigned short GetNumRulers(const unsigned char* pSaveArray,
|
uint16_t GetNumRulers(const uint8_t* pSaveArray,
|
||||||
unsigned short saveArrayCount);
|
uint16_t saveArrayCount);
|
||||||
unsigned short GetNumTextBlocks(const unsigned char* pSaveArray,
|
uint16_t GetNumTextBlocks(const uint8_t* pSaveArray,
|
||||||
unsigned short saveArrayCount);
|
uint16_t saveArrayCount);
|
||||||
void UnpackSaveArrayEntry(const unsigned char* pSaveArray,
|
void UnpackSaveArrayEntry(const uint8_t* pSaveArray,
|
||||||
SaveArrayEntry* pSAE);
|
SaveArrayEntry* pSAE);
|
||||||
bool SkipTextBlocks(const unsigned char** pSrcBuf,
|
bool SkipTextBlocks(const uint8_t** pSrcBuf,
|
||||||
long* pSrcLen, int blockCount);
|
long* pSrcLen, int blockCount);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,13 @@ ReformatAWP::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
bool skipRecord;
|
bool skipRecord;
|
||||||
uchar lineRecCode, lineRecData;
|
uint8_t lineRecCode, lineRecData;
|
||||||
|
|
||||||
if (srcLen > 65536)
|
if (srcLen > 65536)
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
@ -168,8 +168,8 @@ ReformatAWP::InitDocState(void)
|
||||||
* Process a line record.
|
* Process a line record.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatAWP::ProcessLineRecord(uchar lineRecData, uchar lineRecCode,
|
ReformatAWP::ProcessLineRecord(uint8_t lineRecData, uint8_t lineRecCode,
|
||||||
const unsigned char** pSrcPtr, long* pLength)
|
const uint8_t** pSrcPtr, long* pLength)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
@ -305,12 +305,12 @@ ReformatAWP::ProcessLineRecord(uchar lineRecData, uchar lineRecCode,
|
||||||
* "lineRecData" has the number of bytes of input that we have yet to read.
|
* "lineRecData" has the number of bytes of input that we have yet to read.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatAWP::HandleTextRecord(uchar lineRecData,
|
ReformatAWP::HandleTextRecord(uint8_t lineRecData,
|
||||||
const unsigned char** pSrcPtr, long* pLength)
|
const uint8_t** pSrcPtr, long* pLength)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
uchar tabFlags;
|
uint8_t tabFlags;
|
||||||
uchar byteCountPlusCR;
|
uint8_t byteCountPlusCR;
|
||||||
int byteCount = lineRecData;
|
int byteCount = lineRecData;
|
||||||
bool noOutput = false;
|
bool noOutput = false;
|
||||||
int ic;
|
int ic;
|
||||||
|
@ -493,7 +493,7 @@ ReformatADB::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -533,7 +533,7 @@ ReformatADB::Process(const ReformatHolder* pHolder,
|
||||||
LOGI(" ADB should be %d reports", numReports);
|
LOGI(" ADB should be %d reports", numReports);
|
||||||
|
|
||||||
/* dump category names as first record */
|
/* dump category names as first record */
|
||||||
const unsigned char* catPtr;
|
const uint8_t* catPtr;
|
||||||
int catCount;
|
int catCount;
|
||||||
catPtr = srcPtr + 357;
|
catPtr = srcPtr + 357;
|
||||||
catCount = numCats;
|
catCount = numCats;
|
||||||
|
@ -544,7 +544,7 @@ ReformatADB::Process(const ReformatHolder* pHolder,
|
||||||
BufPrintf(",\"");
|
BufPrintf(",\"");
|
||||||
|
|
||||||
int nameLen = *catPtr;
|
int nameLen = *catPtr;
|
||||||
const unsigned char* namePtr = catPtr + 1;
|
const uint8_t* namePtr = catPtr + 1;
|
||||||
while (nameLen--) {
|
while (nameLen--) {
|
||||||
if (*namePtr == '"')
|
if (*namePtr == '"')
|
||||||
BufPrintf("\"\"");
|
BufPrintf("\"\"");
|
||||||
|
@ -650,7 +650,7 @@ ReformatADB::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (ctrl--) {
|
while (ctrl--) {
|
||||||
unsigned char ch = Read8(&srcPtr, &length);
|
uint8_t ch = Read8(&srcPtr, &length);
|
||||||
BufPrintf("%c", ch);
|
BufPrintf("%c", ch);
|
||||||
if (ch == '"')
|
if (ch == '"')
|
||||||
BufPrintf("%c", ch);
|
BufPrintf("%c", ch);
|
||||||
|
@ -751,7 +751,7 @@ ReformatASP::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -798,7 +798,7 @@ ReformatASP::Process(const ReformatHolder* pHolder,
|
||||||
*/
|
*/
|
||||||
fCurrentRow = 1;
|
fCurrentRow = 1;
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
unsigned short rowLen;
|
uint16_t rowLen;
|
||||||
int rowNum;
|
int rowNum;
|
||||||
|
|
||||||
/* row length or EOF marker */
|
/* row length or EOF marker */
|
||||||
|
@ -843,10 +843,9 @@ bail:
|
||||||
* Process one row of spreadsheet data.
|
* Process one row of spreadsheet data.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatASP::ProcessRow(int rowNum, const unsigned char** pSrcPtr,
|
ReformatASP::ProcessRow(int rowNum, const uint8_t** pSrcPtr, long* pLength)
|
||||||
long* pLength)
|
|
||||||
{
|
{
|
||||||
uchar ctrl;
|
uint8_t ctrl;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
fCurrentCol = 0;
|
fCurrentCol = 0;
|
||||||
|
@ -900,9 +899,9 @@ ReformatASP::ProcessRow(int rowNum, const unsigned char** pSrcPtr,
|
||||||
* Process the contents of a single cell.
|
* Process the contents of a single cell.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatASP::ProcessCell(const unsigned char* srcPtr, long cellLength)
|
ReformatASP::ProcessCell(const uint8_t* srcPtr, long cellLength)
|
||||||
{
|
{
|
||||||
uchar flag1, flag2;
|
uint8_t flag1, flag2;
|
||||||
double dval;
|
double dval;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -971,7 +970,7 @@ ReformatASP::ProcessCell(const unsigned char* srcPtr, long cellLength)
|
||||||
* several bytes to express.
|
* several bytes to express.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength)
|
ReformatASP::PrintToken(const uint8_t** pSrcPtr, long* pLength)
|
||||||
{
|
{
|
||||||
/* string constants; note these must NOT contain '"' chars */
|
/* string constants; note these must NOT contain '"' chars */
|
||||||
const int kTokenStart = 0xc0;
|
const int kTokenStart = 0xc0;
|
||||||
|
@ -993,7 +992,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength)
|
||||||
/*0xf8*/ "*", "(", "-" /*unary*/, "+" /*unary*/,
|
/*0xf8*/ "*", "(", "-" /*unary*/, "+" /*unary*/,
|
||||||
/*0xfc*/ "...", "", "", ""
|
/*0xfc*/ "...", "", "", ""
|
||||||
};
|
};
|
||||||
uchar token;
|
uint8_t token;
|
||||||
|
|
||||||
token = Read8(pSrcPtr, pLength);
|
token = Read8(pSrcPtr, pLength);
|
||||||
if (token < kTokenStart) {
|
if (token < kTokenStart) {
|
||||||
|
@ -1039,7 +1038,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (i--) {
|
while (i--) {
|
||||||
unsigned char ch = Read8(pSrcPtr, pLength);
|
uint8_t ch = Read8(pSrcPtr, pLength);
|
||||||
BufPrintQChar(ch);
|
BufPrintQChar(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1102,15 +1101,15 @@ ReformatASP::PrintCol(int col)
|
||||||
* -----
|
* -----
|
||||||
*/
|
*/
|
||||||
double
|
double
|
||||||
ReformatASP::ConvertSANEDouble(const unsigned char* srcPtr)
|
ReformatASP::ConvertSANEDouble(const uint8_t* srcPtr)
|
||||||
{
|
{
|
||||||
double newVal;
|
double newVal;
|
||||||
unsigned char* dptr;
|
uint8_t* dptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ASSERT(sizeof(newVal) == kSANELen);
|
ASSERT(sizeof(newVal) == kSANELen);
|
||||||
|
|
||||||
dptr = (unsigned char*) &newVal;
|
dptr = (uint8_t*) &newVal;
|
||||||
for (i = 0; i < kSANELen; i++)
|
for (i = 0; i < kSANELen; i++)
|
||||||
*dptr++ = *srcPtr++;
|
*dptr++ = *srcPtr++;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ public:
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef unsigned char uchar;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants.
|
* Constants.
|
||||||
|
@ -110,20 +109,20 @@ private:
|
||||||
* be exactly 300 bytes.
|
* be exactly 300 bytes.
|
||||||
*/
|
*/
|
||||||
typedef struct FileHeader {
|
typedef struct FileHeader {
|
||||||
uchar unused1[4]; /* 000 - 003: not used */
|
uint8_t unused1[4]; /* 000 - 003: not used */
|
||||||
uchar seventyNine; /* 004 : $4f (79) */
|
uint8_t seventyNine; /* 004 : $4f (79) */
|
||||||
uchar tabStops[80]; /* 005 - 084: tab stops, one of "=<^>.|" */
|
uint8_t tabStops[80]; /* 005 - 084: tab stops, one of "=<^>.|" */
|
||||||
uchar zoomFlag; /* 085 : boolean Zoom flag */
|
uint8_t zoomFlag; /* 085 : boolean Zoom flag */
|
||||||
uchar unused2[4]; /* 086 - 089: not used */
|
uint8_t unused2[4]; /* 086 - 089: not used */
|
||||||
uchar paginatedFlag; /* 090 : boolean Paginated flag */
|
uint8_t paginatedFlag; /* 090 : boolean Paginated flag */
|
||||||
uchar minLeftMargin; /* 091 : minimum "unseen" left margin */
|
uint8_t minLeftMargin; /* 091 : minimum "unseen" left margin */
|
||||||
uchar mailMergeFlag; /* 092 : boolean - file has merge cmds */
|
uint8_t mailMergeFlag; /* 092 : boolean - file has merge cmds */
|
||||||
uchar unused3[83]; /* 093 - 175: not used, reserved */
|
uint8_t unused3[83]; /* 093 - 175: not used, reserved */
|
||||||
uchar multiRulerFlag; /* 176 : (3.0) boolean Multiple Rulers */
|
uint8_t multiRulerFlag; /* 176 : (3.0) boolean Multiple Rulers */
|
||||||
uchar tabRulers[6]; /* 177 - 182: (3.0) used internally */
|
uint8_t tabRulers[6]; /* 177 - 182: (3.0) used internally */
|
||||||
uchar sfMinVers; /* 183 : (3.0) min version of AW req */
|
uint8_t sfMinVers; /* 183 : (3.0) min version of AW req */
|
||||||
uchar unused4[66]; /* 184 - 249: reserved */
|
uint8_t unused4[66]; /* 184 - 249: reserved */
|
||||||
uchar unused5[50]; /* 250 - 299: available */
|
uint8_t unused5[50]; /* 250 - 299: available */
|
||||||
} FileHeader;
|
} FileHeader;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -139,10 +138,10 @@ private:
|
||||||
|
|
||||||
|
|
||||||
void InitDocState(void);
|
void InitDocState(void);
|
||||||
int ProcessLineRecord(uchar lineRecData, uchar lineRecCode,
|
int ProcessLineRecord(uint8_t lineRecData, uint8_t lineRecCode,
|
||||||
const unsigned char** pSrcPtr, long* pLength);
|
const uint8_t** pSrcPtr, long* pLength);
|
||||||
int HandleTextRecord(uchar lineRecData,
|
int HandleTextRecord(uint8_t lineRecData,
|
||||||
const unsigned char** pSrcPtr, long* pLength);
|
const uint8_t** pSrcPtr, long* pLength);
|
||||||
|
|
||||||
FileHeader fFileHeader;
|
FileHeader fFileHeader;
|
||||||
DocState fDocState;
|
DocState fDocState;
|
||||||
|
@ -192,54 +191,52 @@ private:
|
||||||
kSANELen = 8,
|
kSANELen = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef unsigned char uchar;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File header, mapped directly on top of the input. This structure must
|
* File header, mapped directly on top of the input. This structure must
|
||||||
* be exactly 300 bytes.
|
* be exactly 300 bytes.
|
||||||
*/
|
*/
|
||||||
typedef struct FileHeader {
|
typedef struct FileHeader {
|
||||||
uchar unused1[4]; /* 000-003: not used */
|
uint8_t unused1[4]; /* 000-003: not used */
|
||||||
uchar colWidth[127]; /* 004-130: column width for each column */
|
uint8_t colWidth[127]; /* 004-130: column width for each column */
|
||||||
uchar recalcOrder; /* 131 : recalc order ('R' or 'C') */
|
uint8_t recalcOrder; /* 131 : recalc order ('R' or 'C') */
|
||||||
uchar recalcFreq; /* 132 : recalc frequency ('A' or 'M') */
|
uint8_t recalcFreq; /* 132 : recalc frequency ('A' or 'M') */
|
||||||
uchar lastRowRef[2]; /* 133-134: last row referenced */
|
uint8_t lastRowRef[2]; /* 133-134: last row referenced */
|
||||||
uchar lastColRef; /* 135 : last column referenced */
|
uint8_t lastColRef; /* 135 : last column referenced */
|
||||||
uchar numWindows; /* 136 : '1'/'S'/'T' */
|
uint8_t numWindows; /* 136 : '1'/'S'/'T' */
|
||||||
uchar windowSync; /* 137 : if two windows, are sync'ed? */
|
uint8_t windowSync; /* 137 : if two windows, are sync'ed? */
|
||||||
uchar winInfo1[24]; /* 138-161: struct with info for 1st window */
|
uint8_t winInfo1[24]; /* 138-161: struct with info for 1st window */
|
||||||
uchar winInfo2[24]; /* 162-185: struct with info for 2nd window */
|
uint8_t winInfo2[24]; /* 162-185: struct with info for 2nd window */
|
||||||
uchar unused2[27]; /* 186-212: not used */
|
uint8_t unused2[27]; /* 186-212: not used */
|
||||||
uchar cellProt; /* 213 : cell protection on/off */
|
uint8_t cellProt; /* 213 : cell protection on/off */
|
||||||
uchar unused3; /* 214 : not used */
|
uint8_t unused3; /* 214 : not used */
|
||||||
uchar platenWidth; /* 215 : platen width */
|
uint8_t platenWidth; /* 215 : platen width */
|
||||||
uchar leftMargin; /* 216 : left margin, in 1/10th inches */
|
uint8_t leftMargin; /* 216 : left margin, in 1/10th inches */
|
||||||
uchar rightMargin; /* 217 : right margin */
|
uint8_t rightMargin; /* 217 : right margin */
|
||||||
uchar cpi; /* 218 : characters per inch */
|
uint8_t cpi; /* 218 : characters per inch */
|
||||||
uchar paperLength; /* 219 : paper length, 1/10th inches */
|
uint8_t paperLength; /* 219 : paper length, 1/10th inches */
|
||||||
uchar topMargin; /* 220 : top margin */
|
uint8_t topMargin; /* 220 : top margin */
|
||||||
uchar bottomMargin; /* 221 : bottom margin */
|
uint8_t bottomMargin; /* 221 : bottom margin */
|
||||||
uchar lpi; /* 222 : lines per inch (6 or 8) */
|
uint8_t lpi; /* 222 : lines per inch (6 or 8) */
|
||||||
uchar spacing; /* 223 : 'S'ingle, 'D'ouble, or 'T'riple */
|
uint8_t spacing; /* 223 : 'S'ingle, 'D'ouble, or 'T'riple */
|
||||||
uchar printerCodes[14];/*224-237: "special codes" for printer */
|
uint8_t printerCodes[14];/*224-237: "special codes" for printer */
|
||||||
uchar printDash; /* 238 : print dash when entry is blank */
|
uint8_t printDash; /* 238 : print dash when entry is blank */
|
||||||
uchar reportHeader; /* 239 : print report header */
|
uint8_t reportHeader; /* 239 : print report header */
|
||||||
uchar zoomed; /* 240 : zoomed to show formulas */
|
uint8_t zoomed; /* 240 : zoomed to show formulas */
|
||||||
uchar reserved1; /* 241 : used internally (v2.1) */
|
uint8_t reserved1; /* 241 : used internally (v2.1) */
|
||||||
uchar ssMinVers; /* 242 : holds 0 for AW2.x, 0x1e for AW3.x */
|
uint8_t ssMinVers; /* 242 : holds 0 for AW2.x, 0x1e for AW3.x */
|
||||||
uchar reserved2[7]; /* 243-249: reserved */
|
uint8_t reserved2[7]; /* 243-249: reserved */
|
||||||
uchar available[50]; /* 250-299: available for non-AW app use */
|
uint8_t available[50]; /* 250-299: available for non-AW app use */
|
||||||
} FileHeader;
|
} FileHeader;
|
||||||
|
|
||||||
int fCurrentRow, fCurrentCol;
|
int fCurrentRow, fCurrentCol;
|
||||||
char fPrintColBuf[3];
|
char fPrintColBuf[3];
|
||||||
|
|
||||||
int ProcessRow(int rowNum, const unsigned char** pSrcPtr,
|
int ProcessRow(int rowNum, const uint8_t** pSrcPtr,
|
||||||
long* pLength);
|
long* pLength);
|
||||||
void ProcessCell(const unsigned char* srcPtr, long cellLength);
|
void ProcessCell(const uint8_t* srcPtr, long cellLength);
|
||||||
void PrintToken(const unsigned char** pSrcPtr, long* pLength);
|
void PrintToken(const uint8_t** pSrcPtr, long* pLength);
|
||||||
const char* PrintCol(int col);
|
const char* PrintCol(int col);
|
||||||
double ConvertSANEDouble(const unsigned char* srcPtr);
|
double ConvertSANEDouble(const uint8_t* srcPtr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*REFORMAT_APPLEWORKS_H*/
|
#endif /*REFORMAT_APPLEWORKS_H*/
|
||||||
|
|
176
reformat/Asm.cpp
176
reformat/Asm.cpp
|
@ -79,7 +79,7 @@ ReformatSCAssem::Examine(ReformatHolder* pHolder)
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
ReformatSCAssem::IsSCAssem(const ReformatHolder* pHolder)
|
ReformatSCAssem::IsSCAssem(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
const unsigned char* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
// (this was written before tab stuff in ReformatAsm class existed)
|
// (this was written before tab stuff in ReformatAsm class existed)
|
||||||
|
@ -132,8 +132,8 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
unsigned char lineLen;
|
uint8_t lineLen;
|
||||||
unsigned short lineNum;
|
uint16_t lineNum;
|
||||||
|
|
||||||
/* pull the length byte, which we sanity-check */
|
/* pull the length byte, which we sanity-check */
|
||||||
lineLen = *srcPtr++;
|
lineLen = *srcPtr++;
|
||||||
|
@ -155,7 +155,7 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder,
|
||||||
} else if (*srcPtr == 0xc0) {
|
} else if (*srcPtr == 0xc0) {
|
||||||
if (length > 2) {
|
if (length > 2) {
|
||||||
int count = *(srcPtr+1);
|
int count = *(srcPtr+1);
|
||||||
unsigned char ch = *(srcPtr+2);
|
uint8_t ch = *(srcPtr + 2);
|
||||||
|
|
||||||
srcPtr += 2;
|
srcPtr += 2;
|
||||||
length -= 2;
|
length -= 2;
|
||||||
|
@ -274,7 +274,7 @@ ReformatMerlin::Examine(ReformatHolder* pHolder)
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
ReformatMerlin::IsMerlin(const ReformatHolder* pHolder)
|
ReformatMerlin::IsMerlin(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
const unsigned char* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
|
|
||||||
bool isLineStart = true;
|
bool isLineStart = true;
|
||||||
|
@ -334,14 +334,14 @@ ReformatMerlin::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
enum { kStateLabel, kStateMnemonic, kStateOperand, kStateComment };
|
enum { kStateLabel, kStateMnemonic, kStateOperand, kStateComment };
|
||||||
int tabStop[] = { 0, 9, 15, 26 }; // 1:1 map with state enum
|
int tabStop[] = { 0, 9, 15, 26 }; // 1:1 map with state enum
|
||||||
int state;
|
int state;
|
||||||
unsigned char quoteChar = '\0';
|
uint8_t quoteChar = '\0';
|
||||||
|
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
|
@ -461,9 +461,9 @@ ReformatLISA2::Examine(ReformatHolder* pHolder)
|
||||||
bool
|
bool
|
||||||
ReformatLISA2::IsLISA(const ReformatHolder* pHolder)
|
ReformatLISA2::IsLISA(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
unsigned short version, len;
|
uint16_t version, len;
|
||||||
|
|
||||||
if (srcLen < 8)
|
if (srcLen < 8)
|
||||||
return false;
|
return false;
|
||||||
|
@ -523,7 +523,7 @@ ReformatLISA2::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long actualLen;
|
long actualLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -535,7 +535,7 @@ ReformatLISA2::Process(const ReformatHolder* pHolder,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short version;
|
uint16_t version;
|
||||||
|
|
||||||
version = Read16(&srcPtr, &srcLen); // usually 0x1800; maybe "2.4"?
|
version = Read16(&srcPtr, &srcLen); // usually 0x1800; maybe "2.4"?
|
||||||
actualLen = Read16(&srcPtr, &srcLen);
|
actualLen = Read16(&srcPtr, &srcLen);
|
||||||
|
@ -580,10 +580,10 @@ bail:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReformatLISA2::ProcessLine(const unsigned char* buf)
|
ReformatLISA2::ProcessLine(const uint8_t* buf)
|
||||||
{
|
{
|
||||||
int len = *buf;
|
int len = *buf;
|
||||||
unsigned char uch;
|
uint8_t uch;
|
||||||
|
|
||||||
// consume length byte
|
// consume length byte
|
||||||
buf++;
|
buf++;
|
||||||
|
@ -784,7 +784,7 @@ ReformatLISA3::Examine(ReformatHolder* pHolder)
|
||||||
ReformatLISA3::IsLISA(const ReformatHolder* pHolder)
|
ReformatLISA3::IsLISA(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
bool dosStructure = (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS);
|
bool dosStructure = (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS);
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
|
|
||||||
if (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS)
|
if (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS)
|
||||||
|
@ -793,7 +793,7 @@ ReformatLISA3::IsLISA(const ReformatHolder* pHolder)
|
||||||
if (srcLen < kHeaderLen+2)
|
if (srcLen < kHeaderLen+2)
|
||||||
return false; // too short
|
return false; // too short
|
||||||
|
|
||||||
unsigned short codeLen, symLen;
|
uint16_t codeLen, symLen;
|
||||||
|
|
||||||
codeLen = srcPtr[0x00] | srcPtr[0x01] << 8;
|
codeLen = srcPtr[0x00] | srcPtr[0x01] << 8;
|
||||||
symLen = srcPtr[0x02] | srcPtr[0x03] << 8;
|
symLen = srcPtr[0x02] | srcPtr[0x03] << 8;
|
||||||
|
@ -822,7 +822,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
|
||||||
|
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
unsigned short codeLen, symLen;
|
uint16_t codeLen, symLen;
|
||||||
|
|
||||||
codeLen = srcPtr[0x00] | srcPtr[0x01] << 8;
|
codeLen = srcPtr[0x00] | srcPtr[0x01] << 8;
|
||||||
symLen = srcPtr[0x02] | srcPtr[0x03] << 8;
|
symLen = srcPtr[0x02] | srcPtr[0x03] << 8;
|
||||||
|
@ -868,8 +868,8 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
|
||||||
/*
|
/*
|
||||||
* Do stuff with source lines.
|
* Do stuff with source lines.
|
||||||
*/
|
*/
|
||||||
const unsigned char* codePtr;
|
const uint8_t* codePtr;
|
||||||
const unsigned char* endPtr;
|
const uint8_t* endPtr;
|
||||||
int lineNum;
|
int lineNum;
|
||||||
|
|
||||||
codePtr = srcPtr + kHeaderLen + symLen;
|
codePtr = srcPtr + kHeaderLen + symLen;
|
||||||
|
@ -878,7 +878,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
|
||||||
lineNum = 0;
|
lineNum = 0;
|
||||||
|
|
||||||
while (codePtr < endPtr) {
|
while (codePtr < endPtr) {
|
||||||
unsigned char flagByte;
|
uint8_t flagByte;
|
||||||
int lineLen;
|
int lineLen;
|
||||||
|
|
||||||
OutputStart();
|
OutputStart();
|
||||||
|
@ -967,9 +967,9 @@ bail:
|
||||||
* BIGONE
|
* BIGONE
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA3::ProcessLine(const unsigned char* codePtr, int len)
|
ReformatLISA3::ProcessLine(const uint8_t* codePtr, int len)
|
||||||
{
|
{
|
||||||
unsigned char mnemonic = 0;
|
uint8_t mnemonic = 0;
|
||||||
|
|
||||||
//printf("{code=0x%02x len=%d}", *codePtr, len);
|
//printf("{code=0x%02x len=%d}", *codePtr, len);
|
||||||
if (*codePtr == kCMNTTKN+1 || *codePtr == kCMNTTKN) {
|
if (*codePtr == kCMNTTKN+1 || *codePtr == kCMNTTKN) {
|
||||||
|
@ -987,7 +987,7 @@ ReformatLISA3::ProcessLine(const unsigned char* codePtr, int len)
|
||||||
goto bail;
|
goto bail;
|
||||||
} else if (*codePtr == kMACTKN || *codePtr == kMACTKN+1) {
|
} else if (*codePtr == kMACTKN || *codePtr == kMACTKN+1) {
|
||||||
/* CHKMACRO - handle macro */
|
/* CHKMACRO - handle macro */
|
||||||
unsigned short idx;
|
uint16_t idx;
|
||||||
mnemonic = *codePtr;
|
mnemonic = *codePtr;
|
||||||
idx = (*codePtr & 0x01) << 8;
|
idx = (*codePtr & 0x01) << 8;
|
||||||
idx |= *++codePtr;
|
idx |= *++codePtr;
|
||||||
|
@ -999,7 +999,7 @@ ReformatLISA3::ProcessLine(const unsigned char* codePtr, int len)
|
||||||
goto ConvtOperand;
|
goto ConvtOperand;
|
||||||
} else if (*codePtr == kLBLTKN || *codePtr == kLBLTKN+1) {
|
} else if (*codePtr == kLBLTKN || *codePtr == kLBLTKN+1) {
|
||||||
/* CHKCLBL - handle label at start of line */
|
/* CHKCLBL - handle label at start of line */
|
||||||
unsigned short idx;
|
uint16_t idx;
|
||||||
idx = (*codePtr & 0x01) << 8;
|
idx = (*codePtr & 0x01) << 8;
|
||||||
idx |= *++codePtr;
|
idx |= *++codePtr;
|
||||||
PrintSymEntry(idx);
|
PrintSymEntry(idx);
|
||||||
|
@ -1055,17 +1055,17 @@ bail:
|
||||||
* CNVOPRND
|
* CNVOPRND
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA3::ConvertOperand(unsigned char mnemonic,
|
ReformatLISA3::ConvertOperand(uint8_t mnemonic,
|
||||||
const unsigned char** pCodePtr, int* pLen)
|
const uint8_t** pCodePtr, int* pLen)
|
||||||
{
|
{
|
||||||
static const char kOPRTRST1[] = "+-*/&|^=<>%<><";
|
static const char kOPRTRST1[] = "+-*/&|^=<>%<><";
|
||||||
static const char kOPRTRST2[] = "\0\0\0\0\0\0\0\0\0\0\0==>";
|
static const char kOPRTRST2[] = "\0\0\0\0\0\0\0\0\0\0\0==>";
|
||||||
|
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
OperandResult result;
|
OperandResult result;
|
||||||
unsigned char adrsMode = 0;
|
uint8_t adrsMode = 0;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
|
|
||||||
//printf("{opr len=%d}", len);
|
//printf("{opr len=%d}", len);
|
||||||
|
|
||||||
|
@ -1116,7 +1116,7 @@ ReformatLISA3::ConvertOperand(unsigned char mnemonic,
|
||||||
}
|
}
|
||||||
|
|
||||||
OutOprtr:
|
OutOprtr:
|
||||||
unsigned char opr;
|
uint8_t opr;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
break;
|
break;
|
||||||
|
@ -1164,7 +1164,7 @@ bail:
|
||||||
* Output a single byte as a binary string.
|
* Output a single byte as a binary string.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA3::PrintBin(unsigned char val)
|
ReformatLISA3::PrintBin(uint8_t val)
|
||||||
{
|
{
|
||||||
char buf[9];
|
char buf[9];
|
||||||
buf[8] = '\0';
|
buf[8] = '\0';
|
||||||
|
@ -1178,10 +1178,10 @@ ReformatLISA3::PrintBin(unsigned char val)
|
||||||
* OUTNUM
|
* OUTNUM
|
||||||
*/
|
*/
|
||||||
ReformatLISA3::OperandResult
|
ReformatLISA3::OperandResult
|
||||||
ReformatLISA3::PrintNum(int adrsMode, unsigned char val,
|
ReformatLISA3::PrintNum(int adrsMode, uint8_t val,
|
||||||
const unsigned char** pCodePtr, int* pLen)
|
const uint8_t** pCodePtr, int* pLen)
|
||||||
{
|
{
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
OperandResult result = kResultUnknown;
|
OperandResult result = kResultUnknown;
|
||||||
char numBuf[12];
|
char numBuf[12];
|
||||||
|
@ -1196,7 +1196,7 @@ ReformatLISA3::PrintNum(int adrsMode, unsigned char val,
|
||||||
len--;
|
len--;
|
||||||
} else if (val == 0x1b) {
|
} else if (val == 0x1b) {
|
||||||
// 2-byte decimal
|
// 2-byte decimal
|
||||||
unsigned short num;
|
uint16_t num;
|
||||||
num = *codePtr++;
|
num = *codePtr++;
|
||||||
num |= *codePtr++ << 8;
|
num |= *codePtr++ << 8;
|
||||||
len -= 2;
|
len -= 2;
|
||||||
|
@ -1211,7 +1211,7 @@ ReformatLISA3::PrintNum(int adrsMode, unsigned char val,
|
||||||
} else if (val == 0x1d) {
|
} else if (val == 0x1d) {
|
||||||
// 2-byte hex
|
// 2-byte hex
|
||||||
Output('$');
|
Output('$');
|
||||||
unsigned short num;
|
uint16_t num;
|
||||||
num = *codePtr++;
|
num = *codePtr++;
|
||||||
num |= *codePtr++ << 8;
|
num |= *codePtr++ << 8;
|
||||||
sprintf(numBuf, "%04X", num);
|
sprintf(numBuf, "%04X", num);
|
||||||
|
@ -1252,7 +1252,7 @@ ReformatLISA3::PrintNum(int adrsMode, unsigned char val,
|
||||||
Output(val - 0x20);
|
Output(val - 0x20);
|
||||||
} else if (val < 0x60) {
|
} else if (val < 0x60) {
|
||||||
// ?6..?9 tokens (+0x5c)
|
// ?6..?9 tokens (+0x5c)
|
||||||
unsigned char newVal = val - 0x24;
|
uint8_t newVal = val - 0x24;
|
||||||
Output('?');
|
Output('?');
|
||||||
if (newVal == ';')
|
if (newVal == ';')
|
||||||
Output('#');
|
Output('#');
|
||||||
|
@ -1325,8 +1325,8 @@ ReformatLISA3::PrintSymEntry(int ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char* packed = &fSymTab[ent * 8];
|
const uint8_t* packed = &fSymTab[ent * 8];
|
||||||
unsigned char tmp[8];
|
uint8_t tmp[8];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tmp[0] = packed[0] >> 2;
|
tmp[0] = packed[0] >> 2;
|
||||||
|
@ -1350,7 +1350,7 @@ ReformatLISA3::PrintSymEntry(int ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReformatLISA3::PrintMnemonic(unsigned char val)
|
ReformatLISA3::PrintMnemonic(uint8_t val)
|
||||||
{
|
{
|
||||||
const char* ptr = &gMnemonics3[val * 3];
|
const char* ptr = &gMnemonics3[val * 3];
|
||||||
Output(ptr[0]);
|
Output(ptr[0]);
|
||||||
|
@ -1364,7 +1364,7 @@ ReformatLISA3::PrintMnemonic(unsigned char val)
|
||||||
* Prints the comment. Finishes off the operand if necessary.
|
* Prints the comment. Finishes off the operand if necessary.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA3::PrintComment(int adrsMode, const unsigned char* codePtr, int len)
|
ReformatLISA3::PrintComment(int adrsMode, const uint8_t* codePtr, int len)
|
||||||
{
|
{
|
||||||
assert(len >= 0);
|
assert(len >= 0);
|
||||||
|
|
||||||
|
@ -1448,7 +1448,7 @@ ReformatLISA4::Examine(ReformatHolder* pHolder)
|
||||||
ReformatLISA4::IsLISA(const ReformatHolder* pHolder)
|
ReformatLISA4::IsLISA(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
bool dosStructure = (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS);
|
bool dosStructure = (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS);
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
|
|
||||||
if (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS)
|
if (pHolder->GetSourceFormat() == ReformatHolder::kSourceFormatDOS)
|
||||||
|
@ -1457,9 +1457,9 @@ ReformatLISA4::IsLISA(const ReformatHolder* pHolder)
|
||||||
if (srcLen < kHeaderLen+2)
|
if (srcLen < kHeaderLen+2)
|
||||||
return false; // too short
|
return false; // too short
|
||||||
|
|
||||||
unsigned short version;
|
uint16_t version;
|
||||||
unsigned short symEnd;
|
uint16_t symEnd;
|
||||||
unsigned short symCount;
|
uint16_t symCount;
|
||||||
|
|
||||||
version = srcPtr[0x00] | srcPtr[0x01] << 8;
|
version = srcPtr[0x00] | srcPtr[0x01] << 8;
|
||||||
symEnd = srcPtr[0x02] | srcPtr[0x03] << 8;
|
symEnd = srcPtr[0x02] | srcPtr[0x03] << 8;
|
||||||
|
@ -1475,7 +1475,7 @@ ReformatLISA4::IsLISA(const ReformatHolder* pHolder)
|
||||||
return false;;
|
return false;;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char opTab, adTab, comTab;
|
uint8_t opTab, adTab, comTab;
|
||||||
opTab = srcPtr[0x06];
|
opTab = srcPtr[0x06];
|
||||||
adTab = srcPtr[0x07];
|
adTab = srcPtr[0x07];
|
||||||
comTab = srcPtr[0x08];
|
comTab = srcPtr[0x08];
|
||||||
|
@ -1492,7 +1492,7 @@ ReformatLISA4::IsLISA(const ReformatHolder* pHolder)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* gHexDigit = "0123456789ABCDEF";
|
static const char gHexDigit[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1563,7 +1563,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -1574,8 +1574,8 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
|
||||||
|
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
unsigned short version;
|
uint16_t version;
|
||||||
unsigned short symEnd;
|
uint16_t symEnd;
|
||||||
|
|
||||||
version = srcPtr[0x00] | srcPtr[0x01] << 8;
|
version = srcPtr[0x00] | srcPtr[0x01] << 8;
|
||||||
symEnd = srcPtr[0x02] | srcPtr[0x03] << 8;
|
symEnd = srcPtr[0x02] | srcPtr[0x03] << 8;
|
||||||
|
@ -1599,13 +1599,13 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
if (fSymCount > 0) {
|
if (fSymCount > 0) {
|
||||||
fSymTab = new const unsigned char*[fSymCount];
|
fSymTab = new const uint8_t*[fSymCount];
|
||||||
if (fSymTab == NULL)
|
if (fSymTab == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char* symPtr;
|
const uint8_t* symPtr;
|
||||||
const unsigned char* endPtr;
|
const uint8_t* endPtr;
|
||||||
int symIdx;
|
int symIdx;
|
||||||
|
|
||||||
symPtr = srcPtr + kHeaderLen;
|
symPtr = srcPtr + kHeaderLen;
|
||||||
|
@ -1636,7 +1636,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
|
||||||
/*
|
/*
|
||||||
* Process source lines.
|
* Process source lines.
|
||||||
*/
|
*/
|
||||||
const unsigned char* codePtr;
|
const uint8_t* codePtr;
|
||||||
int lineNum;
|
int lineNum;
|
||||||
|
|
||||||
codePtr = srcPtr + symEnd;
|
codePtr = srcPtr + symEnd;
|
||||||
|
@ -1645,7 +1645,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
|
||||||
lineNum = 0;
|
lineNum = 0;
|
||||||
|
|
||||||
while (codePtr < endPtr) {
|
while (codePtr < endPtr) {
|
||||||
unsigned char flagByte;
|
uint8_t flagByte;
|
||||||
int lineLen;
|
int lineLen;
|
||||||
|
|
||||||
lineNum++;
|
lineNum++;
|
||||||
|
@ -1732,9 +1732,9 @@ bail:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ReformatLISA4::ProcessLine(const unsigned char* codePtr, int len)
|
ReformatLISA4::ProcessLine(const uint8_t* codePtr, int len)
|
||||||
{
|
{
|
||||||
unsigned char mnemonic = 0;
|
uint8_t mnemonic = 0;
|
||||||
|
|
||||||
if (*codePtr == kComntSemiTKN || *codePtr == kComntStarTKN ||
|
if (*codePtr == kComntSemiTKN || *codePtr == kComntStarTKN ||
|
||||||
*codePtr == kErrlnTKN)
|
*codePtr == kErrlnTKN)
|
||||||
|
@ -1765,7 +1765,7 @@ ReformatLISA4::ProcessLine(const unsigned char* codePtr, int len)
|
||||||
goto ConvtOperand;
|
goto ConvtOperand;
|
||||||
} else if (*codePtr == kLabelTKN) {
|
} else if (*codePtr == kLabelTKN) {
|
||||||
/* handle label at start of line */
|
/* handle label at start of line */
|
||||||
unsigned short idx;
|
uint16_t idx;
|
||||||
idx = *++codePtr;
|
idx = *++codePtr;
|
||||||
idx |= *++codePtr << 8;
|
idx |= *++codePtr << 8;
|
||||||
PrintSymEntry(idx);
|
PrintSymEntry(idx);
|
||||||
|
@ -1836,8 +1836,8 @@ bail:
|
||||||
* ConvtOperand
|
* ConvtOperand
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA4::ConvertOperand(unsigned char mnemonic,
|
ReformatLISA4::ConvertOperand(uint8_t mnemonic,
|
||||||
const unsigned char** pCodePtr, int* pLen)
|
const uint8_t** pCodePtr, int* pLen)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Address header char.
|
* Address header char.
|
||||||
|
@ -1937,11 +1937,11 @@ ReformatLISA4::ConvertOperand(unsigned char mnemonic,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
OperandResult result;
|
OperandResult result;
|
||||||
unsigned char adrsMode = 0;
|
uint8_t adrsMode = 0;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
if (mnemonic == kMacroTKN || mnemonic < kSS) {
|
if (mnemonic == kMacroTKN || mnemonic < kSS) {
|
||||||
|
@ -2015,7 +2015,7 @@ ReformatLISA4::ConvertOperand(unsigned char mnemonic,
|
||||||
|
|
||||||
if (doOutOprtr) {
|
if (doOutOprtr) {
|
||||||
OutOprtr:
|
OutOprtr:
|
||||||
unsigned char opr;
|
uint8_t opr;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
break;
|
break;
|
||||||
|
@ -2096,10 +2096,10 @@ not_operator:
|
||||||
* CnvrtDec - convert to decimal output.
|
* CnvrtDec - convert to decimal output.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA4::PrintDec(int count, const unsigned char** pCodePtr,
|
ReformatLISA4::PrintDec(int count, const uint8_t** pCodePtr,
|
||||||
int* pLen)
|
int* pLen)
|
||||||
{
|
{
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
long val = 0;
|
long val = 0;
|
||||||
char buf[12]; // 4 bytes, max 10 chars + sign + nul
|
char buf[12]; // 4 bytes, max 10 chars + sign + nul
|
||||||
|
@ -2119,12 +2119,12 @@ ReformatLISA4::PrintDec(int count, const unsigned char** pCodePtr,
|
||||||
* CnvrtHex - convert to hex output.
|
* CnvrtHex - convert to hex output.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA4::PrintHex(int count, const unsigned char** pCodePtr,
|
ReformatLISA4::PrintHex(int count, const uint8_t** pCodePtr,
|
||||||
int* pLen)
|
int* pLen)
|
||||||
{
|
{
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
|
|
||||||
Output('$');
|
Output('$');
|
||||||
for (int i = count-1; i >= 0; i--) {
|
for (int i = count-1; i >= 0; i--) {
|
||||||
|
@ -2143,12 +2143,12 @@ ReformatLISA4::PrintHex(int count, const unsigned char** pCodePtr,
|
||||||
* CnvrtBin - convert to binary output.
|
* CnvrtBin - convert to binary output.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatLISA4::PrintBin(int count, const unsigned char** pCodePtr,
|
ReformatLISA4::PrintBin(int count, const uint8_t** pCodePtr,
|
||||||
int* pLen)
|
int* pLen)
|
||||||
{
|
{
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
char buf[9];
|
char buf[9];
|
||||||
|
|
||||||
buf[8] = '\0';
|
buf[8] = '\0';
|
||||||
|
@ -2172,11 +2172,11 @@ ReformatLISA4::PrintBin(int count, const unsigned char** pCodePtr,
|
||||||
* OUTNUM
|
* OUTNUM
|
||||||
*/
|
*/
|
||||||
ReformatLISA4::OperandResult
|
ReformatLISA4::OperandResult
|
||||||
ReformatLISA4::PrintNum(unsigned char opr, const unsigned char** pCodePtr,
|
ReformatLISA4::PrintNum(uint8_t opr, const uint8_t** pCodePtr,
|
||||||
int* pLen)
|
int* pLen)
|
||||||
{
|
{
|
||||||
OperandResult result = kResultUnknown;
|
OperandResult result = kResultUnknown;
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
|
@ -2247,9 +2247,9 @@ ReformatLISA4::PrintNum(unsigned char opr, const unsigned char** pCodePtr,
|
||||||
Output("{CheckMoreOprnd}");
|
Output("{CheckMoreOprnd}");
|
||||||
} else {
|
} else {
|
||||||
/* CheckStrings */
|
/* CheckStrings */
|
||||||
unsigned char strLen;
|
uint8_t strLen;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
unsigned char delimit;
|
uint8_t delimit;
|
||||||
|
|
||||||
if ((opr & 0x1f) == 0) {
|
if ((opr & 0x1f) == 0) {
|
||||||
strLen = *codePtr++;
|
strLen = *codePtr++;
|
||||||
|
@ -2296,20 +2296,20 @@ ReformatLISA4::PrintNum(unsigned char opr, const unsigned char** pCodePtr,
|
||||||
* OutOprComp
|
* OutOprComp
|
||||||
*/
|
*/
|
||||||
ReformatLISA4::OperandResult
|
ReformatLISA4::OperandResult
|
||||||
ReformatLISA4::PrintComplexOperand(unsigned char opr,
|
ReformatLISA4::PrintComplexOperand(uint8_t opr,
|
||||||
const unsigned char** pCodePtr, int* pLen)
|
const uint8_t** pCodePtr, int* pLen)
|
||||||
{
|
{
|
||||||
if (opr != kBign_tkn)
|
if (opr != kBign_tkn)
|
||||||
return PrintNum(opr, pCodePtr, pLen);
|
return PrintNum(opr, pCodePtr, pLen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const unsigned char* codePtr = *pCodePtr;
|
const uint8_t* codePtr = *pCodePtr;
|
||||||
int len = *pLen;
|
int len = *pLen;
|
||||||
*pCodePtr = codePtr;
|
*pCodePtr = codePtr;
|
||||||
*pLen = len;
|
*pLen = len;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned char subClass;
|
uint8_t subClass;
|
||||||
|
|
||||||
/* OutOprComp */
|
/* OutOprComp */
|
||||||
subClass = *(*pCodePtr)++;
|
subClass = *(*pCodePtr)++;
|
||||||
|
@ -2322,28 +2322,28 @@ ReformatLISA4::PrintComplexOperand(unsigned char opr,
|
||||||
PrintBin(4, pCodePtr, pLen);
|
PrintBin(4, pCodePtr, pLen);
|
||||||
} else if (subClass == kBignhexs_tkn) {
|
} else if (subClass == kBignhexs_tkn) {
|
||||||
/* hex string, for HEX pseudo-op */
|
/* hex string, for HEX pseudo-op */
|
||||||
unsigned char hexLen = *(*pCodePtr)++;
|
uint8_t hexLen = *(*pCodePtr)++;
|
||||||
(*pLen)--;
|
(*pLen)--;
|
||||||
if (hexLen > *pLen) {
|
if (hexLen > *pLen) {
|
||||||
Output("!BAD HEX!");
|
Output("!BAD HEX!");
|
||||||
return kResultFailed;
|
return kResultFailed;
|
||||||
}
|
}
|
||||||
while (hexLen--) {
|
while (hexLen--) {
|
||||||
unsigned char val = *(*pCodePtr)++;
|
uint8_t val = *(*pCodePtr)++;
|
||||||
(*pLen)--;
|
(*pLen)--;
|
||||||
Output(gHexDigit[(val & 0xf0) >> 4]);
|
Output(gHexDigit[(val & 0xf0) >> 4]);
|
||||||
Output(gHexDigit[val & 0x0f]);
|
Output(gHexDigit[val & 0x0f]);
|
||||||
}
|
}
|
||||||
} else if (subClass == kBignstring_tkn) {
|
} else if (subClass == kBignstring_tkn) {
|
||||||
/* undelimited string */
|
/* undelimited string */
|
||||||
unsigned char strLen = *(*pCodePtr)++;
|
uint8_t strLen = *(*pCodePtr)++;
|
||||||
(*pLen)--;
|
(*pLen)--;
|
||||||
if (strLen > *pLen) {
|
if (strLen > *pLen) {
|
||||||
Output("!BAD USTR!");
|
Output("!BAD USTR!");
|
||||||
return kResultFailed;
|
return kResultFailed;
|
||||||
}
|
}
|
||||||
while (strLen--) {
|
while (strLen--) {
|
||||||
unsigned char val = *(*pCodePtr)++;
|
uint8_t val = *(*pCodePtr)++;
|
||||||
(*pLen)--;
|
(*pLen)--;
|
||||||
Output(val & 0x7f);
|
Output(val & 0x7f);
|
||||||
}
|
}
|
||||||
|
@ -2368,9 +2368,9 @@ ReformatLISA4::PrintSymEntry(int ent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char* str = fSymTab[ent];
|
const uint8_t* str = fSymTab[ent];
|
||||||
|
|
||||||
unsigned char uc;
|
uint8_t uc;
|
||||||
str++;
|
str++;
|
||||||
while (1) {
|
while (1) {
|
||||||
uc = *str++;
|
uc = *str++;
|
||||||
|
|
|
@ -121,7 +121,7 @@ private:
|
||||||
kComTab = 39,
|
kComTab = 39,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ProcessLine(const unsigned char* buf);
|
void ProcessLine(const uint8_t* buf);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -147,17 +147,17 @@ private:
|
||||||
kResultGotoOutOprnd,
|
kResultGotoOutOprnd,
|
||||||
} OperandResult;
|
} OperandResult;
|
||||||
|
|
||||||
void ProcessLine(const unsigned char* codePtr, int len);
|
void ProcessLine(const uint8_t* codePtr, int len);
|
||||||
void ConvertOperand(unsigned char mnemonic, const unsigned char** pCodePtr,
|
void ConvertOperand(uint8_t mnemonic, const uint8_t** pCodePtr,
|
||||||
int* pLen);
|
int* pLen);
|
||||||
OperandResult PrintNum(int adrsMode, unsigned char val,
|
OperandResult PrintNum(int adrsMode, uint8_t val,
|
||||||
const unsigned char** pCodePtr, int* pLen);
|
const uint8_t** pCodePtr, int* pLen);
|
||||||
OperandResult PrintComplexOperand(unsigned char opr,
|
OperandResult PrintComplexOperand(uint8_t opr,
|
||||||
const unsigned char** pCodePtr, int* pLen);
|
const uint8_t** pCodePtr, int* pLen);
|
||||||
void PrintSymEntry(int ent);
|
void PrintSymEntry(int ent);
|
||||||
void PrintMnemonic(unsigned char val);
|
void PrintMnemonic(uint8_t val);
|
||||||
void PrintBin(unsigned char val);
|
void PrintBin(uint8_t val);
|
||||||
void PrintComment(int adrsMode, const unsigned char* ptr, int len);
|
void PrintComment(int adrsMode, const uint8_t* ptr, int len);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kHeaderLen = 4,
|
kHeaderLen = 4,
|
||||||
|
@ -187,8 +187,8 @@ private:
|
||||||
kGROUP9 = 0x4a,
|
kGROUP9 = 0x4a,
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned char* fSymTab;
|
const uint8_t* fSymTab;
|
||||||
unsigned short fSymCount;
|
uint16_t fSymCount;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -265,28 +265,25 @@ private:
|
||||||
kResultGotoOutOprnd,
|
kResultGotoOutOprnd,
|
||||||
} OperandResult;
|
} OperandResult;
|
||||||
|
|
||||||
void ProcessLine(const unsigned char* codePtr, int len);
|
void ProcessLine(const uint8_t* codePtr, int len);
|
||||||
void ConvertOperand(unsigned char mnemonic, const unsigned char** pCodePtr,
|
void ConvertOperand(uint8_t mnemonic, const uint8_t** pCodePtr,
|
||||||
int* pLen);
|
int* pLen);
|
||||||
void PrintSymEntry(int ent);
|
void PrintSymEntry(int ent);
|
||||||
OperandResult PrintNum(unsigned char opr, const unsigned char** pCodePtr,
|
OperandResult PrintNum(uint8_t opr, const uint8_t** pCodePtr,
|
||||||
int* pLen);
|
|
||||||
OperandResult PrintComplexOperand(unsigned char opr,
|
|
||||||
const unsigned char** pCodePtr, int* pLen);
|
|
||||||
void PrintDec(int count, const unsigned char** pCodePtr,
|
|
||||||
int* pLen);
|
|
||||||
void PrintHex(int count, const unsigned char** pCodePtr,
|
|
||||||
int* pLen);
|
|
||||||
void PrintBin(int count, const unsigned char** pCodePtr,
|
|
||||||
int* pLen);
|
int* pLen);
|
||||||
|
OperandResult PrintComplexOperand(uint8_t opr,
|
||||||
|
const uint8_t** pCodePtr, int* pLen);
|
||||||
|
void PrintDec(int count, const uint8_t** pCodePtr, int* pLen);
|
||||||
|
void PrintHex(int count, const uint8_t** pCodePtr, int* pLen);
|
||||||
|
void PrintBin(int count, const uint8_t** pCodePtr, int* pLen);
|
||||||
|
|
||||||
const unsigned char** fSymTab;
|
const uint8_t** fSymTab;
|
||||||
unsigned short fSymCount;
|
uint16_t fSymCount;
|
||||||
|
|
||||||
unsigned char fOpTab;
|
uint8_t fOpTab;
|
||||||
unsigned char fAdTab;
|
uint8_t fAdTab;
|
||||||
unsigned char fComTab;
|
uint8_t fComTab;
|
||||||
unsigned char fCpuType;
|
uint8_t fCpuType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*REFORMAT_ASM_H*/
|
#endif /*REFORMAT_ASM_H*/
|
||||||
|
|
|
@ -106,7 +106,7 @@ ReformatApplesoft::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -133,8 +133,8 @@ ReformatApplesoft::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
unsigned short nextAddr;
|
uint16_t nextAddr;
|
||||||
unsigned short lineNum;
|
uint16_t lineNum;
|
||||||
bool inQuote = false;
|
bool inQuote = false;
|
||||||
bool inRem = false;
|
bool inRem = false;
|
||||||
|
|
||||||
|
@ -349,10 +349,9 @@ ReformatInteger::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
//unsigned short val16;
|
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
//srcPtr += 0xff0; //0x228e;
|
//srcPtr += 0xff0; //0x228e;
|
||||||
|
@ -379,8 +378,8 @@ ReformatInteger::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
unsigned char lineLen;
|
uint8_t lineLen;
|
||||||
unsigned short lineNum;
|
uint16_t lineNum;
|
||||||
bool trailingSpace;
|
bool trailingSpace;
|
||||||
bool newTrailingSpace = false;
|
bool newTrailingSpace = false;
|
||||||
|
|
||||||
|
@ -622,7 +621,7 @@ ReformatBusiness::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -649,14 +648,14 @@ ReformatBusiness::Process(const ReformatHolder* pHolder,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short fileLength;
|
uint16_t fileLength;
|
||||||
fileLength = Read16(&srcPtr, &length);
|
fileLength = Read16(&srcPtr, &length);
|
||||||
LOGI(" BA3 internal file length is: %d", fileLength);
|
LOGI(" BA3 internal file length is: %d", fileLength);
|
||||||
|
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
unsigned short increment;
|
uint16_t increment;
|
||||||
unsigned short extendedToken;
|
uint16_t extendedToken;
|
||||||
unsigned short lineNum;
|
uint16_t lineNum;
|
||||||
bool inQuote = false;
|
bool inQuote = false;
|
||||||
bool inRem = false;
|
bool inRem = false;
|
||||||
bool firstData = true;
|
bool firstData = true;
|
||||||
|
|
|
@ -62,7 +62,7 @@ void
|
||||||
ReformatCPMText::Examine(ReformatHolder* pHolder)
|
ReformatCPMText::Examine(ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
ReformatHolder::ReformatApplies applies = ReformatHolder::kApplicNot;
|
ReformatHolder::ReformatApplies applies = ReformatHolder::kApplicNot;
|
||||||
const unsigned char* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long fileLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long fileLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
const char* nameExt = pHolder->GetNameExt();
|
const char* nameExt = pHolder->GetNameExt();
|
||||||
bool foundCtrlZ = false;
|
bool foundCtrlZ = false;
|
||||||
|
@ -123,7 +123,7 @@ ReformatCPMText::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ ReformatDirectory::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
|
@ -71,13 +71,13 @@ ReformatDirectory::Process(const ReformatHolder* pHolder,
|
||||||
* deleted entries.
|
* deleted entries.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatDirectory::PrintDirEntries(const unsigned char* srcBuf,
|
ReformatDirectory::PrintDirEntries(const uint8_t* srcBuf,
|
||||||
long srcLen, bool showDeleted)
|
long srcLen, bool showDeleted)
|
||||||
{
|
{
|
||||||
const int kEntriesPerBlock = 0x0d; // expected value for entries per blk
|
const int kEntriesPerBlock = 0x0d; // expected value for entries per blk
|
||||||
const int kEntryLength = 0x27; // expected value for dir entry len
|
const int kEntryLength = 0x27; // expected value for dir entry len
|
||||||
const int kMaxFileName = 15;
|
const int kMaxFileName = 15;
|
||||||
const unsigned char* pDirEntry;
|
const uint8_t* pDirEntry;
|
||||||
int blockIdx;
|
int blockIdx;
|
||||||
int entryIdx;
|
int entryIdx;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ ReformatDirectory::PrintDirEntries(const unsigned char* srcBuf,
|
||||||
lockedFlag = ' ';
|
lockedFlag = ' ';
|
||||||
|
|
||||||
CStringA auxTypeStr;
|
CStringA auxTypeStr;
|
||||||
unsigned short auxType = pDirEntry[0x1f] | pDirEntry[0x20] << 8;
|
uint16_t auxType = pDirEntry[0x1f] | pDirEntry[0x20] << 8;
|
||||||
if (pDirEntry[0x10] == 0x06) // bin
|
if (pDirEntry[0x10] == 0x06) // bin
|
||||||
auxTypeStr.Format("A=$%04X", auxType);
|
auxTypeStr.Format("A=$%04X", auxType);
|
||||||
else if (pDirEntry[0x10] == 0x04) // txt
|
else if (pDirEntry[0x10] == 0x04) // txt
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void PrintDirEntries(const unsigned char* srcBuf,
|
void PrintDirEntries(const uint8_t* srcBuf,
|
||||||
long srcLen, bool showDeleted);
|
long srcLen, bool showDeleted);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -149,7 +149,7 @@ ReformatDisasm65xxx::GetOpWidth(OpCode opCode, AddrMode addrMode, CPU cpu,
|
||||||
* The caller is expected to check to see if we're in bank 0.
|
* The caller is expected to check to see if we're in bank 0.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatDisasm65xxx::IsP8Call(const unsigned char* srcBuf, long srcLen)
|
ReformatDisasm65xxx::IsP8Call(const uint8_t* srcBuf, long srcLen)
|
||||||
{
|
{
|
||||||
if (srcLen >= 6 &&
|
if (srcLen >= 6 &&
|
||||||
srcBuf[0] == 0x20 && srcBuf[1] == 0x00 && srcBuf[2] == 0xbf)
|
srcBuf[0] == 0x20 && srcBuf[1] == 0x00 && srcBuf[2] == 0xbf)
|
||||||
|
@ -163,7 +163,7 @@ ReformatDisasm65xxx::IsP8Call(const unsigned char* srcBuf, long srcLen)
|
||||||
* Returns "true" if it looks like we're pointing at a IIgs toolbox call.
|
* Returns "true" if it looks like we're pointing at a IIgs toolbox call.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatDisasm65xxx::IsToolboxCall(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm65xxx::IsToolboxCall(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState)
|
long backState)
|
||||||
{
|
{
|
||||||
if (srcLen >= 4 && backState >= 3 &&
|
if (srcLen >= 4 && backState >= 3 &&
|
||||||
|
@ -179,7 +179,7 @@ ReformatDisasm65xxx::IsToolboxCall(const unsigned char* srcBuf, long srcLen,
|
||||||
* Returns "true" if it looks like we're pointing at an inline GS/OS call.
|
* Returns "true" if it looks like we're pointing at an inline GS/OS call.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatDisasm65xxx::IsInlineGSOS(const unsigned char* srcBuf, long srcLen)
|
ReformatDisasm65xxx::IsInlineGSOS(const uint8_t* srcBuf, long srcLen)
|
||||||
{
|
{
|
||||||
if (srcLen >= 10 &&
|
if (srcLen >= 10 &&
|
||||||
srcBuf[0] == 0x22 && srcBuf[1] == 0xa8 && srcBuf[2] == 0x00 &&
|
srcBuf[0] == 0x22 && srcBuf[1] == 0xa8 && srcBuf[2] == 0x00 &&
|
||||||
|
@ -194,7 +194,7 @@ ReformatDisasm65xxx::IsInlineGSOS(const unsigned char* srcBuf, long srcLen)
|
||||||
* Returns "true" if it looks like we're pointing at a stack GS/OS call.
|
* Returns "true" if it looks like we're pointing at a stack GS/OS call.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatDisasm65xxx::IsStackGSOS(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm65xxx::IsStackGSOS(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState)
|
long backState)
|
||||||
{
|
{
|
||||||
if (srcLen >= 4 && backState >= 3 &&
|
if (srcLen >= 4 && backState >= 3 &&
|
||||||
|
@ -214,8 +214,8 @@ ReformatDisasm65xxx::IsStackGSOS(const unsigned char* srcBuf, long srcLen,
|
||||||
* Returns the number of bytes consumed.
|
* Returns the number of bytes consumed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatDisasm65xxx::OutputMonitor8(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm65xxx::OutputMonitor8(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState, unsigned short addr)
|
long backState, uint16_t addr)
|
||||||
{
|
{
|
||||||
const CPU kCPU = kCPU65C02; // 6502 or 65C02
|
const CPU kCPU = kCPU65C02; // 6502 or 65C02
|
||||||
OpCode opCode;
|
OpCode opCode;
|
||||||
|
@ -249,7 +249,7 @@ ReformatDisasm65xxx::OutputMonitor8(const unsigned char* srcBuf, long srcLen,
|
||||||
} else
|
} else
|
||||||
if (srcLen < bytesUsed) {
|
if (srcLen < bytesUsed) {
|
||||||
assert(bytesUsed <= kMaxByteConsumption);
|
assert(bytesUsed <= kMaxByteConsumption);
|
||||||
unsigned char tmpBuf[kMaxByteConsumption];
|
uint8_t tmpBuf[kMaxByteConsumption];
|
||||||
memset(tmpBuf, 0, kMaxByteConsumption);
|
memset(tmpBuf, 0, kMaxByteConsumption);
|
||||||
memcpy(tmpBuf, srcBuf, srcLen);
|
memcpy(tmpBuf, srcBuf, srcLen);
|
||||||
|
|
||||||
|
@ -267,13 +267,13 @@ ReformatDisasm65xxx::OutputMonitor8(const unsigned char* srcBuf, long srcLen,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatDisasm65xxx::PrintMonitor8Line(OpCode opCode, AddrMode addrMode,
|
ReformatDisasm65xxx::PrintMonitor8Line(OpCode opCode, AddrMode addrMode,
|
||||||
unsigned short addr, const unsigned char* srcBuf, long srcLen,
|
uint16_t addr, const uint8_t* srcBuf, long srcLen,
|
||||||
const char* comment)
|
const char* comment)
|
||||||
{
|
{
|
||||||
char lineBuf[64]; // actual length is about 30 -- does not hold comment
|
char lineBuf[64]; // actual length is about 30 -- does not hold comment
|
||||||
char* cp;
|
char* cp;
|
||||||
const char* mnemonic = kOpCodeDetails[opCode].mnemonic;
|
const char* mnemonic = kOpCodeDetails[opCode].mnemonic;
|
||||||
unsigned char byte0, byte1, byte2;
|
uint8_t byte0, byte1, byte2;
|
||||||
|
|
||||||
cp = lineBuf;
|
cp = lineBuf;
|
||||||
|
|
||||||
|
@ -401,15 +401,15 @@ ReformatDisasm65xxx::PrintMonitor8Line(OpCode opCode, AddrMode addrMode,
|
||||||
* Returns the number of bytes consumed.
|
* Returns the number of bytes consumed.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatDisasm65xxx::OutputMonitor16(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm65xxx::OutputMonitor16(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState, unsigned long addr, bool shortRegs)
|
long backState, uint32_t addr, bool shortRegs)
|
||||||
{
|
{
|
||||||
const CPU kCPU = kCPU65816;
|
const CPU kCPU = kCPU65816;
|
||||||
OpCode opCode;
|
OpCode opCode;
|
||||||
AddrMode addrMode;
|
AddrMode addrMode;
|
||||||
int bytesUsed;
|
int bytesUsed;
|
||||||
int opAndAddr;
|
int opAndAddr;
|
||||||
const char* callName;
|
const char* callName;
|
||||||
|
|
||||||
opAndAddr = kOpMap[*srcBuf].opAndAddr[kCPU];
|
opAndAddr = kOpMap[*srcBuf].opAndAddr[kCPU];
|
||||||
opCode = (OpCode) (opAndAddr & 0xff);
|
opCode = (OpCode) (opAndAddr & 0xff);
|
||||||
|
@ -457,7 +457,7 @@ ReformatDisasm65xxx::OutputMonitor16(const unsigned char* srcBuf, long srcLen,
|
||||||
} else
|
} else
|
||||||
if (srcLen < bytesUsed) {
|
if (srcLen < bytesUsed) {
|
||||||
assert(bytesUsed <= kMaxByteConsumption);
|
assert(bytesUsed <= kMaxByteConsumption);
|
||||||
unsigned char tmpBuf[kMaxByteConsumption];
|
uint8_t tmpBuf[kMaxByteConsumption];
|
||||||
memset(tmpBuf, 0, kMaxByteConsumption);
|
memset(tmpBuf, 0, kMaxByteConsumption);
|
||||||
memcpy(tmpBuf, srcBuf, srcLen);
|
memcpy(tmpBuf, srcBuf, srcLen);
|
||||||
|
|
||||||
|
@ -474,14 +474,14 @@ ReformatDisasm65xxx::OutputMonitor16(const unsigned char* srcBuf, long srcLen,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
||||||
unsigned long addr, const unsigned char* srcBuf, long srcLen,
|
uint32_t addr, const uint8_t* srcBuf, long srcLen,
|
||||||
const char* comment)
|
const char* comment)
|
||||||
{
|
{
|
||||||
char lineBuf[64]; // actual length is about 30 -- does not hold comment
|
char lineBuf[64]; // actual length is about 30 -- does not hold comment
|
||||||
char* cp;
|
char* cp;
|
||||||
const char* mnemonic = kOpCodeDetails[opCode].mnemonic;
|
const char* mnemonic = kOpCodeDetails[opCode].mnemonic;
|
||||||
unsigned char byte0, byte1, byte2, byte3;
|
uint8_t byte0, byte1, byte2, byte3;
|
||||||
short offset;
|
int16_t offset;
|
||||||
|
|
||||||
cp = lineBuf;
|
cp = lineBuf;
|
||||||
|
|
||||||
|
@ -560,10 +560,10 @@ ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
||||||
offset = (char) byte1;
|
offset = (char) byte1;
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
cp += sprintf(cp, " %04X {-%02X}",
|
cp += sprintf(cp, " %04X {-%02X}",
|
||||||
RelOffset((unsigned short) addr, byte1), -offset);
|
RelOffset((uint16_t) addr, byte1), -offset);
|
||||||
else
|
else
|
||||||
cp += sprintf(cp, " %04X {+%02X}",
|
cp += sprintf(cp, " %04X {+%02X}",
|
||||||
RelOffset((unsigned short) addr, byte1), offset);
|
RelOffset((uint16_t) addr, byte1), offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kAddrAbs:
|
case kAddrAbs:
|
||||||
|
@ -622,10 +622,10 @@ ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
||||||
offset = (short) (byte1 | byte2 << 8);
|
offset = (short) (byte1 | byte2 << 8);
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
cp += sprintf(cp, " %04X {-%02X}",
|
cp += sprintf(cp, " %04X {-%02X}",
|
||||||
RelLongOffset((unsigned short) addr, offset), -offset);
|
RelLongOffset((uint16_t) addr, offset), -offset);
|
||||||
else
|
else
|
||||||
cp += sprintf(cp, " %04X {+%02X}",
|
cp += sprintf(cp, " %04X {+%02X}",
|
||||||
RelLongOffset((unsigned short) addr, offset), offset);
|
RelLongOffset((uint16_t) addr, offset), offset);
|
||||||
break;
|
break;
|
||||||
case kAddrStackAbs: // PEA
|
case kAddrStackAbs: // PEA
|
||||||
cp += sprintf(cp, " %02X%02X", byte2, byte1);
|
cp += sprintf(cp, " %02X%02X", byte2, byte1);
|
||||||
|
@ -708,11 +708,11 @@ ReformatDisasm8::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long fileType = pHolder->GetFileType();
|
long fileType = pHolder->GetFileType();
|
||||||
long backState = 0;
|
long backState = 0;
|
||||||
unsigned short addr;
|
uint16_t addr;
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
if (!srcLen)
|
if (!srcLen)
|
||||||
|
@ -724,7 +724,7 @@ ReformatDisasm8::Process(const ReformatHolder* pHolder,
|
||||||
if (fileType == kTypeSYS || fileType == kTypeP8C || fileType == kType8OB)
|
if (fileType == kTypeSYS || fileType == kTypeP8C || fileType == kType8OB)
|
||||||
addr = 0x2000;
|
addr = 0x2000;
|
||||||
else if (fileType == kTypeBIN || fileType == kTypeCMD)
|
else if (fileType == kTypeBIN || fileType == kTypeCMD)
|
||||||
addr = (unsigned short) pHolder->GetAuxType();
|
addr = (uint16_t) pHolder->GetAuxType();
|
||||||
else
|
else
|
||||||
addr = 0x0000;
|
addr = 0x0000;
|
||||||
|
|
||||||
|
@ -817,10 +817,10 @@ ReformatDisasm16::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long fileType = pHolder->GetFileType();
|
long fileType = pHolder->GetFileType();
|
||||||
unsigned long addr = 0;
|
uint32_t addr = 0;
|
||||||
bool shortRegs;
|
bool shortRegs;
|
||||||
|
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
@ -849,7 +849,7 @@ ReformatDisasm16::Process(const ReformatHolder* pHolder,
|
||||||
if (fileType == kTypeSYS)
|
if (fileType == kTypeSYS)
|
||||||
addr = 0x2000;
|
addr = 0x2000;
|
||||||
else if (fileType == kTypeBIN || fileType == kTypeCMD)
|
else if (fileType == kTypeBIN || fileType == kTypeCMD)
|
||||||
addr = (unsigned short) pHolder->GetAuxType();
|
addr = (uint16_t) pHolder->GetAuxType();
|
||||||
OutputSection(srcBuf, srcLen, addr, shortRegs);
|
OutputSection(srcBuf, srcLen, addr, shortRegs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,8 +862,8 @@ ReformatDisasm16::Process(const ReformatHolder* pHolder,
|
||||||
* Output one section of a file.
|
* Output one section of a file.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatDisasm16::OutputSection(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm16::OutputSection(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned long addr, bool shortRegs)
|
uint32_t addr, bool shortRegs)
|
||||||
{
|
{
|
||||||
long backState = 0;
|
long backState = 0;
|
||||||
|
|
||||||
|
@ -883,10 +883,10 @@ ReformatDisasm16::OutputSection(const unsigned char* srcBuf, long srcLen,
|
||||||
* Break an OMF file into sections, and output each individually.
|
* Break an OMF file into sections, and output each individually.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ReformatDisasm16::OutputOMF(const unsigned char* srcBuf, long srcLen,
|
ReformatDisasm16::OutputOMF(const uint8_t* srcBuf, long srcLen,
|
||||||
long fileType, bool shortRegs)
|
long fileType, bool shortRegs)
|
||||||
{
|
{
|
||||||
const unsigned char* origBuf = srcBuf;
|
const uint8_t* origBuf = srcBuf;
|
||||||
long origLen = srcLen;
|
long origLen = srcLen;
|
||||||
OMFSegmentHeader segHdr;
|
OMFSegmentHeader segHdr;
|
||||||
int segmentNumber = 1;
|
int segmentNumber = 1;
|
||||||
|
@ -1006,9 +1006,9 @@ ReformatDisasm16::PrintHeader(const OMFSegmentHeader* pSegHdr,
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr,
|
ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr,
|
||||||
const unsigned char* srcBuf, long srcLen, bool shortRegs)
|
const uint8_t* srcBuf, long srcLen, bool shortRegs)
|
||||||
{
|
{
|
||||||
unsigned long subLen;
|
uint32_t subLen;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
assert(pSegHdr != NULL);
|
assert(pSegHdr != NULL);
|
||||||
|
@ -1035,7 +1035,7 @@ ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr,
|
||||||
#if 0
|
#if 0
|
||||||
OMFSegment seg;
|
OMFSegment seg;
|
||||||
seg.Setup(pSegHdr, srcBuf, srcLen);
|
seg.Setup(pSegHdr, srcBuf, srcLen);
|
||||||
const unsigned char* ptr;
|
const uint8_t* ptr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ptr = seg.ProcessNextChunk();
|
ptr = seg.ProcessNextChunk();
|
||||||
|
@ -1066,7 +1066,7 @@ ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr,
|
||||||
* Returns "true" on success, "false" on failure.
|
* Returns "true" on success, "false" on failure.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen,
|
OMFSegmentHeader::Unpack(const uint8_t* srcBuf, long srcLen,
|
||||||
int fileType)
|
int fileType)
|
||||||
{
|
{
|
||||||
if (srcLen < kHdrMinSize) {
|
if (srcLen < kHdrMinSize) {
|
||||||
|
@ -1175,7 +1175,7 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen,
|
||||||
|
|
||||||
|
|
||||||
/* validate fields */
|
/* validate fields */
|
||||||
if (fByteCnt < kHdrMinSize || fByteCnt > (unsigned long) srcLen) {
|
if (fByteCnt < kHdrMinSize || fByteCnt > (uint32_t) srcLen) {
|
||||||
LOGI("OMF: Bad value for byteCnt (%ld, srcLen=%ld min=%d)",
|
LOGI("OMF: Bad value for byteCnt (%ld, srcLen=%ld min=%d)",
|
||||||
fByteCnt, srcLen, kHdrMinSize);
|
fByteCnt, srcLen, kHdrMinSize);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1204,7 +1204,7 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen,
|
||||||
/* big endian odd-sized numbers?? keep going, I guess */
|
/* big endian odd-sized numbers?? keep going, I guess */
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned char* segName;
|
const uint8_t* segName;
|
||||||
int segLabelLen;
|
int segLabelLen;
|
||||||
|
|
||||||
/* copy the label entries over */
|
/* copy the label entries over */
|
||||||
|
@ -1324,7 +1324,7 @@ OMFSegmentHeader::Dump(void) const
|
||||||
* Prepare to roll through a segment.
|
* Prepare to roll through a segment.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
OMFSegment::Setup(const OMFSegmentHeader* pSegHdr, const unsigned char* srcBuf,
|
OMFSegment::Setup(const OMFSegmentHeader* pSegHdr, const uint8_t* srcBuf,
|
||||||
long srcLen)
|
long srcLen)
|
||||||
{
|
{
|
||||||
fSegBuf = fCurPtr = srcBuf + pSegHdr->GetDispData();
|
fSegBuf = fCurPtr = srcBuf + pSegHdr->GetDispData();
|
||||||
|
@ -1340,12 +1340,12 @@ OMFSegment::Setup(const OMFSegmentHeader* pSegHdr, const unsigned char* srcBuf,
|
||||||
* Returns a pointer to the start of the chunk, or "NULL" if we've encountered
|
* Returns a pointer to the start of the chunk, or "NULL" if we've encountered
|
||||||
* some bogus condition (e.g. running off the end).
|
* some bogus condition (e.g. running off the end).
|
||||||
*/
|
*/
|
||||||
const unsigned char*
|
const uint8_t*
|
||||||
OMFSegment::ProcessNextChunk(void)
|
OMFSegment::ProcessNextChunk(void)
|
||||||
{
|
{
|
||||||
const unsigned char* prevPtr = fCurPtr;
|
const uint8_t* prevPtr = fCurPtr;
|
||||||
long remLen = fSegLen - (fCurPtr - fSegBuf);
|
long remLen = fSegLen - (fCurPtr - fSegBuf);
|
||||||
unsigned long subLen;
|
uint32_t subLen;
|
||||||
int len = 1; // one byte at least (for the opcode)
|
int len = 1; // one byte at least (for the opcode)
|
||||||
|
|
||||||
assert(fLabLen >= 0);
|
assert(fLabLen >= 0);
|
||||||
|
@ -1433,7 +1433,7 @@ OMFSegment::ProcessNextChunk(void)
|
||||||
case kSegOpExperimental4:
|
case kSegOpExperimental4:
|
||||||
subLen = Get32LE(fCurPtr+1); // assumes fNumLen==4
|
subLen = Get32LE(fCurPtr+1); // assumes fNumLen==4
|
||||||
LOGI(" OMF found 'reserved' len=%lu (remLen=%ld)", subLen, remLen);
|
LOGI(" OMF found 'reserved' len=%lu (remLen=%ld)", subLen, remLen);
|
||||||
if (subLen > (unsigned long) remLen)
|
if (subLen > (uint32_t) remLen)
|
||||||
return NULL;
|
return NULL;
|
||||||
len += subLen + fNumLen;
|
len += subLen + fNumLen;
|
||||||
break;
|
break;
|
||||||
|
@ -1455,7 +1455,7 @@ OMFSegment::ProcessNextChunk(void)
|
||||||
* Pass a pointer to the start of the expression.
|
* Pass a pointer to the start of the expression.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
OMFSegment::ExpressionLength(const unsigned char* ptr)
|
OMFSegment::ExpressionLength(const uint8_t* ptr)
|
||||||
{
|
{
|
||||||
// do this someday
|
// do this someday
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -142,10 +142,10 @@ protected:
|
||||||
* Output one or more lines of code in a manner appropriate for a
|
* Output one or more lines of code in a manner appropriate for a
|
||||||
* monitor listing on an 8-bit machine. Returns the #of bytes consumed.
|
* monitor listing on an 8-bit machine. Returns the #of bytes consumed.
|
||||||
*/
|
*/
|
||||||
int OutputMonitor8(const unsigned char* srcBuf, long srcLen,
|
int OutputMonitor8(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState, unsigned short addr);
|
long backState, uint16_t addr);
|
||||||
int OutputMonitor16(const unsigned char* srcBuf, long srcLen,
|
int OutputMonitor16(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState, unsigned long addr, bool shortRegs);
|
long backState, uint32_t addr, bool shortRegs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ValidateOpMap(void);
|
bool ValidateOpMap(void);
|
||||||
|
@ -154,12 +154,12 @@ private:
|
||||||
bool ValidateOpCodeDetails(void);
|
bool ValidateOpCodeDetails(void);
|
||||||
static const OpCodeDetails kOpCodeDetails[];
|
static const OpCodeDetails kOpCodeDetails[];
|
||||||
|
|
||||||
inline unsigned short RelOffset(unsigned short addr, unsigned char off) {
|
inline uint16_t RelOffset(uint16_t addr, uint8_t off) {
|
||||||
char shift = (char) off;
|
int8_t shift = (int8_t) off; // offset is signed
|
||||||
return addr +2 + shift;
|
return addr +2 + shift;
|
||||||
}
|
}
|
||||||
inline unsigned short RelLongOffset(unsigned short addr, unsigned short off) {
|
inline uint16_t RelLongOffset(uint16_t addr, uint16_t off) {
|
||||||
short shift = (short) off;
|
int16_t shift = (int16_t) off; // offset is signed
|
||||||
return addr +3 + shift;
|
return addr +3 + shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,26 +169,26 @@ private:
|
||||||
|
|
||||||
int GetOpWidth(OpCode opCode, AddrMode addrMode, CPU cpu,
|
int GetOpWidth(OpCode opCode, AddrMode addrMode, CPU cpu,
|
||||||
bool emul, bool shortM, bool shortX);
|
bool emul, bool shortM, bool shortX);
|
||||||
bool IsP8Call(const unsigned char* srcBuf, long srcLen);
|
bool IsP8Call(const uint8_t* srcBuf, long srcLen);
|
||||||
bool IsToolboxCall(const unsigned char* srcBuf, long srcLen,
|
bool IsToolboxCall(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState);
|
long backState);
|
||||||
bool IsInlineGSOS(const unsigned char* srcBuf, long srcLen);
|
bool IsInlineGSOS(const uint8_t* srcBuf, long srcLen);
|
||||||
bool IsStackGSOS(const unsigned char* srcBuf, long srcLen,
|
bool IsStackGSOS(const uint8_t* srcBuf, long srcLen,
|
||||||
long backState);
|
long backState);
|
||||||
|
|
||||||
void PrintMonitor8Line(OpCode opCode, AddrMode addrMode,
|
void PrintMonitor8Line(OpCode opCode, AddrMode addrMode,
|
||||||
unsigned short addr, const unsigned char* srcBuf, long srcLen,
|
uint16_t addr, const uint8_t* srcBuf, long srcLen,
|
||||||
const char* comment);
|
const char* comment);
|
||||||
void PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
void PrintMonitor16Line(OpCode opCode, AddrMode addrMode,
|
||||||
unsigned long addr, const unsigned char* srcBuf, long srcLen,
|
uint32_t addr, const uint8_t* srcBuf, long srcLen,
|
||||||
const char* comment);
|
const char* comment);
|
||||||
|
|
||||||
/* 24-bit address helpers */
|
/* 24-bit address helpers */
|
||||||
inline unsigned char Bank(unsigned long addr) {
|
inline uint8_t Bank(uint32_t addr) {
|
||||||
return (unsigned char) ((addr >> 16) & 0xff);
|
return (uint8_t) ((addr >> 16) & 0xff);
|
||||||
}
|
}
|
||||||
inline unsigned short Offset(unsigned long addr) {
|
inline uint16_t Offset(uint32_t addr) {
|
||||||
return (unsigned short) (addr & 0xffff);
|
return (uint16_t) (addr & 0xffff);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ public:
|
||||||
OMFSegmentHeader(void) : fReady(false) {}
|
OMFSegmentHeader(void) : fReady(false) {}
|
||||||
virtual ~OMFSegmentHeader(void) {}
|
virtual ~OMFSegmentHeader(void) {}
|
||||||
|
|
||||||
bool Unpack(const unsigned char* srcBuf, long srcLen, int fileType);
|
bool Unpack(const uint8_t* srcBuf, long srcLen, int fileType);
|
||||||
void Dump(void) const;
|
void Dump(void) const;
|
||||||
|
|
||||||
typedef enum SegmentType {
|
typedef enum SegmentType {
|
||||||
|
@ -241,14 +241,14 @@ public:
|
||||||
kFlagDynamic,
|
kFlagDynamic,
|
||||||
} SegmentFlag;
|
} SegmentFlag;
|
||||||
|
|
||||||
int GetVersion(void) const { return fVersion; }
|
uint8_t GetVersion(void) const { return fVersion; }
|
||||||
unsigned long GetSegmentLen(void) const { return fByteCnt; }
|
uint32_t GetSegmentLen(void) const { return fByteCnt; }
|
||||||
SegmentType GetSegmentType(void) const;
|
SegmentType GetSegmentType(void) const;
|
||||||
bool GetSegmentFlag(SegmentFlag flag) const;
|
bool GetSegmentFlag(SegmentFlag flag) const;
|
||||||
int GetSegNum(void) const { return fSegNum; }
|
uint16_t GetSegNum(void) const { return fSegNum; }
|
||||||
int GetLabLen(void) const { return fLabLen; }
|
uint8_t GetLabLen(void) const { return fLabLen; }
|
||||||
int GetNumLen(void) const { return fNumLen; }
|
uint8_t GetNumLen(void) const { return fNumLen; }
|
||||||
int GetDispData(void) const { return fDispData; }
|
uint16_t GetDispData(void) const { return fDispData; }
|
||||||
const char* GetLoadName(void) const { return (const char*) fLoadName; }
|
const char* GetLoadName(void) const { return (const char*) fLoadName; }
|
||||||
const char* GetSegName(void) const { return (const char*) fSegName; }
|
const char* GetSegName(void) const { return (const char*) fSegName; }
|
||||||
|
|
||||||
|
@ -269,34 +269,34 @@ public:
|
||||||
private:
|
private:
|
||||||
bool fReady;
|
bool fReady;
|
||||||
|
|
||||||
inline unsigned short Get16LE(const unsigned char* buf) {
|
inline uint16_t Get16LE(const uint8_t* buf) {
|
||||||
return *buf | *(buf+1) << 8;
|
return *buf | *(buf+1) << 8;
|
||||||
}
|
}
|
||||||
inline unsigned long Get32LE(const unsigned char* buf) {
|
inline uint32_t Get32LE(const uint8_t* buf) {
|
||||||
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long fBlockCnt; // v0/v1
|
uint32_t fBlockCnt; // v0/v1
|
||||||
unsigned long fByteCnt; // v2
|
uint32_t fByteCnt; // v2
|
||||||
unsigned long fResSpc;
|
uint32_t fResSpc;
|
||||||
unsigned long fLength;
|
uint32_t fLength;
|
||||||
unsigned char fType; // v0/v1
|
uint8_t fType; // v0/v1
|
||||||
unsigned char fLabLen;
|
uint8_t fLabLen;
|
||||||
unsigned char fNumLen; // (always 4)
|
uint8_t fNumLen; // (always 4)
|
||||||
unsigned char fVersion; // (0, 1, or 2)
|
uint8_t fVersion; // (0, 1, or 2)
|
||||||
unsigned long fBankSize; // (always 65536)
|
uint32_t fBankSize; // (always 65536)
|
||||||
unsigned short fKind; // v2
|
uint16_t fKind; // v2
|
||||||
unsigned long fOrg;
|
uint32_t fOrg;
|
||||||
unsigned long fAlign;
|
uint32_t fAlign;
|
||||||
unsigned char fNumSex;
|
uint8_t fNumSex;
|
||||||
unsigned char fLCBank; // v1
|
uint8_t fLCBank; // v1
|
||||||
unsigned short fSegNum; // v1/v2
|
uint16_t fSegNum; // v1/v2
|
||||||
unsigned long fEntry; // v1/v2
|
uint32_t fEntry; // v1/v2
|
||||||
unsigned short fDispName; // v1/v2
|
uint16_t fDispName; // v1/v2
|
||||||
unsigned short fDispData; // v1/v2
|
uint16_t fDispData; // v1/v2
|
||||||
unsigned long fTempOrg; // v2
|
uint32_t fTempOrg; // v2
|
||||||
unsigned char fLoadName[kLoadNameLen+1]; // 10 chars, space-padded
|
uint8_t fLoadName[kLoadNameLen + 1]; // 10 chars, space-padded
|
||||||
unsigned char fSegName[kSegNameLen+1]; // 1-255 chars
|
uint8_t fSegName[kSegNameLen + 1]; // 1-255 chars
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -310,9 +310,9 @@ public:
|
||||||
{}
|
{}
|
||||||
virtual ~OMFSegment(void) {}
|
virtual ~OMFSegment(void) {}
|
||||||
|
|
||||||
void Setup(const OMFSegmentHeader* pSegHdr, const unsigned char* srcBuf,
|
void Setup(const OMFSegmentHeader* pSegHdr, const uint8_t* srcBuf,
|
||||||
long srcLen);
|
long srcLen);
|
||||||
const unsigned char* ProcessNextChunk(void);
|
const uint8_t* ProcessNextChunk(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Segment op codes.
|
* Segment op codes.
|
||||||
|
@ -390,10 +390,10 @@ public:
|
||||||
} ExprOp;
|
} ExprOp;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// inline unsigned short Get16LE(const unsigned char* buf) {
|
// inline uint16_t Get16LE(const uint8_t* buf) {
|
||||||
// return *buf | *(buf+1) << 8;
|
// return *buf | *(buf+1) << 8;
|
||||||
// }
|
// }
|
||||||
inline unsigned long Get32LE(const unsigned char* buf) {
|
inline uint32_t Get32LE(const uint8_t* buf) {
|
||||||
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ private:
|
||||||
* Given a pointer to the start of a label, return the label's len.
|
* Given a pointer to the start of a label, return the label's len.
|
||||||
* The length returned includes the length byte (if present).
|
* The length returned includes the length byte (if present).
|
||||||
*/
|
*/
|
||||||
int LabelLength(const unsigned char* ptr) {
|
int LabelLength(const uint8_t* ptr) {
|
||||||
if (fLabLen != 0)
|
if (fLabLen != 0)
|
||||||
return fLabLen;
|
return fLabLen;
|
||||||
else
|
else
|
||||||
|
@ -409,12 +409,12 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* determine the length of an expression */
|
/* determine the length of an expression */
|
||||||
int ExpressionLength(const unsigned char* ptr);
|
int ExpressionLength(const uint8_t* ptr);
|
||||||
|
|
||||||
const unsigned char* fSegBuf;
|
const uint8_t* fSegBuf;
|
||||||
long fSegLen;
|
long fSegLen;
|
||||||
|
|
||||||
const unsigned char* fCurPtr;
|
const uint8_t* fCurPtr;
|
||||||
int fNumLen;
|
int fNumLen;
|
||||||
int fLabLen;
|
int fLabLen;
|
||||||
};
|
};
|
||||||
|
@ -440,14 +440,14 @@ public:
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OutputSection(const unsigned char* srcBuf, long srcLen,
|
void OutputSection(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned long addr, bool shortRegs);
|
uint32_t addr, bool shortRegs);
|
||||||
bool OutputOMF(const unsigned char* srcBuf, long srcLen,
|
bool OutputOMF(const uint8_t* srcBuf, long srcLen,
|
||||||
long fileType, bool shortRegs);
|
long fileType, bool shortRegs);
|
||||||
void PrintHeader(const OMFSegmentHeader* pSegHdr,
|
void PrintHeader(const OMFSegmentHeader* pSegHdr,
|
||||||
int segmentNumber, bool longFmt);
|
int segmentNumber, bool longFmt);
|
||||||
void PrintSegment(const OMFSegmentHeader* pSegHdr,
|
void PrintSegment(const OMFSegmentHeader* pSegHdr,
|
||||||
const unsigned char* srcBuf, long srcLen, bool shortRegs);
|
const uint8_t* srcBuf, long srcLen, bool shortRegs);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*REFORMAT_DISASM_H*/
|
#endif /*REFORMAT_DISASM_H*/
|
||||||
|
|
|
@ -92,7 +92,7 @@ ReformatDHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -162,10 +162,10 @@ ReformatDHR::InitColorLookup(void)
|
||||||
* Convert a buffer of double-hires data to a 16-color DIB.
|
* Convert a buffer of double-hires data to a 16-color DIB.
|
||||||
*/
|
*/
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
ReformatDHR::DHRScreenToBitmap(const uint8_t* buf)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
const int kMaxLook = 4; // padding to adjust for lookbehind/lookahead
|
const int kMaxLook = 4; // padding to adjust for lookbehind/lookahead
|
||||||
int pixelBits[kMaxLook+kPixelsPerLine+kMaxLook]; // 560 mono pixels
|
int pixelBits[kMaxLook+kPixelsPerLine+kMaxLook]; // 560 mono pixels
|
||||||
unsigned int colorBuf[kOutputWidth]; // 560 color pixels
|
unsigned int colorBuf[kOutputWidth]; // 560 color pixels
|
||||||
|
@ -217,7 +217,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
||||||
if (pDib == NULL)
|
if (pDib == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight,
|
outBuf = (uint8_t*) pDib->Create(kOutputWidth, kOutputHeight,
|
||||||
4, kNumColors);
|
4, kNumColors);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
|
@ -236,7 +236,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
||||||
* be optimized.
|
* be optimized.
|
||||||
*/
|
*/
|
||||||
for (line = 0; line < kNumLines; line++) {
|
for (line = 0; line < kNumLines; line++) {
|
||||||
const unsigned char* lineData = buf + fLineOffset[line];
|
const uint8_t* lineData = buf + fLineOffset[line];
|
||||||
int* bitPtr = pixelBits + kMaxLook;
|
int* bitPtr = pixelBits + kMaxLook;
|
||||||
|
|
||||||
/* this is really just to clear the fore and aft MaxLook bits */
|
/* this is really just to clear the fore and aft MaxLook bits */
|
||||||
|
@ -244,7 +244,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
||||||
|
|
||||||
/* unravel the bits */
|
/* unravel the bits */
|
||||||
for (int byt = 0; byt < kPixelsPerLine / 7; byt++) {
|
for (int byt = 0; byt < kPixelsPerLine / 7; byt++) {
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
|
|
||||||
if (byt & 0x01) {
|
if (byt & 0x01) {
|
||||||
/* odd pixels come from main memory */
|
/* odd pixels come from main memory */
|
||||||
|
@ -498,7 +498,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
||||||
* Can't explain it, but that's how it works...
|
* Can't explain it, but that's how it works...
|
||||||
* usually.
|
* usually.
|
||||||
*/
|
*/
|
||||||
unsigned char mergePix;
|
uint8_t mergePix;
|
||||||
|
|
||||||
mergePix = colorBuf1[idx] & 0x03;
|
mergePix = colorBuf1[idx] & 0x03;
|
||||||
mergePix |= colorBuf1[idx+1] & 0x0c;
|
mergePix |= colorBuf1[idx+1] & 0x0c;
|
||||||
|
@ -520,7 +520,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf)
|
||||||
#define SetPix(x, y, twoval) \
|
#define SetPix(x, y, twoval) \
|
||||||
outBuf[((kOutputHeight-1) - (y)) * (kOutputWidth/2) + (x)] = twoval
|
outBuf[((kOutputHeight-1) - (y)) * (kOutputWidth/2) + (x)] = twoval
|
||||||
|
|
||||||
unsigned char pix4;
|
uint8_t pix4;
|
||||||
for (int pix = 0; pix < kPixelsPerLine/2; pix++) {
|
for (int pix = 0; pix < kPixelsPerLine/2; pix++) {
|
||||||
int bufPosn = pix * 2;
|
int bufPosn = pix * 2;
|
||||||
ASSERT(colorBuf[bufPosn] < kNumColors);
|
ASSERT(colorBuf[bufPosn] < kNumColors);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
} Algorithms;
|
} Algorithms;
|
||||||
|
|
||||||
void InitColorLookup(void);
|
void InitColorLookup(void);
|
||||||
MyDIBitmap* DHRScreenToBitmap(const unsigned char* buf);
|
MyDIBitmap* DHRScreenToBitmap(const uint8_t* buf);
|
||||||
|
|
||||||
Algorithms fAlgorithm;
|
Algorithms fAlgorithm;
|
||||||
int fLineOffset[kNumLines];
|
int fLineOffset[kNumLines];
|
||||||
|
|
|
@ -41,7 +41,7 @@ ReformatDG256SHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ ReformatDG3200SHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ DreamGrafix::ScanDreamGrafix(ReformatHolder* pHolder)
|
||||||
if (!couldBe)
|
if (!couldBe)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const unsigned char* ptr;
|
const uint8_t* ptr;
|
||||||
ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData)
|
ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData)
|
||||||
+ fileLen - kHeaderOffset;
|
+ fileLen - kHeaderOffset;
|
||||||
|
|
||||||
|
@ -164,11 +164,11 @@ DreamGrafix::ScanDreamGrafix(ReformatHolder* pHolder)
|
||||||
* exactly 32768+32*200 bytes.
|
* exactly 32768+32*200 bytes.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
|
DreamGrafix::UnpackDG(const uint8_t* srcBuf, long srcLen,
|
||||||
ReformatSHR::SHRScreen* pScreen, unsigned char* extColorTable)
|
ReformatSHR::SHRScreen* pScreen, uint8_t* extColorTable)
|
||||||
{
|
{
|
||||||
int expectedLen;
|
int expectedLen;
|
||||||
unsigned char* tmpBuf;
|
uint8_t* tmpBuf;
|
||||||
int actual;
|
int actual;
|
||||||
|
|
||||||
if (extColorTable == NULL) {
|
if (extColorTable == NULL) {
|
||||||
|
@ -189,7 +189,7 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* over-alloc -- our LZW decoder doesn't check often */
|
/* over-alloc -- our LZW decoder doesn't check often */
|
||||||
tmpBuf = new unsigned char[expectedLen + 1024];
|
tmpBuf = new uint8_t[expectedLen + 1024];
|
||||||
if (tmpBuf == NULL)
|
if (tmpBuf == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -205,11 +205,11 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
|
||||||
memcpy(pScreen->scb, tmpBuf + 32000, 256);
|
memcpy(pScreen->scb, tmpBuf + 32000, 256);
|
||||||
memcpy(pScreen->colorTable, tmpBuf + 32256, 512);
|
memcpy(pScreen->colorTable, tmpBuf + 32256, 512);
|
||||||
} else {
|
} else {
|
||||||
const unsigned short* pSrcTable;
|
const uint16_t* pSrcTable;
|
||||||
unsigned short* pDstTable;
|
uint16_t* pDstTable;
|
||||||
|
|
||||||
pSrcTable = (const unsigned short*) (tmpBuf + 32000);
|
pSrcTable = (const uint16_t*) (tmpBuf + 32000);
|
||||||
pDstTable = (unsigned short*) extColorTable;
|
pDstTable = (uint16_t*) extColorTable;
|
||||||
int table;
|
int table;
|
||||||
for (table = 0; table < ReformatSHR::kNumLines; table++) {
|
for (table = 0; table < ReformatSHR::kNumLines; table++) {
|
||||||
int entry;
|
int entry;
|
||||||
|
@ -267,18 +267,18 @@ static const unsigned int bitMasks[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*static*/ int
|
/*static*/ int
|
||||||
DreamGrafix::UnpackLZW(const unsigned char* srcBuf, long srcLen,
|
DreamGrafix::UnpackLZW(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned char* dstBuf, long dstLen)
|
uint8_t* dstBuf, long dstLen)
|
||||||
{
|
{
|
||||||
unsigned short finChar, oldCode, inCode, freeCode, maxCode, k;
|
uint16_t finChar, oldCode, inCode, freeCode, maxCode, k;
|
||||||
unsigned short nBitMod1, nBitMask;
|
uint16_t nBitMod1, nBitMask;
|
||||||
int bitOffset;
|
int bitOffset;
|
||||||
unsigned short hashNext[4096];
|
uint16_t hashNext[4096];
|
||||||
unsigned short hashChar[4096];
|
uint16_t hashChar[4096];
|
||||||
|
|
||||||
unsigned char* pOrigDst = dstBuf;
|
uint8_t* pOrigDst = dstBuf;
|
||||||
int iCode;
|
int iCode;
|
||||||
short stack[32768];
|
uint16_t stack[32768];
|
||||||
int stackIdx = 0;
|
int stackIdx = 0;
|
||||||
|
|
||||||
/* initialize table and code reader */
|
/* initialize table and code reader */
|
||||||
|
@ -305,7 +305,7 @@ DreamGrafix::UnpackLZW(const unsigned char* srcBuf, long srcLen,
|
||||||
oldCode = iCode;
|
oldCode = iCode;
|
||||||
k = iCode;
|
k = iCode;
|
||||||
finChar = iCode;
|
finChar = iCode;
|
||||||
*dstBuf++ = (unsigned char)iCode;
|
*dstBuf++ = (uint8_t) iCode;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ ReformatHiRes::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -280,10 +280,10 @@ ReformatHiRes::InitLineOffset(int* pOffsetBuf)
|
||||||
* Convert a buffer of hires data to a 16-color DIB.
|
* Convert a buffer of hires data to a 16-color DIB.
|
||||||
*/
|
*/
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatHiRes::HiResScreenToBitmap(const unsigned char* buf)
|
ReformatHiRes::HiResScreenToBitmap(const uint8_t* buf)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
const int kLeadIn = 4;
|
const int kLeadIn = 4;
|
||||||
unsigned int colorBuf[kLeadIn+kOutputWidth +1]; // 560 half-pixels
|
unsigned int colorBuf[kLeadIn+kOutputWidth +1]; // 560 half-pixels
|
||||||
int pixelBits[kPixelsPerLine];
|
int pixelBits[kPixelsPerLine];
|
||||||
|
@ -319,7 +319,7 @@ ReformatHiRes::HiResScreenToBitmap(const unsigned char* buf)
|
||||||
if (pDib == NULL)
|
if (pDib == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
||||||
outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight,
|
outBuf = (uint8_t*) pDib->Create(kOutputWidth, kOutputHeight,
|
||||||
4, kNumColors);
|
4, kNumColors);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
|
@ -332,13 +332,13 @@ ReformatHiRes::HiResScreenToBitmap(const unsigned char* buf)
|
||||||
* Run through the lines.
|
* Run through the lines.
|
||||||
*/
|
*/
|
||||||
for (line = 0; line < kNumLines; line++) {
|
for (line = 0; line < kNumLines; line++) {
|
||||||
const unsigned char* lineData = buf + fLineOffset[line];
|
const uint8_t* lineData = buf + fLineOffset[line];
|
||||||
int* bitPtr = pixelBits;
|
int* bitPtr = pixelBits;
|
||||||
int* shiftPtr = shiftBits;
|
int* shiftPtr = shiftBits;
|
||||||
|
|
||||||
/* unravel the bits */
|
/* unravel the bits */
|
||||||
for (int byt = 0; byt < kPixelsPerLine / 7; byt++) {
|
for (int byt = 0; byt < kPixelsPerLine / 7; byt++) {
|
||||||
unsigned char val = *lineData;
|
uint8_t val = *lineData;
|
||||||
int shifted = (val & 0x80) != 0;
|
int shifted = (val & 0x80) != 0;
|
||||||
|
|
||||||
for (int bit = 0; bit < 7; bit++) {
|
for (int bit = 0; bit < 7; bit++) {
|
||||||
|
@ -430,7 +430,7 @@ ReformatHiRes::HiResScreenToBitmap(const unsigned char* buf)
|
||||||
#define SetPix(x, y, twoval) \
|
#define SetPix(x, y, twoval) \
|
||||||
outBuf[((kOutputHeight-1) - (y)) * (kOutputWidth/2) + (x)] = twoval
|
outBuf[((kOutputHeight-1) - (y)) * (kOutputWidth/2) + (x)] = twoval
|
||||||
|
|
||||||
unsigned char pix4;
|
uint8_t pix4;
|
||||||
for (int pix = 0; pix < kPixelsPerLine; pix++) {
|
for (int pix = 0; pix < kPixelsPerLine; pix++) {
|
||||||
int bufPosn = kLeadIn + pix * 2;
|
int bufPosn = kLeadIn + pix * 2;
|
||||||
ASSERT(colorBuf[bufPosn] < kNumColors);
|
ASSERT(colorBuf[bufPosn] < kNumColors);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
static void InitLineOffset(int* pOffsetBuf);
|
static void InitLineOffset(int* pOffsetBuf);
|
||||||
MyDIBitmap* HiResScreenToBitmap(const unsigned char* buf);
|
MyDIBitmap* HiResScreenToBitmap(const uint8_t* buf);
|
||||||
|
|
||||||
int fLineOffset[kNumLines];
|
int fLineOffset[kNumLines];
|
||||||
bool fBlackWhite;
|
bool fBlackWhite;
|
||||||
|
|
|
@ -43,7 +43,7 @@ void
|
||||||
ReformatMacPaint::Examine(ReformatHolder* pHolder)
|
ReformatMacPaint::Examine(ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
ReformatHolder::ReformatApplies applies = ReformatHolder::kApplicNot;
|
ReformatHolder::ReformatApplies applies = ReformatHolder::kApplicNot;
|
||||||
const unsigned char* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long fileLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long fileLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
const char* nameExt = pHolder->GetNameExt();
|
const char* nameExt = pHolder->GetNameExt();
|
||||||
long version;
|
long version;
|
||||||
|
@ -84,7 +84,7 @@ ReformatMacPaint::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -111,10 +111,10 @@ bail:
|
||||||
* (required for windows BMP).
|
* (required for windows BMP).
|
||||||
*/
|
*/
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length)
|
ReformatMacPaint::ConvertMacPaint(const uint8_t* srcBuf, long length)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = NULL;
|
MyDIBitmap* pDib = NULL;
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
static const RGBQUAD colorConv[2] = {
|
static const RGBQUAD colorConv[2] = {
|
||||||
/* blue, green, red, reserved */
|
/* blue, green, red, reserved */
|
||||||
{ 0x00, 0x00, 0x00 }, // black
|
{ 0x00, 0x00, 0x00 }, // black
|
||||||
|
@ -146,7 +146,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length)
|
||||||
length -= kLeadingJunkCount;
|
length -= kLeadingJunkCount;
|
||||||
LOGI("Adjusted len is %d", length);
|
LOGI("Adjusted len is %d", length);
|
||||||
|
|
||||||
outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight,
|
outBuf = (uint8_t*) pDib->Create(kOutputWidth, kOutputHeight,
|
||||||
1, kNumColors);
|
1, kNumColors);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
|
@ -155,7 +155,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length)
|
||||||
}
|
}
|
||||||
pDib->SetColorTable(colorConv);
|
pDib->SetColorTable(colorConv);
|
||||||
|
|
||||||
unsigned char* outPtr;
|
uint8_t* outPtr;
|
||||||
int line;
|
int line;
|
||||||
|
|
||||||
/* top row goes at the bottom of the buffer */
|
/* top row goes at the bottom of the buffer */
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyDIBitmap* ConvertMacPaint(const unsigned char* srcBuf, long length);
|
MyDIBitmap* ConvertMacPaint(const uint8_t* srcBuf, long length);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kLeadingJunkCount = 512,
|
kLeadingJunkCount = 512,
|
||||||
|
|
|
@ -319,9 +319,9 @@ HexValue(char ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a 4-char hexadecimal value to an unsigned short.
|
* Convert a 4-char hexadecimal value to an unsigned 16-bit value.
|
||||||
*/
|
*/
|
||||||
/*static*/ unsigned short
|
/*static*/ uint16_t
|
||||||
NiftyList::ConvHexFour(const char* data)
|
NiftyList::ConvHexFour(const char* data)
|
||||||
{
|
{
|
||||||
return HexValue(data[0]) << 12 |
|
return HexValue(data[0]) << 12 |
|
||||||
|
@ -354,7 +354,7 @@ NiftyList::DumpSection(const DataSet& dataSet)
|
||||||
* This uses a binary search, so the entries must be in sorted order.
|
* This uses a binary search, so the entries must be in sorted order.
|
||||||
*/
|
*/
|
||||||
/*static*/ const char*
|
/*static*/ const char*
|
||||||
NiftyList::Lookup(const DataSet& dataSet, unsigned short key)
|
NiftyList::Lookup(const DataSet& dataSet, uint16_t key)
|
||||||
{
|
{
|
||||||
if (!fDataReady) {
|
if (!fDataReady) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -367,7 +367,7 @@ NiftyList::Lookup(const DataSet& dataSet, unsigned short key)
|
||||||
|
|
||||||
while (low <= high) {
|
while (low <= high) {
|
||||||
mid = (high + low)/2;
|
mid = (high + low)/2;
|
||||||
unsigned short midVal = dataSet.pEntries[mid].value;
|
uint16_t midVal = dataSet.pEntries[mid].value;
|
||||||
|
|
||||||
if (key > midVal)
|
if (key > midVal)
|
||||||
low = mid +1;
|
low = mid +1;
|
||||||
|
|
|
@ -45,12 +45,12 @@ ReformatPascalCode::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
PCDSegment segments[kNumSegments];
|
PCDSegment segments[kNumSegments];
|
||||||
unsigned long intrinsSegs;
|
uint32_t intrinsSegs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (srcLen < kSegmentHeaderLen) {
|
if (srcLen < kSegmentHeaderLen) {
|
||||||
|
@ -64,7 +64,7 @@ ReformatPascalCode::Process(const ReformatHolder* pHolder,
|
||||||
* Pull the data fields out of srcBuf.
|
* Pull the data fields out of srcBuf.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < kNumSegments; i++) {
|
for (i = 0; i < kNumSegments; i++) {
|
||||||
unsigned short segInfo;
|
uint16_t segInfo;
|
||||||
|
|
||||||
segments[i].codeAddr = Get16LE(srcBuf + 0x00 + i*4);
|
segments[i].codeAddr = Get16LE(srcBuf + 0x00 + i*4);
|
||||||
segments[i].codeLeng = Get16LE(srcBuf + 0x02 + i*4);
|
segments[i].codeLeng = Get16LE(srcBuf + 0x02 + i*4);
|
||||||
|
@ -143,7 +143,7 @@ bail:
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatPascalCode::PrintSegment(PCDSegment* pSegment, int segNum,
|
ReformatPascalCode::PrintSegment(PCDSegment* pSegment, int segNum,
|
||||||
const unsigned char* srcBuf, long srcLen)
|
const uint8_t* srcBuf, long srcLen)
|
||||||
{
|
{
|
||||||
const char* segKindStr;
|
const char* segKindStr;
|
||||||
const char* mTypeStr;
|
const char* mTypeStr;
|
||||||
|
@ -236,7 +236,7 @@ ReformatPascalText::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
@ -278,7 +278,7 @@ bail:
|
||||||
* appears to -- but I'm not going to assume it.
|
* appears to -- but I'm not going to assume it.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatPascalText::ProcessBlock(const unsigned char* srcBuf, long length)
|
ReformatPascalText::ProcessBlock(const uint8_t* srcBuf, long length)
|
||||||
{
|
{
|
||||||
ASSERT(srcBuf != NULL);
|
ASSERT(srcBuf != NULL);
|
||||||
ASSERT(length > 0 && length <= kPTXBlockSize);
|
ASSERT(length > 0 && length <= kPTXBlockSize);
|
||||||
|
|
|
@ -58,22 +58,22 @@ private:
|
||||||
kMTPAsm9 = 9,
|
kMTPAsm9 = 9,
|
||||||
} MachineType;
|
} MachineType;
|
||||||
typedef struct SegInfo {
|
typedef struct SegInfo {
|
||||||
unsigned char segNum;
|
uint8_t segNum;
|
||||||
MachineType mType;
|
MachineType mType;
|
||||||
unsigned char unused;
|
uint8_t unused;
|
||||||
unsigned char version;
|
uint8_t version;
|
||||||
} SegInfo;
|
} SegInfo;
|
||||||
typedef struct PCDSegment {
|
typedef struct PCDSegment {
|
||||||
unsigned short codeLeng;
|
uint16_t codeLeng;
|
||||||
unsigned short codeAddr;
|
uint16_t codeAddr;
|
||||||
char name[kSegmentNameLen+1];
|
char name[kSegmentNameLen+1];
|
||||||
SegmentKind segmentKind;
|
SegmentKind segmentKind;
|
||||||
unsigned short textAddr;
|
uint16_t textAddr;
|
||||||
SegInfo segInfo;
|
SegInfo segInfo;
|
||||||
} PCDSegment;
|
} PCDSegment;
|
||||||
|
|
||||||
void PrintSegment(PCDSegment* pSegment, int segNum,
|
void PrintSegment(PCDSegment* pSegment, int segNum,
|
||||||
const unsigned char* srcBuf, long srcLen);
|
const uint8_t* srcBuf, long srcLen);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ProcessBlock(const unsigned char* srcBuf, long length);
|
void ProcessBlock(const uint8_t* srcBuf, long length);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*REFORMAT_PASCALFILES_H*/
|
#endif /*REFORMAT_PASCALFILES_H*/
|
||||||
|
|
|
@ -64,7 +64,7 @@ ReformatPrintShop::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = NULL;
|
MyDIBitmap* pDib = NULL;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
|
|
||||||
if (srcLen == 572 || srcLen == 576) {
|
if (srcLen == 572 || srcLen == 576) {
|
||||||
|
@ -95,11 +95,11 @@ ReformatPrintShop::Process(const ReformatHolder* pHolder,
|
||||||
* at the end.
|
* at the end.
|
||||||
*/
|
*/
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatPrintShop::ConvertBW(const unsigned char* srcBuf)
|
ReformatPrintShop::ConvertBW(const uint8_t* srcBuf)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
unsigned char* ptr;
|
uint8_t* ptr;
|
||||||
int pitch;
|
int pitch;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ ReformatPrintShop::ConvertBW(const unsigned char* srcBuf)
|
||||||
colorConv[1].rgbRed = colorConv[1].rgbGreen = colorConv[1].rgbBlue = 0;
|
colorConv[1].rgbRed = colorConv[1].rgbGreen = colorConv[1].rgbBlue = 0;
|
||||||
colorConv[0].rgbReserved = colorConv[1].rgbReserved = 0;
|
colorConv[0].rgbReserved = colorConv[1].rgbReserved = 0;
|
||||||
|
|
||||||
outBuf = (unsigned char*) pDib->Create(kWidth, kHeight, 1, 2);
|
outBuf = (uint8_t*) pDib->Create(kWidth, kHeight, 1, 2);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
pDib = NULL;
|
pDib = NULL;
|
||||||
|
@ -146,13 +146,13 @@ bail:
|
||||||
* table below come from a screen capture of KEGS.
|
* table below come from a screen capture of KEGS.
|
||||||
*/
|
*/
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatPrintShop::ConvertColor(const unsigned char* srcBuf)
|
ReformatPrintShop::ConvertColor(const uint8_t* srcBuf)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
unsigned char* ptr;
|
uint8_t* ptr;
|
||||||
unsigned char outVal;
|
uint8_t outVal;
|
||||||
unsigned short yellow, magenta, cyan;
|
uint16_t yellow, magenta, cyan;
|
||||||
int pitch;
|
int pitch;
|
||||||
int x, y, bit;
|
int x, y, bit;
|
||||||
static const RGBQUAD kColorConv[8] = {
|
static const RGBQUAD kColorConv[8] = {
|
||||||
|
@ -170,7 +170,7 @@ ReformatPrintShop::ConvertColor(const unsigned char* srcBuf)
|
||||||
if (pDib == NULL)
|
if (pDib == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
outBuf = (unsigned char*) pDib->Create(kWidth, kHeight, 4, 8);
|
outBuf = (uint8_t*) pDib->Create(kWidth, kHeight, 4, 8);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
pDib = NULL;
|
pDib = NULL;
|
||||||
|
|
|
@ -28,8 +28,8 @@ public:
|
||||||
private:
|
private:
|
||||||
enum { kWidth=88, kHeight=52 };
|
enum { kWidth=88, kHeight=52 };
|
||||||
|
|
||||||
MyDIBitmap* ConvertBW(const unsigned char* srcBuf);
|
MyDIBitmap* ConvertBW(const uint8_t* srcBuf);
|
||||||
MyDIBitmap* ConvertColor(const unsigned char* srcBuf);
|
MyDIBitmap* ConvertColor(const uint8_t* srcBuf);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*REFORMAT_PRINTSHOP_H*/
|
#endif /*REFORMAT_PRINTSHOP_H*/
|
||||||
|
|
|
@ -528,7 +528,7 @@ ReformatHolder::Apply(ReformatPart part, ReformatID id)
|
||||||
/*
|
/*
|
||||||
* Get the appropriate input buffer.
|
* Get the appropriate input buffer.
|
||||||
*/
|
*/
|
||||||
const unsigned char*
|
const uint8_t*
|
||||||
ReformatHolder::GetSourceBuf(ReformatPart part) const
|
ReformatHolder::GetSourceBuf(ReformatPart part) const
|
||||||
{
|
{
|
||||||
if (part <= kPartUnknown || part >= kPartMAX) {
|
if (part <= kPartUnknown || part >= kPartMAX) {
|
||||||
|
@ -563,7 +563,7 @@ ReformatHolder::GetSourceLen(ReformatPart part) const
|
||||||
* discard its pointer.
|
* discard its pointer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatHolder::SetSourceBuf(ReformatPart part, unsigned char* buf,
|
ReformatHolder::SetSourceBuf(ReformatPart part, uint8_t* buf,
|
||||||
long len)
|
long len)
|
||||||
{
|
{
|
||||||
if (part <= kPartUnknown || part >= kPartMAX) {
|
if (part <= kPartUnknown || part >= kPartMAX) {
|
||||||
|
|
|
@ -263,8 +263,7 @@ public:
|
||||||
void SetErrorMsg(ReformatPart part, const CString& str);
|
void SetErrorMsg(ReformatPart part, const CString& str);
|
||||||
|
|
||||||
/* give a pointer (allocated with new[]) for one of the inputs */
|
/* give a pointer (allocated with new[]) for one of the inputs */
|
||||||
void SetSourceBuf(ReformatPart part, unsigned char* buf,
|
void SetSourceBuf(ReformatPart part, uint8_t* buf, long len);
|
||||||
long len);
|
|
||||||
|
|
||||||
static const WCHAR* GetReformatName(ReformatID id);
|
static const WCHAR* GetReformatName(ReformatID id);
|
||||||
|
|
||||||
|
@ -323,7 +322,7 @@ protected:
|
||||||
/* set the "preferred" flag on all non-"not" entries */
|
/* set the "preferred" flag on all non-"not" entries */
|
||||||
void SetApplicPreferred(ReformatID id, ReformatPart part = kPartUnknown);
|
void SetApplicPreferred(ReformatID id, ReformatPart part = kPartUnknown);
|
||||||
|
|
||||||
const unsigned char* GetSourceBuf(ReformatPart part) const;
|
const uint8_t* GetSourceBuf(ReformatPart part) const;
|
||||||
long GetSourceLen(ReformatPart part) const;
|
long GetSourceLen(ReformatPart part) const;
|
||||||
|
|
||||||
long GetFileType(void) const { return fFileType; }
|
long GetFileType(void) const { return fFileType; }
|
||||||
|
@ -353,7 +352,7 @@ private:
|
||||||
char* fNameExt; // guaranteed non-NULL
|
char* fNameExt; // guaranteed non-NULL
|
||||||
|
|
||||||
/* input goes here */
|
/* input goes here */
|
||||||
unsigned char* fSourceBuf[kPartMAX];
|
uint8_t* fSourceBuf[kPartMAX];
|
||||||
long fSourceLen[kPartMAX];
|
long fSourceLen[kPartMAX];
|
||||||
|
|
||||||
char* fErrorBuf[kPartMAX];
|
char* fErrorBuf[kPartMAX];
|
||||||
|
@ -457,27 +456,27 @@ public:
|
||||||
// one-time cleanup
|
// one-time cleanup
|
||||||
static bool AppCleanup(void);
|
static bool AppCleanup(void);
|
||||||
|
|
||||||
static const char* LookupP8MLI(unsigned char code) {
|
static const char* LookupP8MLI(uint8_t code) {
|
||||||
return Lookup(fP8MLI, code);
|
return Lookup(fP8MLI, code);
|
||||||
}
|
}
|
||||||
static const char* LookupGSOS(unsigned short code) {
|
static const char* LookupGSOS(uint16_t code) {
|
||||||
return Lookup(fGSOS, code);
|
return Lookup(fGSOS, code);
|
||||||
}
|
}
|
||||||
static const char* LookupToolbox(unsigned short req) {
|
static const char* LookupToolbox(uint16_t req) {
|
||||||
return Lookup(fSystemTools, req);
|
return Lookup(fSystemTools, req);
|
||||||
}
|
}
|
||||||
static const char* LookupE1Vector(unsigned short addr) {
|
static const char* LookupE1Vector(uint16_t addr) {
|
||||||
return Lookup(fE1Vectors, addr);
|
return Lookup(fE1Vectors, addr);
|
||||||
}
|
}
|
||||||
static const char* LookupE0Vector(unsigned short addr) {
|
static const char* LookupE0Vector(uint16_t addr) {
|
||||||
return Lookup(fE0Vectors, addr);
|
return Lookup(fE0Vectors, addr);
|
||||||
}
|
}
|
||||||
static const char* Lookup00Addr(unsigned short addr) {
|
static const char* Lookup00Addr(uint16_t addr) {
|
||||||
//if (addr < 0xc000)
|
//if (addr < 0xc000)
|
||||||
// return NULL; // ignore Davex Bxxx values
|
// return NULL; // ignore Davex Bxxx values
|
||||||
return Lookup(f00Addrs, addr);
|
return Lookup(f00Addrs, addr);
|
||||||
}
|
}
|
||||||
static const char* Lookup01Vector(unsigned short addr) {
|
static const char* Lookup01Vector(uint16_t addr) {
|
||||||
return Lookup(f01Vectors, addr);
|
return Lookup(f01Vectors, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +489,7 @@ private:
|
||||||
*/
|
*/
|
||||||
typedef struct NameValue {
|
typedef struct NameValue {
|
||||||
const char* name;
|
const char* name;
|
||||||
unsigned short value;
|
uint16_t value;
|
||||||
} NameValue;
|
} NameValue;
|
||||||
typedef struct DataSet {
|
typedef struct DataSet {
|
||||||
long numEntries;
|
long numEntries;
|
||||||
|
@ -515,10 +514,10 @@ private:
|
||||||
LoadMode mode);
|
LoadMode mode);
|
||||||
static int ScanLine(const char* pData, long remLen);
|
static int ScanLine(const char* pData, long remLen);
|
||||||
static int SortNameValue(const void *, const void *);
|
static int SortNameValue(const void *, const void *);
|
||||||
static unsigned short ConvHexFour(const char* data);
|
static uint16_t ConvHexFour(const char* data);
|
||||||
static void DumpSection(const DataSet& dataSet);
|
static void DumpSection(const DataSet& dataSet);
|
||||||
|
|
||||||
static const char* Lookup(const DataSet& dataSet, unsigned short key);
|
static const char* Lookup(const DataSet& dataSet, uint16_t key);
|
||||||
|
|
||||||
/* we sit on a copy of the entire file */
|
/* we sit on a copy of the entire file */
|
||||||
static char* fFileData;
|
static char* fFileData;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
const int kUnk = 0x3f; // for unmappable chars, use '?'
|
const int kUnk = 0x3f; // for unmappable chars, use '?'
|
||||||
|
|
||||||
/*static*/ const unsigned char ReformatText::kGSCharConv[128] = {
|
/*static*/ const uint8_t ReformatText::kGSCharConv[128] = {
|
||||||
0xc4, // 0x80 A + umlaut (diaeresis?)
|
0xc4, // 0x80 A + umlaut (diaeresis?)
|
||||||
0xc5, // 0x81 A + overcircle
|
0xc5, // 0x81 A + overcircle
|
||||||
0xc7, // 0x82 C + cedilla
|
0xc7, // 0x82 C + cedilla
|
||||||
|
@ -545,7 +545,7 @@ ReformatText::RTFSetFont(RTFFont font)
|
||||||
* Set the font by specifying a IIgs QuickDraw II font family number.
|
* Set the font by specifying a IIgs QuickDraw II font family number.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatText::RTFSetGSFont(unsigned short family)
|
ReformatText::RTFSetGSFont(uint16_t family)
|
||||||
{
|
{
|
||||||
float newMult;
|
float newMult;
|
||||||
|
|
||||||
|
@ -651,7 +651,7 @@ ReformatText::RTFSetGSFontSize(int points)
|
||||||
* fonts, so we're going to look different in some circumstances.
|
* fonts, so we're going to look different in some circumstances.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatText::RTFSetGSFontStyle(unsigned char qdStyle)
|
ReformatText::RTFSetGSFontStyle(uint8_t qdStyle)
|
||||||
{
|
{
|
||||||
if (!fUseRTF)
|
if (!fUseRTF)
|
||||||
return;
|
return;
|
||||||
|
@ -702,7 +702,7 @@ ReformatText::RTFProportionalOff(void) {
|
||||||
* the value is considered.
|
* the value is considered.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatText::ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
ReformatText::ConvertEOL(const uint8_t* srcBuf, long srcLen,
|
||||||
bool stripHiBits)
|
bool stripHiBits)
|
||||||
{
|
{
|
||||||
/* Compatibility - assume we're not stripping nulls */
|
/* Compatibility - assume we're not stripping nulls */
|
||||||
|
@ -719,10 +719,10 @@ ReformatText::ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
||||||
* If "stripNulls" is true, no null values will make it through.
|
* If "stripNulls" is true, no null values will make it through.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatText::ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
ReformatText::ConvertEOL(const uint8_t* srcBuf, long srcLen,
|
||||||
bool stripHiBits, bool stripNulls)
|
bool stripHiBits, bool stripNulls)
|
||||||
{
|
{
|
||||||
unsigned char ch;
|
uint8_t ch;
|
||||||
int mask;
|
int mask;
|
||||||
|
|
||||||
assert(!fUseRTF); // else we have to use RTFPrintChar
|
assert(!fUseRTF); // else we have to use RTFPrintChar
|
||||||
|
@ -761,9 +761,9 @@ ReformatText::ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
||||||
* Write a hex dump into the buffer.
|
* Write a hex dump into the buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatText::BufHexDump(const unsigned char* srcBuf, long srcLen)
|
ReformatText::BufHexDump(const uint8_t* srcBuf, long srcLen)
|
||||||
{
|
{
|
||||||
const unsigned char* origSrcBuf = srcBuf;
|
const uint8_t* origSrcBuf = srcBuf;
|
||||||
char chBuf[17];
|
char chBuf[17];
|
||||||
int i, remLen;
|
int i, remLen;
|
||||||
|
|
||||||
|
@ -923,14 +923,14 @@ ReformatGraphics::SetResultBuffer(ReformatOutput* pOutput, MyDIBitmap* pDib)
|
||||||
* Returns 0 on success, nonzero if the buffer is overfilled or underfilled.
|
* Returns 0 on success, nonzero if the buffer is overfilled or underfilled.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src,
|
ReformatGraphics::UnpackBytes(uint8_t* dst, const uint8_t* src,
|
||||||
long dstRem, long srcLen)
|
long dstRem, long srcLen)
|
||||||
{
|
{
|
||||||
while (srcLen > 0) {
|
while (srcLen > 0) {
|
||||||
unsigned char flag = *src++;
|
uint8_t flag = *src++;
|
||||||
int count = (flag & 0x3f) +1;
|
int count = (flag & 0x3f) +1;
|
||||||
unsigned char val;
|
uint8_t val;
|
||||||
unsigned char valSet[4];
|
uint8_t valSet[4];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
srcLen--;
|
srcLen--;
|
||||||
|
@ -1048,23 +1048,23 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src,
|
||||||
* We have to watch for underruns on the input and overruns on the output.
|
* We have to watch for underruns on the input and overruns on the output.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatGraphics::UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen,
|
ReformatGraphics::UnPackBits(const uint8_t** pSrcBuf, long* pSrcLen,
|
||||||
unsigned char** pOutPtr, long dstLen, unsigned char xorVal)
|
uint8_t** pOutPtr, long dstLen, uint8_t xorVal)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = *pSrcBuf;
|
const uint8_t* srcBuf = *pSrcBuf;
|
||||||
long length = *pSrcLen;
|
long length = *pSrcLen;
|
||||||
unsigned char* outPtr = *pOutPtr;
|
uint8_t* outPtr = *pOutPtr;
|
||||||
int pixByte = 0;
|
int pixByte = 0;
|
||||||
|
|
||||||
while (pixByte < dstLen && length > 0) {
|
while (pixByte < dstLen && length > 0) {
|
||||||
unsigned char countByte;
|
uint8_t countByte;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
countByte = *srcBuf++;
|
countByte = *srcBuf++;
|
||||||
length--;
|
length--;
|
||||||
if (countByte & 0x80) {
|
if (countByte & 0x80) {
|
||||||
/* RLE string */
|
/* RLE string */
|
||||||
unsigned char ch;
|
uint8_t ch;
|
||||||
count = (countByte ^ 0xff)+1 +1;
|
count = (countByte ^ 0xff)+1 +1;
|
||||||
ch = *srcBuf++;
|
ch = *srcBuf++;
|
||||||
length--;
|
length--;
|
||||||
|
@ -1073,7 +1073,7 @@ ReformatGraphics::UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen,
|
||||||
pixByte++;
|
pixByte++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* series of bytse */
|
/* series of bytes */
|
||||||
count = countByte +1;
|
count = countByte +1;
|
||||||
while (count && pixByte < dstLen && length > 0) {
|
while (count && pixByte < dstLen && length > 0) {
|
||||||
*outPtr++ = *srcBuf++ ^ xorVal;
|
*outPtr++ = *srcBuf++ ^ xorVal;
|
||||||
|
|
|
@ -66,19 +66,19 @@ public:
|
||||||
ReformatOutput* pOutput) = 0;
|
ReformatOutput* pOutput) = 0;
|
||||||
|
|
||||||
// grab the next 8 bits
|
// grab the next 8 bits
|
||||||
static inline unsigned char Read8(const unsigned char** pBuf, long* pLength) {
|
static inline uint8_t Read8(const uint8_t** pBuf, long* pLength) {
|
||||||
if (*pLength > 0) {
|
if (*pLength > 0) {
|
||||||
(*pLength)--;
|
(*pLength)--;
|
||||||
return *(*pBuf)++;
|
return *(*pBuf)++;
|
||||||
} else {
|
} else {
|
||||||
// ought to throw an exception here
|
// ought to throw an exception here
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
return (unsigned char) -1;
|
return (uint8_t) -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// grab a 16-bit little-endian value
|
// grab a 16-bit little-endian value
|
||||||
static inline unsigned short Read16(const unsigned char** pBuf, long* pLength) {
|
static inline uint16_t Read16(const uint8_t** pBuf, long* pLength) {
|
||||||
unsigned short val;
|
uint16_t val;
|
||||||
if (*pLength >= 2) {
|
if (*pLength >= 2) {
|
||||||
val = *(*pBuf)++;
|
val = *(*pBuf)++;
|
||||||
val |= *(*pBuf)++ << 8;
|
val |= *(*pBuf)++ << 8;
|
||||||
|
@ -86,13 +86,13 @@ public:
|
||||||
} else {
|
} else {
|
||||||
// ought to throw an exception here
|
// ought to throw an exception here
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
val = (unsigned short) -1;
|
val = (uint16_t) -1;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
// grab a 16-bit little-endian value
|
// grab a 32-bit little-endian value
|
||||||
static inline unsigned long Read32(const unsigned char** pBuf, long* pLength) {
|
static inline uint32_t Read32(const uint8_t** pBuf, long* pLength) {
|
||||||
unsigned long val;
|
uint32_t val;
|
||||||
if (*pLength >= 4) {
|
if (*pLength >= 4) {
|
||||||
val = *(*pBuf)++;
|
val = *(*pBuf)++;
|
||||||
val |= *(*pBuf)++ << 8;
|
val |= *(*pBuf)++ << 8;
|
||||||
|
@ -102,30 +102,30 @@ public:
|
||||||
} else {
|
} else {
|
||||||
// ought to throw an exception here
|
// ought to throw an exception here
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
val = (unsigned long) -1;
|
val = (uint32_t) -1;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned short Get16LE(const unsigned char* buf) {
|
static inline uint16_t Get16LE(const uint8_t* buf) {
|
||||||
return *buf | *(buf+1) << 8;
|
return *buf | *(buf+1) << 8;
|
||||||
}
|
}
|
||||||
static inline unsigned long Get32LE(const unsigned char* buf) {
|
static inline uint32_t Get32LE(const uint8_t* buf) {
|
||||||
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
return *buf | *(buf+1) << 8 | *(buf+2) << 16 | *(buf+3) << 24;
|
||||||
}
|
}
|
||||||
static inline unsigned short Get16BE(const unsigned char* buf) {
|
static inline uint16_t Get16BE(const uint8_t* buf) {
|
||||||
return *buf << 8 | *(buf+1);
|
return *buf << 8 | *(buf+1);
|
||||||
}
|
}
|
||||||
static inline unsigned long Get32BE(const unsigned char* buf) {
|
static inline uint32_t Get32BE(const uint8_t* buf) {
|
||||||
return *buf << 24 | *(buf+1) << 16 | *(buf+2) << 8 | *(buf+3);
|
return *buf << 24 | *(buf+1) << 16 | *(buf+2) << 8 | *(buf+3);
|
||||||
}
|
}
|
||||||
static inline unsigned short Get16(const unsigned char* buf, bool littleEndian) {
|
static inline uint16_t Get16(const uint8_t* buf, bool littleEndian) {
|
||||||
if (littleEndian)
|
if (littleEndian)
|
||||||
return Get16LE(buf);
|
return Get16LE(buf);
|
||||||
else
|
else
|
||||||
return Get16BE(buf);
|
return Get16BE(buf);
|
||||||
}
|
}
|
||||||
static inline unsigned long Get32(const unsigned char* buf, bool littleEndian) {
|
static inline uint32_t Get32(const uint8_t* buf, bool littleEndian) {
|
||||||
if (littleEndian)
|
if (littleEndian)
|
||||||
return Get32LE(buf);
|
return Get32LE(buf);
|
||||||
else
|
else
|
||||||
|
@ -158,10 +158,10 @@ protected:
|
||||||
kPaletteWhite, kPaletteSize };
|
kPaletteWhite, kPaletteSize };
|
||||||
RGBQUAD fPalette[kPaletteSize];
|
RGBQUAD fPalette[kPaletteSize];
|
||||||
|
|
||||||
int UnpackBytes(unsigned char* dst, const unsigned char* src,
|
int UnpackBytes(uint8_t* dst, const uint8_t* src,
|
||||||
long dstRem, long srcLen);
|
long dstRem, long srcLen);
|
||||||
void UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen,
|
void UnPackBits(const uint8_t** pSrcBuf, long* pSrcLen,
|
||||||
unsigned char** pOutPtr, long dstLen, unsigned char xorVal);
|
uint8_t** pOutPtr, long dstLen, uint8_t xorVal);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitPalette();
|
void InitPalette();
|
||||||
|
@ -306,24 +306,24 @@ protected:
|
||||||
void RTFSetColor(TextColor color);
|
void RTFSetColor(TextColor color);
|
||||||
void RTFSetFont(RTFFont font);
|
void RTFSetFont(RTFFont font);
|
||||||
void RTFSetFontSize(int points);
|
void RTFSetFontSize(int points);
|
||||||
void RTFSetGSFont(unsigned short family);
|
void RTFSetGSFont(uint16_t family);
|
||||||
void RTFSetGSFontSize(int points);
|
void RTFSetGSFontSize(int points);
|
||||||
void RTFSetGSFontStyle(unsigned char qdStyle);
|
void RTFSetGSFontStyle(uint8_t qdStyle);
|
||||||
// void RTFProportionalOn(void);
|
// void RTFProportionalOn(void);
|
||||||
// void RTFProportionalOff(void);
|
// void RTFProportionalOff(void);
|
||||||
|
|
||||||
void ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
void ConvertEOL(const uint8_t* srcBuf, long srcLen,
|
||||||
bool stripHiBits);
|
bool stripHiBits);
|
||||||
void ConvertEOL(const unsigned char* srcBuf, long srcLen,
|
void ConvertEOL(const uint8_t* srcBuf, long srcLen,
|
||||||
bool stripHiBits, bool stripNulls);
|
bool stripHiBits, bool stripNulls);
|
||||||
void BufHexDump(const unsigned char* srcBuf, long srcLen);
|
void BufHexDump(const uint8_t* srcBuf, long srcLen);
|
||||||
void SetResultBuffer(ReformatOutput* pOutput, bool multiFont = false);
|
void SetResultBuffer(ReformatOutput* pOutput, bool multiFont = false);
|
||||||
|
|
||||||
ExpandBuffer fExpBuf;
|
ExpandBuffer fExpBuf;
|
||||||
bool fUseRTF;
|
bool fUseRTF;
|
||||||
|
|
||||||
// return a low-ASCII character so we can read high-ASCII files
|
// return a low-ASCII character so we can read high-ASCII files
|
||||||
inline char PrintableChar(unsigned char ch) {
|
inline char PrintableChar(uint8_t ch) {
|
||||||
if (ch < 0x20)
|
if (ch < 0x20)
|
||||||
return '.';
|
return '.';
|
||||||
else if (ch < 0x7f)
|
else if (ch < 0x7f)
|
||||||
|
@ -335,13 +335,13 @@ protected:
|
||||||
}
|
}
|
||||||
// output an RTF-escaped char (do we want to trap Ctrl-Z?)
|
// output an RTF-escaped char (do we want to trap Ctrl-Z?)
|
||||||
// (only use this if we're in RTF mode)
|
// (only use this if we're in RTF mode)
|
||||||
inline void RTFPrintChar(unsigned char ch) {
|
inline void RTFPrintChar(uint8_t ch) {
|
||||||
ch = PrintableChar(ch);
|
char pch = PrintableChar(ch);
|
||||||
RTFPrintExtChar(ch);
|
RTFPrintExtChar(pch);
|
||||||
}
|
}
|
||||||
// output an RTF-escaped char, allowing high ASCII
|
// output an RTF-escaped char, allowing high ASCII
|
||||||
// (only use this if we're in RTF mode)
|
// (only use this if we're in RTF mode)
|
||||||
inline void RTFPrintExtChar(unsigned char ch) {
|
inline void RTFPrintExtChar(uint8_t ch) {
|
||||||
if (ch == '\\')
|
if (ch == '\\')
|
||||||
fExpBuf.Printf("\\\\");
|
fExpBuf.Printf("\\\\");
|
||||||
else if (ch == '{')
|
else if (ch == '{')
|
||||||
|
@ -352,7 +352,7 @@ protected:
|
||||||
fExpBuf.Printf("%c", ch);
|
fExpBuf.Printf("%c", ch);
|
||||||
}
|
}
|
||||||
// output a char, doubling up double quotes (for .CSV)
|
// output a char, doubling up double quotes (for .CSV)
|
||||||
inline void BufPrintQChar(unsigned char ch) {
|
inline void BufPrintQChar(uint8_t ch) {
|
||||||
if (ch == '"')
|
if (ch == '"')
|
||||||
fExpBuf.Printf("\"\"");
|
fExpBuf.Printf("\"\"");
|
||||||
else
|
else
|
||||||
|
@ -360,7 +360,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert IIgs documents
|
// convert IIgs documents
|
||||||
unsigned char ConvertGSChar(unsigned char ch) {
|
uint8_t ConvertGSChar(uint8_t ch) {
|
||||||
if (ch < 128)
|
if (ch < 128)
|
||||||
return ch;
|
return ch;
|
||||||
else
|
else
|
||||||
|
@ -372,7 +372,7 @@ private:
|
||||||
int CreateWorkBuf(void);
|
int CreateWorkBuf(void);
|
||||||
enum { kRTFUnitsPerInch = 1440 }; // TWIPS
|
enum { kRTFUnitsPerInch = 1440 }; // TWIPS
|
||||||
|
|
||||||
static const unsigned char kGSCharConv[];
|
static const uint8_t kGSCharConv[];
|
||||||
|
|
||||||
int fLeftMargin, fRightMargin; // for documents, in 1/10th inch
|
int fLeftMargin, fRightMargin; // for documents, in 1/10th inch
|
||||||
int fPointSize;
|
int fPointSize;
|
||||||
|
|
|
@ -71,7 +71,7 @@ ReformatResourceFork::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ ReformatResourceFork::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* move to start of resource map */
|
/* move to start of resource map */
|
||||||
const unsigned char* mapPtr;
|
const uint8_t* mapPtr;
|
||||||
long mapToIndex, mapIndexSize, mapIndexUsed;
|
long mapToIndex, mapIndexSize, mapIndexUsed;
|
||||||
|
|
||||||
mapPtr = srcBuf + rFileToMap;
|
mapPtr = srcBuf + rFileToMap;
|
||||||
|
@ -118,14 +118,14 @@ ReformatResourceFork::Process(const ReformatHolder* pHolder,
|
||||||
BufPrintf(" mapFreeListUsed = %ld\r\n", Get16(mapPtr + 0x1e, littleEndian));
|
BufPrintf(" mapFreeListUsed = %ld\r\n", Get16(mapPtr + 0x1e, littleEndian));
|
||||||
|
|
||||||
/* dump contents of resource reference records */
|
/* dump contents of resource reference records */
|
||||||
const unsigned char* indexPtr;
|
const uint8_t* indexPtr;
|
||||||
|
|
||||||
BufPrintf("\r\nResources:");
|
BufPrintf("\r\nResources:");
|
||||||
indexPtr = mapPtr + mapToIndex;
|
indexPtr = mapPtr + mapToIndex;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < mapIndexSize; i++) {
|
for (i = 0; i < mapIndexSize; i++) {
|
||||||
unsigned short resType = Get16(indexPtr + 0x00, littleEndian);
|
uint16_t resType = Get16(indexPtr + 0x00, littleEndian);
|
||||||
if (resType == 0)
|
if (resType == 0)
|
||||||
break; // should happen when i == mapIndexUsed
|
break; // should happen when i == mapIndexUsed
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ done:
|
||||||
* Extract and verify the header of a resource fork.
|
* Extract and verify the header of a resource fork.
|
||||||
*/
|
*/
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
ReformatResourceFork::ReadHeader(const unsigned char* srcBuf, long srcLen,
|
ReformatResourceFork::ReadHeader(const uint8_t* srcBuf, long srcLen,
|
||||||
long* pFileVersion, long* pFileToMap, long* pFileMapSize,
|
long* pFileVersion, long* pFileToMap, long* pFileMapSize,
|
||||||
bool* pLittleEndian)
|
bool* pLittleEndian)
|
||||||
{
|
{
|
||||||
|
@ -204,9 +204,9 @@ ReformatResourceFork::ReadHeader(const unsigned char* srcBuf, long srcLen,
|
||||||
* Returns "true" on success, "false" on failure.
|
* Returns "true" on success, "false" on failure.
|
||||||
*/
|
*/
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
ReformatResourceFork::GetResource(const unsigned char* srcBuf, long srcLen,
|
ReformatResourceFork::GetResource(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned short resourceType, unsigned long resourceID,
|
uint16_t resourceType, uint32_t resourceID,
|
||||||
const unsigned char** pResource, long* pResourceLen)
|
const uint8_t** pResource, long* pResourceLen)
|
||||||
{
|
{
|
||||||
/* read the file header */
|
/* read the file header */
|
||||||
long rFileVersion, rFileToMap, rFileMapSize;
|
long rFileVersion, rFileToMap, rFileMapSize;
|
||||||
|
@ -219,7 +219,7 @@ ReformatResourceFork::GetResource(const unsigned char* srcBuf, long srcLen,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* move to start of resource map */
|
/* move to start of resource map */
|
||||||
const unsigned char* mapPtr;
|
const uint8_t* mapPtr;
|
||||||
long mapToIndex, mapIndexSize, mapIndexUsed;
|
long mapToIndex, mapIndexSize, mapIndexUsed;
|
||||||
|
|
||||||
mapPtr = srcBuf + rFileToMap;
|
mapPtr = srcBuf + rFileToMap;
|
||||||
|
@ -228,12 +228,12 @@ ReformatResourceFork::GetResource(const unsigned char* srcBuf, long srcLen,
|
||||||
mapIndexUsed = Get32(mapPtr + 0x18, littleEndian);
|
mapIndexUsed = Get32(mapPtr + 0x18, littleEndian);
|
||||||
|
|
||||||
/* find the appropriate entry */
|
/* find the appropriate entry */
|
||||||
const unsigned char* indexPtr = mapPtr + mapToIndex;
|
const uint8_t* indexPtr = mapPtr + mapToIndex;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < mapIndexSize; i++) {
|
for (i = 0; i < mapIndexSize; i++) {
|
||||||
unsigned short resType;
|
uint16_t resType;
|
||||||
unsigned long resID;
|
uint32_t resID;
|
||||||
|
|
||||||
resType = Get16(indexPtr + 0x00, littleEndian);
|
resType = Get16(indexPtr + 0x00, littleEndian);
|
||||||
if (resType == 0)
|
if (resType == 0)
|
||||||
|
|
|
@ -24,14 +24,14 @@ public:
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
static bool GetResource(const unsigned char* srcBuf, long srcLen,
|
static bool GetResource(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned short resourceType, unsigned long resourceID,
|
uint16_t resourceType, uint32_t resourceID,
|
||||||
const unsigned char** pResource, long* pResourceLen);
|
const uint8_t** pResource, long* pResourceLen);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { kRsrcMapEntryLen = 0x14 };
|
enum { kRsrcMapEntryLen = 0x14 };
|
||||||
|
|
||||||
static bool ReadHeader(const unsigned char* srcBuf, long srcLen,
|
static bool ReadHeader(const uint8_t* srcBuf, long srcLen,
|
||||||
long* pFileVersion, long* pFileToMap, long* pFileMapSize,
|
long* pFileVersion, long* pFileToMap, long* pFileMapSize,
|
||||||
bool* pLittleEndian);
|
bool* pLittleEndian);
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,7 @@ ReformatHexDump::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -124,7 +124,7 @@ ReformatEOL_HA::Process(const ReformatHolder* pHolder,
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
//isHighASCII = GenericEntry::CheckHighASCII(
|
//isHighASCII = GenericEntry::CheckHighASCII(
|
||||||
// (const unsigned char*) pHolder->fSourceBuf, pHolder->fSourceLen);
|
// (const uint8_t*) pHolder->fSourceBuf, pHolder->fSourceLen);
|
||||||
|
|
||||||
ConvertEOL(pHolder->GetSourceBuf(part), pHolder->GetSourceLen(part), true);
|
ConvertEOL(pHolder->GetSourceBuf(part), pHolder->GetSourceLen(part), true);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
#include <afxcmn.h> // for some stuff in util lib
|
#include <afxcmn.h> // for some stuff in util lib
|
||||||
|
|
||||||
|
|
|
@ -55,14 +55,14 @@ ReformatSHR::SHRScreenToBitmap8(const SHRScreen* pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
MyDIBitmap*
|
MyDIBitmap*
|
||||||
ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels,
|
ReformatSHR::SHRDataToBitmap8(const uint8_t* pPixels,
|
||||||
const unsigned char* pSCB, const unsigned char* pColorTable,
|
const uint8_t* pSCB, const uint8_t* pColorTable,
|
||||||
int pixelBytesPerLine, int numScanLines,
|
int pixelBytesPerLine, int numScanLines,
|
||||||
int outputWidth, int outputHeight)
|
int outputWidth, int outputHeight)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
const unsigned char* pSCBStart = pSCB; // sanity check only
|
const uint8_t* pSCBStart = pSCB; // sanity check only
|
||||||
unsigned char* outBuf;
|
uint8_t* outBuf;
|
||||||
int line;
|
int line;
|
||||||
|
|
||||||
if (pDib == NULL)
|
if (pDib == NULL)
|
||||||
|
@ -72,7 +72,7 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels,
|
||||||
* Set up a DIB to hold the data. "Create" returns a pointer to the
|
* Set up a DIB to hold the data. "Create" returns a pointer to the
|
||||||
* pixel storage.
|
* pixel storage.
|
||||||
*/
|
*/
|
||||||
outBuf = (unsigned char*) pDib->Create(outputWidth, outputHeight, 8,
|
outBuf = (uint8_t*) pDib->Create(outputWidth, outputHeight, 8,
|
||||||
kNumColorTables * kNumEntriesPerColorTable);
|
kNumColorTables * kNumEntriesPerColorTable);
|
||||||
if (outBuf == NULL) {
|
if (outBuf == NULL) {
|
||||||
delete pDib;
|
delete pDib;
|
||||||
|
@ -83,8 +83,8 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels,
|
||||||
/*
|
/*
|
||||||
* Convert color palette.
|
* Convert color palette.
|
||||||
*/
|
*/
|
||||||
const unsigned short* pClrTable;
|
const uint16_t* pClrTable;
|
||||||
pClrTable = (const unsigned short*) pColorTable;
|
pClrTable = (const uint16_t*) pColorTable;
|
||||||
int table;
|
int table;
|
||||||
for (table = 0; table < kNumColorTables; table++) {
|
for (table = 0; table < kNumColorTables; table++) {
|
||||||
for (int entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
for (int entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
||||||
|
@ -112,9 +112,8 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels,
|
||||||
bool mode640, fillMode;
|
bool mode640, fillMode;
|
||||||
int colorTableOffset;
|
int colorTableOffset;
|
||||||
int byteCount, pixelByte;
|
int byteCount, pixelByte;
|
||||||
unsigned char pixelVal;
|
uint8_t pixelVal;
|
||||||
// RGBTRIPLE rgbval;
|
uint8_t colorIndex;
|
||||||
unsigned char colorIndex;
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
mode640 = (*pSCB & kSCBNumPixels) != 0;
|
mode640 = (*pSCB & kSCBNumPixels) != 0;
|
||||||
|
@ -331,7 +330,7 @@ ReformatJEQSHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
|
@ -415,9 +414,9 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder,
|
||||||
const int kPWOutputLines = 396;
|
const int kPWOutputLines = 396;
|
||||||
const int kPWOutputSize = kPWOutputLines * kPixelBytesPerLine;
|
const int kPWOutputSize = kPWOutputLines * kPixelBytesPerLine;
|
||||||
const int kPWDataOffset = 0x222;
|
const int kPWDataOffset = 0x222;
|
||||||
unsigned char scb[kPWOutputLines];
|
uint8_t scb[kPWOutputLines];
|
||||||
unsigned char colorTable[kNumEntriesPerColorTable * kColorTableEntrySize];
|
uint8_t colorTable[kNumEntriesPerColorTable * kColorTableEntrySize];
|
||||||
unsigned char* unpackBuf = NULL;
|
uint8_t* unpackBuf = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
int i, result;
|
int i, result;
|
||||||
|
|
||||||
|
@ -441,7 +440,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder,
|
||||||
* than PaintWorks wrote these, because SuperConvert expects them to
|
* than PaintWorks wrote these, because SuperConvert expects them to
|
||||||
* have 396 lines and only recognizes that many.
|
* have 396 lines and only recognizes that many.
|
||||||
*/
|
*/
|
||||||
unpackBuf = new unsigned char[kPWOutputSize];
|
unpackBuf = new uint8_t[kPWOutputSize];
|
||||||
if (unpackBuf == NULL)
|
if (unpackBuf == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
memset(unpackBuf, 0, sizeof(unpackBuf)); // in case we fall short
|
memset(unpackBuf, 0, sizeof(unpackBuf)); // in case we fall short
|
||||||
|
@ -455,7 +454,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder,
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* thd282.shk (rev76.2) has a large collection of these */
|
/* thd282.shk (rev76.2) has a large collection of these */
|
||||||
if (UnpackBytes((unsigned char*) &fScreen,
|
if (UnpackBytes((uint8_t*) &fScreen,
|
||||||
pHolder->GetSourceBuf(part),
|
pHolder->GetSourceBuf(part),
|
||||||
kTotalSize,
|
kTotalSize,
|
||||||
pHolder->GetSourceLen(part)) == 0)
|
pHolder->GetSourceLen(part)) == 0)
|
||||||
|
@ -532,7 +531,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder,
|
||||||
|
|
||||||
ASSERT(sizeof(SHRScreen) == kTotalSize);
|
ASSERT(sizeof(SHRScreen) == kTotalSize);
|
||||||
|
|
||||||
if (UnpackBytes((unsigned char*) &fScreen,
|
if (UnpackBytes((uint8_t*) &fScreen,
|
||||||
pHolder->GetSourceBuf(part), kTotalSize,
|
pHolder->GetSourceBuf(part), kTotalSize,
|
||||||
pHolder->GetSourceLen(part)) != 0)
|
pHolder->GetSourceLen(part)) != 0)
|
||||||
{
|
{
|
||||||
|
@ -597,9 +596,9 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
unsigned char multiPal[kNumLines *
|
uint8_t multiPal[kNumLines *
|
||||||
kNumEntriesPerColorTable * kColorTableEntrySize];
|
kNumEntriesPerColorTable * kColorTableEntrySize];
|
||||||
bool is3200 = false;
|
bool is3200 = false;
|
||||||
bool haveGraphics = false;
|
bool haveGraphics = false;
|
||||||
|
@ -614,7 +613,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder,
|
||||||
|
|
||||||
while (srcLen > 0) {
|
while (srcLen > 0) {
|
||||||
CString blockName;
|
CString blockName;
|
||||||
const unsigned char* nextBlock;
|
const uint8_t* nextBlock;
|
||||||
long blockLen, dataLen, nextLen;
|
long blockLen, dataLen, nextLen;
|
||||||
int nameLen;
|
int nameLen;
|
||||||
|
|
||||||
|
@ -628,7 +627,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder,
|
||||||
nextBlock = srcPtr + (blockLen-4);
|
nextBlock = srcPtr + (blockLen-4);
|
||||||
nextLen = srcLen - (blockLen-4);
|
nextLen = srcLen - (blockLen-4);
|
||||||
|
|
||||||
nameLen = ::GetPascalString((const char*)srcPtr, srcLen, &blockName);
|
nameLen = ::GetPascalString(srcPtr, srcLen, &blockName);
|
||||||
if (nameLen < 0) {
|
if (nameLen < 0) {
|
||||||
LOGI(" APFSHR failed getting pascal name, bailing");
|
LOGI(" APFSHR failed getting pascal name, bailing");
|
||||||
goto bail;
|
goto bail;
|
||||||
|
@ -709,10 +708,10 @@ bail:
|
||||||
* correctly? Can the format be different on every line?
|
* correctly? Can the format be different on every line?
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen)
|
ReformatAPFSHR::UnpackMain(const uint8_t* srcPtr, long srcLen)
|
||||||
{
|
{
|
||||||
const int kColorTableSize = kNumEntriesPerColorTable * kColorTableEntrySize;
|
const int kColorTableSize = kNumEntriesPerColorTable * kColorTableEntrySize;
|
||||||
unsigned short masterMode;
|
uint16_t masterMode;
|
||||||
int numColorTables;
|
int numColorTables;
|
||||||
int* packedDataLen = NULL;
|
int* packedDataLen = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -808,13 +807,13 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen)
|
||||||
* Figure this out someday.
|
* Figure this out someday.
|
||||||
*/
|
*/
|
||||||
fPixelBytesPerLine = ((fPixelBytesPerLine + 7) / 8) * 8;
|
fPixelBytesPerLine = ((fPixelBytesPerLine + 7) / 8) * 8;
|
||||||
fPixelStore = new unsigned char[fPixelBytesPerLine * fNumScanLines];
|
fPixelStore = new uint8_t[fPixelBytesPerLine * fNumScanLines];
|
||||||
if (fPixelStore == NULL) {
|
if (fPixelStore == NULL) {
|
||||||
LOGI(" APFSHR ERROR: alloc of %d bytes fPixelStore failed",
|
LOGI(" APFSHR ERROR: alloc of %d bytes fPixelStore failed",
|
||||||
fPixelBytesPerLine * fNumScanLines);
|
fPixelBytesPerLine * fNumScanLines);
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
fSCBStore = new unsigned char[fNumScanLines];
|
fSCBStore = new uint8_t[fNumScanLines];
|
||||||
if (fSCBStore == NULL) {
|
if (fSCBStore == NULL) {
|
||||||
LOGI(" APFSHR ERROR: alloc of %d bytes fSCBStore failed",
|
LOGI(" APFSHR ERROR: alloc of %d bytes fSCBStore failed",
|
||||||
fNumScanLines);
|
fNumScanLines);
|
||||||
|
@ -831,7 +830,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen)
|
||||||
if (packedDataLen == NULL)
|
if (packedDataLen == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
for (i = 0; i < fNumScanLines; i++) {
|
for (i = 0; i < fNumScanLines; i++) {
|
||||||
unsigned short mode;
|
uint16_t mode;
|
||||||
|
|
||||||
packedDataLen[i] = Read16(&srcPtr, &srcLen);
|
packedDataLen[i] = Read16(&srcPtr, &srcLen);
|
||||||
if (packedDataLen[i] > fPixelsPerScanLine) {
|
if (packedDataLen[i] > fPixelsPerScanLine) {
|
||||||
|
@ -843,7 +842,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen)
|
||||||
|
|
||||||
mode = Read16(&srcPtr, &srcLen);
|
mode = Read16(&srcPtr, &srcLen);
|
||||||
if (mode >> 8 == 0)
|
if (mode >> 8 == 0)
|
||||||
fSCBStore[i] = (unsigned char)mode;
|
fSCBStore[i] = (uint8_t) mode;
|
||||||
else {
|
else {
|
||||||
LOGI(" APFSHR odd mode 0x%04x on line %d", mode, i);
|
LOGI(" APFSHR odd mode 0x%04x on line %d", mode, i);
|
||||||
}
|
}
|
||||||
|
@ -883,8 +882,8 @@ bail:
|
||||||
* fix it here, but we can't reliably detect the files.
|
* fix it here, but we can't reliably detect the files.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
ReformatAPFSHR::UnpackMultipal(unsigned char* dstPtr,
|
ReformatAPFSHR::UnpackMultipal(uint8_t* dstPtr,
|
||||||
const unsigned char* srcPtr, long srcLen)
|
const uint8_t* srcPtr, long srcLen)
|
||||||
{
|
{
|
||||||
const int kMultipalSize = kNumLines *
|
const int kMultipalSize = kNumLines *
|
||||||
kNumEntriesPerColorTable * kColorTableEntrySize;
|
kNumEntriesPerColorTable * kColorTableEntrySize;
|
||||||
|
@ -914,11 +913,11 @@ ReformatAPFSHR::UnpackMultipal(unsigned char* dstPtr,
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
#if 0
|
||||||
/* swap entries */
|
/* swap entries */
|
||||||
const unsigned short* pSrcTable;
|
const uint16_t* pSrcTable;
|
||||||
unsigned short* pDstTable = (unsigned short*) dst;
|
uint16_t* pDstTable = (uint16_t*) dst;
|
||||||
int table, entry;
|
int table, entry;
|
||||||
for (table = 0; table < kNumLines; table++) {
|
for (table = 0; table < kNumLines; table++) {
|
||||||
pSrcTable = (const unsigned short*)src +
|
pSrcTable = (const uint16_t*)src +
|
||||||
(kNumLines - table) * kNumEntriesPerColorTable;
|
(kNumLines - table) * kNumEntriesPerColorTable;
|
||||||
for (entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
for (entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
||||||
pDstTable[entry] = *pSrcTable++;
|
pDstTable[entry] = *pSrcTable++;
|
||||||
|
@ -936,7 +935,7 @@ ReformatAPFSHR::UnpackMultipal(unsigned char* dstPtr,
|
||||||
* ASCII data.
|
* ASCII data.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ReformatAPFSHR::UnpackNote(const unsigned char* srcPtr, long srcLen)
|
ReformatAPFSHR::UnpackNote(const uint8_t* srcPtr, long srcLen)
|
||||||
{
|
{
|
||||||
int numChars;
|
int numChars;
|
||||||
|
|
||||||
|
@ -1021,9 +1020,9 @@ Reformat3200SHR::Process(const ReformatHolder* pHolder,
|
||||||
// sizeof(fExtColorTable));
|
// sizeof(fExtColorTable));
|
||||||
|
|
||||||
/* "Brooks" format color tables are stored in reverse order */
|
/* "Brooks" format color tables are stored in reverse order */
|
||||||
const unsigned short* pSrcTable = (const unsigned short*)
|
const uint16_t* pSrcTable = (const uint16_t*)
|
||||||
(pHolder->GetSourceBuf(part) + sizeof(fScreen.pixels));
|
(pHolder->GetSourceBuf(part) + sizeof(fScreen.pixels));
|
||||||
unsigned short* pDstTable = (unsigned short*) fExtColorTable;
|
uint16_t* pDstTable = (uint16_t*) fExtColorTable;
|
||||||
int table;
|
int table;
|
||||||
for (table = 0; table < kExtNumColorTables; table++) {
|
for (table = 0; table < kExtNumColorTables; table++) {
|
||||||
int entry;
|
int entry;
|
||||||
|
@ -1056,7 +1055,7 @@ Reformat3200SHR::SHR3200ToBitmap24(void)
|
||||||
MyDIBitmap* pDib = new MyDIBitmap;
|
MyDIBitmap* pDib = new MyDIBitmap;
|
||||||
RGBTRIPLE colorLookup[kExtNumColorTables][kNumEntriesPerColorTable];
|
RGBTRIPLE colorLookup[kExtNumColorTables][kNumEntriesPerColorTable];
|
||||||
RGBTRIPLE* rgbBuf;
|
RGBTRIPLE* rgbBuf;
|
||||||
const unsigned char* pPixels = fScreen.pixels;
|
const uint8_t* pPixels = fScreen.pixels;
|
||||||
|
|
||||||
if (pDib == NULL)
|
if (pDib == NULL)
|
||||||
goto bail;
|
goto bail;
|
||||||
|
@ -1074,8 +1073,8 @@ Reformat3200SHR::SHR3200ToBitmap24(void)
|
||||||
/*
|
/*
|
||||||
* Convert color palette data to RGBTRIPLE form.
|
* Convert color palette data to RGBTRIPLE form.
|
||||||
*/
|
*/
|
||||||
const unsigned short* pClrTable;
|
const uint16_t* pClrTable;
|
||||||
pClrTable = (const unsigned short*) fExtColorTable;
|
pClrTable = (const uint16_t*) fExtColorTable;
|
||||||
int table;
|
int table;
|
||||||
for (table = 0; table < kExtNumColorTables; table++) {
|
for (table = 0; table < kExtNumColorTables; table++) {
|
||||||
for (int entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
for (int entry = 0; entry < kNumEntriesPerColorTable; entry++) {
|
||||||
|
@ -1093,7 +1092,7 @@ Reformat3200SHR::SHR3200ToBitmap24(void)
|
||||||
int line;
|
int line;
|
||||||
for (line = 0; line < kNumLines; line++) {
|
for (line = 0; line < kNumLines; line++) {
|
||||||
int byteCount, pixelByte;
|
int byteCount, pixelByte;
|
||||||
unsigned char pixelVal;
|
uint8_t pixelVal;
|
||||||
RGBTRIPLE rgbval;
|
RGBTRIPLE rgbval;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
|
@ -1170,10 +1169,10 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
MyDIBitmap* pDib;
|
MyDIBitmap* pDib;
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
unsigned char* tmpBuf = NULL;
|
uint8_t* tmpBuf = NULL;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
if (srcLen < 16 || srcLen > kExtTotalSize) {
|
if (srcLen < 16 || srcLen > kExtTotalSize) {
|
||||||
|
@ -1193,10 +1192,10 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder,
|
||||||
ASSERT(sizeof(fScreen.pixels) + sizeof(fExtColorTable) == kExtTotalSize);
|
ASSERT(sizeof(fScreen.pixels) + sizeof(fExtColorTable) == kExtTotalSize);
|
||||||
|
|
||||||
/* "Brooks" format color tables are stored in reverse order */
|
/* "Brooks" format color tables are stored in reverse order */
|
||||||
const unsigned short* pSrcTable;
|
const uint16_t* pSrcTable;
|
||||||
unsigned short* pDstTable;
|
uint16_t* pDstTable;
|
||||||
pSrcTable = (const unsigned short*) srcBuf;
|
pSrcTable = (const uint16_t*) srcBuf;
|
||||||
pDstTable = (unsigned short*) fExtColorTable;
|
pDstTable = (uint16_t*) fExtColorTable;
|
||||||
int table;
|
int table;
|
||||||
for (table = 0; table < kExtNumColorTables; table++) {
|
for (table = 0; table < kExtNumColorTables; table++) {
|
||||||
int entry;
|
int entry;
|
||||||
|
@ -1206,7 +1205,7 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder,
|
||||||
pDstTable += kNumEntriesPerColorTable;
|
pDstTable += kNumEntriesPerColorTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcBuf = (const unsigned char*) pSrcTable;
|
srcBuf = (const uint8_t*) pSrcTable;
|
||||||
length -= srcBuf - (pHolder->GetSourceBuf(part) +4);
|
length -= srcBuf - (pHolder->GetSourceBuf(part) +4);
|
||||||
|
|
||||||
/* now unpack the PackBytes-format pixels */
|
/* now unpack the PackBytes-format pixels */
|
||||||
|
|
|
@ -46,10 +46,10 @@ public:
|
||||||
* This holds one SHR screen; the size must be 32768 bytes.
|
* This holds one SHR screen; the size must be 32768 bytes.
|
||||||
*/
|
*/
|
||||||
typedef struct SHRScreen {
|
typedef struct SHRScreen {
|
||||||
unsigned char pixels[kNumLines * kPixelBytesPerLine];
|
uint8_t pixels[kNumLines * kPixelBytesPerLine];
|
||||||
unsigned char scb[kNumLines];
|
uint8_t scb[kNumLines];
|
||||||
unsigned char reserved[256-kNumLines];
|
uint8_t reserved[256 - kNumLines];
|
||||||
unsigned char colorTable[kNumColorTables * kNumEntriesPerColorTable *
|
uint8_t colorTable[kNumColorTables * kNumEntriesPerColorTable *
|
||||||
kColorTableEntrySize];
|
kColorTableEntrySize];
|
||||||
} SHRScreen;
|
} SHRScreen;
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
RGBQUAD fColorTables[kNumColorTables][kNumEntriesPerColorTable];
|
RGBQUAD fColorTables[kNumColorTables][kNumEntriesPerColorTable];
|
||||||
|
|
||||||
MyDIBitmap* SHRScreenToBitmap8(const SHRScreen* pScreen);
|
MyDIBitmap* SHRScreenToBitmap8(const SHRScreen* pScreen);
|
||||||
MyDIBitmap* SHRDataToBitmap8(const unsigned char* pPixels,
|
MyDIBitmap* SHRDataToBitmap8(const uint8_t* pPixels,
|
||||||
const unsigned char* pSCB, const unsigned char* pColorTable,
|
const uint8_t* pSCB, const uint8_t* pColorTable,
|
||||||
int pixelBytesPerLine, int numScanLines,
|
int pixelBytesPerLine, int numScanLines,
|
||||||
int outputWidth, int outputHeight);
|
int outputWidth, int outputHeight);
|
||||||
};
|
};
|
||||||
|
@ -172,10 +172,9 @@ public:
|
||||||
ReformatOutput* pOutput);
|
ReformatOutput* pOutput);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int UnpackMain(const unsigned char* srcPtr, long srcLen);
|
int UnpackMain(const uint8_t* srcPtr, long srcLen);
|
||||||
int UnpackMultipal(unsigned char* dstPtr,
|
int UnpackMultipal(uint8_t* dstPtr, const uint8_t* srcPtr, long srcLen);
|
||||||
const unsigned char* srcPtr, long srcLen);
|
void UnpackNote(const uint8_t* srcPtr, long srcLen);
|
||||||
void UnpackNote(const unsigned char* srcPtr, long srcLen);
|
|
||||||
|
|
||||||
/* use this for standard-sized images */
|
/* use this for standard-sized images */
|
||||||
SHRScreen fScreen;
|
SHRScreen fScreen;
|
||||||
|
@ -184,8 +183,8 @@ private:
|
||||||
bool fNonStandard;
|
bool fNonStandard;
|
||||||
|
|
||||||
/* use this for non-standard-sized images */
|
/* use this for non-standard-sized images */
|
||||||
unsigned char* fPixelStore;
|
uint8_t* fPixelStore;
|
||||||
unsigned char* fSCBStore;
|
uint8_t* fSCBStore;
|
||||||
int fNumScanLines; // #of scan lines in image
|
int fNumScanLines; // #of scan lines in image
|
||||||
int fPixelsPerScanLine;
|
int fPixelsPerScanLine;
|
||||||
int fPixelBytesPerLine;
|
int fPixelBytesPerLine;
|
||||||
|
@ -202,7 +201,7 @@ public:
|
||||||
virtual ~Reformat3200SHR(void) {}
|
virtual ~Reformat3200SHR(void) {}
|
||||||
|
|
||||||
// alternate construction, used by APFSHR
|
// alternate construction, used by APFSHR
|
||||||
Reformat3200SHR(SHRScreen* pScreen, unsigned char* multiPal) {
|
Reformat3200SHR(SHRScreen* pScreen, uint8_t* multiPal) {
|
||||||
memcpy(&fScreen, pScreen, sizeof(fScreen));
|
memcpy(&fScreen, pScreen, sizeof(fScreen));
|
||||||
memcpy(fExtColorTable, multiPal, sizeof(fExtColorTable));
|
memcpy(fExtColorTable, multiPal, sizeof(fExtColorTable));
|
||||||
}
|
}
|
||||||
|
@ -223,7 +222,7 @@ protected:
|
||||||
SHRScreen fScreen; // only "pixels" is valid
|
SHRScreen fScreen; // only "pixels" is valid
|
||||||
|
|
||||||
/* this holds the 200 color tables, with the entries switched to normal */
|
/* this holds the 200 color tables, with the entries switched to normal */
|
||||||
unsigned char fExtColorTable[kExtNumColorTables *
|
uint8_t fExtColorTable[kExtNumColorTables *
|
||||||
kNumEntriesPerColorTable * kColorTableEntrySize];
|
kNumEntriesPerColorTable * kColorTableEntrySize];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -259,16 +258,16 @@ public:
|
||||||
/*
|
/*
|
||||||
* Unpack a DreamGrafix SHR image compressed with LZW.
|
* Unpack a DreamGrafix SHR image compressed with LZW.
|
||||||
*/
|
*/
|
||||||
bool UnpackDG(const unsigned char* srcBuf, long srcLen,
|
bool UnpackDG(const uint8_t* srcBuf, long srcLen,
|
||||||
ReformatSHR::SHRScreen* pScreen, unsigned char* extColorTable);
|
ReformatSHR::SHRScreen* pScreen, uint8_t* extColorTable);
|
||||||
|
|
||||||
int fWidth;
|
int fWidth;
|
||||||
int fHeight;
|
int fHeight;
|
||||||
int fNumColors;
|
int fNumColors;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int UnpackLZW(const unsigned char* srcBuf, long srcLen,
|
static int UnpackLZW(const uint8_t* srcBuf, long srcLen,
|
||||||
unsigned char* dstBuf, long dstLen);
|
uint8_t* dstBuf, long dstLen);
|
||||||
enum { kHeaderOffset = 17 };
|
enum { kHeaderOffset = 17 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ ReformatGWP::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcBuf = pHolder->GetSourceBuf(part);
|
const uint8_t* srcBuf = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
fUseRTF = false;
|
fUseRTF = false;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ ReformatGWP::Process(const ReformatHolder* pHolder,
|
||||||
RTFBegin();
|
RTFBegin();
|
||||||
|
|
||||||
/* convert EOL markers and IIgs characters */
|
/* convert EOL markers and IIgs characters */
|
||||||
unsigned char ch;
|
uint8_t ch;
|
||||||
while (srcLen) {
|
while (srcLen) {
|
||||||
ch = *srcBuf++;
|
ch = *srcBuf++;
|
||||||
srcLen--;
|
srcLen--;
|
||||||
|
@ -111,10 +111,10 @@ ReformatTeach::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* dataBuf;
|
const uint8_t* dataBuf;
|
||||||
const unsigned char* rsrcBuf;
|
const uint8_t* rsrcBuf;
|
||||||
long dataLen, rsrcLen;
|
long dataLen, rsrcLen;
|
||||||
const unsigned char* styleBlock;
|
const uint8_t* styleBlock;
|
||||||
long styleLen;
|
long styleLen;
|
||||||
|
|
||||||
if (part != ReformatHolder::kPartData)
|
if (part != ReformatHolder::kPartData)
|
||||||
|
@ -198,7 +198,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* output the characters */
|
/* output the characters */
|
||||||
unsigned char uch;
|
uint8_t uch;
|
||||||
while (numBytes--) {
|
while (numBytes--) {
|
||||||
if (!dataLen) {
|
if (!dataLen) {
|
||||||
LOGI("WARNING: Teach underrun (%ld wanted)", numBytes);
|
LOGI("WARNING: Teach underrun (%ld wanted)", numBytes);
|
||||||
|
@ -239,10 +239,10 @@ ReformatTeach::Process(const ReformatHolder* pHolder,
|
||||||
* Unpack an rStyleBlock resource.
|
* Unpack an rStyleBlock resource.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
RStyleBlock::Create(const unsigned char* buf, long len)
|
RStyleBlock::Create(const uint8_t* buf, long len)
|
||||||
{
|
{
|
||||||
unsigned short version;
|
uint16_t version;
|
||||||
unsigned long partLen;
|
uint32_t partLen;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
|
@ -259,7 +259,7 @@ RStyleBlock::Create(const unsigned char* buf, long len)
|
||||||
|
|
||||||
/* extract ruler(s) */
|
/* extract ruler(s) */
|
||||||
partLen = Reformat::Read32(&buf, &len);
|
partLen = Reformat::Read32(&buf, &len);
|
||||||
if (partLen > (unsigned long) (len+8)) {
|
if (partLen > (uint32_t) (len+8)) {
|
||||||
/* not enough to satisfy data + two more counts */
|
/* not enough to satisfy data + two more counts */
|
||||||
LOGI("Invalid part1 length (%d vs %d)", partLen, len);
|
LOGI("Invalid part1 length (%d vs %d)", partLen, len);
|
||||||
return false;
|
return false;
|
||||||
|
@ -277,7 +277,7 @@ RStyleBlock::Create(const unsigned char* buf, long len)
|
||||||
|
|
||||||
/* extract TEStyles */
|
/* extract TEStyles */
|
||||||
partLen = Reformat::Read32(&buf, &len);
|
partLen = Reformat::Read32(&buf, &len);
|
||||||
if (partLen > (unsigned long) (len+4)) {
|
if (partLen > (uint32_t) (len + 4)) {
|
||||||
LOGI("Invalid part2 length (%d vs %d)", partLen, len);
|
LOGI("Invalid part2 length (%d vs %d)", partLen, len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -299,8 +299,8 @@ RStyleBlock::Create(const unsigned char* buf, long len)
|
||||||
|
|
||||||
/* extract StyleItems */
|
/* extract StyleItems */
|
||||||
fNumStyleItems = (int) Reformat::Read32(&buf, &len);
|
fNumStyleItems = (int) Reformat::Read32(&buf, &len);
|
||||||
partLen = fNumStyleItems * StyleItem::kDataLen;
|
partLen = fNumStyleItems * StyleItem::kItemDataLen;
|
||||||
if (partLen > (unsigned long) len) {
|
if (partLen > (uint32_t) len) {
|
||||||
LOGI("Invalid part3 length (%d vs %d)", partLen, len);
|
LOGI("Invalid part3 length (%d vs %d)", partLen, len);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,8 @@ RStyleBlock::Create(const unsigned char* buf, long len)
|
||||||
fpStyleItems[i].GetOffset(), TEStyle::kDataLen);
|
fpStyleItems[i].GetOffset(), TEStyle::kDataLen);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buf += StyleItem::kDataLen;
|
buf += StyleItem::kItemDataLen;
|
||||||
len -= StyleItem::kDataLen;
|
len -= StyleItem::kItemDataLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
|
@ -333,7 +333,7 @@ RStyleBlock::Create(const unsigned char* buf, long len)
|
||||||
* Returns the #of bytes consumed, or -1 on failure.
|
* Returns the #of bytes consumed, or -1 on failure.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
RStyleBlock::TERuler::Create(const unsigned char* buf, long len)
|
RStyleBlock::TERuler::Create(const uint8_t* buf, long len)
|
||||||
{
|
{
|
||||||
long origLen = len;
|
long origLen = len;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ RStyleBlock::TERuler::Create(const unsigned char* buf, long len)
|
||||||
* Extract a TEStyle object from the buffer.
|
* Extract a TEStyle object from the buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
RStyleBlock::TEStyle::Create(const unsigned char* buf)
|
RStyleBlock::TEStyle::Create(const uint8_t* buf)
|
||||||
{
|
{
|
||||||
fFontID = Reformat::Get32LE(buf);
|
fFontID = Reformat::Get32LE(buf);
|
||||||
fForeColor = Reformat::Get16LE(buf + 4);
|
fForeColor = Reformat::Get16LE(buf + 4);
|
||||||
|
@ -411,7 +411,7 @@ RStyleBlock::TEStyle::Create(const unsigned char* buf)
|
||||||
* Extract a StyleItem object from the buffer.
|
* Extract a StyleItem object from the buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
RStyleBlock::StyleItem::Create(const unsigned char* buf)
|
RStyleBlock::StyleItem::Create(const uint8_t* buf)
|
||||||
{
|
{
|
||||||
fLength = Reformat::Get32LE(buf);
|
fLength = Reformat::Get32LE(buf);
|
||||||
fOffset = Reformat::Get32LE(buf + 4);
|
fOffset = Reformat::Get32LE(buf + 4);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unpack the resource; returns false on failure */
|
/* unpack the resource; returns false on failure */
|
||||||
bool Create(const unsigned char* buf, long len);
|
bool Create(const uint8_t* buf, long len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class representing a IIgs TERuler object.
|
* Class representing a IIgs TERuler object.
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
virtual ~TERuler(void) {}
|
virtual ~TERuler(void) {}
|
||||||
|
|
||||||
/* unpack the ruler; returns the #of bytes consumed */
|
/* unpack the ruler; returns the #of bytes consumed */
|
||||||
int Create(const unsigned char* buf, long len);
|
int Create(const uint8_t* buf, long len);
|
||||||
|
|
||||||
typedef enum Justification {
|
typedef enum Justification {
|
||||||
kJustLeft = 0x0000,
|
kJustLeft = 0x0000,
|
||||||
|
@ -90,20 +90,20 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct TabItem {
|
typedef struct TabItem {
|
||||||
unsigned short tabKind; // must be $0000
|
uint16_t tabKind; // must be $0000
|
||||||
unsigned short tabData; // tab location, in pixels from left
|
uint16_t tabData; // tab location, in pixels from left
|
||||||
} TabItem;
|
} TabItem;
|
||||||
|
|
||||||
unsigned short fLeftMargin; // pixel indent, except para start
|
uint16_t fLeftMargin; // pixel indent, except para start
|
||||||
unsigned short fLeftIndent; // pixel indent, for para start
|
uint16_t fLeftIndent; // pixel indent, for para start
|
||||||
unsigned short fRightMargin; // maximum line len, in pixels
|
uint16_t fRightMargin; // maximum line len, in pixels
|
||||||
unsigned short fJust; // enum Justification
|
uint16_t fJust; // enum Justification
|
||||||
unsigned short fExtraLS; // extra line spacing, in pixels
|
uint16_t fExtraLS; // extra line spacing, in pixels
|
||||||
unsigned short fFlags; // reserved
|
uint16_t fFlags; // reserved
|
||||||
unsigned long fUserData;
|
uint32_t fUserData;
|
||||||
unsigned short fTabType; // 0=none, 1=interval, 2=irregular
|
uint16_t fTabType; // 0=none, 1=interval, 2=irregular
|
||||||
// array of TabItem appears here for fTabType==2
|
// array of TabItem appears here for fTabType==2
|
||||||
unsigned short fTabTerminator; // present for fTabType==1 or 2
|
uint16_t fTabTerminator; // present for fTabType==1 or 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -115,22 +115,22 @@ public:
|
||||||
virtual ~TEStyle(void) {}
|
virtual ~TEStyle(void) {}
|
||||||
|
|
||||||
/* unpack the style; returns the #of bytes consumed */
|
/* unpack the style; returns the #of bytes consumed */
|
||||||
void Create(const unsigned char* buf);
|
void Create(const uint8_t* buf);
|
||||||
|
|
||||||
/* Apple IIgs font family number */
|
/* Apple IIgs font family number */
|
||||||
unsigned short GetFontFamily(void) const {
|
uint16_t GetFontFamily(void) const {
|
||||||
return (unsigned short) fFontID;
|
return (uint16_t) fFontID;
|
||||||
}
|
}
|
||||||
/* font size, in points */
|
/* font size, in points */
|
||||||
int GetFontSize(void) const {
|
uint8_t GetFontSize(void) const {
|
||||||
return (fFontID >> 24) & 0xff;
|
return (fFontID >> 24) & 0xff;
|
||||||
}
|
}
|
||||||
/* return QDII text style */
|
/* return QDII text style */
|
||||||
unsigned char GetTextStyle(void) const {
|
uint8_t GetTextStyle(void) const {
|
||||||
return (unsigned char) ((fFontID >> 16) & 0xff);
|
return (fFontID >> 16) & 0xff;
|
||||||
}
|
}
|
||||||
/* return QDII text color */
|
/* return QDII text color */
|
||||||
unsigned short GetTextColor(void) const { return fForeColor; }
|
uint16_t GetTextColor(void) const { return fForeColor; }
|
||||||
|
|
||||||
/* individual text style getters */
|
/* individual text style getters */
|
||||||
//bool IsBold(void) const { return (GetTextStyle() & kBold) != 0; }
|
//bool IsBold(void) const { return (GetTextStyle() & kBold) != 0; }
|
||||||
|
@ -140,10 +140,11 @@ public:
|
||||||
enum { kDataLen = 12 };
|
enum { kDataLen = 12 };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned long fFontID;
|
/* font ID has family, size, and style */
|
||||||
unsigned short fForeColor;
|
uint32_t fFontID;
|
||||||
unsigned short fBackColor;
|
uint16_t fForeColor;
|
||||||
unsigned long fUserData;
|
uint16_t fBackColor;
|
||||||
|
uint32_t fUserData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -155,23 +156,22 @@ public:
|
||||||
virtual ~StyleItem(void) {}
|
virtual ~StyleItem(void) {}
|
||||||
|
|
||||||
/* unpack the item */
|
/* unpack the item */
|
||||||
void Create(const unsigned char* buf);
|
void Create(const uint8_t* buf);
|
||||||
|
|
||||||
unsigned long GetLength(void) const { return fLength; }
|
uint32_t GetLength(void) const { return fLength; }
|
||||||
unsigned long GetOffset(void) const { return fOffset; }
|
uint32_t GetOffset(void) const { return fOffset; }
|
||||||
int GetStyleIndex(void) const {
|
uint32_t GetStyleIndex(void) const {
|
||||||
/* MSVC++6.0 won't let me use TEStyle::kDataLen here */
|
return fOffset / TEStyle::kDataLen;
|
||||||
return fOffset / 12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kDataLen = 8,
|
kItemDataLen = 8,
|
||||||
kUnusedItem = 0xffffffff, // in fLength field
|
kUnusedItem = 0xffffffff, // in fLength field
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned long fLength; // #of characters affected by this style
|
uint32_t fLength; // #of characters affected by this style
|
||||||
unsigned long fOffset; // offset in bytes into TEStyle list
|
uint32_t fOffset; // offset in bytes into TEStyle list
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -82,7 +82,7 @@ ReformatMagicWindow::Examine(ReformatHolder* pHolder)
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
ReformatMagicWindow::IsFormatted(const ReformatHolder* pHolder)
|
ReformatMagicWindow::IsFormatted(const ReformatHolder* pHolder)
|
||||||
{
|
{
|
||||||
const unsigned char* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
const uint8_t* ptr = pHolder->GetSourceBuf(ReformatHolder::kPartData);
|
||||||
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
long srcLen = pHolder->GetSourceLen(ReformatHolder::kPartData);
|
||||||
int i, count00, count20;
|
int i, count00, count20;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ ReformatMagicWindow::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -205,7 +205,7 @@ ReformatGutenberg::Process(const ReformatHolder* pHolder,
|
||||||
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part,
|
||||||
ReformatOutput* pOutput)
|
ReformatOutput* pOutput)
|
||||||
{
|
{
|
||||||
const unsigned char* srcPtr = pHolder->GetSourceBuf(part);
|
const uint8_t* srcPtr = pHolder->GetSourceBuf(part);
|
||||||
long srcLen = pHolder->GetSourceLen(part);
|
long srcLen = pHolder->GetSourceLen(part);
|
||||||
long length = srcLen;
|
long length = srcLen;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Guterberg Word Processor
|
* Gutenberg Word Processor
|
||||||
*/
|
*/
|
||||||
class ReformatGutenberg : public ReformatText {
|
class ReformatGutenberg : public ReformatText {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "../app/targetver.h"
|
#include "../app/targetver.h"
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
|
|
|
@ -512,7 +512,7 @@ IsWin9x(void)
|
||||||
* Returns the length of the string found, or -1 on error.
|
* Returns the length of the string found, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
GetPascalString(const char* buf, long maxLen, CString* pStr)
|
GetPascalString(const uint8_t* buf, long maxLen, CString* pStr)
|
||||||
{
|
{
|
||||||
int len = *buf++;
|
int len = *buf++;
|
||||||
int retLen = len;
|
int retLen = len;
|
||||||
|
|
|
@ -116,7 +116,7 @@ bool IsWin9x(void);
|
||||||
/*
|
/*
|
||||||
* Miscellaneous functions.
|
* Miscellaneous functions.
|
||||||
*/
|
*/
|
||||||
int GetPascalString(const char* buf, long maxLen, CString* pStr);
|
int GetPascalString(const uint8_t* buf, long maxLen, CString* pStr);
|
||||||
void LogHexDump(const void* buf, long len);
|
void LogHexDump(const void* buf, long len);
|
||||||
int ComputePercent(LONGLONG part, LONGLONG full);
|
int ComputePercent(LONGLONG part, LONGLONG full);
|
||||||
void FormatDate(time_t when, CString* pStr);
|
void FormatDate(time_t when, CString* pStr);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user