ide: Removed Web package

git-svn-id: svn://ultimatepp.org/upp/trunk@5311 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-09-03 11:24:25 +00:00
parent b7447a2a26
commit d6b56c7712
18 changed files with 1684 additions and 1595 deletions

View file

@ -127,6 +127,22 @@ void TopicEditor::ExportGroupPdf()
}
}
String MakeHtml(const char *title, String css, String body)
{
String h =
"<HTML>\r\n"
"<HEAD>\t\n"
"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\t\n"
"<META NAME=\"Generator\" CONTENT=\"U++ HTML Package\">\t\n"
"<TITLE>" + String(title) + "</TITLE>\r\n"
;
if(!IsNull(css))
h << "<STYLE TYPE=\"text/css\"><!--\r\n"
<< css << "\r\n-->\r\n</STYLE>\r\n";
h << "</HEAD><BODY>" << body << "</BODY>";
return h;
}
void TopicEditor::ExportHTML()
{
String path = SelectFileSaveAs("HTML files\t*.html\nAll files\t*.*");
@ -136,7 +152,7 @@ void TopicEditor::ExportHTML()
String html = EncodeHtml(editor.Get(), css,
VectorMap<String, String>(), VectorMap<String, String>(),
GetFileFolder(path));
SaveFile(path, HtmlHeader((String)~title, AsCss(css)) / html);
SaveFile(path, MakeHtml((String)~title, AsCss(css), html));
// SaveFile(ForceExt(path, ".css"), AsCss(css));
}
@ -154,7 +170,7 @@ void TopicEditor::ExportGroupHTML()
String html = EncodeHtml(ParseQTF(t.text), css,
VectorMap<String, String>(), VectorMap<String, String>(),
dir);
html = HtmlHeader(t.title, AsCss(css)) / html;
html = MakeHtml(t.title, AsCss(css), html);
String path = AppendFileName(dir, GetFileTitle(ff.GetName()) + ".html");
if(LoadFile(path) != html)
SaveFile(path, html);

File diff suppressed because it is too large Load diff

View file

