Skip to content

Commit

Permalink
Added Unused method Removal, Updated to VS2013
Browse files Browse the repository at this point in the history
Increased case_limit to 256. (issue #5)
Added a new Unused Method Removal option (-u). This option still needs
testing, use with caution. (Issue #9)
Increased the pubcon list buffer size to 32K. (issue #14)
Fixed a crash bug in the preprocessor. (issue #16)
Renamed a few .c files to .cpp.
The solution & project files are now VS2013 format. You can get VS2013
community edition free.
  • Loading branch information
reltham committed Mar 16, 2015
1 parent 0e70599 commit c3c0454
Show file tree
Hide file tree
Showing 23 changed files with 1,406 additions and 612 deletions.
3 changes: 0 additions & 3 deletions Makefile
Expand Up @@ -26,9 +26,6 @@ all: $(LIBNAME) $(OBJ) Makefile
%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<

%.o: %.c
$(CXX) $(CXXFLAGS) -o $@ -c $<

$(LIBNAME):
make -C $(LIBDIR) all

Expand Down
8 changes: 5 additions & 3 deletions PropellerCompiler.sln
@@ -1,7 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PropellerCompiler", "PropellerCompiler\PropellerCompiler.vcproj", "{DE0E4A74-1C7F-4479-918D-9040BB599F90}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PropellerCompiler", "PropellerCompiler\PropellerCompiler.vcxproj", "{DE0E4A74-1C7F-4479-918D-9040BB599F90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion PropellerCompiler/CompileDatBlocks.cpp
Expand Up @@ -97,7 +97,7 @@ bool CompileDatBlocks_Enter(int value, int count, int size)
bool CompileDatBlocks_Advance(bool bSymbol, bool bResSymbol, int size)
{
int testVal = (1 << size) - 1;
while (1)
for (;;)
{
if ((g_pCompilerData->obj_ptr & testVal) == 0)
{
Expand Down
10 changes: 5 additions & 5 deletions PropellerCompiler/CompileExpression.cpp
Expand Up @@ -155,7 +155,7 @@ bool CompileSubExpression(int precedence)
}
}

while (1)
for (;;)
{
bool bEof = false;
if (!g_pElementizer->GetNext(bEof))
Expand Down Expand Up @@ -230,7 +230,7 @@ bool CompileTerm_ConStr()
}

// get the string into the string constant buffer
while(1)
for (;;)
{
if (!GetTryValue(true, false))
{
Expand Down Expand Up @@ -334,7 +334,7 @@ bool CompileTerm_ObjPub(unsigned char anchor, int value)

int objPubValue = g_pElementizer->GetValue();

// compile any paramaters the pub has
// compile any parameters the pub has
if (!CompileParameters((objPubValue & 0x0000FF00) >> 8))
{
return false;
Expand Down Expand Up @@ -424,7 +424,7 @@ bool CompileLook(int column, int param)
{
return false;
}
if (!CompileExpression()) // compile primarey value
if (!CompileExpression()) // compile primary value
{
return false;
}
Expand All @@ -433,7 +433,7 @@ bool CompileLook(int column, int param)
return false;
}

while (1)
for (;;)
{
bool bRange = false;
if (!CompileRange(bRange)) // compile (next) value/range
Expand Down
2 changes: 1 addition & 1 deletion PropellerCompiler/CompileInstruction.cpp
Expand Up @@ -36,7 +36,7 @@ bool CompileInst_NextQuit(int value)
int caseDepth = 0;

// find repeat block
while(1)
for (;;)
{
if (blockNestPtr == 0)
{
Expand Down
10 changes: 9 additions & 1 deletion PropellerCompiler/DistillObjects.cpp
Expand Up @@ -34,6 +34,9 @@ bool DistillSetup_Enter(unsigned short value)
return true;
}

// create a table of all objects with their offsets and sub objects
// each entry contains:
// id, offset, number sub objects, [sub object ids]
bool DistillSetup_Record(short id, unsigned short offset, unsigned short& subObjectId)
{
if (!DistillSetup_Enter(id))
Expand Down Expand Up @@ -83,6 +86,9 @@ bool DistillSetup()
return false;
}

// Clear all the objects table of offsets to their sub objects
// this needs to be done so that objects will binary compare with each other properly
// these offsets get replaced in the reconnect step
int disPtr = 0;
while (disPtr < g_pCompilerData->dis_ptr)
{
Expand All @@ -109,6 +115,8 @@ bool DistillSetup()
return true;
}

// update all objects of the given id to the new id
// also flags them as "distilled" with the upper bit being on
void DistillEliminate_Update(unsigned short objectId, int newDisPtr)
{
int disPtr = 0;
Expand Down Expand Up @@ -267,7 +275,7 @@ void DistillReconnect(int disPtr = 0)

// find offset of sub-object
int scanDisPtr = 0;
while(1)
for (;;)
{
if (g_pCompilerData->dis[scanDisPtr] == subObjectId)
{
Expand Down
6 changes: 3 additions & 3 deletions PropellerCompiler/Elementizer.cpp
Expand Up @@ -96,7 +96,7 @@ bool Elementizer::GetNext(bool& bEof)
m_currentSymbol[0] = 0;
int symbolOffset = 0;

while(1)
for (;;)
{
char currentChar = pSource[m_sourceOffset++];

Expand Down Expand Up @@ -281,7 +281,7 @@ bool Elementizer::GetNext(bool& bEof)
bDocComment = true;
g_pCompilerData->doc_flag = true;
}
while(1)
for (;;)
{
currentChar = pSource[m_sourceOffset++];
if (currentChar == 0)
Expand Down Expand Up @@ -318,7 +318,7 @@ bool Elementizer::GetNext(bool& bEof)
m_sourceOffset++; // skip over end if present
}
}
while(1)
for (;;)
{
currentChar = pSource[m_sourceOffset++];
if (currentChar == 0)
Expand Down
10 changes: 5 additions & 5 deletions PropellerCompiler/InstructionBlockCompiler.cpp
Expand Up @@ -337,7 +337,7 @@ bool CompileCase(int column, int param)
g_pCompilerData->error_msg = g_pErrorStrings[error_loxce];
return false;
}
while (1)
for (;;)
{
bool bRange = false;
if (!CompileRange(bRange))
Expand Down Expand Up @@ -442,8 +442,8 @@ bool CompileCase(int column, int param)
}
else
{
// skip over range/values(s), allready compiled
while (1)
// skip over range/values(s), already compiled
for (;;)
{
if (!SkipRange())
{
Expand Down Expand Up @@ -493,7 +493,7 @@ bool CompileRepeatPlain(int column, int param)
{
param = param; // stop warning

BlockStack_Write(2, g_pCompilerData->obj_ptr); // set revearse address
BlockStack_Write(2, g_pCompilerData->obj_ptr); // set reverse address
if (!s_bHasPost)
{
BlockStack_Write(0, g_pCompilerData->obj_ptr); // set plain 'next' address
Expand Down Expand Up @@ -830,7 +830,7 @@ bool OptimizeBlock(int column, int param, bool (*pCompileFunction)(int, int))
int savedObjPtr = g_pCompilerData->obj_ptr;
int size = 0;

while(1)
for (;;)
{
g_pElementizer->SetSourcePtr(savedSourcePtr);
g_pCompilerData->obj_ptr = savedObjPtr;
Expand Down
1 change: 1 addition & 0 deletions PropellerCompiler/Makefile
Expand Up @@ -24,6 +24,7 @@ OBJ=$(SRCDIR)/BlockNestStackRoutines.o \
$(SRCDIR)/StringConstantRoutines.o \
$(SRCDIR)/SymbolEngine.o \
$(SRCDIR)/Utilities.o \
$(SRCDIR)/UnusedMethodUtils.o \
$(SRCDIR)/PropellerCompiler.o \


Expand Down

0 comments on commit c3c0454

Please sign in to comment.