diff --git a/.gitignore b/.gitignore index eded4f0a..9896a519 100644 --- a/.gitignore +++ b/.gitignore @@ -57,3 +57,4 @@ desktop.ini docs/build/ *.sublime-project m.lua +single/sol.hpp diff --git a/single.py b/single.py index a8a324cc..9676555e 100644 --- a/single.py +++ b/single.py @@ -9,7 +9,7 @@ import datetime as dt try: import cStringIO as sstream except ImportError: - import io.StringIO as sstream + from io import StringIO description = "Converts sol to a single file for convenience." @@ -85,6 +85,7 @@ def get_version(): def process_file(filename, out): global includes filename = os.path.normpath(filename) + relativefilename = filename.replace(script_path, "") if filename in includes: return @@ -93,11 +94,11 @@ def process_file(filename, out): if not args.quiet: print('processing {}'.format(filename)) - - out.write('// beginning of {}\n\n'.format(filename)) + + out.write('// beginning of {}\n\n'.format(relativefilename)) empty_line_state = True - with open(filename, 'r') as f: + with open(filename, 'r', encoding='utf-8') as f: for line in f: # skip comments if line.startswith('//'): @@ -135,7 +136,7 @@ def process_file(filename, out): # line is fine out.write(line) - out.write('// end of {}\n\n'.format(filename)) + out.write('// end of {}\n\n'.format(relativefilename)) version = get_version() @@ -147,10 +148,10 @@ if not args.quiet: 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 = '' -ss = sstream.StringIO() +ss = StringIO() ss.write(intro.format(time=dt.datetime.utcnow(), revision=revision, version=version, guard=include_guard)) for processed_file in processed_files: process_file(processed_file, ss) @@ -159,6 +160,6 @@ ss.write('#endif // {}\n'.format(include_guard)) result = ss.getvalue() ss.close() -with open(args.output, 'w') as f: +with open(args.output, 'w', encoding='utf-8') as f: f.write(result) diff --git a/sol.hpp b/sol.hpp index 9b00fad4..2534e646 100644 --- a/sol.hpp +++ b/sol.hpp @@ -24,7 +24,6 @@ #include "sol/state.hpp" #include "sol/object.hpp" -#include "sol/userdata.hpp" #include "sol/function.hpp" #include "sol/coroutine.hpp" diff --git a/sol/object.hpp b/sol/object.hpp index 47ac6736..d5f8880b 100644 --- a/sol/object.hpp +++ b/sol/object.hpp @@ -23,9 +23,8 @@ #define SOL_OBJECT_HPP #include "reference.hpp" +#include "userdata.hpp" #include "stack.hpp" -#include "function.hpp" -#include "protected_function.hpp" namespace sol { class object : public reference {