*ide: various fixes in export/makefile functionality

git-svn-id: svn://ultimatepp.org/upp/trunk@4075 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2011-10-21 12:24:54 +00:00
parent 47712e1640
commit 3aa52fb693
7 changed files with 1642 additions and 1589 deletions

File diff suppressed because it is too large Load diff

View file

@ -114,7 +114,7 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
lnk << " $(LIBPATH)";
if (!HasFlag("OSX11"))
lnk << " -Wl,-O,2";
lnk << " $(LDFLAGS)";
lnk << " $(LDFLAGS) -Wl,--start-group ";
makefile.linkfiles = lnk;
}
@ -143,6 +143,16 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
libfiles = "$(AR) ";
libfiles << makefile.output;
Vector<String> libs = Split(Gather(pkg.library, config.GetKeys()), ' ');
for(int i = 0; i < libs.GetCount(); i++) {
String ln = libs[i];
String ext = ToLower(GetFileExt(ln));
if(ext == ".a" || ext == ".so" || ext == ".dll")
makefile.linkfileend << " \\\n\t\t\t" << GetHostPathQ(FindInDirs(libpath, ln));
else
makefile.linkfileend << " \\\n\t\t\t-l" << ln;
}
for(int i = 0; i < pkg.GetCount(); i++)
if(!pkg[i].separator) {
String gop = Gather(pkg[i].option, config.GetKeys());
@ -188,10 +198,11 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
makefile.linkdep << " \\\n\t" << makefile.output;
makefile.linkfiles << " \\\n\t\t\t" << makefile.output;
}
/*
if(main) {
if(!HasFlag("SOLARIS")&&!HasFlag("OSX11"))
makefile.linkfiles << " \\\n\t\t-Wl,--start-group ";
DDUMPC(all_libraries);
for(int i = 0; i < all_libraries.GetCount(); i++) {
String ln = all_libraries[i];
String ext = ToLower(GetFileExt(ln));
@ -203,6 +214,7 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
if(!HasFlag("SOLARIS")&&!HasFlag("OSX11"))
makefile.linkfileend << " \\\n\t\t-Wl,--end-group\n\n";
}
*/
}
Point CppBuilder::ExtractVersion()

View file

@ -2,19 +2,19 @@
#define _ide_Builders_icpp_init_stub
#include "coff\binobj/init"
#include "ide\Core/init"
#define BLITZ_INDEX__ FA3F768F4F68584D236C40C6DF6A68E40
#define BLITZ_INDEX__ F5D63248A216048F12A96280BF9CB1E86
#include "GccBuilder.icpp"
#undef BLITZ_INDEX__
#define BLITZ_INDEX__ FCF60224B4DFC8C1432DE6B142D025463
#define BLITZ_INDEX__ F58692EE5FAB064756C1AE099CA890EDA
#include "MscBuilder.icpp"
#undef BLITZ_INDEX__
#define BLITZ_INDEX__ FE071E95732F1075BAFD700EC3DE99B84
#define BLITZ_INDEX__ F5A4713C90AFE78208C685537F21EFDF9
#include "OwcBuilder.icpp"
#undef BLITZ_INDEX__
#define BLITZ_INDEX__ FCBB5F9B767211D93A3ED1B649CC25373
#define BLITZ_INDEX__ F9915670F587B8AA51BB4595212B2EC34
#include "JavaBuilder.icpp"
#undef BLITZ_INDEX__
#define BLITZ_INDEX__ F9DC5DB2609C325CEC56405DCC5DAD17F
#define BLITZ_INDEX__ F9D46EF492170960498EA1803DF22DF89
#include "ScriptBuilder.icpp"
#undef BLITZ_INDEX__
#endif

View file

@ -1,415 +1,417 @@
#include "Core.h"
typedef VectorMap<String, Builder *(*)()> BuilderMapType;
GLOBAL_VAR(BuilderMapType, BuilderMap)
void RegisterBuilder(const char *name, Builder *(*create)())
{
ASSERT(BuilderMap().Find(name) < 0);
BuilderMap().Add(name, create);
}
String FindInDirs(const Vector<String>& dir, const String& file)
{
if(!IsFullPath(file))
for(int i = 0; i < dir.GetCount(); i++) {
String ef = CatAnyPath(dir[i], file);
if(FileExists(ef))
return ef;
}
return file;
}
String FindCommand(const Vector<String>& exedir, const String& cmdline)
{
String app;
const char *s = cmdline;
while(*s && (byte)*s <= ' ')
s++;
if(*s == '\"')
{
const char *b = ++s;
while(*s && *s != '\"')
s++;
app = String(b, s);
if(*s)
s++;
}
else
{
const char *b = s;
while(*s && (byte)*s > ' ')
s++;
app = String(b, s);
}
String tail = s;
String fn = FindInDirs(exedir, app);
if(!FileExists(fn))
#ifdef PLATFORM_WIN32
fn = FindInDirs(exedir, ForceExt(app, ".exe"));
#endif
#ifdef PLATFORM_POSIX
fn = FindInDirs(exedir, app);
#endif
if(fn.Find(' ') >= 0)
fn = '\"' + fn + '\"';
return fn + tail;
}
String GetMakePath(String fn, bool win32)
{
fn = UnixPath(fn);
if(!win32)
return fn;
String out;
for(const char *p = fn; *p; p++)
if(*p == '/')
out << "\\\\";
else
out.Cat(*p);
return out;
}
String AdjustMakePath(const char *fn)
{
String out;
for(; *fn; fn++)
if(*fn == '$')
out << '$' << '$';
else
out << *fn;
return out;
}
static IdeContext *the_ide;
IdeContext *TheIde() { return the_ide; }
void TheIde(IdeContext *context) { the_ide = context; }
void PutConsole(const char *s) { if(the_ide) the_ide->PutConsole(s); }
void PutVerbose(const char *s) { if(the_ide) the_ide->PutVerbose(s); }
const Workspace& GetIdeWorkspace()
{
if(the_ide)
return the_ide->IdeWorkspace();
static Workspace x;
return x;
}
String IdeContext::GetDefaultMethod()
{
return LoadFile(ConfigFile("default_method"));
}
VectorMap<String, String> IdeContext::GetMethodVars(const String& method)
{
VectorMap<String, String> map;
LoadVarFile(ConfigFile((String)~method + ".bm"), map);
return map;
}
String GetDefaultMethod()
{
return the_ide ? the_ide->GetDefaultMethod() : String();
}
VectorMap<String, String> GetMethodVars(const String& method)
{
return the_ide ? the_ide->GetMethodVars(method) : VectorMap<String, String>();
}
bool IdeIsBuilding()
{
return the_ide && the_ide->IdeIsBuilding();
}
void IdeSetBar()
{
if(the_ide)
the_ide->IdeSetBar();
}
String IdeGetOneFile()
{
return the_ide ? the_ide->IdeGetOneFile() : String(Null);
}
int IdeConsoleExecute(const char *cmdline, Stream *out, const char *envptr, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecute(cmdline, out, envptr, quiet) : -1;
}
int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecuteWithInput(cmdline, out, envptr, quiet) : -1;
}
int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecute(process, cmdline, out, quiet) : -1;
}
int IdeConsoleAllocSlot()
{
return the_ide ? the_ide->IdeConsoleAllocSlot() : 0;
}
bool IdeConsoleRun(const char *cmdline, Stream *out, const char *envptr, bool quiet, int slot, String key, int blitz_count)
{
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)
{
return the_ide && the_ide->IdeConsoleRun(process, cmdline, out, quiet, slot, key, blitz_count);
}
void IdeConsoleFlush()
{
if(the_ide) the_ide->IdeConsoleFlush();
}
void IdeConsoleBeginGroup(String group)
{
if(the_ide) the_ide->IdeConsoleBeginGroup(group);
}
void IdeConsoleEndGroup()
{
if(the_ide) the_ide->IdeConsoleEndGroup();
}
bool IdeConsoleWait()
{
return the_ide && the_ide->IdeConsoleWait();
}
void IdeGotoCodeRef(String s)
{
if(the_ide) the_ide->IdeGotoCodeRef(s);
}
void IdeSetBottom(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeSetBottom(ctrl);
}
void IdeActivateBottom() {
if(the_ide) the_ide->IdeActivateBottom();
}
void IdeRemoveBottom(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeRemoveBottom(ctrl);
}
void IdeSetRight(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeSetRight(ctrl);
}
void IdeRemoveRight(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeRemoveRight(ctrl);
}
bool IdeIsDebug()
{
return the_ide && the_ide->IdeIsDebug();
}
void IdeEndDebug()
{
if(the_ide)
the_ide->IdeEndDebug();
}
void IdeSetDebugPos(const String& file, int line, const Image& img, int i)
{
if(the_ide)
the_ide->IdeSetDebugPos(file, line, img, i);
}
void IdeHidePtr()
{
if(the_ide)
the_ide->IdeHidePtr();
}
bool IdeDebugLock()
{
return the_ide && the_ide->IdeDebugLock();
}
bool IdeDebugUnLock()
{
return the_ide && the_ide->IdeDebugUnLock();
}
bool IdeIsDebugLock()
{
return the_ide && the_ide->IdeIsDebugLock();
}
String IdeGetFileName()
{
return the_ide ? the_ide->IdeGetFileName() : String(Null);
}
int IdeGetFileLine()
{
return the_ide ? the_ide->IdeGetFileLine() : 0;
}
String IdeGetLine(int i)
{
return the_ide ? the_ide->IdeGetLine(i) : String(Null);
}
bool SaveChangedFile(const char *path, String data, bool delete_empty)
{
if(LoadFile(path) == data)
return true;
if(delete_empty && IsNull(data))
return FileDelete(path);
else
return SaveFile(path, data);
}
static int sReadCharc(CParser& p)
{
p.PassChar('\'');
if(!IsAlpha(p.PeekChar()))
p.ThrowError("language code alphabetic character expected");
char c = p.GetChar();
p.PassChar('\'');
return c;
}
static void sReadLNG(CParser& p, char *c)
{
p.PassChar('(');
c[0] = sReadCharc(p);
p.PassChar(',');
c[1] = sReadCharc(p);
p.PassChar(',');
c[2] = sReadCharc(p);
p.PassChar(',');
c[3] = sReadCharc(p);
}
int ReadLNG(CParser& p) {
char c[4];
if(p.Id("LNG_CZECH"))
return LNG_CZECH;
else
if(p.Id("LNG_ENGLISH"))
return LNG_ENGLISH;
else
if(p.Id("LNG_")) {
sReadLNG(p, c);
p.PassChar(')');
return LNG_(c[0], c[1], c[2], c[3]);
}
else
if(p.Id("LNGC_")) {
sReadLNG(p, c);
p.PassChar(',');
dword l = LNGC_(c[0], c[1], c[2], c[3], p.ReadInt());
p.PassChar(')');
return l;
}
else
p.ThrowError("invalid language code");
return 0;
}
String MakeLNG(int lang)
{
int cs = GetLNGCharset(lang);
String str;
if(cs)
return str << "LNGC_('"
<< char(((lang >> 15) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 10) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 5) & 31) + 'A' - 1) << "', '"
<< char((lang & 31) + 'A' - 1) << "', " << cs << ")";
else
return str << "LNG_('"
<< char(((lang >> 15) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 10) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 5) & 31)+ 'A' - 1) << "', '"
<< char((lang & 31) + 'A' - 1) << "')";
}
String PrintTime(int time) {
int q = time % 1000 / 10;
time /= 1000;
return Format("(%d:%02d.%02d)", time / 60, time % 60, q);
}
Point ReadNums(CParser& p) {
Point pt;
pt.x = p.ReadInt();
p.PassChar(',');
pt.y = p.ReadInt();
return pt;
}
Point ReadPoint(CParser& p)
{
Point pt;
p.PassChar('(');
pt = ReadNums(p);
p.PassChar(')');
return pt;
}
bool OldLang() {
static int q = -1;
if(q < 0)
q = FileExists(ConfigFile("oldlang"));
return q;
}
int CharFilterCid(int c)
{
return IsAlNum(c) || c == '_' ? c : 0;
}
bool IsDoc(String s)
{
s = ToLower(s);
return s.Find("readme") >= 0 || s.Find("copying") >= 0 || s.Find("license") >= 0 ||
s.Find("authors") >= 0;
}
void CopyFolder(const char *_dst, const char *_src, Index<String>& used, bool all)
{
String dst = NativePath(_dst);
String src = NativePath(_src);
if(dst == src)
return;
FindFile ff(AppendFileName(src, "*"));
bool realize = true;
while(ff) {
String s = AppendFileName(src, ff.GetName());
String d = AppendFileName(dst, ff.GetName());
if(ff.IsFolder())
CopyFolder(d, s, used, all);
else
if(ff.IsFile() && (all || IsDoc(s) || used.Find(s) >= 0)) {
if(realize) {
RealizeDirectory(dst);
realize = false;
}
SaveFile(d, LoadFile(s));
SetFileTime(d, ff.GetLastWriteTime());
}
ff.Next();
}
}
#include "Core.h"
typedef VectorMap<String, Builder *(*)()> BuilderMapType;
GLOBAL_VAR(BuilderMapType, BuilderMap)
void RegisterBuilder(const char *name, Builder *(*create)())
{
ASSERT(BuilderMap().Find(name) < 0);
BuilderMap().Add(name, create);
}
String FindInDirs(const Vector<String>& dir, const String& file)
{
if(!IsFullPath(file))
for(int i = 0; i < dir.GetCount(); i++) {
String ef = CatAnyPath(dir[i], file);
if(FileExists(ef))
return ef;
}
return file;
}
String FindCommand(const Vector<String>& exedir, const String& cmdline)
{
String app;
const char *s = cmdline;
while(*s && (byte)*s <= ' ')
s++;
if(*s == '\"')
{
const char *b = ++s;
while(*s && *s != '\"')
s++;
app = String(b, s);
if(*s)
s++;
}
else
{
const char *b = s;
while(*s && (byte)*s > ' ')
s++;
app = String(b, s);
}
String tail = s;
String fn = FindInDirs(exedir, app);
if(!FileExists(fn))
#ifdef PLATFORM_WIN32
fn = FindInDirs(exedir, ForceExt(app, ".exe"));
#endif
#ifdef PLATFORM_POSIX
fn = FindInDirs(exedir, app);
#endif
if(fn.Find(' ') >= 0)
fn = '\"' + fn + '\"';
return fn + tail;
}
String GetMakePath(String fn, bool win32)
{
fn = UnixPath(fn);
if(!win32)
return fn;
String out;
for(const char *p = fn; *p; p++)
if(*p == '/')
out << "\\\\";
else
out.Cat(*p);
return out;
}
String AdjustMakePath(const char *fn)
{
String out;
for(; *fn; fn++)
if(*fn == '$')
out << '$' << '$';
else
out << *fn;
return out;
}
static IdeContext *the_ide;
IdeContext *TheIde() { return the_ide; }
void TheIde(IdeContext *context) { the_ide = context; }
void PutConsole(const char *s) { if(the_ide) the_ide->PutConsole(s); }
void PutVerbose(const char *s) { if(the_ide) the_ide->PutVerbose(s); }
const Workspace& GetIdeWorkspace()
{
if(the_ide)
return the_ide->IdeWorkspace();
static Workspace x;
return x;
}
String IdeContext::GetDefaultMethod()
{
return LoadFile(ConfigFile("default_method"));
}
VectorMap<String, String> IdeContext::GetMethodVars(const String& method)
{
VectorMap<String, String> map;
LoadVarFile(ConfigFile((String)~method + ".bm"), map);
return map;
}
String GetDefaultMethod()
{
return the_ide ? the_ide->GetDefaultMethod() : String();
}
VectorMap<String, String> GetMethodVars(const String& method)
{
return the_ide ? the_ide->GetMethodVars(method) : VectorMap<String, String>();
}
bool IdeIsBuilding()
{
return the_ide && the_ide->IdeIsBuilding();
}
void IdeSetBar()
{
if(the_ide)
the_ide->IdeSetBar();
}
String IdeGetOneFile()
{
return the_ide ? the_ide->IdeGetOneFile() : String(Null);
}
int IdeConsoleExecute(const char *cmdline, Stream *out, const char *envptr, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecute(cmdline, out, envptr, quiet) : -1;
}
int IdeConsoleExecuteWithInput(const char *cmdline, Stream *out, const char *envptr, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecuteWithInput(cmdline, out, envptr, quiet) : -1;
}
int IdeConsoleExecute(One<SlaveProcess> process, const char *cmdline, Stream *out, bool quiet)
{
return the_ide ? the_ide->IdeConsoleExecute(process, cmdline, out, quiet) : -1;
}
int IdeConsoleAllocSlot()
{
return the_ide ? the_ide->IdeConsoleAllocSlot() : 0;
}
bool IdeConsoleRun(const char *cmdline, Stream *out, const char *envptr, bool quiet, int slot, String key, int blitz_count)
{
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)
{
return the_ide && the_ide->IdeConsoleRun(process, cmdline, out, quiet, slot, key, blitz_count);
}
void IdeConsoleFlush()
{
if(the_ide) the_ide->IdeConsoleFlush();
}
void IdeConsoleBeginGroup(String group)
{
if(the_ide) the_ide->IdeConsoleBeginGroup(group);
}
void IdeConsoleEndGroup()
{
if(the_ide) the_ide->IdeConsoleEndGroup();
}
bool IdeConsoleWait()
{
return the_ide && the_ide->IdeConsoleWait();
}
void IdeGotoCodeRef(String s)
{
if(the_ide) the_ide->IdeGotoCodeRef(s);
}
void IdeSetBottom(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeSetBottom(ctrl);
}
void IdeActivateBottom() {
if(the_ide) the_ide->IdeActivateBottom();
}
void IdeRemoveBottom(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeRemoveBottom(ctrl);
}
void IdeSetRight(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeSetRight(ctrl);
}
void IdeRemoveRight(Ctrl& ctrl)
{
if(the_ide) the_ide->IdeRemoveRight(ctrl);
}
bool IdeIsDebug()
{
return the_ide && the_ide->IdeIsDebug();
}
void IdeEndDebug()
{
if(the_ide)
the_ide->IdeEndDebug();
}
void IdeSetDebugPos(const String& file, int line, const Image& img, int i)
{
if(the_ide)
the_ide->IdeSetDebugPos(file, line, img, i);
}
void IdeHidePtr()
{
if(the_ide)
the_ide->IdeHidePtr();
}
bool IdeDebugLock()
{
return the_ide && the_ide->IdeDebugLock();
}
bool IdeDebugUnLock()
{
return the_ide && the_ide->IdeDebugUnLock();
}
bool IdeIsDebugLock()
{
return the_ide && the_ide->IdeIsDebugLock();
}
String IdeGetFileName()
{
return the_ide ? the_ide->IdeGetFileName() : String(Null);
}
int IdeGetFileLine()
{
return the_ide ? the_ide->IdeGetFileLine() : 0;
}
String IdeGetLine(int i)
{
return the_ide ? the_ide->IdeGetLine(i) : String(Null);
}
bool SaveChangedFile(const char *path, String data, bool delete_empty)
{
if(LoadFile(path) == data)
return true;
if(delete_empty && IsNull(data))
return FileDelete(path);
else
return SaveFile(path, data);
}
static int sReadCharc(CParser& p)
{
p.PassChar('\'');
if(!IsAlpha(p.PeekChar()))
p.ThrowError("language code alphabetic character expected");
char c = p.GetChar();
p.PassChar('\'');
return c;
}
static void sReadLNG(CParser& p, char *c)
{
p.PassChar('(');
c[0] = sReadCharc(p);
p.PassChar(',');
c[1] = sReadCharc(p);
p.PassChar(',');
c[2] = sReadCharc(p);
p.PassChar(',');
c[3] = sReadCharc(p);
}
int ReadLNG(CParser& p) {
char c[4];
if(p.Id("LNG_CZECH"))
return LNG_CZECH;
else
if(p.Id("LNG_ENGLISH"))
return LNG_ENGLISH;
else
if(p.Id("LNG_")) {
sReadLNG(p, c);
p.PassChar(')');
return LNG_(c[0], c[1], c[2], c[3]);
}
else
if(p.Id("LNGC_")) {
sReadLNG(p, c);
p.PassChar(',');
dword l = LNGC_(c[0], c[1], c[2], c[3], p.ReadInt());
p.PassChar(')');
return l;
}
else
p.ThrowError("invalid language code");
return 0;
}
String MakeLNG(int lang)
{
int cs = GetLNGCharset(lang);
String str;
if(cs)
return str << "LNGC_('"
<< char(((lang >> 15) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 10) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 5) & 31) + 'A' - 1) << "', '"
<< char((lang & 31) + 'A' - 1) << "', " << cs << ")";
else
return str << "LNG_('"
<< char(((lang >> 15) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 10) & 31) + 'A' - 1) << "', '"
<< char(((lang >> 5) & 31)+ 'A' - 1) << "', '"
<< char((lang & 31) + 'A' - 1) << "')";
}
String PrintTime(int time) {
int q = time % 1000 / 10;
time /= 1000;
return Format("(%d:%02d.%02d)", time / 60, time % 60, q);
}
Point ReadNums(CParser& p) {
Point pt;
pt.x = p.ReadInt();
p.PassChar(',');
pt.y = p.ReadInt();
return pt;
}
Point ReadPoint(CParser& p)
{
Point pt;
p.PassChar('(');
pt = ReadNums(p);
p.PassChar(')');
return pt;
}
bool OldLang() {
static int q = -1;
if(q < 0)
q = FileExists(ConfigFile("oldlang"));
return q;
}
int CharFilterCid(int c)
{
return IsAlNum(c) || c == '_' ? c : 0;
}
bool IsDoc(String s)
{
s = ToLower(s);
if(s.Find("svn") >= 0)
return false;
return s.Find("readme") >= 0 || s.Find("copying") >= 0 || s.Find("license") >= 0 ||
s.Find("authors") >= 0;
}
void CopyFolder(const char *_dst, const char *_src, Index<String>& used, bool all)
{
String dst = NativePath(_dst);
String src = NativePath(_src);
if(dst == src)
return;
FindFile ff(AppendFileName(src, "*"));
bool realize = true;
while(ff) {
String s = AppendFileName(src, ff.GetName());
String d = AppendFileName(dst, ff.GetName());
if(ff.IsFolder())
CopyFolder(d, s, used, all);
else
if(ff.IsFile() && (all || IsDoc(s) || used.Find(s) >= 0)) {
if(realize) {
RealizeDirectory(dst);
realize = false;
}
SaveFile(d, LoadFile(s));
SetFileTime(d, ff.GetLastWriteTime());
}
ff.Next();
}
}

View file

@ -1,409 +1,411 @@
#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);
bool IsDoc(String s);
void CopyFolder(const char *_dst, const char *_src, Index<String>& used, bool all);
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 String GetDefaultMethod();
virtual VectorMap<String, String> GetMethodVars(const String& method);
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);
String GetDefaultMethod();
VectorMap<String, String> GetMethodVars(const String& method);
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);
class Nest {
VectorMap<String, String> var;
VectorMap<String, String> package_cache;
String PackagePath0(const String& name);
public:
bool Save(const char *path);
bool Load(const char *path);
String Get(const String& id);
void Set(const String& id, const String& val);
void InvalidatePackageCache();
String PackagePath(const String& name);
};
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& val, bool save = true);
String GetAnyFileName(const char *path);
String GetAnyFileTitle(const char *path);
String CatAnyPath(String path, const char *more);
void InvalidatePackageCache();
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 {
void Reset();
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<OptItem> include;
Array<File> file;
Array<Config> config;
Array<CustomStep> custom;
Time time;
bool bold, italic;
Color ink;
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 debug_link;
String release_link;
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
#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);
bool IsDoc(String s);
void CopyFolder(const char *_dst, const char *_src, Index<String>& used, bool all);
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 String GetDefaultMethod();
virtual VectorMap<String, String> GetMethodVars(const String& method);
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);
String GetDefaultMethod();
VectorMap<String, String> GetMethodVars(const String& method);
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);
class Nest {
VectorMap<String, String> var;
VectorMap<String, String> package_cache;
String PackagePath0(const String& name);
public:
bool Save(const char *path);
bool Load(const char *path);
String Get(const String& id);
void Set(const String& id, const String& val);
void InvalidatePackageCache();
String PackagePath(const String& name);
};
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& val, bool save = true);
String GetAnyFileName(const char *path);
String GetAnyFileTitle(const char *path);
String CatAnyPath(String path, const char *more);
void InvalidatePackageCache();
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;
String ToString() const { return when + ": " + 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 {
void Reset();
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<OptItem> include;
Array<File> file;
Array<Config> config;
Array<CustomStep> custom;
Time time;
bool bold, italic;
Color ink;
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 debug_link;
String release_link;
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

View file

@ -1,51 +1,68 @@
#include "ide.h"
void Ide::ExportMakefile(const String& ep)
{
SaveMakeFile(AppendFileName(ep, "Makefile"), true);
}
void Ide::ExportProject(const String& ep, bool all, bool gui)
{
SaveFile(false);
::Workspace wspc;
wspc.Scan(main);
Index<String> used;
HdependClearDependencies();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& p = wspc.GetPackage(i);
String pn = wspc[i];
for(int j = 0; j < p.GetCount(); j++) {
const Package::File& f = p[j];
if(!f.separator) {
String p = SourcePath(pn, f);
used.FindAdd(p);
Vector<String> d = HdependGetDependencies(p);
for(int q = 0; q < d.GetCount(); q++)
used.FindAdd(d[q]);
for(int q = 0; q < f.depends.GetCount(); q++)
used.FindAdd(SourcePath(pn, f.depends[q].text));
}
}
used.FindAdd(SourcePath(pn, "init"));
}
if(FileExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
"Do you want to delete it?")) return;
FileDelete(ep);
}
if(DirectoryExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
"Do you want to replace it?")) return;
DeleteFolderDeep(ep);
}
Progress pi("Exporting project");
pi.SetTotal(wspc.GetCount());
for(int i = 0; i < wspc.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all);
}
ExportMakefile(ep);
}
#include "ide.h"
void Ide::ExportMakefile(const String& ep)
{
SaveMakeFile(AppendFileName(ep, "Makefile"), true);
}
void Ide::ExportProject(const String& ep, bool all, bool gui)
{
SaveFile(false);
::Workspace wspc;
wspc.Scan(main);
Index<String> used;
HdependClearDependencies();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& p = wspc.GetPackage(i);
String pn = wspc[i];
for(int j = 0; j < p.GetCount(); j++) {
const Package::File& f = p[j];
if(!f.separator) {
String p = SourcePath(pn, f);
used.FindAdd(p);
Vector<String> d = HdependGetDependencies(p);
for(int q = 0; q < d.GetCount(); q++)
used.FindAdd(d[q]);
for(int q = 0; q < f.depends.GetCount(); q++)
used.FindAdd(SourcePath(pn, f.depends[q].text));
}
}
used.FindAdd(SourcePath(pn, "init"));
}
if(FileExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&"
"Do you want to delete it?")) return;
FileDelete(ep);
}
if(DirectoryExists(ep)) {
if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&"
"Do you want to replace it?")) return;
DeleteFolderDeep(ep);
}
Progress pi("Exporting project");
pi.SetTotal(wspc.GetCount());
for(int i = 0; i < wspc.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all);
}
Vector<String> upp = GetUppDirs();
for(int i = 0; i < upp.GetCount(); i++) {
if(gui && pi.StepCanceled())
return;
String d = upp[i];
FindFile ff(AppendFileName(d, "*"));
while(ff) {
if(ff.IsFile()) {
String fn = ff.GetName();
String path = AppendFileName(d, fn);
if(all || used.Find(path) >= 0)
Upp::SaveFile(AppendFileName(ep, fn), LoadFile(path));
}
ff.Next();
}
CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all);
}
ExportMakefile(ep);
}

View file

@ -1,4 +1,4 @@
#ifndef _umake_icpp_init_stub
#define _umake_icpp_init_stub
#ifndef _umk_icpp_init_stub
#define _umk_icpp_init_stub
#include "ide\Builders/init"
#endif