Modified PCRE to include .c files, fixed serialization of unsinged long, long (now always as 32 bit values)

git-svn-id: svn://ultimatepp.org/upp/trunk@525 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2008-10-13 16:02:48 +00:00
parent 6163754339
commit cedd4340c9
11 changed files with 97 additions and 152 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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));

View file

@ -820,36 +820,51 @@ void Ide::ContextGoto()
if(id.GetCount() == 0)
return;
Vector<String> scope;
for(int i = 0; i < type.GetCount(); i++) {
Index<String> 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<String>::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<String> done;
String r;
if(GetIdScope(r, type[i], id, done))
scope.Add(r);
}
if(scope.GetCount() == 0) {
Index<String> 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<CppItem>& 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<CppItem>& 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<CppItem>& n, int q)

View file

@ -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<EditString>, 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<EditString>, stdout_file, HSizePosZ(106, 4).TopPosZ(52, 19))
ITEM(Label, dv___6, SetLabel(t_("Standard output:")).LeftPosZ(4, 100).TopPosZ(76, 19))

View file

@ -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));

View file

@ -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);

3
uppsrc/plugin/pcre/init Normal file
View file

@ -0,0 +1,3 @@
#ifndef _plugin_pcre_icpp_init_stub
#define _plugin_pcre_icpp_init_stub
#endif

View file

@ -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"

View file

@ -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;