-
Notifications
You must be signed in to change notification settings - Fork 0
/
NOTES
71 lines (62 loc) · 2.3 KB
/
NOTES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
TODO
----
Rename Files
added
modified
uptodate
tracked-missing
Revert
Refresh
Branching
Tagging
diff
diff in commit
initialise
update on file added
DONE
----
Commit.
Add Files.
GetStatus(FileNames)
Remove Files
Up-to-date
Added
Modified
tracked-missing
Menu Options for different file states
On file save (See appendix A)
Startup memory leak
Ignore non-controlled projects
Don't assume .git is where project.cbp is
work out where repo root is using git rev-parse --show-toplevel
Project status tracking
On project Save
---------------------------------------------
Appendix A
void HeaderGuard::OnSave(CodeBlocksEvent& event)
{
cbEditor* ed = (cbEditor*) event.GetEditor();
wxString n = ed->GetFilename();
if(!n.Right(2).Lower().IsSameAs(_T(".h")) && !n.Right(3).Lower().IsSameAs(_T(".hpp")) && !n.Right(3).Lower().IsSameAs(_T(".hxx")))
return;
// Header guards should appear before any comments or code to ensure the compiler can perform header guard optimisation,
// therefore we don't really need to scan the full text, checking the first line is good enough and much faster, both here and in build.
// It also doesn't choke on external header guards that some people still use.
// We're omitting a check for "#pragma once", as that's not standard compliant. It doesn't hurt to add guards around "#pragma once", either.
const wxString s(ed->GetControl()->GetLine(0).Trim(true).Trim(false));
if(s.StartsWith(_T("#ifndef")) && ( s.Contains(_T("HEADER")) || s.Right(2).IsSameAs(_T("_H")) || s.Contains(_T(" H_")) || s.Contains(_T("_H_")) || s.Contains(_T("_INCLUDED")) ))
return;
unsigned int s1 = 257, s2 = 123, b = 9737333, c = 174440041;
for(unsigned int i = 0; i < n.length(); ++i)
{
b = (b*33) + (s1 += n[i]);
(c *= 47) += s2;
s2 += s1;
}
b ^= (((s1%255)<<10) | (s2&255));
c ^= (c << 14); b ^= (b << 21); c ^= (c >> 5);
b ^= (b >> 17); c ^= (c << 11); b ^= (b << 9);
n.Printf(_T("#ifndef HEADER_%X%X\n#define HEADER_%X%X\n\n"), b, c, b, c);
ed->GetControl()->InsertText (0, n);
ed->GetControl()->InsertText (ed->GetControl()->GetLength(), _T("\n#endif // header guard \n"));
}