6 Commits
7 changed files with 79 additions and 13 deletions
+7
View File
@@ -1,6 +1,13 @@
RABCDAsm Changelog
==================
RABCDAsm v1.16 (2014.04.21)
---------------------------
* Fix handling of TypeName-kind Multinames with null parameters
* Fix v1.15 regression in handling very long paths on Windows
(DMD 2.066 is required when building from source for this to work)
RABCDAsm v1.15 (2014.01.11)
---------------------------
+3
View File
@@ -74,6 +74,9 @@ compilation flags (`-O -inline`).
To be able to manipulate SWF files packed with LZMA compression, you'll need
to have the liblzma library and development files installed on your system.
Note: DMD 2.066 (as of this moment not yet released) is required for long path
support on Windows since RABCDAsm 1.16.
[d2]: http://dlang.org/
[dmd]: http://www.digitalmars.com/d/download.html
[gdc]: http://bitbucket.org/goshawk/gdc/
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, 2011, 2012, 2013 Vladimir Panteleev <vladimir@thecybershadow.net>
* Copyright 2010, 2011, 2012, 2013, 2014 Vladimir Panteleev <vladimir@thecybershadow.net>
* This file is part of RABCDAsm.
*
* RABCDAsm is free software: you can redistribute it and/or modify
@@ -994,7 +994,8 @@ private final class AStoABC : ASVisitor
{
multinames.registerDependency(m, m.vTypeName.name);
foreach (t; m.vTypeName.params)
multinames.registerDependency(m, t);
if (t)
multinames.registerDependency(m, t);
}
}
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, 2011, 2012, 2013 Vladimir Panteleev <vladimir@thecybershadow.net>
* Copyright 2010, 2011, 2012, 2013, 2014 Vladimir Panteleev <vladimir@thecybershadow.net>
* This file is part of RABCDAsm.
*
* RABCDAsm is free software: you can redistribute it and/or modify
@@ -80,7 +80,7 @@ final class Assembler
else
{
createBuffer(BUF_SIZE);
f.open(name, "rb");
f = openFile(name, "rb");
}
}
@@ -144,7 +144,7 @@ final class Assembler
dataSource = (cast(ubyte[])data).only.inputRangeObject;
else
{
f.open(name, "rb");
f = openFile(name, "rb");
dataSource = f.byChunk(BUF_SIZE).inputRangeObject;
}
scope(exit) if (!isVirtual) f.close();
+3 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, 2011, 2012 Vladimir Panteleev <vladimir@thecybershadow.net>
* Copyright 2010, 2011, 2012, 2014 Vladimir Panteleev <vladimir@thecybershadow.net>
* This file is part of RABCDAsm.
*
* RABCDAsm is free software: you can redistribute it and/or modify
@@ -222,8 +222,8 @@ struct ToStringDataHandler
_AutoDataResult ~= to!string(" ~ name ~ ");
";
*/
static if (is(typeof(T.init.toString())))
enum getMixinSingle = "_AutoDataResult ~= " ~ name ~ ".toString();";
static if (is(typeof(T.init is null)))
enum getMixinSingle = "_AutoDataResult ~= " ~ name ~ " ? to!string(" ~ name ~ ") : `null`;";
else
enum getMixinSingle = "_AutoDataResult ~= to!string(" ~ name ~ ");";
}
+57 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2012 Vladimir Panteleev <vladimir@thecybershadow.net>
* Copyright 2012, 2014 Vladimir Panteleev <vladimir@thecybershadow.net>
* This file is part of RABCDAsm.
*
* RABCDAsm is free software: you can redistribute it and/or modify
@@ -18,9 +18,10 @@
module common;
import std.path;
import std.string;
import std.array;
import std.path;
import std.stdio;
import std.string;
string longPath(string s)
{
@@ -34,3 +35,56 @@ string longPath(string s)
else
return s;
}
File openFile(string fn, string mode)
{
File f;
static if (is(typeof(&f.windowsHandleOpen)))
{
import core.sys.windows.windows;
import std.exception;
import std.utf;
import std.windows.syserror;
string winMode;
foreach (c; mode)
switch (c)
{
case 'r':
case 'w':
case 'a':
case '+':
winMode ~= c;
break;
case 'b':
case 't':
break;
default:
assert(false, "Unknown character in mode");
}
DWORD access, creation;
bool append;
switch (winMode)
{
case "r" : access = GENERIC_READ ; creation = OPEN_EXISTING; break;
case "r+": access = GENERIC_READ | GENERIC_WRITE; creation = OPEN_EXISTING; break;
case "w" : access = GENERIC_WRITE; creation = OPEN_ALWAYS ; break;
case "w+": access = GENERIC_READ | GENERIC_WRITE; creation = OPEN_ALWAYS ; break;
case "a" : access = GENERIC_WRITE; creation = OPEN_ALWAYS ; append = true; break;
case "a+": assert(false, "Not implemented"); // requires two file pointers
default: assert(false, "Bad file mode: " ~ mode);
}
auto pathW = toUTF16z(longPath(fn));
auto h = CreateFileW(pathW, access, FILE_SHARE_READ, null, creation, 0, HANDLE.init);
enforce(h != INVALID_HANDLE_VALUE, "Failed to open file \"" ~ fn ~ "\": " ~ sysErrorString(GetLastError()));
assert(!append, "'a' mode not implemented");
f.windowsHandleOpen(h, mode);
}
else
f.open(fn, mode);
return f;
}
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2010, 2011, 2012, 2013 Vladimir Panteleev <vladimir@thecybershadow.net>
* Copyright 2010, 2011, 2012, 2013, 2014 Vladimir Panteleev <vladimir@thecybershadow.net>
* This file is part of RABCDAsm.
*
* RABCDAsm is free software: you can redistribute it and/or modify
@@ -58,7 +58,7 @@ final class StringBuilder
if (subdir.length && !exists(longPath(subdir)))
mkdir(longPath(subdir));
}
file.open(longPath(filename), "wb");
file = openFile(filename, "wb");
assert(!pos, "Opening new file with unflushed buffer");
}
@@ -1129,6 +1129,7 @@ final class Disassembler
T[size] buf;
size_t pos;
void put(T v) { buf[pos++] = v; }
void put(in T[] v) { buf[pos..pos+v.length] = v[]; pos+=v.length; }
T[] data() { return buf[0..pos]; }
}