Fix linux build
This commit is contained in:
parent
ec15336174
commit
f3eb6e19cf
|
@ -7,20 +7,20 @@ bool mouse_lb, mouse_rb;
|
||||||
static char mouse_px, mouse_py;
|
static char mouse_px, mouse_py;
|
||||||
static char mouse_port;
|
static char mouse_port;
|
||||||
|
|
||||||
inline signed char dpos(char * old, char new)
|
inline signed char dpos(char * old, char mnew)
|
||||||
{
|
{
|
||||||
new = (new & 0x7f) >> 1;
|
mnew = (mnew & 0x7f) >> 1;
|
||||||
|
|
||||||
char diff = (new - *old) & 0x3f;
|
char diff = (mnew - *old) & 0x3f;
|
||||||
|
|
||||||
if (diff >= 0x20)
|
if (diff >= 0x20)
|
||||||
{
|
{
|
||||||
*old = new;
|
*old = mnew;
|
||||||
return diff | 0xe0;
|
return diff | 0xe0;
|
||||||
}
|
}
|
||||||
else if (diff)
|
else if (diff)
|
||||||
{
|
{
|
||||||
*old = new;
|
*old = mnew;
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4523,6 +4523,11 @@ void InterCodeBasicBlock::Append(InterInstruction * code)
|
||||||
{
|
{
|
||||||
assert(code->mDst.mType == code->mConst.mType);
|
assert(code->mDst.mType == code->mConst.mType);
|
||||||
}
|
}
|
||||||
|
if (code->mCode == IC_CONSTANT && code->mConst.mType == IT_POINTER && code->mConst.mMemory == IM_GLOBAL && code->mConst.mVarIndex >= 0)
|
||||||
|
{
|
||||||
|
assert(code->mConst.mVarIndex < mProc->mModule->mGlobalVars.Size());
|
||||||
|
assert(mProc->mModule->mGlobalVars[code->mConst.mVarIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < code->mNumOperands; i++)
|
for (int i = 0; i < code->mNumOperands; i++)
|
||||||
assert(code->mSrc[i].mType != IT_NONE);
|
assert(code->mSrc[i].mType != IT_NONE);
|
||||||
|
@ -11370,10 +11375,12 @@ bool InterCodeBasicBlock::CheckStaticStack(void)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyStaticStack(InterOperand & iop, const GrowingVariableArray& localVars)
|
void InterCodeBasicBlock::ApplyStaticStack(InterOperand & iop, const GrowingVariableArray& localVars)
|
||||||
{
|
{
|
||||||
if (iop.mMemory == IM_LOCAL)
|
if (iop.mMemory == IM_LOCAL)
|
||||||
{
|
{
|
||||||
|
assert(localVars[iop.mVarIndex]->mIndex < mProc->mModule->mGlobalVars.Size());
|
||||||
|
|
||||||
iop.mMemory = IM_GLOBAL;
|
iop.mMemory = IM_GLOBAL;
|
||||||
iop.mLinkerObject = localVars[iop.mVarIndex]->mLinkerObject;
|
iop.mLinkerObject = localVars[iop.mVarIndex]->mLinkerObject;
|
||||||
iop.mVarIndex = localVars[iop.mVarIndex]->mIndex;
|
iop.mVarIndex = localVars[iop.mVarIndex]->mIndex;
|
||||||
|
@ -11419,6 +11426,7 @@ void PromoteStaticStackParam(InterOperand& iop, LinkerObject* paramlobj)
|
||||||
iop.mMemory = IM_GLOBAL;
|
iop.mMemory = IM_GLOBAL;
|
||||||
iop.mIntConst += offset;
|
iop.mIntConst += offset;
|
||||||
iop.mLinkerObject = paramlobj;
|
iop.mLinkerObject = paramlobj;
|
||||||
|
iop.mVarIndex = -1;
|
||||||
paramlobj->EnsureSpace(int(iop.mIntConst), iop.mOperandSize);
|
paramlobj->EnsureSpace(int(iop.mIntConst), iop.mOperandSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,6 +569,7 @@ public:
|
||||||
bool DropUnreachable(void);
|
bool DropUnreachable(void);
|
||||||
|
|
||||||
bool CheckStaticStack(void);
|
bool CheckStaticStack(void);
|
||||||
|
void ApplyStaticStack(InterOperand& iop, const GrowingVariableArray& localVars);
|
||||||
void CollectStaticStack(LinkerObject * lobj, const GrowingVariableArray& localVars);
|
void CollectStaticStack(LinkerObject * lobj, const GrowingVariableArray& localVars);
|
||||||
void PromoteStaticStackParams(LinkerObject* paramlobj);
|
void PromoteStaticStackParams(LinkerObject* paramlobj);
|
||||||
|
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ void InterCodeGenerator::CopyStruct(InterCodeProcedure* proc, Expression* exp, I
|
||||||
pcins->mConst.mVarIndex = ccdec->mVarIndex;
|
pcins->mConst.mVarIndex = ccdec->mVarIndex;
|
||||||
pcins->mConst.mIntConst = 0;
|
pcins->mConst.mIntConst = 0;
|
||||||
pcins->mConst.mOperandSize = 2;
|
pcins->mConst.mOperandSize = 2;
|
||||||
pcins->mConst.mMemory = IM_GLOBAL;
|
pcins->mConst.mMemory = IM_PROCEDURE;
|
||||||
pcins->mConst.mLinkerObject = ccdec->mLinkerObject;
|
pcins->mConst.mLinkerObject = ccdec->mLinkerObject;
|
||||||
block->Append(pcins);
|
block->Append(pcins);
|
||||||
|
|
||||||
|
|
|
@ -4717,6 +4717,8 @@ int Parser::OverloadDistance(Declaration* fdec, Expression* pexp)
|
||||||
dist += 1;
|
dist += 1;
|
||||||
else if (ptype->mType == DT_TYPE_POINTER && etype->mType == DT_TYPE_FUNCTION && ptype->mBase->IsSame(etype))
|
else if (ptype->mType == DT_TYPE_POINTER && etype->mType == DT_TYPE_FUNCTION && ptype->mBase->IsSame(etype))
|
||||||
dist += 0;
|
dist += 0;
|
||||||
|
else if (ptype->mType == DT_TYPE_POINTER && etype->mType == DT_TYPE_POINTER && etype->mBase->mType == DT_TYPE_VOID)
|
||||||
|
dist += 0;
|
||||||
else if (ptype->IsSubType(etype))
|
else if (ptype->IsSubType(etype))
|
||||||
dist += 256;
|
dist += 256;
|
||||||
else if (ptype->mType == DT_TYPE_REFERENCE && ptype->mBase->IsSame(etype))
|
else if (ptype->mType == DT_TYPE_REFERENCE && ptype->mBase->IsSame(etype))
|
||||||
|
@ -5232,6 +5234,20 @@ Expression* Parser::ParsePrefixExpression(bool lhs)
|
||||||
nexp->mDecType = dec->BuildPointer(mScanner->mLocation);
|
nexp->mDecType = dec->BuildPointer(mScanner->mLocation);
|
||||||
|
|
||||||
if (mScanner->mToken == TK_OPEN_PARENTHESIS || dec->mDefaultConstructor)
|
if (mScanner->mToken == TK_OPEN_PARENTHESIS || dec->mDefaultConstructor)
|
||||||
|
{
|
||||||
|
Declaration* mdec = dec->mDefaultConstructor;
|
||||||
|
|
||||||
|
bool plist = false;
|
||||||
|
if (ConsumeTokenIf(TK_OPEN_PARENTHESIS))
|
||||||
|
{
|
||||||
|
if (!ConsumeTokenIf(TK_CLOSE_PARENTHESIS))
|
||||||
|
{
|
||||||
|
plist = true;
|
||||||
|
mdec = dec->mScope->Lookup(dec->mIdent->PreMangle("+"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mdec)
|
||||||
{
|
{
|
||||||
Declaration* vdec = new Declaration(mScanner->mLocation, DT_VARIABLE);
|
Declaration* vdec = new Declaration(mScanner->mLocation, DT_VARIABLE);
|
||||||
vdec->mVarIndex = mLocalIndex++;
|
vdec->mVarIndex = mLocalIndex++;
|
||||||
|
@ -5248,17 +5264,12 @@ Expression* Parser::ParsePrefixExpression(bool lhs)
|
||||||
iexp->mRight = nexp;
|
iexp->mRight = nexp;
|
||||||
iexp->mDecType = nexp->mDecType;
|
iexp->mDecType = nexp->mDecType;
|
||||||
|
|
||||||
Declaration* mdec = dec->mDefaultConstructor;
|
|
||||||
Expression* pexp = vexp;
|
Expression* pexp = vexp;
|
||||||
|
|
||||||
if (ConsumeTokenIf(TK_OPEN_PARENTHESIS))
|
if (plist)
|
||||||
{
|
|
||||||
if (!ConsumeTokenIf(TK_CLOSE_PARENTHESIS))
|
|
||||||
{
|
{
|
||||||
pexp = ParseListExpression(false);
|
pexp = ParseListExpression(false);
|
||||||
|
|
||||||
mdec = dec->mScope->Lookup(dec->mIdent->PreMangle("+"));
|
|
||||||
|
|
||||||
ConsumeToken(TK_CLOSE_PARENTHESIS);
|
ConsumeToken(TK_CLOSE_PARENTHESIS);
|
||||||
|
|
||||||
Expression* lexp = new Expression(mScanner->mLocation, EX_LIST);
|
Expression* lexp = new Expression(mScanner->mLocation, EX_LIST);
|
||||||
|
@ -5266,7 +5277,6 @@ Expression* Parser::ParsePrefixExpression(bool lhs)
|
||||||
lexp->mRight = pexp;
|
lexp->mRight = pexp;
|
||||||
pexp = lexp;
|
pexp = lexp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Expression* cexp = new Expression(mScanner->mLocation, EX_CONSTANT);
|
Expression* cexp = new Expression(mScanner->mLocation, EX_CONSTANT);
|
||||||
cexp->mDecValue = mdec;
|
cexp->mDecValue = mdec;
|
||||||
|
@ -5302,6 +5312,11 @@ Expression* Parser::ParsePrefixExpression(bool lhs)
|
||||||
nexp->mRight = coexp;
|
nexp->mRight = coexp;
|
||||||
nexp->mDecType = coexp->mDecType;
|
nexp->mDecType = coexp->mDecType;
|
||||||
}
|
}
|
||||||
|
else if (plist)
|
||||||
|
{
|
||||||
|
mErrors->Error(mScanner->mLocation, ERRO_NO_MATCHING_FUNCTION_CALL, "No matching constructor", dec->mIdent);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mScanner->mToken == TK_DELETE)
|
else if (mScanner->mToken == TK_DELETE)
|
||||||
|
|
Loading…
Reference in New Issue