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