Primetime

This commit is contained in:
ThePhD 2016-03-13 10:03:05 -04:00
parent 3239f020c7
commit d3ccfa7426
4 changed files with 11 additions and 11 deletions

1
.gitignore vendored
View File

@ -57,3 +57,4 @@ desktop.ini
docs/build/ docs/build/
*.sublime-project *.sublime-project
m.lua m.lua
single/sol.hpp

View File

@ -9,7 +9,7 @@ import datetime as dt
try: try:
import cStringIO as sstream import cStringIO as sstream
except ImportError: except ImportError:
import io.StringIO as sstream from io import StringIO
description = "Converts sol to a single file for convenience." description = "Converts sol to a single file for convenience."
@ -85,6 +85,7 @@ def get_version():
def process_file(filename, out): def process_file(filename, out):
global includes global includes
filename = os.path.normpath(filename) filename = os.path.normpath(filename)
relativefilename = filename.replace(script_path, "")
if filename in includes: if filename in includes:
return return
@ -94,10 +95,10 @@ def process_file(filename, out):
if not args.quiet: if not args.quiet:
print('processing {}'.format(filename)) print('processing {}'.format(filename))
out.write('// beginning of {}\n\n'.format(filename)) out.write('// beginning of {}\n\n'.format(relativefilename))
empty_line_state = True empty_line_state = True
with open(filename, 'r') as f: with open(filename, 'r', encoding='utf-8') as f:
for line in f: for line in f:
# skip comments # skip comments
if line.startswith('//'): if line.startswith('//'):
@ -135,7 +136,7 @@ def process_file(filename, out):
# line is fine # line is fine
out.write(line) out.write(line)
out.write('// end of {}\n\n'.format(filename)) out.write('// end of {}\n\n'.format(relativefilename))
version = get_version() version = get_version()
@ -147,10 +148,10 @@ if not args.quiet:
print('Current version: {version} (revision {revision})\n'.format(version = version, revision = revision)) print('Current version: {version} (revision {revision})\n'.format(version = version, revision = revision))
processed_files = [os.path.join(script_path, 'sol', x) for x in ('state.hpp', 'object.hpp', 'function.hpp')] processed_files = [os.path.join(script_path, 'sol', x) for x in ('state.hpp', 'object.hpp', 'function.hpp', 'coroutine.hpp')]
result = '' result = ''
ss = sstream.StringIO() ss = StringIO()
ss.write(intro.format(time=dt.datetime.utcnow(), revision=revision, version=version, guard=include_guard)) ss.write(intro.format(time=dt.datetime.utcnow(), revision=revision, version=version, guard=include_guard))
for processed_file in processed_files: for processed_file in processed_files:
process_file(processed_file, ss) process_file(processed_file, ss)
@ -159,6 +160,6 @@ ss.write('#endif // {}\n'.format(include_guard))
result = ss.getvalue() result = ss.getvalue()
ss.close() ss.close()
with open(args.output, 'w') as f: with open(args.output, 'w', encoding='utf-8') as f:
f.write(result) f.write(result)

View File

@ -24,7 +24,6 @@
#include "sol/state.hpp" #include "sol/state.hpp"
#include "sol/object.hpp" #include "sol/object.hpp"
#include "sol/userdata.hpp"
#include "sol/function.hpp" #include "sol/function.hpp"
#include "sol/coroutine.hpp" #include "sol/coroutine.hpp"

View File

@ -23,9 +23,8 @@
#define SOL_OBJECT_HPP #define SOL_OBJECT_HPP
#include "reference.hpp" #include "reference.hpp"
#include "userdata.hpp"
#include "stack.hpp" #include "stack.hpp"
#include "function.hpp"
#include "protected_function.hpp"
namespace sol { namespace sol {
class object : public reference { class object : public reference {