@ -63,7 +63,7 @@ struct MakeBuild {
const TargetMode& GetTargetMode();
Index<String> PackageConfig(const Workspace& wspc, int package, const VectorMap<String, String>& bm,
String mainparam, Host& host, Builder& b, String *target = NULL);
bool SyncHostFiles(RemoteHost& host);
// bool SyncHostFiles(RemoteHost& host);
One<Host> CreateHost(bool sync_files);
One<Builder> CreateBuilder(Host *host);
String OutDir(const Index<String>& cfg, const String& package,

View file

@ -146,7 +146,7 @@ int Console::Flush()
return !running ? -1 : done_output ? 1 : 0;
}
int Console::Execute(One<SlaveProcess> p, const char *command, Stream *out, bool q)
int Console::Execute(One<AProcess> p, const char *command, Stream *out, bool q)
{
Wait();
if(!Run(p, command, out, q, 0))
@ -159,12 +159,14 @@ int Console::Execute(const char *command, Stream *out, const char *envptr, bool
{
try {
Wait();
return Execute(StartProcess(command, envptr, REMOTE_TIMEOUT), command, out, q);
One<AProcess> p;
if(p.Create<LocalProcess>().Start(command, envptr))
return Execute(p, command, out, q);
}
catch(Exc e) {
ProcessEvents();
return Null;
}
ProcessEvents();
return Null;
}
int Console::AllocSlot()
@ -188,17 +190,18 @@ bool Console::Run(const char *cmdline, Stream *out, const char *envptr, bool qui
{
try {
Wait(slot);
One<SlaveProcess> sproc = StartProcess(cmdline, envptr, REMOTE_TIMEOUT);
return !!sproc && Run(sproc, cmdline, out, quiet, slot, key, blitz_count);
One<AProcess> sproc;
return sproc.Create<LocalProcess>().Start(cmdline, envptr) &&
Run(sproc, cmdline, out, quiet, slot, key, blitz_count);
}
catch(Exc e) {
Append(e);
ProcessEvents();
return false;
}
ProcessEvents();
return false;
}
bool Console::Run(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
bool Console::Run(One<AProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
{
if(!process) {
if(verbosebuild)
@ -300,7 +303,8 @@ void Console::Kill(int islot)
{
Slot& slot = processes[islot];
if(slot.process) {
slot.process->Kill();
if(slot.process->IsRunning())
slot.process->Kill();
slot.exitcode = slot.process->GetExitCode();
if(slot.exitcode != 0 && !IsNull(slot.key))
error_keys.Add(slot.key);

View file

@ -146,7 +146,7 @@ int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *env
return the_ide ? the_ide->IdeConsoleExecuteWithInput(cmdline, out, envptr, quiet) : -1;
}
int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet)
int IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecute(process, cmdline, out, quiet) : -1;
}
@ -161,7 +161,7 @@ bool IdeConsoleRun(const char *cmdline, Stream *out, const char *envptr, bool qu
return the_ide && the_ide->IdeConsoleRun(cmdline, out, envptr, quiet, slot, key, blitz_count);
}
bool IdeConsoleRun(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
bool IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
{
return the_ide && the_ide->IdeConsoleRun(process, cmdline, out, quiet, slot, key, blitz_count);
}

View file

@ -2,7 +2,7 @@
#define COMMON_H
#include <Esc/Esc.h>
#include <Web/Web.h>
// #include <Web/Web.h>
#include <coff/binobj/binobj.h>
#include <plugin/bz2/bz2.h>
@ -45,10 +45,10 @@ public:
virtual String IdeGetOneFile() const = 0;
virtual int IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false) = 0;
virtual int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet) = 0;
virtual int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false) = 0;
virtual int IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false) = 0;
virtual int IdeConsoleAllocSlot() = 0;
virtual bool IdeConsoleRun(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1) = 0;
virtual bool IdeConsoleRun(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1) = 0;
virtual bool IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1) = 0;
virtual void IdeConsoleFlush() = 0;
virtual void IdeConsoleBeginGroup(String group) = 0;
virtual void IdeConsoleEndGroup() = 0;
@ -95,10 +95,10 @@ bool IdeIsBuilding();
String IdeGetOneFile();
int IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet);
int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
int IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
int IdeConsoleAllocSlot();
bool IdeConsoleRun(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
bool IdeConsoleRun(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
bool IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
void IdeConsoleFlush();
void IdeConsoleBeginGroup(String group);
void IdeConsoleEndGroup();

View file

@ -2,7 +2,6 @@ description "TheIDE - common library\377B";
uses
Esc,
Web,
coff/binobj,
plugin/bz2;

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@ struct Host {
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count) = 0;
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count) = 0;
virtual bool Wait() = 0;
virtual One<SlaveProcess> StartProcess(const char *cmdline) = 0;
virtual One<AProcess> StartProcess(const char *cmdline) = 0;
virtual void Launch(const char *cmdline, bool console = false) = 0;
virtual void AddFlags(Index<String>& cfg) = 0;
@ -56,11 +56,12 @@ struct LocalHost : Host {
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count);
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
virtual bool Wait();
virtual One<SlaveProcess> StartProcess(const char *cmdline);
virtual One<AProcess> StartProcess(const char *cmdline);
virtual void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
};
/*
struct RemoteHost : Host {
String host;
int port;
@ -91,9 +92,10 @@ struct RemoteHost : Host {
virtual bool Run(const char *cmdline, int slot, String key, int blitz_count);
virtual bool Run(const char *cmdline, Stream& out, int slot, String key, int blitz_count);
virtual bool Wait();
virtual One<SlaveProcess> StartProcess(const char *cmdline);
virtual One<AProcess> StartProcess(const char *cmdline);
virtual void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
String RemoteExec(String cmd);
};
*/

View file

@ -69,7 +69,7 @@ struct Dbg : Debugger, ParentCtrl {
virtual bool IsFinished();
One<Host> host;
One<SlaveProcess> dbg;
One<AProcess> dbg;
FrameBottom<WithRegistersLayout<StaticRect> > regs;

View file

@ -1,242 +1,242 @@
#ifndef _ide_Debuggers_Gdb_MI2_h_
#define _ide_Debuggers_Gdb_MI2_h_
#include "MIValue.h"
class WatchEdit : public LineEdit
{
virtual void HighlightLine(int line, Vector<Highlight>& h, int pos);
};
#define LAYOUTFILE <ide/Debuggers/Gdb_MI2.lay>
#include <CtrlCore/lay.h>
class Gdb_MI2 : public Debugger, public ParentCtrl
{
private:
One<Host> host;
One<SlaveProcess> dbg;
bool firstRun;
// the disassembler window
DbgDisas disas;
// the registers pane
#ifdef CPU_64
FrameBottom<WithGdb_MI2Registers64Layout<StaticRect> > regs;
#define RPREFIX "r"
#else
FrameBottom<WithGdb_MI2RegistersLayout<StaticRect> > regs;
#define RPREFIX "e"
#endif
// the quick watch dialog
WithGdb_MI2QuickwatchLayout<TopWindow> quickwatch;
EditString watchedit;
DropList frame;
DropList threadSelector;
TabCtrl tab;
ArrayCtrl locals;
ArrayCtrl watches;
ArrayCtrl autos;
// explorer stuffs -- just starting
ArrayCtrl explorer;
EditString explorerExprEdit;
Button explorerBackBtn, explorerForwardBtn;
StaticRect explorerPane;
void onExploreExpr(ArrayCtrl *what = NULL);
void onExplorerChild();
void onExplorerBack();
void onExplorerForward();
void ExplorerMenu(Bar& bar);
void doExplore(String const &expr, String var, bool isChild, bool appendHistory);
Index<String> explorerHistoryExpressions;
Index<String> explorerHistoryVars;
Vector<bool> explorerHistoryChilds;
int explorerHistoryPos;
Vector<String> explorerChildVars;
String explorerParentExpr;
Label dlock;
Vector<String> regname;
Vector<Label *> reglbl;
void AddReg(const char *reg, Label *lbl) { regname.Add(reg); reglbl.Add(lbl); }
// find free space at right of tabs (we should probably add something to TabCtrl for that..)
int FindTabsRight(void);
// running flags -- setup by ReadGdb function when async input is catched
bool started;
bool stopped;
MIValue stopReason;
// read debugger output analyzing command responses
// and async output
MIValue ParseGdb(String const &s, bool wait = true);
MIValue ReadGdb(bool wait = true);
// sends an MI command and get answer back
MIValue MICmd(const char *cmdLine);
// format breakpoint line from ide file and line
String BreakPos(String const &file, int line);
// get breakpoints info
MIValue GetBreakpoints(void);
MIValue GetBreakpoint(int id);
MIValue GetBreakPoint(const char *file, int line);
// try to set a breakpoint - returns false if no code there
bool TryBreak(adr_t addr, bool temp);
bool TryBreak(String const &file, int line, bool temp);
// set breakpoint
MIValue InsertBreakpoint(const char *file, int line);
// local variable names -- used to synch ide locals with internal GDB variables
Index<String>localVarNames;
// stored local variable expressions, values and types
// just changed variables gets re-updated from GDB
// on frame change, all values are wiped and re-read from GDB
Vector<String>localVarTypes;
Index<String>localVarExpressions;
Vector<String>localVarValues;
// stored watches expressions, values and types
Index<String>watchesNames;
Vector<String>watchesTypes;
Index<String>watchesExpressions;
Vector<String>watchesValues;
// stored autos expressions, values and types
String autoLine;
Index<String>autosNames;
Vector<String>autosTypes;
Index<String>autosExpressions;
Vector<String>autosValues;
// update variables on demand (locals, watches....)
void UpdateVars(void);
// update local variables on demand
void UpdateLocalVars(void);
// update stored watches values on demand
void UpdateWatches(void);
// update stored auto values on demand
void UpdateAutos(void);
// logs frame data on console
void LogFrame(String const &msg, MIValue &frame);
// check for stop reason
void CheckStopReason(void);
// stop all running threads and re-select previous current thread
void StopAllThreads(void);
// single step command handler
void Step(const char *cmd);
// run to command for menu -- just removes return value
void doRunTo(void) { RunTo(); }
// setup ide cursor based on disassembler one
void DisasCursor();
// reset ide default cursor image when disassembler loose focus
void DisasFocus();
// sync disassembler pane
void SyncDisas(MIValue &fInfo, bool fr);
// sync local variables pane
void SyncLocals(void);
// sync watches treectrl
void SyncWatches();
// sync auto vars treectrl
void SyncAutos();
// sync data tabs, depending on which tab is shown
void SyncData();
// sync ide display with breakpoint position
void SyncIde(bool frame = false);
// watches arrayctrl key handling
bool Key(dword key, int count);
// create a string representation of frame given its info and args
String FormatFrame(MIValue &fInfo, MIValue &fArgs);
// re-fills frame's droplist when dropping it
void DropFrames();
// shows selected stack frame in editor
void ShowFrame();
// re-fills thread selector droplist on drop
void dropThreads();
// selects current thread
void showThread(void);
// sends pretty-prinding scripts
void SendPrettyPrinters(void);
// opens quick watch dialog
void QuickWatch(void);
// format watch line
String FormatWatchLine(String exp, String const &val, int level);
// deep watch current quickwatch variable
void WatchDeep0(String parentExp, String const &name, int level, int &maxRemaining);
void WatchDeep(String parentExp, String const &name);
// copy stack frame list to clipboard
void CopyStack(void);
// copy disassembly listing to clipboard
void CopyDisas(void);
// lock/unlock debugger controls
void Lock();
void Unlock();
String GetHostPath(const String& path) { return host->GetHostPath(path); }
String GetLocalPath(const String& path) { return host->GetLocalPath(path); }
protected:
public :
typedef Gdb_MI2 CLASSNAME;
// debugger IDE inteface
virtual void DebugBar(Bar& bar);
virtual bool SetBreakpoint(const String& filename, int line, const String& bp);
virtual void AsyncBrk();
virtual bool RunTo();
virtual void Run();
virtual void Stop();
virtual bool IsFinished();
virtual bool Tip(const String& exp, CodeEditor::MouseTip& mt);
// create GDB process and initializes it
bool Create(One<Host> _host, const String& exefile, const String& cmdline);
Gdb_MI2();
virtual ~Gdb_MI2();
};
#endif
#ifndef _ide_Debuggers_Gdb_MI2_h_
#define _ide_Debuggers_Gdb_MI2_h_
#include "MIValue.h"
class WatchEdit : public LineEdit
{
virtual void HighlightLine(int line, Vector<Highlight>& h, int pos);
};
#define LAYOUTFILE <ide/Debuggers/Gdb_MI2.lay>
#include <CtrlCore/lay.h>
class Gdb_MI2 : public Debugger, public ParentCtrl
{
private:
One<Host> host;
One<AProcess> dbg;
bool firstRun;
// the disassembler window
DbgDisas disas;
// the registers pane
#ifdef CPU_64
FrameBottom<WithGdb_MI2Registers64Layout<StaticRect> > regs;
#define RPREFIX "r"
#else
FrameBottom<WithGdb_MI2RegistersLayout<StaticRect> > regs;
#define RPREFIX "e"
#endif
// the quick watch dialog
WithGdb_MI2QuickwatchLayout<TopWindow> quickwatch;
EditString watchedit;
DropList frame;
DropList threadSelector;
TabCtrl tab;
ArrayCtrl locals;
ArrayCtrl watches;
ArrayCtrl autos;
// explorer stuffs -- just starting
ArrayCtrl explorer;
EditString explorerExprEdit;
Button explorerBackBtn, explorerForwardBtn;
StaticRect explorerPane;
void onExploreExpr(ArrayCtrl *what = NULL);
void onExplorerChild();
void onExplorerBack();
void onExplorerForward();
void ExplorerMenu(Bar& bar);
void doExplore(String const &expr, String var, bool isChild, bool appendHistory);
Index<String> explorerHistoryExpressions;
Index<String> explorerHistoryVars;
Vector<bool> explorerHistoryChilds;
int explorerHistoryPos;
Vector<String> explorerChildVars;
String explorerParentExpr;
Label dlock;
Vector<String> regname;
Vector<Label *> reglbl;
void AddReg(const char *reg, Label *lbl) { regname.Add(reg); reglbl.Add(lbl); }
// find free space at right of tabs (we should probably add something to TabCtrl for that..)
int FindTabsRight(void);
// running flags -- setup by ReadGdb function when async input is catched
bool started;
bool stopped;
MIValue stopReason;
// read debugger output analyzing command responses
// and async output
MIValue ParseGdb(String const &s, bool wait = true);
MIValue ReadGdb(bool wait = true);
// sends an MI command and get answer back
MIValue MICmd(const char *cmdLine);
// format breakpoint line from ide file and line
String BreakPos(String const &file, int line);
// get breakpoints info
MIValue GetBreakpoints(void);
MIValue GetBreakpoint(int id);
MIValue GetBreakPoint(const char *file, int line);
// try to set a breakpoint - returns false if no code there
bool TryBreak(adr_t addr, bool temp);
bool TryBreak(String const &file, int line, bool temp);
// set breakpoint
MIValue InsertBreakpoint(const char *file, int line);
// local variable names -- used to synch ide locals with internal GDB variables
Index<String>localVarNames;
// stored local variable expressions, values and types
// just changed variables gets re-updated from GDB
// on frame change, all values are wiped and re-read from GDB
Vector<String>localVarTypes;
Index<String>localVarExpressions;
Vector<String>localVarValues;
// stored watches expressions, values and types
Index<String>watchesNames;
Vector<String>watchesTypes;
Index<String>watchesExpressions;
Vector<String>watchesValues;
// stored autos expressions, values and types
String autoLine;
Index<String>autosNames;
Vector<String>autosTypes;
Index<String>autosExpressions;
Vector<String>autosValues;
// update variables on demand (locals, watches....)
void UpdateVars(void);
// update local variables on demand
void UpdateLocalVars(void);
// update stored watches values on demand
void UpdateWatches(void);
// update stored auto values on demand
void UpdateAutos(void);
// logs frame data on console
void LogFrame(String const &msg, MIValue &frame);
// check for stop reason
void CheckStopReason(void);
// stop all running threads and re-select previous current thread
void StopAllThreads(void);
// single step command handler
void Step(const char *cmd);
// run to command for menu -- just removes return value
void doRunTo(void) { RunTo(); }
// setup ide cursor based on disassembler one
void DisasCursor();
// reset ide default cursor image when disassembler loose focus
void DisasFocus();
// sync disassembler pane
void SyncDisas(MIValue &fInfo, bool fr);
// sync local variables pane
void SyncLocals(void);
// sync watches treectrl
void SyncWatches();
// sync auto vars treectrl
void SyncAutos();
// sync data tabs, depending on which tab is shown
void SyncData();
// sync ide display with breakpoint position
void SyncIde(bool frame = false);
// watches arrayctrl key handling
bool Key(dword key, int count);
// create a string representation of frame given its info and args
String FormatFrame(MIValue &fInfo, MIValue &fArgs);
// re-fills frame's droplist when dropping it
void DropFrames();
// shows selected stack frame in editor
void ShowFrame();
// re-fills thread selector droplist on drop
void dropThreads();
// selects current thread
void showThread(void);
// sends pretty-prinding scripts
void SendPrettyPrinters(void);
// opens quick watch dialog
void QuickWatch(void);
// format watch line
String FormatWatchLine(String exp, String const &val, int level);
// deep watch current quickwatch variable
void WatchDeep0(String parentExp, String const &name, int level, int &maxRemaining);
void WatchDeep(String parentExp, String const &name);
// copy stack frame list to clipboard
void CopyStack(void);
// copy disassembly listing to clipboard
void CopyDisas(void);
// lock/unlock debugger controls
void Lock();
void Unlock();
String GetHostPath(const String& path) { return host->GetHostPath(path); }
String GetLocalPath(const String& path) { return host->GetLocalPath(path); }
protected:
public :
typedef Gdb_MI2 CLASSNAME;
// debugger IDE inteface
virtual void DebugBar(Bar& bar);
virtual bool SetBreakpoint(const String& filename, int line, const String& bp);
virtual void AsyncBrk();
virtual bool RunTo();
virtual void Run();
virtual void Stop();
virtual bool IsFinished();
virtual bool Tip(const String& exp, CodeEditor::MouseTip& mt);
// create GDB process and initializes it
bool Create(One<Host> _host, const String& exefile, const String& cmdline);
Gdb_MI2();
virtual ~Gdb_MI2();
};
#endif

View file

@ -2,7 +2,6 @@ description "TheIDE - Source codes management\377B";
uses
CtrlLib,
Web,
usvn;
file

View file

@ -1,6 +1,5 @@
#ifndef _ide_SrcUpdater_icpp_init_stub
#define _ide_SrcUpdater_icpp_init_stub
#include "CtrlLib/init"
#include "Web/init"
#include "usvn/init"
#endif

View file

@ -78,7 +78,7 @@ protected:
struct Slot {
Slot() : outfile(NULL), quiet(true), exitcode(Null) {}
One<SlaveProcess> process;
One<AProcess> process;
String cmdline;
String output;
String key;
@ -118,11 +118,11 @@ public:
bool verbosebuild;
int Execute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
int Execute(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
int Execute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
int GetSlotCount() const { return processes.GetCount(); }
int AllocSlot();
bool Run(const char *cmdline, Stream *out = NULL, const char *endptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
bool Run(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
bool Run(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
void BeginGroup(String group);
void EndGroup();
@ -472,11 +472,11 @@ public:
virtual bool IdeIsBuilding() const;
virtual String IdeGetOneFile() const;
virtual int IdeConsoleExecute(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false);
virtual int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
virtual int IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false);
virtual int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet);
virtual int IdeConsoleAllocSlot();
virtual bool IdeConsoleRun(const char *cmdline, Stream *out = NULL, const char *envptr = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
virtual bool IdeConsoleRun(One<SlaveProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
virtual bool IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out = NULL, bool quiet = false, int slot = 0, String key = Null, int blitz_count = 1);
virtual void IdeConsoleFlush();
virtual void IdeConsoleBeginGroup(String group);
virtual void IdeConsoleEndGroup();

View file

@ -10,7 +10,6 @@ uses
ide\Browser,
CodeEditor,
CtrlLib,
Web,
plugin\bz2,
HexView,
art\BlueBar,

View file

@ -640,6 +640,69 @@ void Ide::CheckFileUpdate()
ReloadFile();
}
static void GetLineIndex(String file, HashBase& hash, Vector<String>& lines)
{
const char *p = file;
while(*p)
{
while(*p && *p != '\n' && (byte)*p <= ' ')
p++;
const char *b = p;
while(*p && *p++ != '\n')
;
const char *e = p;
while(e > b && (byte)e[-1] <= ' ')
e--;
String s(b, e);
hash.Add(GetHashValue(s));
lines.Add(s);
}
}
int LocateLine(String old_file, int old_line, String new_file)
{
HashBase old_hash, new_hash;
Vector<String> old_lines, new_lines;
GetLineIndex(old_file, old_hash, old_lines);
GetLineIndex(new_file, new_hash, new_lines);
if(old_line <= 0)
return 0;
if(old_line >= old_lines.GetCount())
return new_lines.GetCount();
String line = old_lines[old_line];
//int hash = old_hash[old_line]; Mirek: unused
//int fore_count = old_lines.GetCount() - old_line - 1;
int best_match = 0, best_value = 0;
for(int r = 0; r < 10 && !best_value; r++)
{
int src = (r & 1 ? old_line + (r >> 1) + 1 : old_line - (r >> 1));
if(src < 0 || src >= old_lines.GetCount())
continue;
dword hash = old_hash[src];
for(int i = new_hash.Find(hash); i >= 0; i = new_hash.FindNext(i))
if(new_lines[i] == old_lines[src])
{
int max_back = min(i, src);
int max_fore = min(new_lines.GetCount() - i, old_lines.GetCount() - src) - 1;
if(max_back + max_fore <= best_value)
continue;
int back = 1;
while(back <= max_back && new_hash[i - back] == old_hash[src - back]
&& new_lines[i - back] == old_lines[src - back])
back++;
int fore = 1;
while(fore < max_fore && new_hash[i + fore] == old_hash[src + fore]
&& new_lines[i + fore] == old_lines[src + fore])
fore++;
if(back + fore > best_value)
{
best_value = back + fore;
best_match = minmax(i, 0, new_lines.GetCount());
}
}
}
return best_match;
}
void Ide::ReloadFile()
{

View file

@ -116,7 +116,7 @@ int Ide::IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char
return r;
}
int Ide::IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet)
int Ide::IdeConsoleExecute(One<AProcess> process, const char *cmdline, Stream *out, bool quiet)
{
return console.Execute(process, cmdline, out, quiet);
}
@ -131,7 +131,7 @@ bool Ide::IdeConsoleRun(const char *cmdline, Stream *out, const char *envptr, bo
return console.Run(cmdline, out, envptr, quiet, slot, key, blitz_count);
}
bool Ide::IdeConsoleRun(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
bool Ide::IdeConsoleRun(One<AProcess> process, const char *cmdline, Stream *out, bool quiet, int slot, String key, int blitz_count)
{
return console.Run(process, cmdline, out, quiet, slot, key, blitz_count);
}

View file

@ -9,7 +9,6 @@
#include "ide\Browser/init"
#include "CodeEditor/init"
#include "CtrlLib/init"
#include "Web/init"
#include "plugin\bz2/init"
#include "HexView/init"
#include "art\BlueBar/init"