Skip to content

Commit

Permalink
Strip whitespace from files in repo (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 authored and jacob1 committed Apr 4, 2018
1 parent 31fcb1b commit 27f6a6b
Show file tree
Hide file tree
Showing 142 changed files with 651 additions and 650 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
@@ -1,2 +1,2 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitignore export-ignore
4 changes: 2 additions & 2 deletions TODO
@@ -1,5 +1,5 @@
HTTP API:
Make it OO,
Make it OO,
Use STL (i.e std::string for url, etc)

RequestBroker:
Expand All @@ -16,4 +16,4 @@ Interface General:
Move interfaces into separate folder

Interface Elements:
Vertical Scrolling for Textbox,
Vertical Scrolling for Textbox,
1 change: 1 addition & 0 deletions data/font.h
Expand Up @@ -300,3 +300,4 @@ extern unsigned char font_data[];
extern short font_ptrs[];
#endif
#endif

10 changes: 5 additions & 5 deletions font/Makefile
@@ -1,21 +1,21 @@

editor: editor.c
gcc -oeditor -DSCALE=1 -DFONTEDITOR editor.c -lSDL -lm -O3 -ffast-math -march=k8 -Wno-unused-result

editor.exe: editor.c
i686-w64-mingw32-gcc -oeditor.exe -DSCALE=1 -DFONTEDITOR editor.c -lmingw32 -lm -lSDLmain -lSDL -O3 -ffast-math -march=k8 -mwindows -Wno-unused-result

packer: packer.c
gcc -opacker -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result

packer.exe: packer.c
i686-w64-mingw32-gcc -opacker.exe -DFONTEDITOR packer.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result

unpacker: unpacker.c
gcc -ounpacker -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result

unpacker.exe: unpacker.c
i686-w64-mingw32-gcc -ounpacker.exe -DFONTEDITOR unpacker.c -lm -O3 -ffast-math -march=k8 -Wno-unused-result

clean:
rm -f editor packer unpacker editor.exe packer.exe unpacker.exe
2 changes: 1 addition & 1 deletion font/editor.c
Expand Up @@ -374,7 +374,7 @@ int main(int argc, char *argv[])
#endif

drawchar(vid_buf, 32, 192+32*CELLH, c, 255, 255, 255);

sprintf(hex, "%02X", c);
drawtext(vid_buf, 32, 192+34*CELLH, hex, 255, 255, 255);
#ifdef EXTENDED_FONT
Expand Down
26 changes: 13 additions & 13 deletions generator.py
Expand Up @@ -24,7 +24,7 @@ def generateElements(elementFiles, outputCpp, outputH):
f = open(elementFile, "r")
except:
f = open("src/simulation/elements/"+elementFile, "r")

fileData = f.read()
f.close()

Expand Down Expand Up @@ -144,7 +144,7 @@ class {0}: public {1}

def generateTools(toolFiles, outputCpp, outputH):
toolClasses = {}

toolHeader = """#ifndef TOOLCLASSES_H
#define TOOLCLASSES_H
Expand All @@ -153,7 +153,7 @@ def generateTools(toolFiles, outputCpp, outputH):
#include "simulation/simtools/SimTool.h"
"""

directives = []

for toolFile in toolFiles:
Expand All @@ -163,14 +163,14 @@ def generateTools(toolFiles, outputCpp, outputH):
f = open("src/simulation/simtools/"+toolFile, "r")
fileData = f.read()
f.close()

directiveMatcher = '//#TPT-Directive\s+([^\r\n]+)'
matcher = re.compile(directiveMatcher)
directiveMatches = matcher.findall(fileData)

for match in directiveMatches:
directives.append(match.split(" "))

classDirectives = []
usedIDs = []
for d in directives:
Expand All @@ -182,11 +182,11 @@ def generateTools(toolFiles, outputCpp, outputH):
if d[3] in usedIDs:
print("WARNING: duplicate tool ID {} ({})".format(d[3],d[2]))
usedIDs.append(d[3])

for d in directives:
if d[0] == "ToolHeader":
toolClasses[d[1]].append(" ".join(d[2:])+";")

for className, classMembers in list(toolClasses.items()):
toolHeader += """
class {0}: public SimTool
Expand All @@ -197,24 +197,24 @@ class {0}: public SimTool
virtual int Perform(Simulation * sim, Particle * cpart, int x, int y, int brushX, int brushY, float strength);
}};
""".format(className, str.join("\n", classMembers))

toolHeader += """
std::vector<SimTool*> GetTools();
#endif
"""

toolContent = """#include "ToolClasses.h"
std::vector<SimTool*> GetTools()
{
std::vector<SimTool*> tools;
""";

toolIDs = sorted(classDirectives, key=lambda directive: directive[3])
for d in toolIDs:
toolContent += """ tools.push_back(new %s());
""" % (d[1])

toolContent += """ return tools;
}
""";
Expand All @@ -226,7 +226,7 @@ class {0}: public SimTool
f = open(outputH, "w")
f.write(toolHeader)
f.close()

f = open(outputCpp, "w")
f.write(toolContent)
f.close()
Expand Down
28 changes: 14 additions & 14 deletions site_scons/site_tools/mfprogram/__init__.py
Expand Up @@ -26,7 +26,7 @@
import os
import new
import sys
##
##
import SCons

if sys.version_info < (2,6,0):
Expand Down Expand Up @@ -98,16 +98,16 @@ def MFProgramEmitter(target, source, env):
"""Ensures that target list is complete, and does validity checking. Sets precious"""
if len(target) == 1 and len(source) > 1:
#Looks like the user specified many sources and SCons created 1 target
#targets are implicit, but the builder doesn't know how to handle
#targets are implicit, but the builder doesn't know how to handle
#suffixes for multiple target files, so we'll do it here
objdir = env.get('OBJDIR', '')
#target = [os.path.join(
# objdir,
# objdir,
# os.path.splitext(
# os.path.basename(str(i)))[0] + '.o' ) for i in source]
elif len(source) == 1 and 'OBJDIR' in env:
target = os.path.join(
env['OBJDIR'],
env['OBJDIR'],
os.path.splitext(
os.path.basename(str(source[0])))[0] + '.o' )
else:
Expand All @@ -129,25 +129,25 @@ def MFProgramEmitter(target, source, env):
return target, source

def MFProgramGenerator(source, target, env, for_signature):
#Rebuild everything if
#Rebuild everything if
# a) the number of dependencies has changed
# b) any target does not exist
# c) the build command has changed
#Else rebuild only those c files that have changed_since_last_build
#The signature of this builder should always be the same, because the
#multifile compile is always functionally equivalent to rebuilding
#everything

if for_signature:
pared_sources = source
else:
#First a sanity check
assert len(set([os.path.splitext(str(i))[1] for i in source])) == 1, \
"All source files must have the same extension."
pared_sources = []
src_names = [os.path.splitext(os.path.basename(str(i)))[0]
src_names = [os.path.splitext(os.path.basename(str(i)))[0]
for i in source]
tgt_names = [os.path.splitext(os.path.basename(str(t)))[0]
tgt_names = [os.path.splitext(os.path.basename(str(t)))[0]
for t in target]
ni = target[0].get_binfo()
oi = target[0].get_stored_info().binfo
Expand Down Expand Up @@ -191,7 +191,7 @@ def MFProgramGenerator(source, target, env, for_signature):
prefixed_sources = [relpath(str(i), destdir) for i in pared_sources]
prefixed_sources_str = ' '.join([str(i) for i in prefixed_sources])
lang_ext = os.path.splitext(prefixed_sources[0])[1]
tgt_names2 = [os.path.splitext(os.path.basename(str(t)))[0]
tgt_names2 = [os.path.splitext(os.path.basename(str(t)))[0]
for t in target]

_CPPPATH = []
Expand All @@ -201,7 +201,7 @@ def MFProgramGenerator(source, target, env, for_signature):
##_CPPPATH.append(relpath(i[1:], destdir))
_CPPPATH.append(i)
#else:
# _CPPPATH.append(relpath(os.path.join(sconscript_dir, i),
# _CPPPATH.append(relpath(os.path.join(sconscript_dir, i),
# destdir))

defines = ""
Expand Down Expand Up @@ -231,11 +231,11 @@ def MFProgramGenerator(source, target, env, for_signature):

def generate(env):
"""Adds the MFObject builder to your environment"""
MFProgramBld = env.Builder(generator = MFProgramGenerator,
MFProgramBld = env.Builder(generator = MFProgramGenerator,
emitter = MFProgramEmitter,
suffix = '.o',
suffix = '.o',
source_scanner=SCons.Tool.SourceFileScanner)
MFProgramBld.get_single_executor = new.instancemethod(MF_get_single_executor,
MFProgramBld.get_single_executor = new.instancemethod(MF_get_single_executor,
MFProgramBld, MFProgramBld.__class__)

env.Append(BUILDERS = {'MFProgram': MFProgramBld})
env.Append(BUILDERS = {'MFProgram': MFProgramBld})
2 changes: 1 addition & 1 deletion site_scons/site_tools/mfprogram/relpath.py
Expand Up @@ -70,4 +70,4 @@ def relpath(path, start=curdir):
rel_list = [pardir] * (len(start_list)-i) + path_list[i:]
if not rel_list:
return curdir
return join(*rel_list)
return join(*rel_list)
4 changes: 2 additions & 2 deletions src/Format.cpp
Expand Up @@ -310,7 +310,7 @@ std::vector<char> format::VideoBufferToPNG(const VideoBuffer & vidBuf)
currentRow[rowPos++] = PIXB(vidBuf.Buffer[(y*vidBuf.Width)+x]);
}

uncompressedData[dataPos++] = 2; //Up Sub(x) filter
uncompressedData[dataPos++] = 2; //Up Sub(x) filter
for(int b = 0; b < rowPos; b++)
{
int filteredByte = (currentRow[b]-previousRow[b])&0xFF;
Expand All @@ -329,7 +329,7 @@ std::vector<char> format::VideoBufferToPNG(const VideoBuffer & vidBuf)
unsigned char * compressedData = new unsigned char[compressedBufferSize];

int result;
z_stream zipStream;
z_stream zipStream;
zipStream.zalloc = Z_NULL;
zipStream.zfree = Z_NULL;
zipStream.opaque = Z_NULL;
Expand Down
4 changes: 2 additions & 2 deletions src/PowderToyRenderer.cpp
Expand Up @@ -57,7 +57,7 @@ void writeFile(std::string filename, std::vector<char> & fileData)
}

int main(int argc, char *argv[])
{
{
ui::Engine * engine;
std::string outputPrefix, inputFilename;
std::vector<char> inputFile;
Expand All @@ -76,7 +76,7 @@ int main(int argc, char *argv[])
readFile(inputFilename, inputFile);

ui::Engine::Ref().g = new Graphics();

engine = &ui::Engine::Ref();
engine->Begin(WINDOWW, WINDOWH);

Expand Down

0 comments on commit 27f6a6b

Please sign in to comment.