Developing gui-less true umk: separated non-gui ide/core

git-svn-id: svn://ultimatepp.org/upp/trunk@1044 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-04-04 09:13:31 +00:00
parent f08de14ea2
commit 13f2b95a3c
22 changed files with 3008 additions and 2914 deletions

View file

@ -1,2 +1,3 @@
file
TreeTypes.txt;

View file

@ -1,5 +1,9 @@
#include "Common.h"
#define IMAGECLASS IdeCommonImg
#define IMAGEFILE <ide/Common/common.iml>
#include <Draw/iml_source.h>
void IdeFileIcon0(bool dir, const String& filename, Image& img, bool fast = false)
{
if(dir) return;

View file

@ -1,119 +1,36 @@
#ifndef COMMON_H
#define COMMON_H
#ifndef _ide_GuiCommon_GuiCommon_h_
#define _ide_GuiCommon_GuiCommon_h_
#include <ide/Core/Core.h>
#include <CtrlLib/CtrlLib.h>
#include <Esc/Esc.h>
#include <Web/Web.h>
using namespace Upp;
#define IMAGECLASS IdeCommonImg
#define IMAGEFILE <ide/Common/common.iml>
#include <Draw/iml_header.h>
int CharFilterCid(int c);
struct Debugger {
virtual void DebugBar(Bar& bar) = 0;
virtual bool SetBreakpoint(const String& filename, int line, const String& bp) = 0;
virtual bool RunTo() = 0;
virtual void Run() = 0;
virtual void Stop() = 0;
virtual bool IsFinished() = 0;
int ReadLNG(CParser& p);
String MakeLNG(int lang);
bool OldLang();
String PrintTime(int msecs);
inline String GetPrintTime(dword time0) { return PrintTime(msecs(time0)); }
bool SaveChangedFile(const char *path, String data, bool delete_empty = false);
class Workspace;
struct Ide;
class IdeContext
{
public:
virtual void PutConsole(const char *s) = 0;
virtual void PutVerbose(const char *s) = 0;
virtual const Workspace& IdeWorkspace() const = 0;
virtual bool IdeIsBuilding() const = 0;
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 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 void IdeConsoleFlush() = 0;
virtual void IdeConsoleBeginGroup(String group) = 0;
virtual void IdeConsoleEndGroup() = 0;
virtual bool IdeConsoleWait() = 0;
virtual bool IdeIsDebug() const = 0;
virtual void IdeEndDebug() = 0;
virtual void IdeSetBottom(Ctrl& ctrl) = 0;
virtual void IdeActivateBottom() = 0;
virtual void IdeRemoveBottom(Ctrl& ctrl) = 0;
virtual void IdeSetRight(Ctrl& ctrl) = 0;
virtual void IdeRemoveRight(Ctrl& ctrl) = 0;
virtual String IdeGetFileName() const = 0;
virtual int IdeGetFileLine() = 0;
virtual String IdeGetLine(int i) const = 0;
virtual void IdeSetDebugPos(const String& fn, int line, const Image& img, int i) = 0;
virtual void IdeHidePtr() = 0;
virtual bool IdeDebugLock() = 0;
virtual bool IdeDebugUnLock() = 0;
virtual bool IdeIsDebugLock() const = 0;
virtual void IdeSetBar() = 0;
virtual void IdeGotoCodeRef(String link) = 0;
virtual void IdeOpenTopicFile(const String& file) = 0;
virtual void IdeFlushFile() = 0;
virtual String IdeGetFileName() = 0;
virtual String IdeGetNestFolder() = 0;
virtual ~IdeContext() {}
virtual ~Debugger() {}
};
IdeContext *TheIde();
void TheIde(IdeContext *context);
void SourceFs(FileSel& fsel);
FileSel& AnySourceFs();
FileSel& AnyPackageFs();
FileSel& BasedSourceFs();
FileSel& OutputFs();
void PutConsole(const char *s);
void PutVerbose(const char *s);
Image IdeFileImage(const String& filename, bool fast = false);
const Workspace& GetIdeWorkspace();
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 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);
void IdeConsoleFlush();
void IdeConsoleBeginGroup(String group);
void IdeConsoleEndGroup();
bool IdeConsoleWait();
void IdeGotoCodeRef(String s);
bool IdeIsDebug();
void IdeEndDebug();
void IdeSetBottom(Ctrl& ctrl);
void IdeActivateBottom();
void IdeRemoveBottom(Ctrl& ctrl);
void IdeSetRight(Ctrl& ctrl);
void IdeRemoveRight(Ctrl& ctrl);
String IdeGetFileName();
int IdeGetFileLine();
String IdeGetLine(int i);
void IdeSetDebugPos(const String& fn, int line, const Image& img, int i);
void IdeHidePtr();
bool IdeDebugLock();
bool IdeDebugUnLock();
bool IdeIsDebugLock();
void IdeSetBar();
bool FinishSave(String tmpfile, String outfile);
bool FinishSave(String outfile);
bool SaveFileFinish(const String& filename, const String& data);
bool SaveChangedFileFinish(const String& filename, const String& data);
struct IdeDesigner {
virtual String GetFileName() const = 0;
@ -143,312 +60,10 @@ void RegisterIdeModule(IdeModule& module);
int GetIdeModuleCount();
IdeModule& GetIdeModule(int q);
struct IdeMacro {
IdeMacro();
int hotkey;
String menu;
String submenu;
EscValue code;
};
ArrayMap<String, EscValue>& UscGlobal();
Array<IdeMacro>& UscMacros();
void CleanUsc();
void ParseUscFile(const char *filename) throw(CParser::Error);
Point ReadNums(CParser& p);
Point ReadPoint(CParser& p);
struct SemiTextTest : public TextTest {
virtual const char *Accept(const char *s) const;
};
Vector<String> SplitDirs(const char *s);
String VarFilePath();
String VarFilePath(String name);
bool SaveVarFile(const char *filename, const VectorMap<String, String>& var);
bool LoadVarFile(const char *name, VectorMap<String, String>& var);
bool SaveVars(const char *name);
bool LoadVars(const char *name);
String GetVar(const String& var);
String GetVarsName();
String VarFilePath();
Vector<String> GetUppDirs();
String GetUppDir();
void SetVar(const String& var, const String& value);
String GetAnyFileName(const char *path);
String GetAnyFileTitle(const char *path);
String CatAnyPath(String path, const char *more);
String PackagePath(const String& name);
String SourcePath(const String& package, const String& name);
inline
String PackageDirectory(const String& name) { return GetFileDirectory(PackagePath(name)); }
bool IsNestReadOnly(const String& path);
String GetLocalDir();
String LocalPath(const String& filename);
Vector<String> IgnoreList();
bool IsFullDirectory(const String& d);
bool IsFolder(const String& path);
bool IsCSourceFile(const char *path);
bool IsCHeaderFile(const char *path);
String FollowCygwinSymlink(const String& filename);
void SplitPathMap(const char *path_map, Vector<String>& local, Vector<String>& remote);
String JoinPathMap(const Vector<String>& local, const Vector<String>& remote);
void SplitHostName(const char *hostname, String& host, int& port);
Vector<String> SplitFlags0(const char *flags);
Vector<String> SplitFlags(const char *flags, bool main = false);
Vector<String> SplitFlags(const char *flags, bool main, const Vector<String>& accepts);
bool MatchWhen(const String& when, const Vector<String>& flag);
String ReadWhen(CParser& p);
String AsStringWhen(const String& when);
struct OptItem {
String when;
String text;
};
struct CustomStep {
String when;
String ext;
String command;
String output;
void Load(CParser& p) throw(CParser::Error);
String AsString() const;
String GetExt() const;
bool MatchExt(const char *fn) const;
};
Vector<String> Combine(const Vector<String>& conf, const char *flags);
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace = false);
bool HasFlag(const Vector<String>& conf, const char *flag);
enum {
FLAG_MISMATCH = -2,
FLAG_UNDEFINED = -1,
};
int GetType(const Vector<String>& conf, const char *flags);
int GetType(const Vector<String>& conf, const char *flags, int def);
bool GetFlag(const Vector<String>& conf, const char *flag);
String RemoveType(Vector<String>& conf, const char *flags);
class Package {
public:
struct File : public String {
Array<OptItem> option;
Array<OptItem> depends;
bool readonly;
bool separator;
int tabsize;
byte charset;
int font;
String highlight;
int optimize_speed;
void operator=(const String& s) { String::operator=(s); readonly = separator = false; }
void Init() { readonly = separator = false; tabsize = Null; charset = 0; font = 0;
optimize_speed = false; }
File() { Init(); }
File(const String& s) : String(s) { Init(); }
};
struct Config {
String name;
String param;
};
byte charset;
bool optimize_speed;
bool noblitz;
String description;
Vector<String> accepts;
Array<OptItem> flag;
Array<OptItem> uses;
Array<OptItem> target;
Array<OptItem> library;
Array<OptItem> link;
Array<OptItem> option;
Array<File> file;
Array<Config> config;
Array<CustomStep> custom;
Time time;
int GetCount() const { return file.GetCount(); }
File& operator[](int i) { return file[i]; }
const File& operator[](int i) const { return file[i]; }
void Load(const char *file);
bool Save(const char *file) const;
Package();
};
class Workspace {
void AddUses(Package& p, bool match, const Vector<String>& flag);
void AddLoad(const String& name, bool match, const Vector<String>& flag);
public:
ArrayMap<String, Package> package;
void Clear() { package.Clear(); }
String operator[](int i) const { return package.GetKey(i); }
Package& GetPackage(int i) { return package[i]; }
const Package& GetPackage(int i) const { return package[i]; }
int GetCount() const { return package.GetCount(); }
void Scan(const char *prjname);
void Scan(const char *prjname, const Vector<String>& flag);
Vector<String> GetAllAccepts(int pk) const;
void Dump();
};
struct Ide;
bool FinishSave(String tmpfile, String outfile);
bool FinishSave(String outfile);
bool SaveFileFinish(const String& filename, const String& data);
bool SaveChangedFileFinish(const String& filename, const String& data);
enum {
DEBUG_NONE, DEBUG_MINIMAL, DEBUG_FULL
};
struct Host {
struct FileInfo : Time, Moveable<FileInfo> {
int length;
};
virtual String GetEnvironment() = 0;
virtual String GetHostPath(const String& path) = 0;
virtual String GetLocalPath(const String& path) = 0;
virtual String NormalizePath(const String& path) = 0;
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) = 0;
virtual void DeleteFile(const Vector<String>& path) = 0;
virtual void DeleteFolderDeep(const String& dir) = 0;
virtual void ChDir(const String& path) = 0;
virtual void RealizeDir(const String& path) = 0;
virtual void SaveFile(const String& path, const String& data) = 0;
virtual String LoadFile(const String& path) = 0;
virtual int Execute(const char *cmdline) = 0;
virtual int ExecuteWithInput(const char *cmdline) = 0;
virtual int Execute(const char *cmdline, Stream& out) = 0;
virtual int AllocSlot() = 0;
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 void Launch(const char *cmdline, bool console = false) = 0;
virtual void AddFlags(Index<String>& cfg) = 0;
virtual ~Host() {}
};
String FindInDirs(const Vector<String>& dir, const String& file);
String FindCommand(const Vector<String>& exedir, const String& cmdline);
struct MakeFile {
String outdir;
String outfile;
String output;
String config;
String install;
String rules;
String linkdep;
String linkfiles;
String linkfileend;
};
String GetMakePath(String fn, bool win32);
String AdjustMakePath(const char *fn);
enum {
R_OPTIMAL,
R_SPEED,
R_SIZE
};
struct Builder {
Host *host;
Index<String> config;
String compiler;
String method;
String outdir;
Vector<String> include;
Vector<String> libpath;
String target;
String debug_options;
String release_options;
String release_size_options;
String version;
String script;
bool doall;
virtual bool BuildPackage(const String& package, Vector<String>& linkfile, String& linkoptions,
const Vector<String>& all_uses, const Vector<String>& all_libraries, int optimize)
{ return false; }
virtual bool Link(const Vector<String>& linkfile, const String& linkoptions, bool createmap)
{ return false; }
virtual bool Preprocess(const String& package, const String& file, const String& result, bool asmout)
{ return false; }
virtual void AddFlags(Index<String>& cfg) {}
virtual void AddMakeFile(MakeFile& mfinfo, String package,
const Vector<String>& all_uses, const Vector<String>& all_libraries,
const Index<String>& common_config, bool exporting) {}
virtual String GetTargetExt() const = 0;
Builder() { doall = false; }
virtual ~Builder() {}
};
VectorMap<String, Builder *(*)()>& BuilderMap();
void RegisterBuilder(const char *name, Builder *(*create)());
struct Debugger {
virtual void DebugBar(Bar& bar) = 0;
virtual bool SetBreakpoint(const String& filename, int line, const String& bp) = 0;
virtual bool RunTo() = 0;
virtual void Run() = 0;
virtual void Stop() = 0;
virtual bool IsFinished() = 0;
virtual ~Debugger() {}
};
void HdependSetDirs(pick_ Vector<String>& id);
void HdependTimeDirty();
void HdependClearDependencies();
void HdependAddDependency(const String& file, const String& depends);
Time HdependFileTime(const String& path);
Vector<String> HdependGetDependencies(const String& path);
String FindIncludeFile(const char *s, const String& filedir);
bool HdependBlitzApproved(const String& path);
const Vector<String>& HdependGetDefines(const String& path);
const Vector<String>& HdependGetAllFiles();
void SourceFs(FileSel& fsel);
FileSel& AnySourceFs();
FileSel& AnyPackageFs();
FileSel& BasedSourceFs();
FileSel& OutputFs();
Image IdeFileImage(const String& filename, bool fast = false);
void RegisterWorkspaceConfig(const char *name);
void RegisterNWorkspaceConfig(const char *name, Callback WhenFlush);
String& WorkspaceConfigData(const char *name);

