diff --git a/uppsrc/Core/Format.h b/uppsrc/Core/Format.h index d395609ac..e574e59a4 100644 --- a/uppsrc/Core/Format.h +++ b/uppsrc/Core/Format.h @@ -26,8 +26,8 @@ template<> inline String AsString(const short& a) { return FormatInteg template<> inline String AsString(const unsigned short& a) { return FormatUnsigned(a); } template<> inline String AsString(const int& a) { return FormatInteger(a); } template<> inline String AsString(const unsigned int& a) { return FormatUnsigned(a); } -template<> inline String AsString(const long& a) { return FormatInteger(a); } -template<> inline String AsString(const unsigned long& a) { return FormatUnsigned(a); } +template<> inline String AsString(const long& a) { return FormatInt64(a); } +template<> inline String AsString(const unsigned long& a) { return Format64(a); } template<> inline String AsString(const double& a) { return FormatDouble(a); } template<> inline String AsString(const float& a) { return FormatDouble(a); } //template<> inline String AsString(const bool& a) { return FormatBool(a); } // TRC: moved to String.h by CXL diff --git a/uppsrc/Core/StrUtil.cpp b/uppsrc/Core/StrUtil.cpp index 81e29d611..0bed5bf5d 100644 --- a/uppsrc/Core/StrUtil.cpp +++ b/uppsrc/Core/StrUtil.cpp @@ -88,6 +88,11 @@ int CharFilterCrLf(int c) return c == '\r' || c == '\n' ? c : 0; } +int CharFilterNoCrLf(int c) +{ + return c != '\r' && c != '\n' ? c : 0; +} + String Filter(const char *s, int (*filter)(int)) { String result; diff --git a/uppsrc/Core/Stream.cpp b/uppsrc/Core/Stream.cpp index c43d63078..156366d51 100644 --- a/uppsrc/Core/Stream.cpp +++ b/uppsrc/Core/Stream.cpp @@ -580,7 +580,6 @@ void Stream::Pack(bool& a, bool& b) { bool h = false; Pack(a, b, h, h, h, h, h, h); } -#if 1 Stream& Stream::operator%(bool& d) { SerializeRaw((byte *)&d, 1); @@ -631,13 +630,19 @@ Stream& Stream::operator%(unsigned int& d) Stream& Stream::operator%(long& d) { - SerializeRaw((dword *)&d, 1); + uint32 x = (uint32)d; + SerializeRaw(&x, 1); + if(IsLoading()) + d = (long)x; return *this; } Stream& Stream::operator%(unsigned long& d) { - SerializeRaw((dword *)&d, 1); + uint32 x = (uint32)d; + SerializeRaw(&x, 1); + if(IsLoading()) + d = (unsigned long)x; return *this; } @@ -665,93 +670,6 @@ Stream& Stream::operator%(uint64& d) return *this; } -#else - -Stream& Stream::operator%(bool& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(char& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(signed char& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(unsigned char& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(short& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(unsigned short& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(int& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(unsigned int& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(long& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(unsigned long& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(float& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(double& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(int64& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} - -Stream& Stream::operator%(uint64& d) -{ - SerializeRaw((byte *)&d, sizeof(d)); - return *this; -} -#endif - Stream& Stream::operator%(String& s) { if(IsError()) return *this; diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index f3e600302..1b0872c37 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -779,6 +779,7 @@ int CharFilterInt(int c); int CharFilterDouble(int c); int CharFilterDefaultToUpperAscii(int c); int CharFilterCrLf(int c); +int CharFilterNoCrLf(int c); String Filter(const char *s, int (*filter)(int)); String FilterWhile(const char *s, int (*filter)(int)); diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 40be3d080..e84ce3753 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -820,36 +820,51 @@ void Ide::ContextGoto() if(id.GetCount() == 0) return; Vector scope; - for(int i = 0; i < type.GetCount(); i++) { - Index done; - String r; - if(GetIdScope(r, type[i], id, done)) - scope.Add(r); + bool istype = false; + if(xp.GetCount() == 0) { // 'String' + String t = Qualify(CodeBase(), parser.current_scope, id); + if(CodeBase().Find(t) >= 0) { + scope.Add(t); + istype = true; + } } - + if(xp.GetCount() == 1 && iscib(*xp[0])) { // 'Vector::Iterator' + String t = Qualify(CodeBase(), parser.current_scope, xp[0] + "::" + id); + if(CodeBase().Find(t) >= 0) { + scope.Add(t); + istype = true; + } + } + + if(scope.GetCount() == 0) + for(int i = 0; i < type.GetCount(); i++) { // 'x.attr' + Index done; + String r; + if(GetIdScope(r, type[i], id, done)) + scope.Add(r); + } if(scope.GetCount() == 0) { Index done; String r; - if(GetIdScope(r, "", id, done)) + if(GetIdScope(r, "", id, done)) // global scope.Add(r); - else { - String t = Qualify(CodeBase(), parser.current_scope, id); - if(CodeBase().Find(t) < 0) - return; - scope.Add(t); - } } if(scope.GetCount() == 0) return; - q = CodeBase().Find(scope[0]); - if(q < 0) - return; - const Array& n = CodeBase()[q]; - q = FindName(n, id); - if(q >= 0) - JumpToDefinition(n, q); + for(int j = 0; j < scope.GetCount(); j++) { + q = CodeBase().Find(scope[j]); + if(q >= 0) { + const Array& n = CodeBase()[q]; + for(int i = 0; i < n.GetCount(); i++) { + if(n[i].IsType() == istype && n[i].name == id) { + JumpToDefinition(n, i); + return; + } + } + } + } } void Ide::JumpToDefinition(const Array& n, int q) diff --git a/uppsrc/ide/ide.lay b/uppsrc/ide/ide.lay index 733617227..b7a42edb7 100644 --- a/uppsrc/ide/ide.lay +++ b/uppsrc/ide/ide.lay @@ -52,10 +52,10 @@ LAYOUT(CustomLayout, 608, 410) END_LAYOUT LAYOUT(RunLayout, 410, 144) - ITEM(Label, dv___0, SetLabel(t_("&Working directory:")).LeftPosZ(4, 100).TopPosZ(28, 19)) - ITEM(EditString, dir, HSizePosZ(106, 4).TopPosZ(28, 19)) - ITEM(Label, dv___2, SetLabel(t_("&Program arguments:")).LeftPosZ(4, 100).TopPosZ(4, 19)) + ITEM(Label, dv___0, SetLabel(t_("&Program arguments:")).LeftPosZ(4, 100).TopPosZ(4, 19)) ITEM(WithDropChoice, arg, HSizePosZ(106, 4).TopPosZ(4, 19)) + ITEM(Label, dv___2, SetLabel(t_("&Working directory:")).LeftPosZ(4, 100).TopPosZ(28, 19)) + ITEM(EditString, dir, HSizePosZ(106, 4).TopPosZ(28, 19)) ITEM(Label, dv___4, SetLabel(t_("STDOUT file:")).LeftPosZ(4, 100).TopPosZ(52, 19)) ITEM(WithDropChoice, stdout_file, HSizePosZ(106, 4).TopPosZ(52, 19)) ITEM(Label, dv___6, SetLabel(t_("Standard output:")).LeftPosZ(4, 100).TopPosZ(76, 19)) diff --git a/uppsrc/ide/idebar.cpp b/uppsrc/ide/idebar.cpp index 48f185184..6a32fc16b 100644 --- a/uppsrc/ide/idebar.cpp +++ b/uppsrc/ide/idebar.cpp @@ -439,9 +439,9 @@ void Ide::DebugMenu(Bar& menu) } void Ide::BrowseMenu(Bar& menu) { - menu.AddMenu(AK_TOGGLEINDEX, IdeImg::index(), THISBACK1(ToggleNavigator, AssistEditor::NAV_INDEX)) + menu.AddMenu(AK_TOGGLEINDEX, IdeImg::index(), THISBACK1(ToggleNavigator, (int)AssistEditor::NAV_INDEX)) .Check(editor.IsIndex()); - menu.AddMenu(AK_NAVIGATOR, IdeImg::Navigator(), THISBACK1(ToggleNavigator, AssistEditor::NAV_BROWSER)) + menu.AddMenu(AK_NAVIGATOR, IdeImg::Navigator(), THISBACK1(ToggleNavigator, (int)AssistEditor::NAV_BROWSER)) .Check(editor.IsBrowser()); if(editor.IsIndex()) menu.Add(AK_SEARCHINDEX, THISBACK(SearchIndex)); diff --git a/uppsrc/plugin/pcre/RegExp.h b/uppsrc/plugin/pcre/RegExp.h index 3a0b61866..b18f5bcd0 100644 --- a/uppsrc/plugin/pcre/RegExp.h +++ b/uppsrc/plugin/pcre/RegExp.h @@ -10,6 +10,7 @@ public: PARTIAL = PCRE_PARTIAL, /* compile options */ UNICODE = PCRE_UTF8, + UTF8 = PCRE_UTF8, CASELESS = PCRE_CASELESS, MULTILINE = PCRE_MULTILINE, UNGREEDY = PCRE_UNGREEDY @@ -29,9 +30,9 @@ private: int execute_options; public: - RegExp(int options = UNICODE); - RegExp(const char * p, int options = UNICODE); - RegExp(const String &p, int options = UNICODE); + RegExp(int options = UTF8); + RegExp(const char * p, int options = UTF8); + RegExp(const String &p, int options = UTF8); ~RegExp(); void Clear(bool freemem = false); diff --git a/uppsrc/plugin/pcre/init b/uppsrc/plugin/pcre/init new file mode 100644 index 000000000..45ebd60be --- /dev/null +++ b/uppsrc/plugin/pcre/init @@ -0,0 +1,3 @@ +#ifndef _plugin_pcre_icpp_init_stub +#define _plugin_pcre_icpp_init_stub +#endif diff --git a/uppsrc/plugin/pcre/lib.cpp b/uppsrc/plugin/pcre/lib.cpp new file mode 100644 index 000000000..ca200ad2f --- /dev/null +++ b/uppsrc/plugin/pcre/lib.cpp @@ -0,0 +1,31 @@ +#define SUPPORT_UTF8 +#define SUPPORT_UCP +#define HAVE_CONFIG_H + +#ifdef COMPILER_GCC +#define PCRE_STATIC +#endif + +#include "lib/pcre_chartables.c" +#include "lib/pcre_compile.c" +#undef PSSTART +#undef PSEND +#undef NLBLOCK +#include "lib/pcre_config.c" +#include "lib/pcre_dfa_exec.c" +#include "lib/pcre_exec.c" +#include "lib/pcre_fullinfo.c" +#include "lib/pcre_get.c" +#include "lib/pcre_globals.c" +#include "lib/pcre_info.c" +#include "lib/pcre_maketables.c" +#include "lib/pcre_newline.c" +#include "lib/pcre_ord2utf8.c" +#include "lib/pcre_refcount.c" +#include "lib/pcre_study.c" +#include "lib/pcre_tables.c" +#include "lib/pcre_try_flipped.c" +#include "lib/pcre_ucp_searchfuncs.c" +#include "lib/pcre_valid_utf8.c" +#include "lib/pcre_version.c" +#include "lib/pcre_xclass.c" diff --git a/uppsrc/plugin/pcre/pcre.upp b/uppsrc/plugin/pcre/pcre.upp index bdb5d5ff8..9c5df43ab 100644 --- a/uppsrc/plugin/pcre/pcre.upp +++ b/uppsrc/plugin/pcre/pcre.upp @@ -1,37 +1,8 @@ -options - "-DSUPPORT_UTF8 -DSUPPORT_UCP -DHAVE_CONFIG_H", - -Ilib; - -options(GCC) -DPCRE_STATIC; +description "PCRE regular expressions library"; file Pcre.h, RegExp.h, RegExp.cpp, - PCRE readonly separator, - lib\config.h, - lib\pcre.h, - lib\pcre_chartables.c, - lib\pcre_compile.c, - lib\pcre_config.c, - lib\pcre_dfa_exec.c, - lib\pcre_exec.c, - lib\pcre_fullinfo.c, - lib\pcre_get.c, - lib\pcre_globals.c, - lib\pcre_info.c, - lib\pcre_internal.h, - lib\pcre_maketables.c, - lib\pcre_newline.c, - lib\pcre_ord2utf8.c, - lib\pcre_refcount.c, - lib\pcre_study.c, - lib\pcre_tables.c, - lib\pcre_try_flipped.c, - lib\pcre_ucp_searchfuncs.c, - lib\pcre_valid_utf8.c, - lib\pcre_version.c, - lib\pcre_xclass.c, - lib\ucp.h, - lib\ucpinternal.h, - lib\ucptable.h; + lib.cpp; +