-
Notifications
You must be signed in to change notification settings - Fork 2
/
oddbits.h
executable file
·86 lines (66 loc) · 3.17 KB
/
oddbits.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Copyright (C) 2010 Matthew Baranowski, Sander van Rossen & Raven software.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ODDBITS_H
#define ODDBITS_H
#include "assert.h"
#define SAFEFREE(arg) if (arg){free(arg);arg=0;}
#define ZEROMEM(arg) memset(arg, 0, sizeof(arg))
#define ASSERT assert
#ifdef _DEBUG
#define VERIFY(arg) ASSERT(arg)
#else
#define VERIFY(arg) arg
#endif
char *va(char *format, ...);
bool FileExists (LPCSTR psFilename);
void ErrorBox(const char *sString);
void InfoBox(const char *sString);
void WarningBox(const char *sString);
#define GetYesNo(psQuery) (!!(MessageBox(mdview.hwnd,psQuery,"Query",MB_YESNO|MB_ICONWARNING|MB_TASKMODAL)==IDYES))
char *scGetTempPath(void);
char *InputLoadFileName(char *psInitialLoadName, char *psCaption, const char *psInitialDir, char *psFilter);
long filesize(FILE *handle);
int LoadFile (LPCSTR psPathedFilename, void **bufferptr);
//void Filename_RemoveBASEQ(CString &string);
//void Filename_RemoveFilename(CString &string);
//void Filename_BaseOnly(CString &string);
//void Filename_AccountForLOD(CString &string, int iLODLevel);
char *Filename_WithoutPath(LPCSTR psFilename);
char *Filename_WithoutExt(LPCSTR psFilename);
char *Filename_PathOnly(LPCSTR psFilename);
char *Filename_ExtOnly(LPCSTR psFilename);
char *String_ToLower(LPCSTR psString);
char *String_ToUpper(LPCSTR psString);
char *String_Neaten(LPCSTR psString);
char *String_NeatenEveryWord(LPCSTR psString);
char *String_Replace(char *psString, char *psFind, char *psReplace, BOOL bCaseInSensitive);
char *String_GetField(char *psString);
char *String_LoseField(char *psString);
char *String_LoseWhitespace(char *psString);
char *String_LoseLeadingWhitespace(char *psString);
char *String_LoseTrailingWhitespace(char *psString);
char *String_EnsureTrailingChar(char *psString, char c);
char *String_LoseTrailingChar(char *psString, char c);
char *String_LoseComment(char *psString);
char *String_LoseNewline(char *psString);
char *String_EnsureMinLength(LPCSTR psString, int iMinLength);
int RunningNT(void);
#define StartWait() HCURSOR hcurSave = SetCursor(::LoadCursor(NULL, IDC_WAIT))
#define RestoreWait() SetCursor(::LoadCursor(NULL, IDC_WAIT))
#define EndWait() SetCursor(hcurSave)
#define STL_ITERATE_DECL(iter, dataname) for (dataname##_t::iterator iter = dataname.begin(); iter!=dataname.end(); ++iter)
#define STL_ITERATE(iter, dataname) for (iter = dataname.begin(); iter!=dataname.end(); ++iter)
void SystemErrorBox(DWORD dwError = GetLastError());
#endif // #ifndef ODDBITS_H
/////////////////// eof ////////////////////