View file

@ -1,18 +1,10 @@
description "TheIDE - common library";
uses
CtrlLib,
Esc;
ide\Core;
file
Common.h,
Common.cpp,
Hdepend.cpp optimize_speed,
Package.cpp,
Workspace.cpp,
usc.cpp,
ComDlg.cpp,
common.iml,
Info readonly separator,
Copying;
Module.cpp,
Util.cpp,
common.iml;

View file

@ -0,0 +1,22 @@
#include "Common.h"
static Vector<IdeModule *>& sM()
{
static Vector<IdeModule *> m;
return m;
}
void RegisterIdeModule(IdeModule& module)
{
sM().Add(&module);
}
int GetIdeModuleCount()
{
return sM().GetCount();
}
IdeModule& GetIdeModule(int q)
{
return *sM()[q];
}

190
uppsrc/ide/Common/Util.cpp Normal file
View file

@ -0,0 +1,190 @@
#include "Common.h"
bool FinishSave(String tmpfile, String outfile)
{
Progress progress;
int time = GetTickCount();
for(;;) {
progress.SetTotal(10000);
progress.SetText("Saving '" + GetFileName(outfile) + "'");
if(!FileExists(tmpfile))
return false;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
return true;
IdeConsoleFlush();
Sleep(200);
if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) {
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
return false;
if(art && AnySourceFs().ExecuteSaveAs())
outfile = AnySourceFs();
progress.SetPos(0);
}
}
}
bool FinishSave(String outfile)
{
return FinishSave(outfile + ".$tmp", outfile);
}
bool SaveFileFinish(const String& filename, const String& data)
{
if(!SaveFile(filename + ".$tmp", data)) {
Exclamation("Error creating temporary file " + filename);
return false;
}
return FinishSave(filename);
}
bool SaveChangedFileFinish(const String& filename, const String& data)
{
if(data == LoadFile(filename))
return true;
return SaveFileFinish(filename, data);
}
typedef VectorMap<String, String> StringMap;
GLOBAL_VAR(StringMap, sWorkspaceCfg)
GLOBAL_VAR(Vector<Callback>, sWorkspaceCfgFlush)
void RegisterWorkspaceConfig(const char *name)
{
ASSERT(sWorkspaceCfg().Find(name) < 0);
sWorkspaceCfg().Add(name);
}
void RegisterWorkspaceConfig(const char *name, Callback WhenFlush)
{
RegisterWorkspaceConfig(name);
sWorkspaceCfgFlush().Add(WhenFlush);
}
String& WorkspaceConfigData(const char *name)
{
return sWorkspaceCfg().GetAdd(name);
}
void SerializeWorkspaceConfigs(Stream& s)
{
int i;
for(i = 0; i < sWorkspaceCfgFlush().GetCount(); i++)
sWorkspaceCfgFlush()[i]();
VectorMap<String, String>& cfg = sWorkspaceCfg();
int version = 0;
s / version;
int count = cfg.GetCount();
s / count;
for(i = 0; i < count; i++) {
String name;
if(s.IsStoring())
name = cfg.GetKey(i);
s % name;
int q = cfg.Find(name);
if(q >= 0)
s % cfg[q];
else
{
String dummy;
s % dummy;
}
}
s.Magic();
}
bool GuiPackageResolver(const String& error, const String& path, int line)
{
prompt:
switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
error + "&while parsing package " + DeQtf(path),
"Edit \\& Retry", "Ignore", "Stop")) {
case 0:
if(!PromptYesNo("Ignoring will damage package. Everything past the "
"point of error will be lost.&Do you want to continue ?"))
goto prompt;
return false;
case 1: {
TopWindow win;
LineEdit edit;
edit.Set(LoadFile(path));
edit.SetCursor(edit.GetPos(line));
win.Title(path);
win.Add(edit.SizePos());
win.Run();
SaveFile(path, edit.Get());
}
return true;;
case -1:
exit(1);
}
return false;
}
void CleanModules()
{
for(int i = 0; i < GetIdeModuleCount(); i++)
GetIdeModule(i).CleanUsc();
}
bool IdeModuleUsc(CParser& p)
{
for(int i = 0; i < GetIdeModuleCount(); i++)
if(GetIdeModule(i).ParseUsc(p))
return true;
return false;
}
static void ReadMacro(CParser& p)
{
IdeMacro macro;
if(p.IsString()) {
macro.menu = p.ReadString();
if(p.Char(':'))
macro.submenu = p.ReadString();
}
if(!p.IsChar('{'))
macro.hotkey = ParseKeyDesc(p);
EscLambda& l = macro.code.CreateLambda();
const char *t = p.GetPtr();
l.filename = p.GetFileName();
l.line = p.GetLine();
if(!p.Char('{'))
p.ThrowError("missing '{'");
SkipBlock(p);
l.code = String(t, p.GetPtr());
Array<IdeMacro>& mlist = UscMacros();
if(macro.hotkey) {
int f = FindFieldIndex(mlist, &IdeMacro::hotkey, macro.hotkey);
if(f >= 0) {
PutConsole(NFormat("%s(%d): duplicate macro hotkey %s\n", l.filename, l.line, GetKeyDesc(macro.hotkey)));
const EscLambda& lambda = UscMacros()[f].code.GetLambda();
PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line));
}
}
if(!IsNull(macro.menu)) {
for(int i = 0; i < mlist.GetCount(); i++)
if(mlist[i].menu == macro.menu && mlist[i].submenu == macro.submenu) {
PutConsole(NFormat("%s(%d): duplicate macro menu item (%s:%s)\n",
l.filename, l.line, macro.menu, macro.submenu));
const EscLambda& lambda = UscMacros()[i].code.GetLambda();
PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line));
break;
}
}
mlist.Add(macro);
}
INITBLOCK {
Package::SetPackageResolver(GuiPackageResolver);
UscSetCleanModules(CleanModules);
SetIdeModuleUsc(IdeModuleUsc);
UscSetReadMacro(ReadMacro);
}

View file

@ -1,5 +1,4 @@
#ifndef _ide_Common_icpp_init_stub
#define _ide_Common_icpp_init_stub
#include "CtrlLib/init"
#include "Esc/init"
#include "ide\Core/init"
#endif

View file

@ -1,113 +0,0 @@
#include "Common.h"
ArrayMap<String, EscValue>& UscGlobal()
{
static ArrayMap<String, EscValue> global;
return global;
}
IdeMacro::IdeMacro()
{
hotkey = 0;
}
GLOBAL_VAR(Array<IdeMacro>, UscMacros)
void ESC_cout(EscEscape& e)
{
if(e[0].IsArray())
PutConsole((String) e[0]);
else
if(e[0].IsNumber()) {
String str;
str << e[0].GetNumber();
PutConsole(str);
}
else
if(!e[0].IsVoid())
e.ThrowError("invalid argument to 'cout'" + e.DumpType(0));
}
void ESC_dump(EscEscape& e)
{
PutConsole(e[0].ToString());
}
void CleanUsc()
{
UscGlobal().Clear();
UscMacros().Clear();
for(int i = 0; i < GetIdeModuleCount(); i++)
GetIdeModule(i).CleanUsc();
StdLib(UscGlobal());
Escape(UscGlobal(), "cout(x)", ESC_cout);
Escape(UscGlobal(), "dump(x)", ESC_dump);
}
bool IdeModuleUsc(CParser& p)
{
for(int i = 0; i < GetIdeModuleCount(); i++)
if(GetIdeModule(i).ParseUsc(p))
return true;
return false;
}
static void ReadMacro(CParser& p)
{
IdeMacro macro;
if(p.IsString()) {
macro.menu = p.ReadString();
if(p.Char(':'))
macro.submenu = p.ReadString();
}
if(!p.IsChar('{'))
macro.hotkey = ParseKeyDesc(p);
EscLambda& l = macro.code.CreateLambda();
const char *t = p.GetPtr();
l.filename = p.GetFileName();
l.line = p.GetLine();
if(!p.Char('{'))
p.ThrowError("missing '{'");
SkipBlock(p);
l.code = String(t, p.GetPtr());
Array<IdeMacro>& mlist = UscMacros();
if(macro.hotkey) {
int f = FindFieldIndex(mlist, &IdeMacro::hotkey, macro.hotkey);
if(f >= 0) {
PutConsole(NFormat("%s(%d): duplicate macro hotkey %s\n", l.filename, l.line, GetKeyDesc(macro.hotkey)));
const EscLambda& lambda = UscMacros()[f].code.GetLambda();
PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line));
}
}
if(!IsNull(macro.menu)) {
for(int i = 0; i < mlist.GetCount(); i++)
if(mlist[i].menu == macro.menu && mlist[i].submenu == macro.submenu) {
PutConsole(NFormat("%s(%d): duplicate macro menu item (%s:%s)\n",
l.filename, l.line, macro.menu, macro.submenu));
const EscLambda& lambda = UscMacros()[i].code.GetLambda();
PutConsole(NFormat("%s(%d): previously defined here\n", lambda.filename, lambda.line));
break;
}
}
mlist.Add(macro);
}
void ParseUscFile(const char *filename) throw(CParser::Error)
{
String d = LoadFile(filename);
CParser p(d, filename);
while(!p.IsEof()) {
if(p.Id("fn")) {
EscValue& v = UscGlobal().GetPut(p.ReadId());
v = ReadLambda(p);
}
else
if(p.Id("macro"))
ReadMacro(p);
else
if(!IdeModuleUsc(p)) {
EscValue& v = UscGlobal().GetPut(p.ReadId());
v = ReadLambda(p);
}
}
}

