cmd /c $(g++) -c "$(FULL_CURRENT_PATH)" -o "$(obj).o" && $(g++) "$(obj).o" -o "$(obj).exe" && "$(obj).exe"
Explanation: all the commands above are executed by the command interpretter cmd.exe which can be seen from "cmd /c" at the beginning. The special "keyword" or "operator" && tells cmd.exe the following: execute the command next to && only in case of successful execution of the previous command. I.e. the logic of this command line is the following:
IF $(g++) -c "$(FULL_CURRENT_PATH)" -o "$(obj).o" THEN
// compiled OK - building the .exe
IF $(g++) "$(obj).o" -o "$(obj).exe" THEN
// built OK - running the .exe
"$(obj).exe"
ENDIF
ENDIF
Some additional information can be found in the NppExec Manual under the section 4.4.
2) Delete the file. And again we use cmd.exe:
cmd /c del "$(obj).exe"
Some additional information can be found in the NppExec Manual under the section 4.4.
3) Run the console program in its own console window. Described in the NppExec Manual under the section 3.3.
"$(NPP_DIRECTORY)\tcc\tcc.exe" "$(FULL_CURRENT_PATH)" -run
cmd /c cd "$(CURRENT_DIRECTORY)" && javac "$(FILE_NAME)" && java "$(NAME_PART)"
It would be fine if all C files ran correctly in NppExec's console, which is not the case.
So I'd like to make both C and Java compiled files to compile (or display debugging information) in NppExec's console, but to run (only on successful compilation) in their own console windows.
Yeah, Java is is running fine in NppExec's console, but.. I just want the "compile and run" processes for C and Java to work in the same manner. :)
The scripts I made up to do make it work this way (but it does not care if it compiled successfully) are as follows (for C and Java respectively):
"$(NPP_DIRECTORY)\tcc\tcc.exe" "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)"\$(NAME_PART).exe
NPP_RUN cmd /k ""$(CURRENT_DIRECTORY)"\$(NAME_PART).exe"
cd "$(CURRENT_DIRECTORY)"
javac "$(FILE_NAME)"
NPP_RUN cmd /k "java $(NAME_PART)"
Tried something like..
cmd /c "$(NPP_DIRECTORY)\tcc\tcc.exe" "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)"\$(NAME_PART).exe && NPP_RUN cmd /k ""$(CURRENT_DIRECTORY)"\$(NAME_PART).exe"
But it won't work. I think because it's TCC does not understant '&&' operator..
And for Java:
cmd /c cd "$(CURRENT_DIRECTORY)" && javac "$(FILE_NAME)" && NPP_RUN cmd /k "java $(NAME_PART)"
But it obviously says "'NPP_RUN' is not recognized as an internal or external command, operable program or batch file.", since it is sent to cmd, not to NppExec's console..
So I wonder if this idea can be implemented using TCC and JDK.. I mean compiling in NppExec's console and running in a new window on successful compilation.
cmd /c ""$(gcc_path)" -o "$(NAME_PART)" "$(FULL_CURRENT_PATH)" && start cmd /c ""$(CURRENT_DIRECTORY)\$(NAME_PART).exe" & pause""
and for Java:
cmd /c ""$(javac_path)" "$(FULL_CURRENT_PATH)" && start cmd /c ""java.exe" -classpath "$(CURRENT_DIRECTORY)" "$(NAME_PART)" & pause""
cmd /c ""$(NPP_DIRECTORY)\tcc\tcc.exe" "$(FULL_CURRENT_PATH)" -o "$(CURRENT_DIRECTORY)"\$(NAME_PART).exe && start cmd /c ""$(CURRENT_DIRECTORY)"\$(NAME_PART).exe & echo. & pause""
As of Java and C++, they seem to run fine in NppExec console, so I prefer to run them there, rather than in a new window. :)
This forum does not allow anonymous participation.
Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.