Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstarkos <none@none>2009-06-15 22:36:09 +0400
committerstarkos <none@none>2009-06-15 22:36:09 +0400
commit00c7cc56608d5b4fb2686aae5eede96fc73918b9 (patch)
tree9fbed0854d8e5239191fc3c10af6d1c0a19333d3 /premake4.lua
parent9dc5530ab6af5a3bec03a392145824d0cd0631de (diff)
Cut some more fat from the embedded scripts
Diffstat (limited to 'premake4.lua')
-rw-r--r--premake4.lua32
1 files changed, 12 insertions, 20 deletions
diff --git a/premake4.lua b/premake4.lua
index 26ada57..f537574 100644
--- a/premake4.lua
+++ b/premake4.lua
@@ -97,42 +97,34 @@ end
-- bytecodes are not portable to different architectures.
--
- local function loadscript(fname)
+ local function embedfile(out, fname)
local f = io.open(fname)
local s = f:read("*a")
f:close()
- -- strip out comments
- s = s:gsub("[\n]%-%-[^\n]*", "")
+ -- strip tabs
+ s = s:gsub("[\t]", "")
-- strip any CRs
s = s:gsub("[\r]", "")
+ -- strip out comments
+ s = s:gsub("\n%-%-[^\n]*", "")
+
-- escape backslashes
s = s:gsub("\\", "\\\\")
+ -- strip duplicate line feeds
+ s = s:gsub("\n+", "\n")
+
+ -- strip out leading comments
+ s = s:gsub("^%-%-\n", "")
+
-- escape line feeds
s = s:gsub("\n", "\\n")
-- escape double quote marks
s = s:gsub("\"", "\\\"")
-
- return s
- end
-
-
- local function embedfile(out, fname)
- local s = loadscript(fname)
-
- -- strip tabs
- s = s:gsub("[\t]", "")
-
- -- strip duplicate line feeds
- local t = s
- repeat
- s = t
- t = s:gsub("\\n\\n", "\\n")
- until s == t
out:write("\t\"")
out:write(s)