// Begin GWC mods
//
// Filter for GNU grep version 2.1
// based on ParseBorlandMessages() in this file
// key difference is that a colon follows the line number
// Handle messages of the form:
// Filename:####: MessageText
// (Type: INFORMATION)
// and also:
// grep: MessageText
// (Type: ERROR)
// where:
// Filename is the name of the source module
// #### is a number representing the line in the source module
//
ParseGNUGrepMessages(output){
declare input; // The raw text output.
declare line; // The input string that is processed.
declare p; // A "pointer" into line.
declare fileName; // The message filename.
declare fileRow; // The message line number.
declare msgType; // The message type.
declare message; // The message.
// Notify user that messages are being processed.
IDE.StatusBar = "grep...";
// Read output text until there is no more.
while((input = output.ReadLine()) != NULL)
{
// Convert the raw text into a String object.
line = new String(input);
// Remove leading whitespace and skip empty lines
if(line == "" || line.Trim(1).Length <= 1)
{
continue;
}
// Check for lines that begin with "grep:"
if(line.SubString(0, 5).Text == "grep:")
{
msgType = ERROR;
}
else
{
msgType = INFORMATION;
}
p = 0;
// Extract a filename and line number.
// Move to the filename.
line = line.SubString(p);
// Extract the filename.
if((p = line.Index(":")) != 0)
{
fileName = line.SubString(0, p - 1).Text;
// Move to the line number.
line = line.SubString(p);
// Extract the line number.
if((p = line.Index(":")) != 0)
{
fileRow = line.SubString(0, p - 1).Integer;
}
else
{
fileRow = 1;
}
}
else
{
fileName = "";
fileRow = 1;
}
// Post the message to the IDE message database.
IDE.MessageCreate
("GNU Grep"
,"transfer"
,msgType
,0
,fileName
,fileRow
,1
,line.SubString(p).Text
,0
,0
);
IDE.ViewMessage("&GNU grep");
}
return 0;
}
// End GWC mods
Add the follwing code in bc5\script\filtstub.spp, in the switch (Tool.Text) statement
// Begin GWC mods
case "GG2MSG":
case "GG2MSG.DLL":
{
return ParseGNUGrepMessages(output);
}
// End GWC mods
Note: If you have modified filters.spp and filtstub.spp,
do not download them from the site. Instead, make the changes from above.
Download FiltStub.zip
Download Filters.zip
Download GNU grep
import IDE;
import "KERNEL32.DLL"
{
int MoveFileExA(char* from, char* to, unsigned flags);
int DeleteFileA(char* file );
int CopyFileA(char* from, char* to, bool FailIfExists );
int GetFileAttributes( char* from );
}
#define MOVEFILE_REPLACE_EXISTING 0x00000001
#define MOVEFILE_COPY_ALLOWED 0x00000002
on IDE:>TranslateComplete(declare status, declare inputPath, declare outputPath){
if(status){
declare tmpFileName = new String(outputPath);
tmpFileName = tmpFileName.Lower();
declare idx = tmpFileName.Index(".obj");
if(idx){
//.MessageCreate("Buildtime", "transfer", INFORMATION, 0, outputPath, 0, 0, "Idx found");
tmpFileName = tmpFileName.SubString(0, idx);
tmpFileName = tmpFileName.Text+"000";
if( GetFileAttributes(tmpFileName)==-1 ){
//declare msg = "000 File does not exist. Nothing to do";
//.MessageCreate("Buildtime", "transfer", INFORMATION, 0, outputPath, 0, 0, msg);
}else
if(MoveFileExA(tmpFileName, outputPath, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED )){
// practically it does not work on substed drives at least
declare msg = "Renamed " + tmpFileName + " to " + outputPath;
.MessageCreate("Buildtime", "transfer", INFORMATION, 0, outputPath, 0, 0, msg);
}else
if(CopyFileA(tmpFileName, outputPath, false)){
if(DeleteFileA( tmpFileName )){
// practically it does work in most cases
declare msg = "Moved " + tmpFileName + " to " + outputPath;
.MessageCreate("Buildtime", "transfer", INFORMATION, 0, outputPath, 0, 0, msg);
}else{
declare msg = "Copyed " + tmpFileName + " to " + outputPath;
.MessageCreate("Buildtime", "transfer", INFORMATION, 0, outputPath, 0, 0, msg);
msg = "Not deleted " + tmpFileName;
.MessageCreate("Buildtime", "transfer", ERROR, 0, tmpFileName, 0, 0, msg);
}
}else{
declare msg = "Not renamed " + tmpFileName + " to " + outputPath;
.MessageCreate("Buildtime", "transfer", FATAL, 0, outputPath, 0, 0, msg);
}
}
}
pass(status, inputPath, outputPath);
}
Download TasmFix.zip
import IDE;
declare keyboard = IDE.KeyboardManager.GetKeyboard("Project");
keyboard.Assign("<F12>", "ShowNodeAttr();");
ShowNodeAttr()
{
IDE.KeyboardManager.SendKeys("{VK_DOWN}%{VK_F10}n%s");
}
Download NodeAttr.zip
/* - increments the build number in the first found resource file
* (extension .rc ) of the project AFTER each build
* Author: Matthias Seemann (2004)
*/
import IDE;
import scriptEngine;
//
// Load support module(s).
//
if (!scriptEngine.IsLoaded("file")) scriptEngine.Load("file");
on IDE:>BuildComplete(status, inputPath, outputPath)
{
if (!status)
{
return;
}
declare project = new ProjectNode();
declare exe = new ProjectNode(project.ChildNodes[0]);
declare current;
declare sName;
declare tmpNode;
iterate (tmpNode; exe.ChildNodes)
{
current = new ProjectNode(tmpNode);
sName = new String(current.Type);
if (sName.Index(".rc") > 0)
{
//IDE.Message(current.InputName);
declare rcFile = new TFlatFile(current.InputName);
/* declare aLines = rcFile.GetLines("FILEVERSION");
declare sLine;
iterate(sLine; aLines)
{
IDE.Message(sLine);
}
delete sLine;
delete aLines;
*/
rcFile.EdPos.Move(1,1);
if (!rcFile.EdPos.Search("VERSIONINFO", TRUE, FALSE))
break;
if (!rcFile.EdPos.Search("FILEVERSION", TRUE, FALSE))
break;
//IDE.Message(rcFile.EdPos.Search("FILEVERSION", TRUE, FALSE));
rcFile.EdPos.Search(",", TRUE, FALSE);
rcFile.EdPos.Search(",", TRUE, FALSE);
rcFile.EdPos.Search(",", TRUE, FALSE);
declare sIn = new String(rcFile.EdPos.RipText(" 0123456789",
INCLUDE_NUMERIC_CHARS));
//IDE.Message(sIn.Text);
declare iTextLength = sIn.Length;
//IDE.Message(iTextLength);
sIn.Trim(TRUE);
declare iNumber = sIn.Integer;
//IDE.Message(iNumber);
iNumber = iNumber + 1;
//IDE.Message(iNumber);
//IDE.Message(rcFile.EdPos.Row);
//IDE.Message(rcFile.EdPos.Column);
sIn.Integer = iNumber;
rcFile.EdPos.InsertText(" ");
rcFile.EdPos.InsertText(sIn.Text);
rcFile.EdPos.Delete(iTextLength);
delete iTextLength;
delete iNumber;
delete sIn;
rcFile.Close(TRUE);
delete rcFile;
break;
}
delete sName;
delete current;
}
delete sName;
delete tmpNode;
/*declare i;
for (i = 0; i < 2 ; i++)
{
IDE.Message(project.ChildNodes[i] + project.ChildNodes[i].Type);
}
delete i;*/
delete current;
delete exe;
delete project;
}
Download AutoBuildNumber.zip