Skip to content

Commit d661e9d

Browse files
committed
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.
1 parent 26a3f96 commit d661e9d

19 files changed

+259
-612
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ all: $(LIBNAME) $(OBJ) Makefile
2626
%.o: %.cpp
2727
$(CXX) $(CXXFLAGS) -o $@ -c $<
2828

29-
%.o: %.c
30-
$(CXX) $(CXXFLAGS) -o $@ -c $<
31-
3229
$(LIBNAME):
3330
make -C $(LIBDIR) all
3431

PropellerCompiler.sln

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 10.00
3-
# Visual Studio 2008
4-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PropellerCompiler", "PropellerCompiler\PropellerCompiler.vcproj", "{DE0E4A74-1C7F-4479-918D-9040BB599F90}"
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PropellerCompiler", "PropellerCompiler\PropellerCompiler.vcxproj", "{DE0E4A74-1C7F-4479-918D-9040BB599F90}"
57
EndProject
68
Global
79
GlobalSection(SolutionConfigurationPlatforms) = preSolution

PropellerCompiler/CompileDatBlocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ bool CompileDatBlocks_Enter(int value, int count, int size)
9797
bool CompileDatBlocks_Advance(bool bSymbol, bool bResSymbol, int size)
9898
{
9999
int testVal = (1 << size) - 1;
100-
while (1)
100+
for (;;)
101101
{
102102
if ((g_pCompilerData->obj_ptr & testVal) == 0)
103103
{

PropellerCompiler/CompileExpression.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ bool CompileSubExpression(int precedence)
155155
}
156156
}
157157

158-
while (1)
158+
for (;;)
159159
{
160160
bool bEof = false;
161161
if (!g_pElementizer->GetNext(bEof))
@@ -230,7 +230,7 @@ bool CompileTerm_ConStr()
230230
}
231231

232232
// get the string into the string constant buffer
233-
while(1)
233+
for (;;)
234234
{
235235
if (!GetTryValue(true, false))
236236
{
@@ -334,7 +334,7 @@ bool CompileTerm_ObjPub(unsigned char anchor, int value)
334334

335335
int objPubValue = g_pElementizer->GetValue();
336336

337-
// compile any paramaters the pub has
337+
// compile any parameters the pub has
338338
if (!CompileParameters((objPubValue & 0x0000FF00) >> 8))
339339
{
340340
return false;
@@ -424,7 +424,7 @@ bool CompileLook(int column, int param)
424424
{
425425
return false;
426426
}
427-
if (!CompileExpression()) // compile primarey value
427+
if (!CompileExpression()) // compile primary value
428428
{
429429
return false;
430430
}
@@ -433,7 +433,7 @@ bool CompileLook(int column, int param)
433433
return false;
434434
}
435435

436-
while (1)
436+
for (;;)
437437
{
438438
bool bRange = false;
439439
if (!CompileRange(bRange)) // compile (next) value/range

PropellerCompiler/CompileInstruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool CompileInst_NextQuit(int value)
3636
int caseDepth = 0;
3737

3838
// find repeat block
39-
while(1)
39+
for (;;)
4040
{
4141
if (blockNestPtr == 0)
4242
{

PropellerCompiler/DistillObjects.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ bool DistillSetup_Enter(unsigned short value)
3434
return true;
3535
}
3636

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

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

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

268276
// find offset of sub-object
269277
int scanDisPtr = 0;
270-
while(1)
278+
for (;;)
271279
{
272280
if (g_pCompilerData->dis[scanDisPtr] == subObjectId)
273281
{

PropellerCompiler/Elementizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ bool Elementizer::GetNext(bool& bEof)
9696
m_currentSymbol[0] = 0;
9797
int symbolOffset = 0;
9898

99-
while(1)
99+
for (;;)
100100
{
101101
char currentChar = pSource[m_sourceOffset++];
102102

@@ -281,7 +281,7 @@ bool Elementizer::GetNext(bool& bEof)
281281
bDocComment = true;
282282
g_pCompilerData->doc_flag = true;
283283
}
284-
while(1)
284+
for (;;)
285285
{
286286
currentChar = pSource[m_sourceOffset++];
287287
if (currentChar == 0)
@@ -318,7 +318,7 @@ bool Elementizer::GetNext(bool& bEof)
318318
m_sourceOffset++; // skip over end if present
319319
}
320320
}
321-
while(1)
321+
for (;;)
322322
{
323323
currentChar = pSource[m_sourceOffset++];
324324
if (currentChar == 0)

PropellerCompiler/InstructionBlockCompiler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ bool CompileCase(int column, int param)
337337
g_pCompilerData->error_msg = g_pErrorStrings[error_loxce];
338338
return false;
339339
}
340-
while (1)
340+
for (;;)
341341
{
342342
bool bRange = false;
343343
if (!CompileRange(bRange))
@@ -442,8 +442,8 @@ bool CompileCase(int column, int param)
442442
}
443443
else
444444
{
445-
// skip over range/values(s), allready compiled
446-
while (1)
445+
// skip over range/values(s), already compiled
446+
for (;;)
447447
{
448448
if (!SkipRange())
449449
{
@@ -493,7 +493,7 @@ bool CompileRepeatPlain(int column, int param)
493493
{
494494
param = param; // stop warning
495495

496-
BlockStack_Write(2, g_pCompilerData->obj_ptr); // set revearse address
496+
BlockStack_Write(2, g_pCompilerData->obj_ptr); // set reverse address
497497
if (!s_bHasPost)
498498
{
499499
BlockStack_Write(0, g_pCompilerData->obj_ptr); // set plain 'next' address
@@ -830,7 +830,7 @@ bool OptimizeBlock(int column, int param, bool (*pCompileFunction)(int, int))
830830
int savedObjPtr = g_pCompilerData->obj_ptr;
831831
int size = 0;
832832

833-
while(1)
833+
for (;;)
834834
{
835835
g_pElementizer->SetSourcePtr(savedSourcePtr);
836836
g_pCompilerData->obj_ptr = savedObjPtr;

PropellerCompiler/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ OBJ=$(SRCDIR)/BlockNestStackRoutines.o \
2424
$(SRCDIR)/StringConstantRoutines.o \
2525
$(SRCDIR)/SymbolEngine.o \
2626
$(SRCDIR)/Utilities.o \
27+
$(SRCDIR)/UnusedMethodUtils.o \
2728
$(SRCDIR)/PropellerCompiler.o \
2829

2930

0 commit comments

Comments
 (0)