View file

@ -1,8 +1,4 @@
#include "Common.h"
#define IMAGECLASS IdeCommonImg
#define IMAGEFILE <ide/Common/common.iml>
#include <Draw/iml_source.h>
#include "Core.h"
typedef VectorMap<String, Builder *(*)()> BuilderMapType;
GLOBAL_VAR(BuilderMapType, BuilderMap)
@ -349,126 +345,6 @@ Point ReadPoint(CParser& p)
return pt;
}
static Vector<IdeModule *>& sM()
{
static Vector<IdeModule *> m;
return m;
}
void RegisterIdeModule(IdeModule& module)
{
sM().Add(&module);
}
int GetIdeModuleCount()
{
return sM().GetCount();
}
IdeModule& GetIdeModule(int q)
{
return *sM()[q];
}
bool FinishSave(String tmpfile, String outfile)
{
Progress progress;
int time = GetTickCount();
for(;;) {
progress.SetTotal(10000);
progress.SetText("Saving '" + GetFileName(outfile) + "'");
if(!FileExists(tmpfile))
return false;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
return true;
IdeConsoleFlush();
Sleep(200);
if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) {
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
return false;
if(art && AnySourceFs().ExecuteSaveAs())
outfile = AnySourceFs();
progress.SetPos(0);
}
}
}
bool FinishSave(String outfile)
{
return FinishSave(outfile + ".$tmp", outfile);
}
bool SaveFileFinish(const String& filename, const String& data)
{
if(!SaveFile(filename + ".$tmp", data)) {
Exclamation("Error creating temporary file " + filename);
return false;
}
return FinishSave(filename);
}
bool SaveChangedFileFinish(const String& filename, const String& data)
{
if(data == LoadFile(filename))
return true;
return SaveFileFinish(filename, data);
}
typedef VectorMap<String, String> StringMap;
GLOBAL_VAR(StringMap, sWorkspaceCfg)
GLOBAL_VAR(Vector<Callback>, sWorkspaceCfgFlush)
void RegisterWorkspaceConfig(const char *name)
{
ASSERT(sWorkspaceCfg().Find(name) < 0);
sWorkspaceCfg().Add(name);
}
void RegisterWorkspaceConfig(const char *name, Callback WhenFlush)
{
RegisterWorkspaceConfig(name);
sWorkspaceCfgFlush().Add(WhenFlush);
}
String& WorkspaceConfigData(const char *name)
{
return sWorkspaceCfg().GetAdd(name);
}
void SerializeWorkspaceConfigs(Stream& s)
{
int i;
for(i = 0; i < sWorkspaceCfgFlush().GetCount(); i++)
sWorkspaceCfgFlush()[i]();
VectorMap<String, String>& cfg = sWorkspaceCfg();
int version = 0;
s / version;
int count = cfg.GetCount();
s / count;
for(i = 0; i < count; i++) {
String name;
if(s.IsStoring())
name = cfg.GetKey(i);
s % name;
int q = cfg.Find(name);
if(q >= 0)
s % cfg[q];
else
{
String dummy;
s % dummy;
}
}
s.Magic();
}
bool OldLang() {
static int q = -1;
if(q < 0)

375
uppsrc/ide/Core/Core.h Normal file
View file

@ -0,0 +1,375 @@
#ifndef COMMON_H
#define COMMON_H
#include <Esc/Esc.h>
#include <Web/Web.h>
using namespace Upp;
int CharFilterCid(int c);
int ReadLNG(CParser& p);
String MakeLNG(int lang);
bool OldLang();
String PrintTime(int msecs);
inline String GetPrintTime(dword time0) { return PrintTime(msecs(time0)); }
bool SaveChangedFile(const char *path, String data, bool delete_empty = false);
class Workspace;
struct Ide;
namespace Upp {
class Ctrl;
class Image;
};
class IdeContext
{
public:
virtual void PutConsole(const char *s) = 0;
virtual void PutVerbose(const char *s) = 0;
virtual const Workspace& IdeWorkspace() const = 0;
virtual bool IdeIsBuilding() const = 0;
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 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 void IdeConsoleFlush() = 0;
virtual void IdeConsoleBeginGroup(String group) = 0;
virtual void IdeConsoleEndGroup() = 0;
virtual bool IdeConsoleWait() = 0;
virtual bool IdeIsDebug() const = 0;
virtual void IdeEndDebug() = 0;
virtual void IdeSetBottom(Ctrl& ctrl) = 0;
virtual void IdeActivateBottom() = 0;
virtual void IdeRemoveBottom(Ctrl& ctrl) = 0;
virtual void IdeSetRight(Ctrl& ctrl) = 0;
virtual void IdeRemoveRight(Ctrl& ctrl) = 0;
virtual String IdeGetFileName() const = 0;
virtual int IdeGetFileLine() = 0;
virtual String IdeGetLine(int i) const = 0;
virtual void IdeSetDebugPos(const String& fn, int line, const Image& img, int i) = 0;
virtual void IdeHidePtr() = 0;
virtual bool IdeDebugLock() = 0;
virtual bool IdeDebugUnLock() = 0;
virtual bool IdeIsDebugLock() const = 0;
virtual void IdeSetBar() = 0;
virtual void IdeGotoCodeRef(String link) = 0;
virtual void IdeOpenTopicFile(const String& file) = 0;
virtual void IdeFlushFile() = 0;
virtual String IdeGetFileName() = 0;
virtual String IdeGetNestFolder() = 0;
virtual ~IdeContext() {}
};
IdeContext *TheIde();
void TheIde(IdeContext *context);
void PutConsole(const char *s);
void PutVerbose(const char *s);
const Workspace& GetIdeWorkspace();
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 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);
void IdeConsoleFlush();
void IdeConsoleBeginGroup(String group);
void IdeConsoleEndGroup();
bool IdeConsoleWait();
void IdeGotoCodeRef(String s);
bool IdeIsDebug();
void IdeEndDebug();
void IdeSetBottom(Ctrl& ctrl);
void IdeActivateBottom();
void IdeRemoveBottom(Ctrl& ctrl);
void IdeSetRight(Ctrl& ctrl);
void IdeRemoveRight(Ctrl& ctrl);
String IdeGetFileName();
int IdeGetFileLine();
String IdeGetLine(int i);
void IdeSetDebugPos(const String& fn, int line, const Image& img, int i);
void IdeHidePtr();
bool IdeDebugLock();
bool IdeDebugUnLock();
bool IdeIsDebugLock();
void IdeSetBar();
#include "Host.h"
struct IdeMacro {
IdeMacro();
int hotkey;
String menu;
String submenu;
EscValue code;
};
ArrayMap<String, EscValue>& UscGlobal();
Array<IdeMacro>& UscMacros();
void UscSetCleanModules(void (*CleanModules)());
void SetIdeModuleUsc(bool (*IdeModuleUsc)(CParser& p));
void UscSetReadMacro(void (*ReadMacro)(CParser& p));
void CleanUsc();
void ParseUscFile(const char *filename) throw(CParser::Error);
Point ReadNums(CParser& p);
Point ReadPoint(CParser& p);
struct SemiTextTest : public TextTest {
virtual const char *Accept(const char *s) const;
};
Vector<String> SplitDirs(const char *s);
String VarFilePath();
String VarFilePath(String name);
bool SaveVarFile(const char *filename, const VectorMap<String, String>& var);
bool LoadVarFile(const char *name, VectorMap<String, String>& var);
bool SaveVars(const char *name);
bool LoadVars(const char *name);
String GetVar(const String& var);
String GetVarsName();
String VarFilePath();
Vector<String> GetUppDirs();
String GetUppDir();
void SetVar(const String& var, const String& value);
String GetAnyFileName(const char *path);
String GetAnyFileTitle(const char *path);
String CatAnyPath(String path, const char *more);
String PackagePath(const String& name);
String SourcePath(const String& package, const String& name);
inline
String PackageDirectory(const String& name) { return GetFileDirectory(PackagePath(name)); }
bool IsNestReadOnly(const String& path);
String GetLocalDir();
String LocalPath(const String& filename);
Vector<String> IgnoreList();
bool IsFullDirectory(const String& d);
bool IsFolder(const String& path);
bool IsCSourceFile(const char *path);
bool IsCHeaderFile(const char *path);
String FollowCygwinSymlink(const String& filename);
void SplitPathMap(const char *path_map, Vector<String>& local, Vector<String>& remote);
String JoinPathMap(const Vector<String>& local, const Vector<String>& remote);
void SplitHostName(const char *hostname, String& host, int& port);
Vector<String> SplitFlags0(const char *flags);
Vector<String> SplitFlags(const char *flags, bool main = false);
Vector<String> SplitFlags(const char *flags, bool main, const Vector<String>& accepts);
bool MatchWhen(const String& when, const Vector<String>& flag);
String ReadWhen(CParser& p);
String AsStringWhen(const String& when);
struct OptItem {
String when;
String text;
};
struct CustomStep {
String when;
String ext;
String command;
String output;
void Load(CParser& p) throw(CParser::Error);
String AsString() const;
String GetExt() const;
bool MatchExt(const char *fn) const;
};
Vector<String> Combine(const Vector<String>& conf, const char *flags);
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace = false);
bool HasFlag(const Vector<String>& conf, const char *flag);
enum {
FLAG_MISMATCH = -2,
FLAG_UNDEFINED = -1,
};
int GetType(const Vector<String>& conf, const char *flags);
int GetType(const Vector<String>& conf, const char *flags, int def);
bool GetFlag(const Vector<String>& conf, const char *flag);
String RemoveType(Vector<String>& conf, const char *flags);
class Package {
public:
struct File : public String {
Array<OptItem> option;
Array<OptItem> depends;
bool readonly;
bool separator;
int tabsize;
byte charset;
int font;
String highlight;
int optimize_speed;
void operator=(const String& s) { String::operator=(s); readonly = separator = false; }
void Init() { readonly = separator = false; tabsize = Null; charset = 0; font = 0;
optimize_speed = false; }
File() { Init(); }
File(const String& s) : String(s) { Init(); }
};
struct Config {
String name;
String param;
};
byte charset;
bool optimize_speed;
bool noblitz;
String description;
Vector<String> accepts;
Array<OptItem> flag;
Array<OptItem> uses;
Array<OptItem> target;
Array<OptItem> library;
Array<OptItem> link;
Array<OptItem> option;
Array<File> file;
Array<Config> config;
Array<CustomStep> custom;
Time time;
int GetCount() const { return file.GetCount(); }
File& operator[](int i) { return file[i]; }
const File& operator[](int i) const { return file[i]; }
void Load(const char *path);
bool Save(const char *file) const;
static void SetPackageResolver(bool (*Resolve)(const String& error, const String& path, int line));
Package();
};
class Workspace {
void AddUses(Package& p, bool match, const Vector<String>& flag);
void AddLoad(const String& name, bool match, const Vector<String>& flag);
public:
ArrayMap<String, Package> package;
void Clear() { package.Clear(); }
String operator[](int i) const { return package.GetKey(i); }
Package& GetPackage(int i) { return package[i]; }
const Package& GetPackage(int i) const { return package[i]; }
int GetCount() const { return package.GetCount(); }
void Scan(const char *prjname);
void Scan(const char *prjname, const Vector<String>& flag);
Vector<String> GetAllAccepts(int pk) const;
void Dump();
};
struct Ide;
String FindInDirs(const Vector<String>& dir, const String& file);
String FindCommand(const Vector<String>& exedir, const String& cmdline);
struct MakeFile {
String outdir;
String outfile;
String output;
String config;
String install;
String rules;
String linkdep;
String linkfiles;
String linkfileend;
};
String GetMakePath(String fn, bool win32);
String AdjustMakePath(const char *fn);
enum {
R_OPTIMAL,
R_SPEED,
R_SIZE
};
struct Builder {
Host *host;
Index<String> config;
String compiler;
String method;
String outdir;
Vector<String> include;
Vector<String> libpath;
String target;
String debug_options;
String release_options;
String release_size_options;
String version;
String script;
bool doall;
virtual bool BuildPackage(const String& package, Vector<String>& linkfile, String& linkoptions,
const Vector<String>& all_uses, const Vector<String>& all_libraries, int optimize)
{ return false; }
virtual bool Link(const Vector<String>& linkfile, const String& linkoptions, bool createmap)
{ return false; }
virtual bool Preprocess(const String& package, const String& file, const String& result, bool asmout)
{ return false; }
virtual void AddFlags(Index<String>& cfg) {}
virtual void AddMakeFile(MakeFile& mfinfo, String package,
const Vector<String>& all_uses, const Vector<String>& all_libraries,
const Index<String>& common_config, bool exporting) {}
virtual String GetTargetExt() const = 0;
Builder() { doall = false; }
virtual ~Builder() {}
};
VectorMap<String, Builder *(*)()>& BuilderMap();
void RegisterBuilder(const char *name, Builder *(*create)());
void HdependSetDirs(pick_ Vector<String>& id);
void HdependTimeDirty();
void HdependClearDependencies();
void HdependAddDependency(const String& file, const String& depends);
Time HdependFileTime(const String& path);
Vector<String> HdependGetDependencies(const String& path);
String FindIncludeFile(const char *s, const String& filedir);
bool HdependBlitzApproved(const String& path);
const Vector<String>& HdependGetDefines(const String& path);
const Vector<String>& HdependGetAllFiles();
#endif

19
uppsrc/ide/Core/Core.upp Normal file
View file

@ -0,0 +1,19 @@
description "TheIDE - common library";
uses
CtrlLib,
Esc;
file
Core.h,
Core.cpp,
Hdepend.cpp optimize_speed,
Package.cpp,
Workspace.cpp,
usc.cpp,
Host.h,
Host.cpp,
common.iml,
Info readonly separator,
Copying;

View file

@ -1,4 +1,4 @@
#include "Common.h"
#include "Core.h"
class Hdepend {
struct Info {

View file

@ -1,4 +1,4 @@
#include "ide.h"
#include "Core.h"
#define LLOG(x)

99
uppsrc/ide/Core/Host.h Normal file
View file

@ -0,0 +1,99 @@
enum { REMOTE_TIMEOUT = 2000 };
extern String LinuxHostConsole;
struct Host {
struct FileInfo : Time, Moveable<FileInfo> {
int length;
};
virtual String GetEnvironment() = 0;
virtual String GetHostPath(const String& path) = 0;
virtual String GetLocalPath(const String& path) = 0;
virtual String NormalizePath(const String& path) = 0;
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) = 0;
virtual void DeleteFile(const Vector<String>& path) = 0;
virtual void DeleteFolderDeep(const String& dir) = 0;
virtual void ChDir(const String& path) = 0;
virtual void RealizeDir(const String& path) = 0;
virtual void SaveFile(const String& path, const String& data) = 0;
virtual String LoadFile(const String& path) = 0;
virtual int Execute(const char *cmdline) = 0;
virtual int ExecuteWithInput(const char *cmdline) = 0;
virtual int Execute(const char *cmdline, Stream& out) = 0;
virtual int AllocSlot() = 0;
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 void Launch(const char *cmdline, bool console = false) = 0;
virtual void AddFlags(Index<String>& cfg) = 0;
virtual ~Host() {}
};
struct LocalHost : Host {
Vector<String> exedirs;
String environment;
String *cmdout;
void DoDir(const String& s);
virtual String GetEnvironment();
virtual String GetHostPath(const String& path);
virtual String GetLocalPath(const String& path);
virtual String NormalizePath(const String& path);
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path);
virtual void DeleteFile(const Vector<String>& path);
virtual void DeleteFolderDeep(const String& dir);
virtual void ChDir(const String& path);
virtual void RealizeDir(const String& path);
virtual void SaveFile(const String& path, const String& data);
virtual String LoadFile(const String& path);
virtual int Execute(const char *cmdline);
virtual int ExecuteWithInput(const char *cmdline);
virtual int Execute(const char *cmdline, Stream& out);
virtual int AllocSlot();
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 void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
};
struct RemoteHost : Host {
String host;
int port;
String os_type;
// bool transfer_files;
Vector<String> path_map_local;
Vector<String> path_map_remote;
String chdir_path;
String environment;
static Time TimeBase() { return Time(2000, 1, 1); }
virtual String GetEnvironment();
virtual String GetHostPath(const String& path);
virtual String GetLocalPath(const String& path);
virtual String NormalizePath(const String& path);
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path);
virtual void DeleteFile(const Vector<String>& path);
virtual void DeleteFolderDeep(const String& dir);
virtual void ChDir(const String& path);
virtual void RealizeDir(const String& path);
virtual void SaveFile(const String& path, const String& data);
virtual String LoadFile(const String& path);
virtual int Execute(const char *cmdline);
virtual int ExecuteWithInput(const char *cmdline);
virtual int Execute(const char *cmdline, Stream& out);
virtual int AllocSlot();
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 void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
String RemoteExec(String cmd);
};

View file

@ -1,4 +1,4 @@
#include "Common.h"
#include "Core.h"
bool IsUppValueChar(int c)
{
@ -163,7 +163,22 @@ Package::Package()
noblitz = true;
}
void Package::Load(const char *path) {
bool StdResolver(const String& error, const String& path, int line)
{
PutConsole("Invalid package: " + path);
exit(1);
return false;
}
static bool (*sResolve)(const String& error, const String& path, int line) = StdResolver;
void Package::SetPackageResolver(bool (*Resolve)(const String& error, const String& path, int line))
{
sResolve = Resolve;
}
void Package::Load(const char *path)
{
for(;;) {
charset = 0;
optimize_speed = false;
@ -272,30 +287,10 @@ void Package::Load(const char *path) {
return;
}
catch(CParser::Error error) {
prompt:
switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
error + "&while parsing package " + DeQtf(path),
"Edit \\& Retry", "Ignore", "Stop")) {
case 0:
if(!PromptYesNo("Ignoring will damage package. Everything past the "
"point of error will be lost.&Do you want to continue ?"))
goto prompt;
Save(path);
return;
case 1: {
TopWindow win;
LineEdit edit;
edit.Set(f);
edit.SetCursor(edit.GetPos(p.GetLine() - 1));
win.Title(path);
win.Add(edit.SizePos());
win.Run();
SaveFile(path, edit.Get());
}
if(sResolve(error, path, p.GetLine() - 1))
break;
case -1:
exit(1);
}
Save(path);
return;
}
}
}

