Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
If you add the c:\bcpp\ instalation directory to the PATH environment variable the following command line can be used instead:
bcpp.exe -fi example.cpp -fo result.cpp
In this case the bcpp.exe will go looking for the bcpp.cfg by searching the PATH environment variable.
Dispite the fact the number of configuration options provided seem fairly limited (i.e. just the bare minimum), IMHO it does a very good job of cleaning up the code
@echo off
if %1 == "" goto BadInputData
if %2 == "" goto BadInputData
REM Make a backup copy of the file
if not exist %1 goto Failed
copy %1 %2
REM Make sure we have the backup copy
if not exist %2 goto Failed
REM Reformat the file by formating the backup copy
echo bcpp.exe -fi %2 -fo %1
bcpp.exe -fi %2 -fo %1
REM Success
goto End
REM BadInputData
:BadInputData
Echo Bad input data provided.
Echo USAGE: bcpp.cmd "$fn" "$zdzBackup\$f"
exit -1
REM Failed
:Failed
Echo Unexpected error with input files!
exit -1
:End
exit 0
Step 2:
Put the bcpp.cmd batch file in the Zeus install directory and run the batch file using the following bcpp.lua Lua macro:
--
-- Name: BCPP Lua Macro
--
-- Author: Jussi Jumppanen
--
-- Language: Lua Macro
--
-- Description: This simple Lua macro will run the bcpp.cmd
-- which will formats the currently active file.
--
function key_macro()
-- macro only works for documents
if is_document() == 0 then
message("This macro only works for document files!")
beep()
return
end
-- macro only works for read/write documents
if is_read_only() == 1 then
message("The current document is marked as read only!")
beep()
return
end
-- build up the file names
local file_source = macro_tag("$fn")
local file_backup = macro_tag("$zdzBackup\\") .. macro_tag("$f")
-- build up the command line
local cmd = "bcpp.cmd \"" .. file_source .. "\" \"" .. file_backup .. "\""
message("BCPP Comand:" .. cmd)
-- help with debugging
-- message_box(1, cmd)
-- setup command control falgs (see Zeus Macro help for more details)
-- 1 : save the document before running the program
-- 16 : the program uses MS-DOS command interpreter (ie. dir *.* etc)
-- 32 : wait for the program to complete (the ESC key will cancel the wait)
local flags = 1+16+32
-- run command
system(cmd, "", flags)
-- relaod teh formated file
FileReloadCurrent()
message("Formating complete")
end
key_macro() -- run the macro