Skip to content

Commit

Permalink
Updated changelog.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFreezed committed Nov 22, 2021
1 parent 87fad95 commit abc7f82
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
9 changes: 9 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
LuaPreprocess

v1.17 (2021-11-22)
Library:
- Added predefined macros @@ASSERT() and @@LOG().
- Added params.release and params.logLevel for controlling aspects of the predefined macros.
- Added params.macroPrefix and params.macroSuffix (e.g. make @@FOO() call the function MACRO_FOO()).
Command line program:
- Added support for using stdin/stdout as input/output. (Specify "-" as the file path.)
- Added --release and --loglevel options.

v1.16 (2021-11-16)
Library:
- Added preprocessor symbols (in the form of '$name').
Expand Down
14 changes: 7 additions & 7 deletions preprocess.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
- getOutputSoFar, getOutputSizeSoFar, getCurrentLineNumberInOutput
- outputValue, outputLua, outputLuaTemplate
- startInterceptingOutput, stopInterceptingOutput
Macros (search for 'PredefinedMacros'):
Macros:
- ASSERT
- LOG
Search this file for 'EnvironmentTable' for more info.
Search this file for 'EnvironmentTable' and 'PredefinedMacros' for more info.
Exported stuff from the library:
- (all the functions above)
Expand Down Expand Up @@ -127,7 +127,7 @@



local PP_VERSION = "1.16.0-dev"
local PP_VERSION = "1.17.0"

local MAX_DUPLICATE_FILE_INSERTS = 1000 -- @Incomplete: Make this a parameter for processFile()/processString().

Expand Down Expand Up @@ -1873,8 +1873,8 @@ end

-- ASSERT()
-- @@ASSERT( condition [, message=auto ] )
-- Macro. Does nothing if params.release is set, otherwise calls error() if
-- the condition fails. The message is only evaluated if the condition fails.
-- Macro. Does nothing if params.release is set, otherwise calls error() if the
-- condition fails. The message argument is only evaluated if the condition fails.
function metaFuncs.ASSERT(conditionCode, messageCode)
errorIfNotRunningMeta(2)
if not conditionCode then error("missing argument #1 to 'ASSERT'", 2) end
Expand Down Expand Up @@ -1903,8 +1903,8 @@ end
-- Macro. Does nothing if logLevel is lower than params.logLevel,
-- otherwise prints a value[1] or a formatted message[2].
--
-- logLevel can be "error" (level 1), "warning" (level 2),
-- "info" (level 3), "debug" (level 4) or "trace" (level 5).
-- logLevel can be "error", "warning", "info", "debug" or "trace"
-- (from highest to lowest priority).
--
function metaFuncs.LOG(logLevelCode, valueOrFormatCode, ...)
errorIfNotRunningMeta(2)
Expand Down
4 changes: 2 additions & 2 deletions tests/suite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ doTest("Predefined macros", function()
assertCodeOutput(luaOut, [[if not (foo) then error("Assertion failed: foo") end]])

local luaOut = assert(pp.processString{ code=[[
@@ASSERT(foo ~= "bad", "Bad foo: "..foo)
@@ASSERT(foo ~= "good", "Bad foo: "..foo)
]]})
assertCodeOutput(luaOut, [[if not (foo ~= "bad") then error(("Bad foo: "..foo)) end]])
assertCodeOutput(luaOut, [[if not (foo ~= "good") then error(("Bad foo: "..foo)) end]])

-- @@LOG()
local luaOut = assert(pp.processString{ logLevel="error", code=[[
Expand Down

0 comments on commit abc7f82

Please sign in to comment.