Tabs to spaces and minor cleanup
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6514 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
41fd62105e
commit
edd80964a7
15 changed files with 317 additions and 326 deletions
|
@ -56,8 +56,8 @@ TCHAR* NSISCALL getuservariable(const int varnum)
|
|||
|
||||
void NSISCALL setuservariable(const int varnum, const TCHAR *var)
|
||||
{
|
||||
if (var && isvalidnsisvarindex(varnum))
|
||||
lstrcpy(g_variables + varnum*g_stringsize, var);
|
||||
if (var && isvalidnsisvarindex(varnum))
|
||||
lstrcpy(g_variables + varnum*g_stringsize, var);
|
||||
}
|
||||
|
||||
#ifdef _UNICODE
|
||||
|
@ -290,7 +290,7 @@ int NSISCALL popint_or()
|
|||
|
||||
void NSISCALL pushintptr(INT_PTR value)
|
||||
{
|
||||
TCHAR buffer[30];
|
||||
wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
|
||||
pushstring(buffer);
|
||||
TCHAR buffer[30];
|
||||
wsprintf(buffer, sizeof(void*) > 4 ? _T("%Id") : _T("%d"), value);
|
||||
pushstring(buffer);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||
{
|
||||
if (uMsg == WM_CREATE)
|
||||
{
|
||||
BITMAP bm;
|
||||
BITMAP bm;
|
||||
RECT vp;
|
||||
GetObject(g_hbm, sizeof(bm), &bm);
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0);
|
||||
|
|
|
@ -469,7 +469,7 @@ void AddFolderFromReg(int nFolder)
|
|||
(LPARAM)ExtractAssociatedIcon(g_hInstance, FileData.cFileName, (WORD*)&idx));*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (FindNextFile(hSearch, &FileData));
|
||||
FindClose(hSearch);
|
||||
}
|
||||
|
|
|
@ -997,7 +997,7 @@ FUNC_DECL _CallBack
|
|||
pop edx
|
||||
jne _retexpr_stdcall
|
||||
;# retexpr[1] = proc->ArgsSize
|
||||
call _GetArgsSizeOffset
|
||||
call _GetArgsSizeOffset
|
||||
mov ecx,dword ptr [ebp+8]
|
||||
mov al,byte ptr [ecx+eax]
|
||||
mov byte ptr [_retexpr+1],al
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef STDAFX_H
|
||||
#define STDAFX_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ class CCRC
|
|||
{
|
||||
UInt32 _value;
|
||||
public:
|
||||
static UInt32 Table[256];
|
||||
static void InitTable();
|
||||
static UInt32 Table[256];
|
||||
static void InitTable();
|
||||
|
||||
CCRC(): _value(0xFFFFFFFF){};
|
||||
void Init() { _value = 0xFFFFFFFF; }
|
||||
|
|
|
@ -132,33 +132,33 @@ typedef IUnknown *LPUNKNOWN;
|
|||
#define VARIANT_FALSE ((VARIANT_BOOL)0)
|
||||
|
||||
enum VARENUM
|
||||
{
|
||||
VT_EMPTY = 0,
|
||||
VT_NULL = 1,
|
||||
VT_I2 = 2,
|
||||
VT_I4 = 3,
|
||||
VT_R4 = 4,
|
||||
VT_R8 = 5,
|
||||
VT_CY = 6,
|
||||
VT_DATE = 7,
|
||||
VT_BSTR = 8,
|
||||
VT_DISPATCH = 9,
|
||||
VT_ERROR = 10,
|
||||
VT_BOOL = 11,
|
||||
VT_VARIANT = 12,
|
||||
VT_UNKNOWN = 13,
|
||||
VT_DECIMAL = 14,
|
||||
VT_I1 = 16,
|
||||
VT_UI1 = 17,
|
||||
VT_UI2 = 18,
|
||||
VT_UI4 = 19,
|
||||
VT_I8 = 20,
|
||||
VT_UI8 = 21,
|
||||
VT_INT = 22,
|
||||
VT_UINT = 23,
|
||||
VT_VOID = 24,
|
||||
VT_HRESULT = 25,
|
||||
VT_FILETIME = 64
|
||||
{
|
||||
VT_EMPTY = 0,
|
||||
VT_NULL = 1,
|
||||
VT_I2 = 2,
|
||||
VT_I4 = 3,
|
||||
VT_R4 = 4,
|
||||
VT_R8 = 5,
|
||||
VT_CY = 6,
|
||||
VT_DATE = 7,
|
||||
VT_BSTR = 8,
|
||||
VT_DISPATCH = 9,
|
||||
VT_ERROR = 10,
|
||||
VT_BOOL = 11,
|
||||
VT_VARIANT = 12,
|
||||
VT_UNKNOWN = 13,
|
||||
VT_DECIMAL = 14,
|
||||
VT_I1 = 16,
|
||||
VT_UI1 = 17,
|
||||
VT_UI2 = 18,
|
||||
VT_UI4 = 19,
|
||||
VT_I8 = 20,
|
||||
VT_UI8 = 21,
|
||||
VT_INT = 22,
|
||||
VT_UINT = 23,
|
||||
VT_VOID = 24,
|
||||
VT_HRESULT = 25,
|
||||
VT_FILETIME = 64
|
||||
};
|
||||
|
||||
typedef unsigned short VARTYPE;
|
||||
|
@ -210,10 +210,10 @@ MY_EXTERN_C LONG CompareFileTime(const FILETIME* ft1, const FILETIME* ft2);
|
|||
#define CP_OEMCP 1
|
||||
|
||||
typedef enum tagSTREAM_SEEK
|
||||
{
|
||||
STREAM_SEEK_SET = 0,
|
||||
STREAM_SEEK_CUR = 1,
|
||||
STREAM_SEEK_END = 2
|
||||
{
|
||||
STREAM_SEEK_SET = 0,
|
||||
STREAM_SEEK_CUR = 1,
|
||||
STREAM_SEEK_END = 2
|
||||
} STREAM_SEEK;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,39 +37,39 @@ public:
|
|||
~CVersionStrigList();
|
||||
|
||||
/**
|
||||
* Add a version_string_list struct referred to by langid. Then add the
|
||||
* codepage value to the structure.
|
||||
*
|
||||
* @param langid The language ID (LANGID)
|
||||
* @param codepage The code page value to set.
|
||||
* @return The position to the inserted structure, false (0) if failed.
|
||||
*/
|
||||
* Add a version_string_list struct referred to by langid. Then add the
|
||||
* codepage value to the structure.
|
||||
*
|
||||
* @param langid The language ID (LANGID)
|
||||
* @param codepage The code page value to set.
|
||||
* @return The position to the inserted structure, false (0) if failed.
|
||||
*/
|
||||
int add(LANGID langid, int codepage);
|
||||
|
||||
/**
|
||||
* Get the language ID given the positional index idx.
|
||||
*/
|
||||
* Get the language ID given the positional index idx.
|
||||
*/
|
||||
LANGID get_lang(int idx);
|
||||
|
||||
/**
|
||||
* Get the codepage value given the positional index idx.
|
||||
*/
|
||||
* Get the codepage value given the positional index idx.
|
||||
*/
|
||||
int get_codepage(int idx);
|
||||
|
||||
/**
|
||||
* Get the string pair mappings given the positional index idx.
|
||||
*/
|
||||
* Get the string pair mappings given the positional index idx.
|
||||
*/
|
||||
DefineList* get_strings(int idx);
|
||||
|
||||
/**
|
||||
* Given a language ID return the positional index that holds the
|
||||
* version_string_list struct. Actually, the codepage value is ignored.
|
||||
*/
|
||||
*/
|
||||
int find(LANGID lang_id, int codepage);
|
||||
|
||||
/**
|
||||
* Get the number of version_string_list objects stored in this list.
|
||||
*/
|
||||
* Get the number of version_string_list objects stored in this list.
|
||||
*/
|
||||
int getnum();
|
||||
};
|
||||
|
||||
|
@ -85,46 +85,46 @@ public:
|
|||
int SetKeyValue(LANGID lang_id, int codepage, TCHAR* AKeyName, TCHAR* AValue);
|
||||
|
||||
/**
|
||||
* Set the file version.
|
||||
*/
|
||||
* Set the file version.
|
||||
*/
|
||||
void SetFileVersion(int HighPart, int LowPart);
|
||||
|
||||
/**
|
||||
* Set the product version.
|
||||
*/
|
||||
* Set the product version.
|
||||
*/
|
||||
void SetProductVersion(int HighPart, int LowPart);
|
||||
|
||||
/**
|
||||
* Write the data out to the flat buffer 'strm'. Not sure where and how
|
||||
* it gets read back in though.
|
||||
*/
|
||||
* Write the data out to the flat buffer 'strm'. Not sure where and how
|
||||
* it gets read back in though.
|
||||
*/
|
||||
void ExportToStream(GrowBuf &strm, int Index);
|
||||
|
||||
/**
|
||||
* How many string tables are we storing in the m_ChildStringLists?
|
||||
*/
|
||||
* How many string tables are we storing in the m_ChildStringLists?
|
||||
*/
|
||||
int GetStringTablesCount();
|
||||
|
||||
/**
|
||||
* Given a positional index, get the Language ID associated with it.
|
||||
*/
|
||||
* Given a positional index, get the Language ID associated with it.
|
||||
*/
|
||||
LANGID GetLangID(int Index);
|
||||
|
||||
/**
|
||||
* Given a positional index, get the CodePage associated with it.
|
||||
*/
|
||||
* Given a positional index, get the CodePage associated with it.
|
||||
*/
|
||||
int GetCodePage(int Index);
|
||||
|
||||
/**
|
||||
* Given the language ID, codepage, and the 'keyname', return the
|
||||
* TCHAR* pointer to the value portion of the key-value pair.
|
||||
*
|
||||
* @param LangID The language ID.
|
||||
* @param codepage The codepage. (Not used.)
|
||||
* @param pKeyName The key name in the key-value pair of strings.
|
||||
* @return The value string associated with the key string. NULL
|
||||
* if not found.
|
||||
*/
|
||||
* Given the language ID, codepage, and the 'keyname', return the
|
||||
* TCHAR* pointer to the value portion of the key-value pair.
|
||||
*
|
||||
* @param LangID The language ID.
|
||||
* @param codepage The codepage. (Not used.)
|
||||
* @param pKeyName The key name in the key-value pair of strings.
|
||||
* @return The value string associated with the key string. NULL
|
||||
* if not found.
|
||||
*/
|
||||
TCHAR *FindKey(LANGID LangID, int codepage, const TCHAR *pKeyName);
|
||||
};
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ class CEXEBuild {
|
|||
int parseScript();
|
||||
int includeScript(const TCHAR *f, NStreamEncoding&enc);
|
||||
TCHAR* GetMacro(const TCHAR *macroname, TCHAR**macroend = 0);
|
||||
inline bool MacroExists(const TCHAR *macroname);
|
||||
bool MacroExists(const TCHAR *macroname) { return !!GetMacro(macroname); }
|
||||
int LoadLicenseFile(const TCHAR *file, TCHAR** pdata, const TCHAR *cmdname, WORD AnsiCP);
|
||||
#ifdef NSIS_FIX_DEFINES_IN_STRINGS
|
||||
void ps_addtoline(const TCHAR *str, GrowBuf &linedata, StringList &hist, bool bIgnoreDefines = false);
|
||||
|
@ -470,8 +470,6 @@ class CEXEBuild {
|
|||
const TCHAR* m_currentmacroname;
|
||||
GrowBuf m_macros;
|
||||
|
||||
StringList m_macro_entry;
|
||||
|
||||
UINT64 db_opt_save, db_opt_save_u, db_full_size, db_full_size_u;
|
||||
int db_comp_save, db_comp_save_u;
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
// NSIS Plug-In Callback Messages
|
||||
enum NSPIM
|
||||
{
|
||||
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
|
||||
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
|
||||
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
|
||||
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
|
||||
};
|
||||
|
||||
// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback()
|
||||
|
|
|
@ -451,9 +451,9 @@ TCHAR * NSISCALL my_GetTempFileName(TCHAR *buf, const TCHAR *dir)
|
|||
|
||||
BOOL NSISCALL myReadFile(HANDLE h, LPVOID buf, DWORD cb)
|
||||
{
|
||||
DWORD cbio;
|
||||
BOOL r = ReadFile(h, buf, cb, &cbio, NULL);
|
||||
return r && cb == cbio;
|
||||
DWORD cbio;
|
||||
BOOL r = ReadFile(h, buf, cb, &cbio, NULL);
|
||||
return r && cb == cbio;
|
||||
}
|
||||
|
||||
#ifdef NSIS_SUPPORT_MOVEONREBOOT
|
||||
|
|
187
Source/lang.h
187
Source/lang.h
|
@ -39,7 +39,7 @@ struct langstring {
|
|||
class LangStringList : public SortedStringListND<struct langstring>
|
||||
{
|
||||
public:
|
||||
/* Default constructor */
|
||||
/* Default constructor */
|
||||
LangStringList() : m_count(0) {}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ class LangStringList : public SortedStringListND<struct langstring>
|
|||
*/
|
||||
int add(const TCHAR *name, int *sn=0);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Gets the values in the langstring struct that is mapped to the string
|
||||
* 'name'. Sets sn, index, and uindex to -1 before looking for the
|
||||
* 'name'. If not found, -1 is returned. If found, then the values
|
||||
|
@ -64,91 +64,91 @@ class LangStringList : public SortedStringListND<struct langstring>
|
|||
* @param index [out] Set to index value in langstring.
|
||||
* @param uindex [out] Set to uindex value in langstring.
|
||||
* @param process [out] Set to process value in langstring.
|
||||
* @return The index into langstring array. -1 if not found.
|
||||
*/
|
||||
* @return The index into langstring array. -1 if not found.
|
||||
*/
|
||||
int get(const TCHAR *name, int *sn=0, int *index=0, int *uindex=0, int *process=0);
|
||||
|
||||
/**
|
||||
* Sets the values in the langstring struct that is in the position 'pos'.
|
||||
*
|
||||
* @param pos The langstring index into m_gr.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
/**
|
||||
* Sets the values in the langstring struct that is in the position 'pos'.
|
||||
*
|
||||
* @param pos The langstring index into m_gr.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
void set(int pos, int index=-1, int uindex=-1, int process=-1);
|
||||
|
||||
/**
|
||||
* Sets the values in the langstring struct that is mapped to the string
|
||||
* 'name'.
|
||||
*
|
||||
* @param name The string key to lookup langstring.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
/**
|
||||
* Sets the values in the langstring struct that is mapped to the string
|
||||
* 'name'.
|
||||
*
|
||||
* @param name The string key to lookup langstring.
|
||||
* @param index Value to set langstring[pos].index.
|
||||
* @param uindex Value to set langstring[pos].uindex.
|
||||
* @param process Value to set langstring[pos].process.
|
||||
*/
|
||||
void set(const TCHAR *name, int index, int uindex=-1, int process=-1);
|
||||
|
||||
/**
|
||||
* From the position index, get the pointer to the key string.
|
||||
* Basically, get the string referenced by langstring[pos].name.
|
||||
*
|
||||
* @param pos The position index.
|
||||
* @return The TCHAR* to the string referenced by pos.
|
||||
*/
|
||||
/**
|
||||
* From the position index, get the pointer to the key string.
|
||||
* Basically, get the string referenced by langstring[pos].name.
|
||||
*
|
||||
* @param pos The position index.
|
||||
* @return The TCHAR* to the string referenced by pos.
|
||||
*/
|
||||
const TCHAR *pos2name(int pos);
|
||||
|
||||
/**
|
||||
* From the index into the strings, get the pointer to the
|
||||
* key string. Note: the positional index into the storage of
|
||||
* key strings probably should not be exposed to the outside.
|
||||
*
|
||||
* @param name Index into the m_strings array.
|
||||
* @return The TCHAR* to the string referenced by name.
|
||||
*/
|
||||
/**
|
||||
* From the index into the strings, get the pointer to the
|
||||
* key string. Note: the positional index into the storage of
|
||||
* key strings probably should not be exposed to the outside.
|
||||
*
|
||||
* @param name Index into the m_strings array.
|
||||
* @return The TCHAR* to the string referenced by name.
|
||||
*/
|
||||
const TCHAR *offset2name(int name);
|
||||
|
||||
/**
|
||||
* Get the number of entries.
|
||||
*
|
||||
* @return The number of langstring entries.
|
||||
*/
|
||||
/**
|
||||
* Get the number of entries.
|
||||
*
|
||||
* @return The number of langstring entries.
|
||||
*/
|
||||
int getnum();
|
||||
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .index values via their difference (item1->index - item2->index).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .index values via their difference (item1->index - item2->index).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
static int compare_index(const void *item1, const void *item2);
|
||||
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
langstring *sort_index(int *num);
|
||||
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .uindex values via their difference (item1->uindex - item2->uindex).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
/**
|
||||
* Compare two langstring structs pointed by item1 and item2 by looking at
|
||||
* their .uindex values via their difference (item1->uindex - item2->uindex).
|
||||
*
|
||||
* @return 0 if equal, negative value if item1 is smaller, positive value
|
||||
* if item1 is bigger.
|
||||
*/
|
||||
static int compare_uindex(const void *item1, const void *item2);
|
||||
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
/**
|
||||
* Sorts the langstrings by their index. Then return the sorted array
|
||||
* via m_sortbuf. Warning: This function is not thread-safe!
|
||||
*
|
||||
* @param num [out] Set to the size of langstring items in the array.
|
||||
* @return The sorted langstring array via m_sortbuf.
|
||||
*/
|
||||
langstring *sort_uindex(int *num);
|
||||
|
||||
private:
|
||||
|
@ -168,30 +168,30 @@ class StringsArray
|
|||
public:
|
||||
StringsArray();
|
||||
|
||||
/**
|
||||
* Resizes the m_offsets so that the index num is valid.
|
||||
*
|
||||
* @param num New size.
|
||||
*/
|
||||
/**
|
||||
* Resizes the m_offsets so that the index num is valid.
|
||||
*
|
||||
* @param num New size.
|
||||
*/
|
||||
void resize(int num);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set the string 'str' at index idx. This class cannot really delete
|
||||
* strings. It can "overwrite" them in the sense that the string is no
|
||||
* longer referenceable via the index but they are never gone.
|
||||
*
|
||||
* @param idx The index position to set the string to.
|
||||
* @param str The string value to set.
|
||||
* @return If overwriting, the position in m_strings of the old string.
|
||||
*/
|
||||
*
|
||||
* @param idx The index position to set the string to.
|
||||
* @param str The string value to set.
|
||||
* @return If overwriting, the position in m_strings of the old string.
|
||||
*/
|
||||
int set(int idx, const TCHAR *str);
|
||||
|
||||
/**
|
||||
* Get the string at index 'idx'.
|
||||
*
|
||||
* @param idx The logical index to the string.
|
||||
* @return Returns the TCHAR* to the string.
|
||||
*/
|
||||
/**
|
||||
* Get the string at index 'idx'.
|
||||
*
|
||||
* @param idx The logical index to the string.
|
||||
* @return Returns the TCHAR* to the string.
|
||||
*/
|
||||
const TCHAR *get(int idx);
|
||||
|
||||
private:
|
||||
|
@ -305,17 +305,14 @@ enum {
|
|||
};
|
||||
|
||||
struct NLF {
|
||||
bool m_bLoaded; /* Is the table loaded? */
|
||||
TCHAR *m_szName; /* The language name */
|
||||
bool m_bLoaded; /* Is the table loaded? */
|
||||
TCHAR *m_szName; /* The language name */
|
||||
TCHAR *m_szFont;
|
||||
int m_iFontSize;
|
||||
unsigned int m_uCodePage; /* Code page associated with language. When
|
||||
* using Unicode, this value will be 1200.
|
||||
*/
|
||||
|
||||
bool m_bRTL; /* Is this a right-to-left language like
|
||||
Hebrew? */
|
||||
|
||||
* using Unicode, this value will be 1200.
|
||||
*/
|
||||
bool m_bRTL; /* Is this a right-to-left language like Hebrew? */
|
||||
TCHAR *m_szStrings[NLF_STRINGS];
|
||||
};
|
||||
|
||||
|
@ -324,7 +321,7 @@ struct NLF {
|
|||
* variables for that specific language.
|
||||
*/
|
||||
struct LanguageTable {
|
||||
LANGID lang_id; /* Windows Language ID identifier */
|
||||
LANGID lang_id; /* Windows Language ID identifier */
|
||||
|
||||
int dlg_offset;
|
||||
|
||||
|
|
|
@ -952,10 +952,6 @@ TCHAR* CEXEBuild::GetMacro(const TCHAR *macroname, TCHAR**macroend /*= 0*/)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
inline bool CEXEBuild::MacroExists(const TCHAR *macroname)
|
||||
{
|
||||
return !!GetMacro(macroname);
|
||||
}
|
||||
|
||||
int CEXEBuild::LoadLicenseFile(const TCHAR *file, TCHAR** pdata, const TCHAR *cmdname, WORD AnsiCP) // caller must free *pdata, even on error result
|
||||
{
|
||||
|
|
192
Source/strlist.h
192
Source/strlist.h
|
@ -44,74 +44,74 @@ public:
|
|||
/**
|
||||
* Adds a string to the StringList. If the string already exists in the
|
||||
* list, then it just returns the index of the found string.
|
||||
*
|
||||
*
|
||||
* @param str String to add.
|
||||
*
|
||||
*
|
||||
* @param case_sensitive If 0, search for whole string case insensitively.
|
||||
* If 1, then search for whole string case sensitively. If 2, then search
|
||||
* for just the end of the string match case sensitively. Basically it's
|
||||
* like searching for regexp('str$') in the list of string. If -1, then it
|
||||
* adds the string regardless of whether there is a match or not!
|
||||
*
|
||||
*
|
||||
* @return the index to the string in TCHARs.
|
||||
*/
|
||||
int add(const TCHAR *str, int case_sensitive);
|
||||
|
||||
/**
|
||||
* Search the StrinList for a string. If the string already exists in the
|
||||
* Search the StringList for a string. If the string already exists in the
|
||||
* list then it returns the index of the found string. Returns -1 on
|
||||
* failure.
|
||||
*
|
||||
* @param str String to search for.
|
||||
*
|
||||
*
|
||||
* @param case_sensitive If 0, search for whole string case insensitively.If
|
||||
* 1, then search for whole string case <b>sensitively</b>. If 2, then
|
||||
* search for just the <b>end of the string match</b>, case sensitively.
|
||||
* Basically it's like searching for regexp('str$') in the list of string.
|
||||
*
|
||||
* @param idx If not NULL, the *idx is set to the cardinal number of the
|
||||
* string. In other words, it tells you which nth string it is in the
|
||||
* list.
|
||||
*
|
||||
*
|
||||
* @param idx If not NULL, the *idx is set to the cardinal number of the
|
||||
* string. In other words, it tells you which nth string it is in the
|
||||
* list.
|
||||
*
|
||||
* @return the TCHAR index to the string (not necessarily the byte positional
|
||||
* offset). -1 if not found.
|
||||
*/
|
||||
* offset). -1 if not found.
|
||||
*/
|
||||
int find(const TCHAR *str, int case_sensitive, int *idx=NULL) const; // returns -1 if not found
|
||||
|
||||
/**
|
||||
* Delete the string at the positional index.
|
||||
*
|
||||
* @param pos The number of TCHARS to count from the beginning of the buffer
|
||||
* before the start of the string.
|
||||
*/
|
||||
* Delete the string at the positional index.
|
||||
*
|
||||
* @param pos The number of TCHARS to count from the beginning of the buffer
|
||||
* before the start of the string.
|
||||
*/
|
||||
void delbypos(int pos);
|
||||
void deleteall() { m_gr.resize(0); }
|
||||
|
||||
/**
|
||||
* Converts the string index to the positional TCHAR index. For example,
|
||||
* it gives the answer to which TCHAR position is the beginning of the
|
||||
* nth string in the list?
|
||||
*
|
||||
* @param idx The string index.
|
||||
*/
|
||||
* Converts the string index to the positional TCHAR index. For example,
|
||||
* it gives the answer to which TCHAR position is the beginning of the
|
||||
* nth string in the list?
|
||||
*
|
||||
* @param idx The string index.
|
||||
*/
|
||||
int idx2pos(int idx) const;
|
||||
|
||||
/**
|
||||
* Get the count of the number of strings in the list.
|
||||
* @return the number of string in the list.
|
||||
*/
|
||||
* Get the count of the number of strings in the list.
|
||||
* @return the number of string in the list.
|
||||
*/
|
||||
int getnum() const;
|
||||
|
||||
/**
|
||||
* Get the buffer straight as a const TCHAR pointer. Very unwise to use.
|
||||
* @return m_gr.m_s cast as a TCHAR*.
|
||||
*/
|
||||
* Get the buffer straight as a const TCHAR pointer. Very unwise to use.
|
||||
* @return m_gr.m_s cast as a TCHAR*.
|
||||
*/
|
||||
const TCHAR *get() const { return (const TCHAR*) m_gr.get(); }
|
||||
|
||||
/**
|
||||
* Get the buffer size (number of TCHARs).
|
||||
* @return The buffer size (number of TCHARs).
|
||||
*/
|
||||
* Get the buffer size (number of TCHARs).
|
||||
* @return The buffer size (number of TCHARs).
|
||||
*/
|
||||
int getcount() const { return m_gr.getlen() / sizeof(TCHAR); }
|
||||
|
||||
protected:
|
||||
|
@ -270,12 +270,12 @@ class SortedStringList
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a T position, it deletes it from the buffer. It will
|
||||
* move the rest of the Ts to fill its position.
|
||||
*
|
||||
* @param pos The position of the target for deletion in T* offsets.
|
||||
*/
|
||||
/**
|
||||
* Given a T position, it deletes it from the buffer. It will
|
||||
* move the rest of the Ts to fill its position.
|
||||
*
|
||||
* @param pos The position of the target for deletion in T* offsets.
|
||||
*/
|
||||
void delbypos(int pos)
|
||||
{
|
||||
T *db=(T *) m_gr.get();
|
||||
|
@ -479,41 +479,41 @@ class DefineList : public SortedStringList<struct define>
|
|||
int addn(const TCHAR *name, size_t maxvallen, const TCHAR *value); // maxvallen does not include \0
|
||||
void set(const TCHAR *name, const TCHAR *value=_T(""));
|
||||
|
||||
/**
|
||||
* This function returns the pointer to the .value TCHAR* that corresponds
|
||||
* to the name key.
|
||||
*
|
||||
* @param name The key to search with.
|
||||
*
|
||||
* @return The TCHAR* to the value portion of the define struct. If not
|
||||
* found, returns NULL.
|
||||
*/
|
||||
/**
|
||||
* This function returns the pointer to the .value TCHAR* that corresponds
|
||||
* to the name key.
|
||||
*
|
||||
* @param name The key to search with.
|
||||
*
|
||||
* @return The TCHAR* to the value portion of the define struct. If not
|
||||
* found, returns NULL.
|
||||
*/
|
||||
TCHAR *find(const TCHAR *name);
|
||||
|
||||
/**
|
||||
* This function deletes the define struct corresponding to the key 'str'.
|
||||
*
|
||||
* @return Returns 0 on success, 1 otherwise
|
||||
*/
|
||||
/**
|
||||
* This function deletes the define struct corresponding to the key 'str'.
|
||||
*
|
||||
* @return Returns 0 on success, 1 otherwise
|
||||
*/
|
||||
int del(const TCHAR *str);
|
||||
|
||||
/**
|
||||
* This function returns the number of define structs in the sorted array.
|
||||
*/
|
||||
/**
|
||||
* This function returns the number of define structs in the sorted array.
|
||||
*/
|
||||
int getnum();
|
||||
|
||||
/**
|
||||
* Get the .name string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .name.
|
||||
*/
|
||||
/**
|
||||
* Get the .name string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .name.
|
||||
*/
|
||||
TCHAR *getname(int num);
|
||||
|
||||
/**
|
||||
* Get the .value string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .value.
|
||||
*/
|
||||
/**
|
||||
* Get the .value string of the (num)th define struct in the sorted array.
|
||||
*
|
||||
* @return Returns 0 if not found, otherwise the pointer to the .value.
|
||||
*/
|
||||
TCHAR *getvalue(int num);
|
||||
};
|
||||
|
||||
|
@ -540,46 +540,46 @@ class FastStringList : public SortedStringListND<struct string_t>
|
|||
void operator=(const FastStringList&);
|
||||
|
||||
public:
|
||||
/* Empty constructor */
|
||||
/* Empty constructor */
|
||||
FastStringList() {} // VC6 complains otherwise
|
||||
|
||||
/* Empty virtual destructor */
|
||||
/* Empty virtual destructor */
|
||||
virtual ~FastStringList() {}
|
||||
|
||||
/**
|
||||
* Adds name to sorted array and returns the TCHAR* offset of m_strings
|
||||
* where it is stored.
|
||||
*
|
||||
* @param name The string to store.
|
||||
*
|
||||
* @param case_sensitive Should we store this case sensitively or not?
|
||||
* Setting case_sensitive to -1 will cause it to be case sensitive and
|
||||
* always overwrite. (Weird bad behavior).
|
||||
*
|
||||
* @return The TCHAR* offset of name in m_string as an int.
|
||||
*/
|
||||
/**
|
||||
* Adds name to sorted array and returns the TCHAR* offset of m_strings
|
||||
* where it is stored.
|
||||
*
|
||||
* @param name The string to store.
|
||||
*
|
||||
* @param case_sensitive Should we store this case sensitively or not?
|
||||
* Setting case_sensitive to -1 will cause it to be case sensitive and
|
||||
* always overwrite. (Weird bad behavior).
|
||||
*
|
||||
* @return The TCHAR* offset of name in m_string as an int.
|
||||
*/
|
||||
int add(const TCHAR *name, int case_sensitive=0);
|
||||
|
||||
/**
|
||||
* Get the buffer that contains the list of the strings in the order
|
||||
* in which they were added.
|
||||
*
|
||||
* @return The pointer to m_strings as a TCHAR*.
|
||||
*/
|
||||
/**
|
||||
* Get the buffer that contains the list of the strings in the order
|
||||
* in which they were added.
|
||||
*
|
||||
* @return The pointer to m_strings as a TCHAR*.
|
||||
*/
|
||||
TCHAR *get() const;
|
||||
|
||||
/**
|
||||
* The size of the collection of m_strings as a count of TCHARs.
|
||||
*
|
||||
* @return the size of m_strings as count of TCHARs.
|
||||
*/
|
||||
int getcount() const;
|
||||
/**
|
||||
* The size of the collection of m_strings as a count of TCHARs.
|
||||
*
|
||||
* @return the size of m_strings as count of TCHARs.
|
||||
*/
|
||||
int getcount() const;
|
||||
|
||||
/**
|
||||
* The number of strings stored in the sorted array.
|
||||
*
|
||||
* @return The number of strings stored.
|
||||
*/
|
||||
/**
|
||||
* The number of strings stored in the sorted array.
|
||||
*
|
||||
* @return The number of strings stored.
|
||||
*/
|
||||
int getnum() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,20 +31,20 @@ struct uservarstring {
|
|||
class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
||||
{
|
||||
public:
|
||||
/* Default constructor */
|
||||
/* Default constructor */
|
||||
UserVarsStringList() : m_index(0) {}
|
||||
|
||||
/* Destructor */
|
||||
/* Destructor */
|
||||
virtual ~UserVarsStringList() {}
|
||||
|
||||
/**
|
||||
* Adds a name to the UserVarsStringList. Sets reference count to
|
||||
* ref_count.
|
||||
*
|
||||
* @param name The User variable string to store.
|
||||
* @param ref_count The reference count to store. Default is 0.
|
||||
* @return The index of the added variable string.
|
||||
*/
|
||||
/**
|
||||
* Adds a name to the UserVarsStringList. Sets reference count to
|
||||
* ref_count.
|
||||
*
|
||||
* @param name The User variable string to store.
|
||||
* @param ref_count The reference count to store. Default is 0.
|
||||
* @return The index of the added variable string.
|
||||
*/
|
||||
int add(const TCHAR *name, int ref_count = 0 )
|
||||
{
|
||||
int pos=SortedStringListND<struct uservarstring>::add(name);
|
||||
|
@ -61,15 +61,15 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the index of the string that matches 'name.'
|
||||
*
|
||||
* @param name The name of the string to search for.
|
||||
* @param n_chars If -1, match entire string, otherwise compare only
|
||||
* n_chars worth of characters.
|
||||
* @return The index position of the structure where structure.name ==
|
||||
* name.
|
||||
*/
|
||||
/**
|
||||
* Get the index of the string that matches 'name.'
|
||||
*
|
||||
* @param name The name of the string to search for.
|
||||
* @param n_chars If -1, match entire string, otherwise compare only
|
||||
* n_chars worth of characters.
|
||||
* @return The index position of the structure where structure.name ==
|
||||
* name.
|
||||
*/
|
||||
int get(const TCHAR *name, int n_chars = -1) const
|
||||
{
|
||||
int v = SortedStringListND<struct uservarstring>::find(name, n_chars);
|
||||
|
@ -77,22 +77,22 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return (((struct uservarstring*) m_gr.get())[v].index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count of strings.
|
||||
*
|
||||
* @return The count of strings.
|
||||
*/
|
||||
/**
|
||||
* Get count of strings.
|
||||
*
|
||||
* @return The count of strings.
|
||||
*/
|
||||
int getnum() const
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the index of the structure, return the reference count.
|
||||
*
|
||||
* @return The reference count of the nth uservarstring structure.
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
/**
|
||||
* Given the index of the structure, return the reference count.
|
||||
*
|
||||
* @return The reference count of the nth uservarstring structure.
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
int get_reference(int idx) const
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
|
@ -100,12 +100,12 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return (((struct uservarstring*) m_gr.get())[pos].reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the index of the structure, increment the reference count.
|
||||
*
|
||||
* @return The previous reference count (before the increment).
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
/**
|
||||
* Given the index of the structure, increment the reference count.
|
||||
*
|
||||
* @return The previous reference count (before the increment).
|
||||
* If not found, returns -1.
|
||||
*/
|
||||
int inc_reference(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
|
@ -113,13 +113,13 @@ class UserVarsStringList : public SortedStringListND<struct uservarstring>
|
|||
return ((struct uservarstring*) m_gr.get())[pos].reference++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the index of the structure, return the string value
|
||||
* of the name.
|
||||
*
|
||||
* @return String value of the name as TCHAR*.
|
||||
* If not found, returns NULL.
|
||||
*/
|
||||
/**
|
||||
* Given the index of the structure, return the string value
|
||||
* of the name.
|
||||
*
|
||||
* @return String value of the name as TCHAR*.
|
||||
* If not found, returns NULL.
|
||||
*/
|
||||
TCHAR *idx2name(int idx)
|
||||
{
|
||||
int pos=get_internal_idx(idx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue