mirror of https://gitlab.com/basile.b/dexed.git
work on #39 for the linux platform
This commit is contained in:
parent
375c96df01
commit
95fae8efbb
|
|
@ -13,6 +13,7 @@ object CurrentProject: TCENativeProject
|
|||
debugingOptions.debug = True
|
||||
debugingOptions.codeviewDexts = True
|
||||
messagesOptions.additionalWarnings = True
|
||||
messagesOptions.tlsInformations = True
|
||||
outputOptions.binaryKind = obj
|
||||
pathsOptions.outputFilename = '../bin/cedast.o'
|
||||
otherOptions.customOptions.Strings = (
|
||||
|
|
@ -30,7 +31,6 @@ object CurrentProject: TCENativeProject
|
|||
)
|
||||
ConfigurationIndex = 1
|
||||
LibraryAliases.Strings = (
|
||||
'libdparse'
|
||||
'iz'
|
||||
'*'
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
dmd ../bin/cedast.o -of../bin/cedast.so -shared -defaultlib=libphobos2.so
|
||||
dmd ../bin/cedast.o /home/basile/Dev/dproj/Iz/lib/iz.a /home/basile/Dev/metad/libs/libdparse.a -of../bin/cedast.so -shared -defaultlib=libphobos2.so
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module ast;
|
||||
|
||||
import std.d.lexer, std.d.parser, std.d.ast;
|
||||
import std.json, std.array, std.conv, std.parallelism;
|
||||
import std.json, std.array, std.conv, std.parallelism, std.concurrency;
|
||||
import iz.enumset, iz.memory;
|
||||
|
||||
import common;
|
||||
|
|
@ -323,7 +323,7 @@ private:
|
|||
ubyte[] todosJson;
|
||||
ubyte[] symsPas;
|
||||
ubyte[] symsJson;
|
||||
static AstError*[] errors;
|
||||
__gshared static AstError*[] errors;
|
||||
|
||||
final static void parserError(string fname, size_t line, size_t col, string msg, bool isErr)
|
||||
{
|
||||
|
|
@ -349,6 +349,7 @@ private:
|
|||
mod = parseModule(getTokensForParser(src, config, &strcache), fname, null, &parserError);
|
||||
if (notif) notif(notifparam);
|
||||
scanned = true;
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -366,7 +367,8 @@ public:
|
|||
try src = cast(ubyte[]) read(fname, size_t.max);
|
||||
catch(Exception e){}
|
||||
scanned = false;
|
||||
task(&taskScan).executeInNewThread;
|
||||
version(Windows)task(&taskScan).executeInNewThread;
|
||||
else taskScan;
|
||||
}
|
||||
|
||||
final void scanBuffer(ubyte[] buffer)
|
||||
|
|
@ -374,7 +376,8 @@ public:
|
|||
resetCachedInfo;
|
||||
src = buffer.dup;
|
||||
scanned = false;
|
||||
task(&taskScan).executeInNewThread;
|
||||
version(Windows) task(&taskScan).executeInNewThread;
|
||||
else taskScan;
|
||||
}
|
||||
|
||||
@property AstNotification notification(){return notif;}
|
||||
|
|
@ -393,7 +396,7 @@ public:
|
|||
foreach(Token t; mod.moduleDeclaration.moduleName.identifiers)
|
||||
result ~= t.text ~ ".";
|
||||
if (result.length)
|
||||
modName = result[0 .. $-1];
|
||||
modName = result[0 .. $-1].idup;
|
||||
}
|
||||
return modName;
|
||||
}
|
||||
|
|
@ -421,7 +424,7 @@ public:
|
|||
cachedInfos += AstInfos.SymsPas;
|
||||
SymbolListBuilder slb = construct!SymbolListBuilder(mod);
|
||||
scope(exit) destruct(slb);
|
||||
symsPas = cast(ubyte[]) slb.serializePas();
|
||||
symsPas = cast(ubyte[]) slb.serializePas().dup;
|
||||
}
|
||||
return symsPas;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,19 @@ import core.runtime, common, ast;
|
|||
import iz.memory;
|
||||
|
||||
__gshared Ast[] modules;
|
||||
__gshared bool init;
|
||||
|
||||
void tryInit()
|
||||
{
|
||||
if (init) return;
|
||||
Runtime.initialize;
|
||||
init = true;
|
||||
}
|
||||
|
||||
extern(C) export
|
||||
AstHandle newAst(void* param, AstNotification clbck)
|
||||
{
|
||||
version(linux) tryInit;
|
||||
AstHandle result;
|
||||
try
|
||||
{
|
||||
|
|
@ -134,7 +142,7 @@ version(Windows)
|
|||
final switch (ulReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
Runtime.initialize;
|
||||
tryInit;
|
||||
g_hInst = hInstance;
|
||||
dll_process_attach( hInstance, true );
|
||||
break;
|
||||
|
|
@ -155,4 +163,3 @@ version(Windows)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
module common;
|
||||
|
||||
extern(C):
|
||||
|
||||
alias AstHandle = ptrdiff_t;
|
||||
|
||||
alias AstNotification = extern(C) void function(void* param);
|
||||
alias AstNotification = void function(void* param);
|
||||
|
||||
__gshared immutable AstHandle invalidAstHandle = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@
|
|||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<WorkingDirectory Value="C:\"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="6">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ unit ce_dast;
|
|||
interface
|
||||
|
||||
uses
|
||||
dynlibs, forms;
|
||||
dynlibs, sysutils, ce_common;
|
||||
|
||||
type
|
||||
|
||||
|
|
@ -44,14 +44,14 @@ var
|
|||
implementation
|
||||
|
||||
var
|
||||
dastHdl: TLibHandle;
|
||||
dastHdl: TLibHandle = 0;
|
||||
fname: string;
|
||||
|
||||
initialization
|
||||
|
||||
if application.GetOptionValue('cedast') = 'off' then
|
||||
exit;
|
||||
|
||||
dastHdl := LoadLibrary('cedast');
|
||||
fname := exeFullName('cedast' + dynExt);
|
||||
if FileExists(fname) then
|
||||
dastHdl := LoadLibrary(fname);
|
||||
if dastHdl <> NilHandle then
|
||||
begin
|
||||
newAST := TNewAst(GetProcAddress(dastHdl, 'newAst'));
|
||||
|
|
@ -60,13 +60,11 @@ initialization
|
|||
scanBuffer := TScanBuffer(GetProcAddress(dastHdl, 'scanBuffer'));
|
||||
moduleName := TModuleName(GetProcAddress(dastHdl, 'moduleName'));
|
||||
symbolList := TSymbolList(GetProcAddress(dastHdl, 'symbolList'));
|
||||
symbolList := TSymbolList(GetProcAddress(dastHdl, 'symbolList'));
|
||||
//
|
||||
dastAvailable := assigned(newAST) and assigned(deleteAST) and assigned(scanFile)
|
||||
and assigned(scanBuffer) and assigned(moduleName) and assigned(symbolList);
|
||||
end;
|
||||
|
||||
|
||||
finalization
|
||||
{$IFDEF RELEASE}
|
||||
if dastHdl <> NilHandle then
|
||||
|
|
|
|||
|
|
@ -712,6 +712,7 @@ begin
|
|||
if fDoc.ast = 0 then exit;
|
||||
//
|
||||
ptr := symbolList(fDoc.ast, len, TSerializationFormat.pas);
|
||||
if len = 0 then exit;
|
||||
fSymStream.clear;
|
||||
fSymStream.Write(ptr^, len);
|
||||
fSymStream.Position:=0;
|
||||
|
|
|
|||
|
|
@ -377,6 +377,7 @@ begin
|
|||
fAstTimer.Interval:= 2000;
|
||||
fAstTimer.OnTimer:= @AstTimerEvent;
|
||||
fAstTimer.Enabled:=true;
|
||||
fAstTimer.AutoEnabled:=true;
|
||||
end;
|
||||
//
|
||||
ShowHint := false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue