mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 10:48:18 +08:00
Replace Real64 with double
This commit is contained in:
@@ -297,8 +297,6 @@ AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
|
||||
dnl These custom typedefs are unnecessary and should be deprecated.
|
||||
dnl Linux systems for ages now have had stdint.h to define uint8_t, etc.
|
||||
AH_BOTTOM([
|
||||
typedef double Real64;
|
||||
|
||||
#if SIZEOF_UNSIGNED_CHAR != 1
|
||||
# error "sizeof (unsigned char) != 1"
|
||||
#else
|
||||
|
@@ -95,7 +95,7 @@ static double FROUND(double in){
|
||||
#define BIAS80 16383
|
||||
#define BIAS64 1023
|
||||
|
||||
static Real64 FPU_FLD80(PhysPt addr,FPU_Reg_80 &raw) {
|
||||
static double FPU_FLD80(PhysPt addr,FPU_Reg_80 &raw) {
|
||||
struct {
|
||||
Bit16s begin;
|
||||
FPU_Reg eind;
|
||||
@@ -166,7 +166,7 @@ static void FPU_FLD_F32(PhysPt addr,Bitu store_to) {
|
||||
Bit32u l;
|
||||
} blah;
|
||||
blah.l = mem_readd(addr);
|
||||
fpu.regs[store_to].d = static_cast<Real64>(blah.f);
|
||||
fpu.regs[store_to].d = static_cast<double>(blah.f);
|
||||
fpu.use80[store_to] = false;
|
||||
}
|
||||
|
||||
@@ -183,13 +183,13 @@ static void FPU_FLD_F80(PhysPt addr) {
|
||||
|
||||
static void FPU_FLD_I16(PhysPt addr,Bitu store_to) {
|
||||
Bit16s blah = (Bit16s)mem_readw(addr);
|
||||
fpu.regs[store_to].d = static_cast<Real64>(blah);
|
||||
fpu.regs[store_to].d = static_cast<double>(blah);
|
||||
fpu.use80[store_to] = false;
|
||||
}
|
||||
|
||||
static void FPU_FLD_I32(PhysPt addr,Bitu store_to) {
|
||||
Bit32s blah = (Bit32s)mem_readd(addr);
|
||||
fpu.regs[store_to].d = static_cast<Real64>(blah);
|
||||
fpu.regs[store_to].d = static_cast<double>(blah);
|
||||
fpu.use80[store_to] = false;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ static void FPU_FLD_I64(PhysPt addr,Bitu store_to) {
|
||||
FPU_Reg blah;
|
||||
blah.l.lower = mem_readd(addr);
|
||||
blah.l.upper = (Bit32s)mem_readd(addr+4);
|
||||
fpu.regs[store_to].d = static_cast<Real64>(blah.ll);
|
||||
fpu.regs[store_to].d = static_cast<double>(blah.ll);
|
||||
// store the signed 64-bit integer in the 80-bit format mantissa with faked exponent.
|
||||
// this is needed for DOS and Windows games that use the Pentium fast memcpy trick, using FLD/FST to copy 64 bits at a time.
|
||||
// I wonder if that trick is what helped spur Intel to make the MMX extensions :)
|
||||
@@ -220,7 +220,7 @@ static void FPU_FBLD(PhysPt addr,Bitu store_to) {
|
||||
|
||||
//last number, only now convert to float in order to get
|
||||
//the best signification
|
||||
Real64 temp = static_cast<Real64>(val);
|
||||
double temp = static_cast<double>(val);
|
||||
in = mem_readb(addr + 9);
|
||||
temp += ( (in&0xf) * base );
|
||||
if(in&0x80) temp *= -1.0;
|
||||
@@ -294,20 +294,20 @@ static void FPU_FBST(PhysPt addr) {
|
||||
val.d=-val.d;
|
||||
}
|
||||
//numbers from back to front
|
||||
Real64 temp=val.d;
|
||||
double temp=val.d;
|
||||
Bitu p;
|
||||
for(Bit8u i=0;i<9;i++){
|
||||
val.d=temp;
|
||||
temp = static_cast<Real64>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
temp = static_cast<double>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
p = static_cast<Bitu>(val.d - 10.0*temp);
|
||||
val.d=temp;
|
||||
temp = static_cast<Real64>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
temp = static_cast<double>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
p |= (static_cast<Bitu>(val.d - 10.0*temp)<<4);
|
||||
|
||||
mem_writeb(addr+i,(Bit8u)p);
|
||||
}
|
||||
val.d=temp;
|
||||
temp = static_cast<Real64>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
temp = static_cast<double>(static_cast<Bit64s>(floor(val.d/10.0)));
|
||||
p = static_cast<Bitu>(val.d - 10.0*temp);
|
||||
if(sign)
|
||||
p|=0x80;
|
||||
@@ -346,7 +346,7 @@ static void FPU_FSIN(void){
|
||||
}
|
||||
|
||||
static void FPU_FSINCOS(void){
|
||||
Real64 temp = fpu.regs[TOP].d;
|
||||
double temp = fpu.regs[TOP].d;
|
||||
fpu.use80[TOP] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[TOP].d = sin(temp);
|
||||
FPU_PUSH(cos(temp));
|
||||
@@ -515,11 +515,11 @@ static void FPU_FRNDINT(void){
|
||||
}
|
||||
|
||||
static void FPU_FPREM(void){
|
||||
Real64 valtop = fpu.regs[TOP].d;
|
||||
Real64 valdiv = fpu.regs[STV(1)].d;
|
||||
double valtop = fpu.regs[TOP].d;
|
||||
double valdiv = fpu.regs[STV(1)].d;
|
||||
Bit64s ressaved = static_cast<Bit64s>( (valtop/valdiv) );
|
||||
// Some backups
|
||||
// Real64 res=valtop - ressaved*valdiv;
|
||||
// double res=valtop - ressaved*valdiv;
|
||||
// res= fmod(valtop,valdiv);
|
||||
fpu.use80[TOP] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[TOP].d = valtop - ressaved*valdiv;
|
||||
@@ -530,8 +530,8 @@ static void FPU_FPREM(void){
|
||||
}
|
||||
|
||||
static void FPU_FPREM1(void){
|
||||
Real64 valtop = fpu.regs[TOP].d;
|
||||
Real64 valdiv = fpu.regs[STV(1)].d;
|
||||
double valtop = fpu.regs[TOP].d;
|
||||
double valdiv = fpu.regs[STV(1)].d;
|
||||
double quot = valtop/valdiv;
|
||||
double quotf = floor(quot);
|
||||
Bit64s ressaved;
|
||||
@@ -579,21 +579,21 @@ static void FPU_F2XM1(void){
|
||||
|
||||
static void FPU_FYL2X(void){
|
||||
fpu.use80[STV(1)] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[STV(1)].d*=log(fpu.regs[TOP].d)/log(static_cast<Real64>(2.0));
|
||||
fpu.regs[STV(1)].d*=log(fpu.regs[TOP].d)/log(static_cast<double>(2.0));
|
||||
FPU_FPOP();
|
||||
return;
|
||||
}
|
||||
|
||||
static void FPU_FYL2XP1(void){
|
||||
fpu.use80[STV(1)] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[STV(1)].d*=log(fpu.regs[TOP].d+1.0)/log(static_cast<Real64>(2.0));
|
||||
fpu.regs[STV(1)].d*=log(fpu.regs[TOP].d+1.0)/log(static_cast<double>(2.0));
|
||||
FPU_FPOP();
|
||||
return;
|
||||
}
|
||||
|
||||
static void FPU_FSCALE(void){
|
||||
fpu.use80[TOP] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[TOP].d *= pow(2.0,static_cast<Real64>(static_cast<Bit64s>(fpu.regs[STV(1)].d)));
|
||||
fpu.regs[TOP].d *= pow(2.0,static_cast<double>(static_cast<Bit64s>(fpu.regs[STV(1)].d)));
|
||||
return; //2^x where x is chopped.
|
||||
}
|
||||
|
||||
@@ -657,9 +657,9 @@ static void FPU_FXTRACT(void) {
|
||||
FPU_Reg test = fpu.regs[TOP];
|
||||
Bit64s exp80 = test.ll&LONGTYPE(0x7ff0000000000000);
|
||||
Bit64s exp80final = (exp80>>52) - BIAS64;
|
||||
Real64 mant = test.d / (pow(2.0,static_cast<Real64>(exp80final)));
|
||||
double mant = test.d / (pow(2.0,static_cast<double>(exp80final)));
|
||||
fpu.use80[TOP] = false; // we used the less precise version, drop the 80-bit precision
|
||||
fpu.regs[TOP].d = static_cast<Real64>(exp80final);
|
||||
fpu.regs[TOP].d = static_cast<double>(exp80final);
|
||||
FPU_PUSH(mant);
|
||||
}
|
||||
|
||||
|
@@ -76,8 +76,8 @@ CPrinter::CPrinter(Bit16u dpi, Bit16u width, Bit16u height, char* output, bool m
|
||||
this->output = output;
|
||||
this->multipageOutput = multipageOutput;
|
||||
|
||||
defaultPageWidth = (Real64)width / (Real64)10;
|
||||
defaultPageHeight = (Real64)height / (Real64)10;
|
||||
defaultPageWidth = (double)width / (double)10;
|
||||
defaultPageHeight = (double)height / (double)10;
|
||||
|
||||
// Create page
|
||||
page = SDL_CreateRGBSurface(SDL_SWSURFACE, (int)(defaultPageWidth*dpi), (int)(defaultPageHeight*dpi), 8, 0, 0, 0, 0);
|
||||
@@ -173,7 +173,7 @@ void CPrinter::resetPrinter()
|
||||
topMargin = leftMargin = 0.0;
|
||||
rightMargin = pageWidth = defaultPageWidth;
|
||||
bottomMargin = pageHeight = defaultPageHeight;
|
||||
lineSpacing = (Real64)1 / 6;
|
||||
lineSpacing = (double)1 / 6;
|
||||
cpi = 10.0;
|
||||
curCharTable = 1;
|
||||
style = 0;
|
||||
@@ -203,7 +203,7 @@ void CPrinter::resetPrinter()
|
||||
|
||||
// Default tabs => Each eight characters
|
||||
for (Bitu i = 0; i < 32; i++)
|
||||
horiztabs[i] = i * 8 * (1 / (Real64)cpi);
|
||||
horiztabs[i] = i * 8 * (1 / (double)cpi);
|
||||
numHorizTabs = 32;
|
||||
numVertTabs = 255;
|
||||
}
|
||||
@@ -351,8 +351,8 @@ void CPrinter::updateFont()
|
||||
}
|
||||
}
|
||||
|
||||
Real64 horizPoints = 10.5;
|
||||
Real64 vertPoints = 10.5;
|
||||
double horizPoints = 10.5;
|
||||
double vertPoints = 10.5;
|
||||
|
||||
if (!multipoint)
|
||||
{
|
||||
@@ -622,21 +622,21 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
// Collect vertical tabs
|
||||
if (ESCCmd == 0x42)
|
||||
{
|
||||
if (ch == 0 || (numVertTabs > 0 && verttabs[numVertTabs-1] > (Real64)ch * lineSpacing)) // Done
|
||||
if (ch == 0 || (numVertTabs > 0 && verttabs[numVertTabs-1] > (double)ch * lineSpacing)) // Done
|
||||
ESCCmd = 0;
|
||||
else
|
||||
if (numVertTabs < 16)
|
||||
verttabs[numVertTabs++] = (Real64)ch * lineSpacing;
|
||||
verttabs[numVertTabs++] = (double)ch * lineSpacing;
|
||||
}
|
||||
|
||||
// Collect horizontal tabs
|
||||
if (ESCCmd == 0x44)
|
||||
{
|
||||
if (ch == 0 || (numHorizTabs > 0 && horiztabs[numHorizTabs-1] > (Real64)ch * (1 / (Real64)cpi))) // Done
|
||||
if (ch == 0 || (numHorizTabs > 0 && horiztabs[numHorizTabs-1] > (double)ch * (1 / (double)cpi))) // Done
|
||||
ESCCmd = 0;
|
||||
else
|
||||
if (numHorizTabs < 32)
|
||||
horiztabs[numHorizTabs++] = (Real64)ch*(1 / (Real64)cpi);
|
||||
horiztabs[numHorizTabs++] = (double)ch*(1 / (double)cpi);
|
||||
}
|
||||
|
||||
if (numParam < neededParam)
|
||||
@@ -678,7 +678,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
case 0x20: // Set intercharacter space (ESC SP)
|
||||
if (!multipoint)
|
||||
{
|
||||
extraIntraSpace = (Real64)params[0] / (printQuality == QUALITY_DRAFT ? 120 : 180);
|
||||
extraIntraSpace = (double)params[0] / (printQuality == QUALITY_DRAFT ? 120 : 180);
|
||||
hmi = -1;
|
||||
updateFont();
|
||||
}
|
||||
@@ -715,11 +715,11 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x24: // Set absolute horizontal print position (ESC $)
|
||||
{
|
||||
Real64 unitSize = definedUnit;
|
||||
double unitSize = definedUnit;
|
||||
if (unitSize < 0)
|
||||
unitSize = (Real64)60.0;
|
||||
unitSize = (double)60.0;
|
||||
|
||||
Real64 newX = leftMargin + ((Real64)PARAM16(0) / unitSize);
|
||||
double newX = leftMargin + ((double)PARAM16(0) / unitSize);
|
||||
if (newX <= rightMargin)
|
||||
curX = newX;
|
||||
}
|
||||
@@ -732,7 +732,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x2b: // Set n/360-inch line spacing (ESC +)
|
||||
case 0x833: // Set n/360-inch line spacing (FS 3)
|
||||
lineSpacing = (Real64)params[0] / 360;
|
||||
lineSpacing = (double)params[0] / 360;
|
||||
break;
|
||||
case 0x2d: // Turn underline on/off (ESC -)
|
||||
if (params[0] == 0 || params[0] == 48)
|
||||
@@ -748,13 +748,13 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
// Ignore
|
||||
break;
|
||||
case 0x30: // Select 1/8-inch line spacing (ESC 0)
|
||||
lineSpacing = (Real64)1 / 8;
|
||||
lineSpacing = (double)1 / 8;
|
||||
break;
|
||||
case 0x32: // Select 1/6-inch line spacing (ESC 2)
|
||||
lineSpacing = (Real64)1 / 6;
|
||||
lineSpacing = (double)1 / 6;
|
||||
break;
|
||||
case 0x33: // Set n/180-inch line spacing (ESC 3)
|
||||
lineSpacing = (Real64)params[0] / 180;
|
||||
lineSpacing = (double)params[0] / 180;
|
||||
break;
|
||||
case 0x34: // Select italic font (ESC 4)
|
||||
style |= STYLE_ITALICS;
|
||||
@@ -794,11 +794,11 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x41: // Set n/60-inch line spacing
|
||||
case 0x841:
|
||||
lineSpacing = (Real64)params[0] / 60;
|
||||
lineSpacing = (double)params[0] / 60;
|
||||
break;
|
||||
case 0x43: // Set page length in lines (ESC C)
|
||||
if (params[0] != 0)
|
||||
pageHeight = bottomMargin = (Real64)params[0] * lineSpacing;
|
||||
pageHeight = bottomMargin = (double)params[0] * lineSpacing;
|
||||
else // == 0 => Set page length in inches
|
||||
{
|
||||
neededParam = 1;
|
||||
@@ -822,7 +822,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
style &= ~STYLE_DOUBLESTRIKE;
|
||||
break;
|
||||
case 0x4a: // Advance print position vertically (ESC J n)
|
||||
curY += (Real64)((Real64)params[0] / 180);
|
||||
curY += (double)((double)params[0] / 180);
|
||||
if (curY > bottomMargin)
|
||||
newPage(true, false);
|
||||
break;
|
||||
@@ -840,7 +840,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x4e: // Set bottom margin (ESC N)
|
||||
topMargin = 0.0;
|
||||
bottomMargin = (Real64)params[0] * lineSpacing;
|
||||
bottomMargin = (double)params[0] * lineSpacing;
|
||||
break;
|
||||
case 0x4f: // Cancel bottom (and top) margin
|
||||
topMargin = 0.0;
|
||||
@@ -853,7 +853,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
updateFont();
|
||||
break;
|
||||
case 0x51: // Set right margin
|
||||
rightMargin = (Real64)(params[0] - 1.0) / (Real64)cpi;
|
||||
rightMargin = (double)(params[0] - 1.0) / (double)cpi;
|
||||
break;
|
||||
case 0x52: // Select an international character set (ESC R)
|
||||
if (params[0] <= 13 || params[0] == 64)
|
||||
@@ -910,12 +910,12 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
if (params[0] == 1) // Proportional spacing
|
||||
style |= STYLE_PROP;
|
||||
else if (params[0] >= 5)
|
||||
multicpi = (Real64)360 / (Real64)params[0];
|
||||
multicpi = (double)360 / (double)params[0];
|
||||
}
|
||||
if (multiPointSize == 0)
|
||||
multiPointSize = (Real64)10.5;
|
||||
multiPointSize = (double)10.5;
|
||||
if (PARAM16(1) > 0) // Set points
|
||||
multiPointSize = ((Real64)PARAM16(1)) / 2;
|
||||
multiPointSize = ((double)PARAM16(1)) / 2;
|
||||
updateFont();
|
||||
break;
|
||||
case 0x59: // Select 120-dpi, double-speed graphics (ESC Y)
|
||||
@@ -927,17 +927,17 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
case 0x5c: // Set relative horizontal print position (ESC \)
|
||||
{
|
||||
Bit16s toMove = PARAM16(0);
|
||||
Real64 unitSize = definedUnit;
|
||||
double unitSize = definedUnit;
|
||||
if (unitSize < 0)
|
||||
unitSize = (Real64)(printQuality == QUALITY_DRAFT ? 120.0 : 180.0);
|
||||
curX += (Real64)((Real64)toMove / unitSize);
|
||||
unitSize = (double)(printQuality == QUALITY_DRAFT ? 120.0 : 180.0);
|
||||
curX += (double)((double)toMove / unitSize);
|
||||
}
|
||||
break;
|
||||
case 0x61: // Select justification (ESC a)
|
||||
// Ignore
|
||||
break;
|
||||
case 0x63: // Set horizontal motion index (HMI) (ESC c)
|
||||
hmi = (Real64)PARAM16(0) / (Real64)360.0;
|
||||
hmi = (double)PARAM16(0) / (double)360.0;
|
||||
extraIntraSpace = 0.0;
|
||||
break;
|
||||
case 0x67: // Select 10.5-point, 15-cpi (ESC g)
|
||||
@@ -951,7 +951,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x6a: // Reverse paper feed (ESC j)
|
||||
{
|
||||
Real64 reverse = (Real64)PARAM16(0) / (Real64)216.0;
|
||||
double reverse = (double)PARAM16(0) / (double)216.0;
|
||||
reverse = curY - reverse;
|
||||
if (reverse < leftMargin)
|
||||
curY = leftMargin;
|
||||
@@ -965,7 +965,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
updateFont();
|
||||
break;
|
||||
case 0x6c: // Set left margin (ESC l)
|
||||
leftMargin = (Real64)(params[0] - 1.0) / (Real64)cpi;
|
||||
leftMargin = (double)(params[0] - 1.0) / (double)cpi;
|
||||
if (curX < leftMargin)
|
||||
curX = leftMargin;
|
||||
break;
|
||||
@@ -1022,7 +1022,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
updateFont();
|
||||
break;
|
||||
case 0x100: // Set page length in inches (ESC C NUL)
|
||||
pageHeight = (Real64)params[0];
|
||||
pageHeight = (double)params[0];
|
||||
bottomMargin = pageHeight;
|
||||
topMargin = 0.0;
|
||||
break;
|
||||
@@ -1062,19 +1062,19 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
case 0x243: // Set page length in defined unit (ESC (C)
|
||||
if (params[0] != 0 && definedUnit > 0)
|
||||
{
|
||||
pageHeight = bottomMargin = ((Real64)PARAM16(2)) * definedUnit;
|
||||
pageHeight = bottomMargin = ((double)PARAM16(2)) * definedUnit;
|
||||
topMargin = 0.0;
|
||||
}
|
||||
break;
|
||||
case 0x255: // Set unit (ESC (U)
|
||||
definedUnit = (Real64)params[2] / (Real64)3600;
|
||||
definedUnit = (double)params[2] / (double)3600;
|
||||
break;
|
||||
case 0x256: // Set absolute vertical print position (ESC (V)
|
||||
{
|
||||
Real64 unitSize = definedUnit;
|
||||
double unitSize = definedUnit;
|
||||
if (unitSize < 0)
|
||||
unitSize = (Real64)360.0;
|
||||
Real64 newPos = topMargin + (((Real64)PARAM16(2)) * unitSize);
|
||||
unitSize = (double)360.0;
|
||||
double newPos = topMargin + (((double)PARAM16(2)) * unitSize);
|
||||
if (newPos > bottomMargin)
|
||||
newPage(true, false);
|
||||
else
|
||||
@@ -1087,9 +1087,9 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
case 0x263: // Set page format (ESC (c)
|
||||
if (definedUnit > 0)
|
||||
{
|
||||
Real64 newTop, newBottom;
|
||||
newTop = ((Real64)PARAM16(2)) * definedUnit;
|
||||
newBottom = ((Real64)PARAM16(4)) * definedUnit;
|
||||
double newTop, newBottom;
|
||||
newTop = ((double)PARAM16(2)) * definedUnit;
|
||||
newBottom = ((double)PARAM16(4)) * definedUnit;
|
||||
if(newTop >= newBottom) break;
|
||||
if(newTop < pageHeight) topMargin = newTop;
|
||||
if(newBottom < pageHeight) bottomMargin = newBottom;
|
||||
@@ -1101,10 +1101,10 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
case 0x276: // Set relative vertical print position (ESC (v)
|
||||
{
|
||||
Real64 unitSize = definedUnit;
|
||||
double unitSize = definedUnit;
|
||||
if (unitSize < 0)
|
||||
unitSize = (Real64)360.0;
|
||||
Real64 newPos = curY + ((Real64)((Bit16s)PARAM16(2)) * unitSize);
|
||||
unitSize = (double)360.0;
|
||||
double newPos = curY + ((double)((Bit16s)PARAM16(2)) * unitSize);
|
||||
if (newPos > topMargin)
|
||||
{
|
||||
if (newPos > bottomMargin)
|
||||
@@ -1136,7 +1136,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
return true;
|
||||
case 0x08: // Backspace (BS)
|
||||
{
|
||||
Real64 newX = curX - (1/(Real64)actcpi);
|
||||
double newX = curX - (1/(double)actcpi);
|
||||
if (hmi > 0)
|
||||
newX = curX - hmi;
|
||||
if (newX >= leftMargin)
|
||||
@@ -1146,7 +1146,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
case 0x09: // Tab horizontally (HT)
|
||||
{
|
||||
// Find tab right to current pos
|
||||
Real64 moveTo = -1;
|
||||
double moveTo = -1;
|
||||
for (Bit8u i = 0; i < numHorizTabs; i++)
|
||||
if (horiztabs[i] > curX)
|
||||
moveTo = horiztabs[i];
|
||||
@@ -1168,7 +1168,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
else
|
||||
{
|
||||
// Find tab below current pos
|
||||
Real64 moveTo = -1;
|
||||
double moveTo = -1;
|
||||
for (Bit8u i = 0; i < numVertTabs; i++)
|
||||
if (verttabs[i] > curY)
|
||||
moveTo = verttabs[i];
|
||||
@@ -1208,7 +1208,7 @@ bool CPrinter::processCommandChar(Bit8u ch)
|
||||
if (curY > bottomMargin)
|
||||
newPage(true, false);
|
||||
return true;
|
||||
case 0x0e: //Select Real64-width printing (one line) (SO)
|
||||
case 0x0e: //Select double-width printing (one line) (SO)
|
||||
if (!multipoint)
|
||||
{
|
||||
hmi = -1;
|
||||
@@ -1348,13 +1348,13 @@ void CPrinter::printChar(Bit8u ch)
|
||||
Bit16u lineStart = (Bit16u)PIXX;
|
||||
|
||||
// advance the cursor to the right
|
||||
Real64 x_advance;
|
||||
double x_advance;
|
||||
if (style & STYLE_PROP)
|
||||
x_advance = (Real64)((Real64)(curFont->glyph->advance.x) / (Real64)(dpi * 64));
|
||||
x_advance = (double)((double)(curFont->glyph->advance.x) / (double)(dpi * 64));
|
||||
else
|
||||
{
|
||||
if (hmi < 0)
|
||||
x_advance = 1 / (Real64)actcpi;
|
||||
x_advance = 1 / (double)actcpi;
|
||||
else
|
||||
x_advance = hmi;
|
||||
}
|
||||
@@ -1577,7 +1577,7 @@ void CPrinter::printBitGraph(Bit8u ch)
|
||||
if (bitGraph.readBytesColumn < bitGraph.bytesColumn)
|
||||
return;
|
||||
|
||||
Real64 oldY = curY;
|
||||
double oldY = curY;
|
||||
|
||||
SDL_LockSurface(page);
|
||||
|
||||
@@ -1609,7 +1609,7 @@ void CPrinter::printBitGraph(Bit8u ch)
|
||||
*((Bit8u*)page->pixels + (PIXX + xx) + (PIXY + yy)*page->pitch) |= (color | 0x1F);
|
||||
}
|
||||
} // else white pixel
|
||||
curY += (Real64)1 / (Real64)bitGraph.vertDens; // TODO line wrap?
|
||||
curY += (double)1 / (double)bitGraph.vertDens; // TODO line wrap?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1620,7 +1620,7 @@ void CPrinter::printBitGraph(Bit8u ch)
|
||||
bitGraph.readBytesColumn = 0;
|
||||
|
||||
// Advance to the left
|
||||
curX += (Real64)1 / (Real64)bitGraph.horizDens;
|
||||
curX += (double)1 / (double)bitGraph.horizDens;
|
||||
}
|
||||
|
||||
void CPrinter::formFeed()
|
||||
@@ -1670,17 +1670,17 @@ void CPrinter::outputPage()
|
||||
Bit16u physW = GetDeviceCaps(printerDC, PHYSICALWIDTH);
|
||||
Bit16u physH = GetDeviceCaps(printerDC, PHYSICALHEIGHT);
|
||||
|
||||
Real64 scaleW, scaleH;
|
||||
double scaleW, scaleH;
|
||||
|
||||
if (page->w > physW)
|
||||
scaleW = (Real64)page->w / (Real64)physW;
|
||||
scaleW = (double)page->w / (double)physW;
|
||||
else
|
||||
scaleW = (Real64)physW / (Real64)page->w;
|
||||
scaleW = (double)physW / (double)page->w;
|
||||
|
||||
if (page->h > physH)
|
||||
scaleH = (Real64)page->h / (Real64)physH;
|
||||
scaleH = (double)page->h / (double)physH;
|
||||
else
|
||||
scaleH = (Real64)physH / (Real64)page->h;
|
||||
scaleH = (double)physH / (double)page->h;
|
||||
|
||||
HDC memHDC = CreateCompatibleDC(printerDC);
|
||||
HBITMAP bitmap = CreateCompatibleBitmap(memHDC, page->w, page->h);
|
||||
|
@@ -167,7 +167,7 @@ private:
|
||||
FT_Face curFont = NULL; // The font currently used to render characters
|
||||
Bit8u color = 0;
|
||||
|
||||
Real64 curX = 0, curY = 0; // Position of the print head (in inch)
|
||||
double curX = 0, curY = 0; // Position of the print head (in inch)
|
||||
|
||||
Bit16u dpi = 0; // dpi of the page
|
||||
Bit16u ESCCmd = 0; // ESC-command that is currently processed
|
||||
@@ -178,18 +178,18 @@ private:
|
||||
|
||||
Bit8u params[20] = {}; // Buffer for the read params
|
||||
Bit16u style = 0; // Style of font (see STYLE_* constants)
|
||||
Real64 cpi = 0, actcpi = 0; // CPI value set by program and the actual one (taking in account font types)
|
||||
double cpi = 0, actcpi = 0; // CPI value set by program and the actual one (taking in account font types)
|
||||
Bit8u score = 0; // Score for lines (see SCORE_* constants)
|
||||
|
||||
Real64 topMargin = 0, bottomMargin = 0, rightMargin = 0, leftMargin = 0; // Margins of the page (in inch)
|
||||
Real64 pageWidth = 0, pageHeight = 0; // Size of page (in inch)
|
||||
Real64 defaultPageWidth = 0, defaultPageHeight = 0; // Default size of page (in inch)
|
||||
Real64 lineSpacing = 0; // Size of one line (in inch)
|
||||
double topMargin = 0, bottomMargin = 0, rightMargin = 0, leftMargin = 0; // Margins of the page (in inch)
|
||||
double pageWidth = 0, pageHeight = 0; // Size of page (in inch)
|
||||
double defaultPageWidth = 0, defaultPageHeight = 0; // Default size of page (in inch)
|
||||
double lineSpacing = 0; // Size of one line (in inch)
|
||||
|
||||
Real64 horiztabs[32] = {}; // Stores the set horizontal tabs (in inch)
|
||||
double horiztabs[32] = {}; // Stores the set horizontal tabs (in inch)
|
||||
Bit8u numHorizTabs = 0; // Number of configured tabs
|
||||
|
||||
Real64 verttabs[16] = {}; // Stores the set vertical tabs (in inch)
|
||||
double verttabs[16] = {}; // Stores the set vertical tabs (in inch)
|
||||
Bit8u numVertTabs = 0; // Number of configured tabs
|
||||
|
||||
Bit8u curCharTable = 0; // Currently used char table und charset
|
||||
@@ -197,7 +197,7 @@ private:
|
||||
|
||||
Typeface LQtypeFace = (Typeface)0; // Typeface used in LQ printing mode
|
||||
|
||||
Real64 extraIntraSpace = 0; // Extra space between two characters (set by program, in inch)
|
||||
double extraIntraSpace = 0; // Extra space between two characters (set by program, in inch)
|
||||
|
||||
bool charRead = false; // True if a character was read since the printer was last initialized
|
||||
bool autoFeed = false; // True if a LF should automatically added after a CR
|
||||
@@ -218,13 +218,13 @@ private:
|
||||
Bit16u curMap[256] = {}; // Currently used ASCII => Unicode mapping
|
||||
Bit16u charTables[4] = {}; // Charactertables
|
||||
|
||||
Real64 definedUnit = 0; // Unit used by some ESC/P2 commands (negative => use default)
|
||||
double definedUnit = 0; // Unit used by some ESC/P2 commands (negative => use default)
|
||||
|
||||
bool multipoint = false; // If multipoint mode is enabled
|
||||
Real64 multiPointSize = 0; // Point size of font in multipoint mode
|
||||
Real64 multicpi = 0; // CPI used in multipoint mode
|
||||
double multiPointSize = 0; // Point size of font in multipoint mode
|
||||
double multicpi = 0; // CPI used in multipoint mode
|
||||
|
||||
Real64 hmi = 0; // Horizontal motion index (in inch; overrides CPI settings)
|
||||
double hmi = 0; // Horizontal motion index (in inch; overrides CPI settings)
|
||||
|
||||
Bit8u msb = 0; // MSB mode
|
||||
Bit16u numPrintAsChar = 0; // Number of bytes to print as characters (even when normally control codes)
|
||||
|
Reference in New Issue
Block a user