Use new indentation-aware APIs in VC 200x exporter
This commit is contained in:
parent
f40bdf16c1
commit
6db06d6985
@ -180,7 +180,7 @@
|
|||||||
_p(3,'<Link>%s</Link>', path.translate(link))
|
_p(3,'<Link>%s</Link>', path.translate(link))
|
||||||
end
|
end
|
||||||
if #contents > 0 then
|
if #contents > 0 then
|
||||||
_p("%s", contents)
|
io.printf("%s", contents)
|
||||||
end
|
end
|
||||||
_p(2,'</%s>', info.action)
|
_p(2,'</%s>', info.action)
|
||||||
else
|
else
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -384,7 +384,7 @@
|
|||||||
end)
|
end)
|
||||||
if #contents > 0 then
|
if #contents > 0 then
|
||||||
_p(2,'<Lib>')
|
_p(2,'<Lib>')
|
||||||
_p("%s", contents)
|
io.printf("%s", contents)
|
||||||
_p(2,'</Lib>')
|
_p(2,'</Lib>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -529,7 +529,7 @@
|
|||||||
|
|
||||||
if #contents > 0 then
|
if #contents > 0 then
|
||||||
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
|
_x(2,'<ClCompile Include=\"%s\">', path.translate(file.relpath))
|
||||||
_p("%s", contents)
|
io.printf("%s", contents)
|
||||||
_p(2,'</ClCompile>')
|
_p(2,'</ClCompile>')
|
||||||
else
|
else
|
||||||
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))
|
_x(2,'<ClCompile Include=\"%s\" />', path.translate(file.relpath))
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
|
|
||||||
function io.captured()
|
function io.captured()
|
||||||
if io._captured then
|
if io._captured then
|
||||||
if not io._captured_string then
|
if not io._captured_string and #io._captured > 0 then
|
||||||
io._captured_string = table.concat(io._captured, io.eol)
|
io._captured_string = table.concat(io._captured, io.eol)
|
||||||
end
|
end
|
||||||
return io._captured_string
|
return io._captured_string or ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,11 +78,21 @@
|
|||||||
---
|
---
|
||||||
-- Write a formatted string to the exported file, after decreasing the
|
-- Write a formatted string to the exported file, after decreasing the
|
||||||
-- indentation level by one.
|
-- indentation level by one.
|
||||||
|
--
|
||||||
|
-- @param i
|
||||||
|
-- If set to a number, the indentation level will be decreased by
|
||||||
|
-- this amount. If nil, the indentation level is decremented and
|
||||||
|
-- no output is written. Otherwise, pass to premake.w() as the
|
||||||
|
-- formatting string, followed by any additional arguments.
|
||||||
---
|
---
|
||||||
|
|
||||||
function premake.pop(...)
|
function premake.pop(i, ...)
|
||||||
|
if i == nil or type(i) == "number" then
|
||||||
|
premake.indentation = premake.indentation - (i or 1)
|
||||||
|
else
|
||||||
premake.indentation = premake.indentation - 1
|
premake.indentation = premake.indentation - 1
|
||||||
premake.w(...)
|
premake.w(i, ...)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -90,12 +100,22 @@
|
|||||||
---
|
---
|
||||||
-- Write a formatted string to the exported file, and increase the
|
-- Write a formatted string to the exported file, and increase the
|
||||||
-- indentation level by one.
|
-- indentation level by one.
|
||||||
|
--
|
||||||
|
-- @param i
|
||||||
|
-- If set to a number, the indentation level will be increased by
|
||||||
|
-- this amount. If nil, the indentation level is incremented and
|
||||||
|
-- no output is written. Otherwise, pass to premake.w() as the
|
||||||
|
-- formatting string, followed by any additional arguments.
|
||||||
---
|
---
|
||||||
|
|
||||||
function premake.push(...)
|
function premake.push(i, ...)
|
||||||
premake.w(...)
|
if i == nil or type(i) == "number" then
|
||||||
|
premake.indentation = premake.indentation + (i or 1)
|
||||||
|
else
|
||||||
|
premake.w(i, ...)
|
||||||
premake.indentation = premake.indentation + 1
|
premake.indentation = premake.indentation + 1
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -264,3 +284,18 @@
|
|||||||
_p('')
|
_p('')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Write a formatted string to the exported file, after passing all
|
||||||
|
-- arguments (except for the first, which is the formatting string)
|
||||||
|
-- through premake.esc().
|
||||||
|
---
|
||||||
|
|
||||||
|
function premake.x(msg, ...)
|
||||||
|
for i = 1, #arg do
|
||||||
|
arg[i] = premake.esc(arg[i])
|
||||||
|
end
|
||||||
|
premake.w(msg, unpack(arg))
|
||||||
|
end
|
||||||
|
Reference in New Issue
Block a user