View file

@ -1,4 +1,4 @@
#include "Common.h"
#include "Core.h"
String GetLocalDir()
{

5
uppsrc/ide/Core/init Normal file
View file

@ -0,0 +1,5 @@
#ifndef _ide_Core_icpp_init_stub
#define _ide_Core_icpp_init_stub
#include "CtrlLib/init"
#include "Esc/init"
#endif

85
uppsrc/ide/Core/usc.cpp Normal file
View file

@ -0,0 +1,85 @@
#include "Core.h"
ArrayMap<String, EscValue>& UscGlobal()
{
static ArrayMap<String, EscValue> global;
return global;
}
IdeMacro::IdeMacro()
{
hotkey = 0;
}
GLOBAL_VAR(Array<IdeMacro>, UscMacros)
void ESC_cout(EscEscape& e)
{
if(e[0].IsArray())
PutConsole((String) e[0]);
else
if(e[0].IsNumber()) {
String str;
str << e[0].GetNumber();
PutConsole(str);
}
else
if(!e[0].IsVoid())
e.ThrowError("invalid argument to 'cout'" + e.DumpType(0));
}
void ESC_dump(EscEscape& e)
{
PutConsole(e[0].ToString());
}
static void (*sCleanModules)();
void UscSetCleanModules(void (*CleanModules)())
{
sCleanModules = CleanModules;
}
void CleanUsc()
{
UscGlobal().Clear();
UscMacros().Clear();
if(sCleanModules)
sCleanModules();
StdLib(UscGlobal());
Escape(UscGlobal(), "cout(x)", ESC_cout);
Escape(UscGlobal(), "dump(x)", ESC_dump);
}
static bool (*sIdeModuleUsc)(CParser& p);
static void (*sReadMacro)(CParser& p);
void SetIdeModuleUsc(bool (*IdeModuleUsc)(CParser& p))
{
sIdeModuleUsc = IdeModuleUsc;
}
void UscSetReadMacro(void (*ReadMacro)(CParser& p))
{
sReadMacro = ReadMacro;
}
void ParseUscFile(const char *filename) throw(CParser::Error)
{
String d = LoadFile(filename);
CParser p(d, filename);
while(!p.IsEof()) {
if(p.Id("fn")) {
EscValue& v = UscGlobal().GetPut(p.ReadId());
v = ReadLambda(p);
}
else
if(p.Id("macro") && sReadMacro)
sReadMacro(p);
else
if(!sIdeModuleUsc || !sIdeModuleUsc(p)) {
EscValue& v = UscGlobal().GetPut(p.ReadId());
v = ReadLambda(p);
}
}
}

View file

@ -32,8 +32,6 @@
#include <plugin/astyle/astyle.h>
enum { REMOTE_TIMEOUT = 2000 };
const char *FindTag(const char *txt, const char *tag);
const char *FindAfter(const char *txt, const char *tag);
int IdeLocateLine(String old_file, int old_line, String new_file);
@ -144,75 +142,6 @@ public:
Console();
};
extern String LinuxHostConsole;
struct LocalHost : Host {
Vector<String> exedirs;
String environment;
String *cmdout;
void DoDir(const String& s);
virtual String GetEnvironment();
virtual String GetHostPath(const String& path);
virtual String GetLocalPath(const String& path);
virtual String NormalizePath(const String& path);
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path);
virtual void DeleteFile(const Vector<String>& path);
virtual void DeleteFolderDeep(const String& dir);
virtual void ChDir(const String& path);
virtual void RealizeDir(const String& path);
virtual void SaveFile(const String& path, const String& data);
virtual String LoadFile(const String& path);
virtual int Execute(const char *cmdline);
virtual int ExecuteWithInput(const char *cmdline);
virtual int Execute(const char *cmdline, Stream& out);
virtual int AllocSlot();
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 void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
};
struct RemoteHost : Host {
String host;
int port;
String os_type;
// bool transfer_files;
Vector<String> path_map_local;
Vector<String> path_map_remote;
String chdir_path;
String environment;
static Time TimeBase() { return Time(2000, 1, 1); }
virtual String GetEnvironment();
virtual String GetHostPath(const String& path);
virtual String GetLocalPath(const String& path);
virtual String NormalizePath(const String& path);
virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path);
virtual void DeleteFile(const Vector<String>& path);
virtual void DeleteFolderDeep(const String& dir);
virtual void ChDir(const String& path);
virtual void RealizeDir(const String& path);
virtual void SaveFile(const String& path, const String& data);
virtual String LoadFile(const String& path);
virtual int Execute(const char *cmdline);
virtual int ExecuteWithInput(const char *cmdline);
virtual int Execute(const char *cmdline, Stream& out);
virtual int AllocSlot();
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 void Launch(const char *cmdline, bool console);
virtual void AddFlags(Index<String>& cfg);
String RemoteExec(String cmd);
};
VectorMap<String, Builder *(*)()>& BuilderMap();
String SelectAnyPackage();

View file

@ -2,6 +2,7 @@ description "TheIDE main package";
uses
ide\Common,
ide\Core,
ide\LayDes,
ide\IconDes,
ide\Builders,
@ -64,7 +65,6 @@ file
Methods.cpp,
AutoSetup.cpp,
OutputMode.cpp,
Host.cpp,
Build.cpp,
Debug.cpp,
Valgrind.cpp,

View file

@ -1,6 +1,7 @@
#ifndef _ide_icpp_init_stub
#define _ide_icpp_init_stub
#include "ide\Common/init"
#include "ide\Core/init"
#include "ide\LayDes/init"
#include "ide\IconDes/init"
#include "ide\Builders/init"