Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Disable Assits++ scan on certain files
Re: Disable Assits++ scan on certain files [message #52297 is a reply to message #51272] Sun, 01 September 2019 00:20 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 726
Registered: November 2008
Location: France
Contributor
Well I finally found some time to look into this problem and actually found something that works.

Code is just a first quick try, but before going further I would like to share it first and have some return on it.

* in uppsrc/CppBase/CppBase.h

const char *SkipString(const char *s);

void RemoveComments(String& l, bool& incomment);
void RemoveDirectives(String& l, bool& inDirective);    // ======= ADDED THIS LINE  ============

String GetStdDefs();


* in uppsrc/CppBase/ppFile.cpp
Added the following function:
void RemoveDirectives(String& l, bool& inDirective)
{
	int q = -1;
	int w = -1;
	if(inDirective)
		q = w = 0;
	else {
		const char *s = l;
		while(*s) {
			if(*s == '\"')
				s = SkipString(s);
			else
			if(s[0] == '/' && s[1] == '/' && s[2] == '$' && s[3] == '-') {
				q = int(s - ~l);
				break;
			}
			else
				s++;
		}
		if(q >= 0)
			w = q + 4;
	}
	while(q >= 0) {
		int eq = l.Find("//$+", w);
		if(eq < 0) {
			inDirective = true;
			SetSpaces(l, q, l.GetCount() - q);
			return;
		}
		SetSpaces(l, q, eq + 4 - q);
		inDirective = false;
		q = l.Find("//$+");
		w = q + 4;
	}
}


* Modified ppFile::parse() method
void PPFile::Parse(Stream& in)
{
	LTIMING("PPFile::Parse");
	for(int i = 0; i < ppmacro.GetCount(); i++)
		sAllMacros.Unlink(ppmacro[i]);
	ppmacro.Clear();
	item.Clear();
	includes.Clear();
	bool was_using = false;
	bool was_namespace = false;
	int  level = 0;
	bool incomment = false;
	bool inDirective = false;     ========== line added ===========
	Vector<int> namespace_block;
	bool next_segment = true;
	Index<int> local_segments;
	keywords.Clear();
	int linei = 0;
	Md5Stream md5;
	while(!in.IsEof()) {
		String l = in.GetLine();
		while(*l.Last() == '\\' && !in.IsEof()) {
			l.Trim(l.GetLength() - 1);
			l.Cat(in.GetLine());
		}
		RemoveDirectives(l, inDirective);       ========== line added =========
		RemoveComments(l, incomment);
		try {
			CParser p(l);


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Read Message
Previous Topic: Versioning support (hack-ishly solved)
Next Topic: [Linux] Tooltips and pop-up windows don't disappear when TheIde is losing focus
Goto Forum:
  


Current Time: Mon May 12 13:09:16 CEST 2025

Total time taken to generate the page: 0.00841 seconds