code
stringlengths 3
10M
| language
stringclasses 31
values |
|---|---|
/*******************************************************************************
* 参照カウンタ
*/
module voile.refcnt;
import std.traits;
import std.functional: toDelegate;
import voile.handler: DelegateTypeOf;
/*******************************************************************************
* アロケータ
*
* CountedDataを作成する際、メモリを割り当てる関数の型。
*/
alias Allocator = CountedInstance* delegate() pure nothrow;
/*******************************************************************************
* デアロケータ
*
* CountedDataを解放する際、メモリを解放する関数の型。
*/
alias Deallocator = void delegate(CountedInstance* instance) pure nothrow @nogc;
/*******************************************************************************
* アロケータかどうかを判定する
*/
template isAllocator(T...)
if (T.length > 0 && isCallable!(T[0]))
{
enum bool isAllocator = isAssignable!(Allocator, DelegateTypeOf!(T[0]));
}
///
@system unittest
{
static assert(isAllocator!(CountedInstance* delegate() @safe pure nothrow));
static assert(isAllocator!(CountedInstance* delegate() @system pure nothrow const));
static assert(isAllocator!(CountedInstance* delegate() @system pure nothrow @nogc));
static assert(!isAllocator!(CountedInstance* delegate() @system nothrow @nogc));
static assert(!isAllocator!(CountedInstance* delegate() @system pure @nogc));
void aaa();
static assert(!isAllocator!aaa);
CountedInstance* bbb() pure nothrow;
static assert(isAllocator!bbb);
}
/*******************************************************************************
* デアロケータかどうかを判定する
*/
template isDeallocator(T...)
if (T.length > 0 && isCallable!(T[0]))
{
static if (isFunction!(T[0]))
{
enum bool isDeallocator = isAssignable!(Deallocator, typeof(toDelegate(typeof(&T[0]).init)));
}
else
{
enum bool isDeallocator = isAssignable!(Deallocator, typeof(toDelegate(T.init)));
}
}
///
@system unittest
{
static assert(isDeallocator!(void delegate(CountedInstance*) @safe pure nothrow @nogc));
static assert(isDeallocator!(void delegate(CountedInstance*) @system pure nothrow @nogc));
static assert(isDeallocator!(void delegate(CountedInstance*) @system pure nothrow @nogc inout));
static assert(!isDeallocator!(void delegate(CountedInstance*) @system nothrow @nogc const));
static assert(!isDeallocator!(void delegate(CountedInstance*) @system pure @nogc));
void aaa();
static assert(!isDeallocator!aaa);
void bbb(CountedInstance*) pure nothrow @nogc;
static assert(isDeallocator!bbb);
}
/*******************************************************************************
* malloc/freeによるアロケータ
*/
auto defaultAllocatorByMalloc(size_t bufSize = 0) pure nothrow @nogc @safe
{
import core.exception: OutOfMemoryError;
import core.stdc.stdlib;
import core.memory;
import std.traits;
import voile.misc: assumePure, nogcEnforce, assumeNogc;
static struct Alloc
{
size_t bufSize;
this(size_t s) pure nothrow @nogc @safe
{
bufSize = s;
}
private CountedInstance* callImpl() nothrow
{
auto newSize = CountedInstance.sizeof + bufSize;
auto buf = (cast(ubyte*)malloc(newSize).nogcEnforce!OutOfMemoryError())[0..newSize];
GC.addRange(buf.ptr, buf.length, null);
GC.setAttr(buf.ptr, GC.BlkAttr.NO_MOVE);
auto ret = cast(CountedInstance*)buf.ptr;
ret.counter = 1;
ret.rawData = buf[CountedInstance.sizeof..$];
ret.deallocator = toDelegate((CountedInstance* inst)
{
assumePure!(GC.removeRange)(inst);
assumePure!free(inst);
});
return ret;
}
CountedInstance* opCall() pure nothrow
{
return assumeNogc(assumePure(&callImpl))();
}
}
return Alloc(bufSize);
}
/*******************************************************************************
* GCによるアロケータ
*/
auto defaultAllocatorByGC(size_t bufSize = 0) pure nothrow
{
static struct Alloc
{
size_t bufSize;
this(size_t s) pure nothrow @nogc @safe
{
bufSize = s;
}
CountedInstance* opCall() pure nothrow
{
auto newSize = CountedInstance.sizeof + bufSize;
auto buf = new ubyte[newSize];
auto ret = cast(CountedInstance*)buf.ptr;
ret.counter = 1;
ret.rawData = buf[CountedInstance.sizeof..$];
return ret;
}
}
return Alloc(bufSize);
}
/*******************************************************************************
* 参照カウンタ用のデータを作成する
*/
struct CountedInstance
{
/// 参照カウンタ
int counter;
/// 生データ(データのインスタンスと拡張領域を含むメモリ領域全体)
ubyte[] rawData;
/// 解放時に呼び出すためのコールバック
Deallocator deallocator;
}
/*******************************************************************************
* 参照カウンタ用のデータを作成するmixinテンプレート
*/
mixin template CountedImpl(T)
{
private CountedInstance* _instance;
/***************************************************************************
* 生データ(データのインスタンスと拡張領域を含むメモリ領域全体)
*/
inout(ubyte)[] buffer() @safe @nogc pure nothrow inout @property
in (_instance)
{
return _instance.rawData;
}
/***************************************************************************
* データのインスタンス
*/
ref inout(T) data() @trusted @nogc pure nothrow inout @property
in (_instance)
in (_instance.rawData.length >= T.sizeof)
{
return *cast(inout T*)&_instance.rawData[0];
}
/***************************************************************************
* 拡張データ領域
*/
inout(ubyte)[] extra() @safe @nogc pure nothrow inout @property
in (_instance)
in (_instance.rawData.length >= T.sizeof)
{
return _instance.rawData[T.sizeof..$];
}
/***************************************************************************
* 初期化する
*
* Note:
* 本関数を呼び出して初期化した場合、正しくrelease(CountedInstanceのdeallocatorの呼び出し)をしなければ
* メモリリークする
*/
void initializeCountedInstance(ubyte[] refbuf) @system pure @nogc
{
initializeCountedInstance(defaultAllocatorByMalloc(0));
_instance.rawData = refbuf;
}
/// ditto
void initializeCountedInstance(size_t bufSize = T.sizeof) @system pure @nogc
{
initializeCountedInstance(defaultAllocatorByMalloc(bufSize));
}
/// ditto
void initializeCountedInstance(Alloc)(scope Alloc alloc)
{
import voile.misc: assumeNogc, nogcEnforce;
if (_instance && _instance.counter > 0)
{
assert(_instance);
// 解放の際にはGCは走らないはず…
assumeNogc(_instance.deallocator)(_instance);
_instance = null;
}
_instance = alloc().nogcEnforce();
}
/***************************************************************************
* キャスト
*/
bool opCast(T)() @safe nothrow pure @nogc const
if (is(T == bool))
{
return _instance !is null;
}
/***************************************************************************
* 参照カウンタ加算
*/
int addRef() @system pure @nogc
in (_instance)
{
return ++_instance.counter;
}
/***************************************************************************
* 参照カウンタ減算と解放
*/
int release() @system pure
in (_instance)
{
import core.stdc.stdlib;
auto ret = --_instance.counter;
if (ret == 0)
{
if (_instance.rawData.ptr)
{
if (_instance.deallocator)
_instance.deallocator(_instance);
}
_instance = null;
}
return ret;
}
}
/*******************************************************************************
* 参照カウントを持つを形成する(RefCounted専用)
*
* CountedImplを実装しており、isCountedData!Tでtrueを返す型です。
* ただし、メソッドはすべてモジュール内ローカルとなっており、アクセスは許されません。
* かならずRefCountedを通してアクセスしてください。
*/
struct CountedData(T)
{
private:
mixin CountedImpl!T _impl;
}
private enum bool isRef(T) = is(T == class) || is(T == interface) || isPointer!T || isAssociativeArray!T;
/*******************************************************************************
* RefCountedにできるデータか検証する
*
* RefCountedに直接対応可能な型は以下の特徴を備えています。
* - 参照型か、ポインタのサイズと同じサイズ
* - releaseまたはRelease関数を備えていて、それらは整数を返す
* - addRefまたはAddRef関数を備えていて、それらは整数を返す
*
* 上記に該当しない場合、RefCounted!Tとすると、自動的に上記特徴を備えたCountedData!Tが内部的に使用されます。
*
* Params:
* T = 調べたい型
* See_Also:
* $(LINK2 #.CountedData, CountedData)
*/
template isCountedData(T)
{
static if ((isRef!T || T.sizeof == size_t.sizeof)
&& ((is(typeof(T.Release()) U1) && isIntegral!U1)
|| (is(typeof(T.release()) U2) && isIntegral!U2))
&& ((is(typeof(T.AddRef()) U3) && isIntegral!U3)
|| (is(typeof(T.addRef()) U4) && isIntegral!U4)))
{
enum isCountedData = true;
}
else
{
enum isCountedData = false;
}
}
///
@system unittest
{
static struct S1 {}
static assert(!isCountedData!S1);
static assert(isCountedData!(CountedData!S1));
static struct S2 { size_t x; uint release() {return 0;} uint addRef(){return 0;} }
static assert(isCountedData!S2);
static assert(isCountedData!(CountedData!S2));
class C1 {}
static assert(!isCountedData!C1);
class C2 { uint release(){return 0;} uint addRef(){return 0;}}
static assert( isCountedData!C2);
static assert(!isCountedData!int);
static assert(!isCountedData!(int*));
static assert(isCountedData!(CountedData!int));
}
// ユニークなメンバ名を取得する
private template uniqueMemberName(T, string name = "_uniqueMemberName", uint num = 0)
{
import std.conv;
enum string candidate = num == 0 ? name : text(name, num);
static if (__traits(hasMember, T, candidate))
{
enum string uniqueMemberName = uniqueMemberName!(T, name, num+1);
}
else
{
enum string uniqueMemberName = candidate;
}
}
// 参照の型
private template RefType(T)
{
static if (isCountedData!T)
{
alias RefType = T;
}
else
{
alias RefType = CountedData!T;
}
}
/*******************************************************************************
* 参照カウンタのあるデータを管理する
*
* isCountedDataなデータの参照カウントをコピーの発生や寿命の終了で自動的に増減させる。
*
* Params:
* T = isCountedDataなclass/interface/structのポインタ/size_tと同サイズのstruct、およびCountedDataのインスタンス
* See_Also:
* $(LINK2 #.isCountedData, isCountedData)
*/
struct RefCounted(T)
{
private:
mixin(`RefType!T ` ~ uniqueMemberName!(T, "_data") ~ `;`);
public:
static if (isCountedData!T)
{
mixin(`ref inout(T) ` ~ uniqueMemberName!(T, "_refData") ~ `() pure nothrow @nogc @safe inout @property
{
return ` ~ uniqueMemberName!(T, "_data") ~ `;
}`);
}
else
{
mixin(`ref inout(T) ` ~ uniqueMemberName!(T, "_refData") ~ `() pure nothrow @nogc @safe inout @property
{
return ` ~ uniqueMemberName!(T, "_data") ~ `._impl.data;
}`);
}
/***************************************************************************
* 参照カウンタを保持してアタッチ&加算する
*/
this(U)(U newRefData) @trusted
if (is(U : RefType!T))
{
__traits(getMember, this, uniqueMemberName!(T, "_data")) = newRefData;
if (isInitialized(this))
{
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef();
else static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef();
else static assert(0);
}
}
/***************************************************************************
* 参照のコピーを作成し、参照カウンタを加算する
*/
this(this) @trusted
{
if (isInitialized(this))
{
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef();
else static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef();
else static assert(0);
}
}
/***************************************************************************
* 参照カウンタを減算し、カウンタが0になったら開放する
*/
~this() @trusted
{
if (isInitialized(this))
{
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).release)))
auto x = __traits(getMember, this, uniqueMemberName!(T, "_data")).release();
else static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).Release)))
auto x = __traits(getMember, this, uniqueMemberName!(T, "_data")).Release();
static if (is(T == class) || is(T == interface))
{
if (!x)
{
if (auto obj = cast(Object)__traits(getMember, this, uniqueMemberName!(T, "_refData")))
destroy(obj);
}
}
}
}
/***************************************************************************
* 参照カウンタを保持してアタッチ&加算する
*/
void opAssign(U)(U newRefData)
if (is(U: RefType!T))
{
if (isInitialized(this))
{
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).release)))
auto x = __traits(getMember, this, uniqueMemberName!(T, "_data")).release();
else static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).Release)))
auto x = __traits(getMember, this, uniqueMemberName!(T, "_data")).Release();
static if (is(T == class) || is(T == interface))
{
if (!x)
{
if (auto obj = cast(Object)__traits(getMember, this, uniqueMemberName!(T, "_data")))
obj.destroy();
}
}
}
__traits(getMember, this, uniqueMemberName!(T, "_data")) = newRefData;
if (isInitialized(this))
{
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).addRef();
static if (is(typeof(__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef)))
__traits(getMember, this, uniqueMemberName!(T, "_data")).AddRef();
}
}
/***************************************************************************
* 参照外し
*/
auto ref opUnary(string op)() if (op == "*")
{
return __traits(getMember, this, uniqueMemberName!(T, "_refData"));
}
/// alias thisで元データにアクセス可能
mixin(`alias ` ~ uniqueMemberName!(T, "_refData") ~ ` this;`);
}
///
@safe unittest
{
string[] msg;
static class C
{
int cnt;
string[]* msg;
this(int x, string[]* m) {cnt = x; msg = m; }
~this() @trusted {*msg ~= "dtor"; }
int release() @trusted { cnt--; return cnt; }
int addRef(){ cnt++; return cnt;}
}
{
// コンストラクタを使うとカウント値が増える
RefCounted!C dat1 = new C(0, (() @trusted => &msg)());
assert(dat1.cnt == 1);
}
// スコープを抜けてRefCountedのインスタンスの寿命が終わると、デストラクタが呼ばれる
assert(msg == ["dtor"]);
}
/***************************************************************************
* 参照カウンタかどうか確認します
*/
enum isRefCounted(T) = isInstanceOf!(RefCounted, T);
///
@safe unittest
{
static assert(isRefCounted!(RefCounted!int));
static assert(!isRefCounted!(int*));
}
/***************************************************************************
* 参照カウンタの元データの型を得ます
*/
template RefCountedTypeOf(T)
if (isRefCounted!T)
{
alias RefCountedTypeOf = TemplateArgsOf!(T)[0];
}
///
@safe unittest
{
static assert(is(RefCountedTypeOf!(RefCounted!int) == int));
}
/***************************************************************************
* 参照が初期化されているか確認する
*/
bool isInitialized(T)(const ref RefCounted!T dat)
{
static if (__traits(compiles, __traits(getMember, dat, uniqueMemberName!(T, "_data")) ? true : false))
{
// ifで評価可能
return __traits(getMember, dat, uniqueMemberName!(T, "_data")) ? true : false;
}
else static if (__traits(compiles, __traits(getMember, dat, uniqueMemberName!(T, "_data")) !is null))
{
// is nullで比較可能
return __traits(getMember, dat, uniqueMemberName!(T, "_data")) !is null;
}
else static if (__traits(compiles, __traits(getMember, dat, uniqueMemberName!(T, "_data")) !is T.init))
{
// is T.initで比較可能
return __traits(getMember, dat, uniqueMemberName!(T, "_data")) !is T.init;
}
else static assert(0);
}
/// ditto
bool isEmpty(T)(const ref RefCounted!T dat)
{
return !isInitialized(dat);
}
/// ditto
alias isNull = isEmpty;
///
@safe unittest
{
RefCounted!int x;
assert(!x.isInitialized());
assert(x.isEmpty());
assert(x.isNull());
x = createRefCounted!int(1);
assert(x.isInitialized());
assert(!x.isEmpty());
assert(!x.isNull());
}
/***************************************************************************
* 参照カウンタ加算せずにアタッチする
*/
void attach(T, U)(ref RefCounted!T rc, auto ref U newRefData) pure nothrow @property
if (is(U: RefType!T))
{
__traits(getMember, rc, uniqueMemberName!(T, "_data")) = newRefData;
if (__traits(isRef, newRefData))
newRefData = null;
}
///
@safe unittest
{
static class C
{
int cnt;
this(int x) {cnt = x;}
int release() @trusted { cnt--; return cnt; }
int addRef(){ cnt++; return cnt;}
}
// コンストラクタを使うとカウント値が増える
RefCounted!C dat1 = new C(1);
assert(dat1.cnt == 2);
dat1.release();
// attachを使うとカウント値が増えない
RefCounted!C dat2;
dat2.attach(new C(1));
assert(dat2.cnt == 1);
}
/***************************************************************************
* 参照外し
*/
pragma(inline) ref inout(T) deref(T)(inout ref RefCounted!T rc) pure nothrow
{
return __traits(getMember, rc, uniqueMemberName!(T, "_refData"));
}
///
@safe unittest
{
auto x = createRefCounted!int(1);
static assert (is(typeof(x.deref) == int));
x.deref = 2;
assert(x == 2);
}
/***************************************************************************
* ポインタを得る
*/
pragma(inline) inout(T)* ptr(T)(inout ref RefCounted!T rc) pure nothrow
{
return &deref(rc);
}
///
@safe unittest
{
auto x = createRefCounted!int(1);
static assert (is(typeof(x.ptr) == int*));
*x = 2;
assert(x == 2);
(() @trusted => *(x.ptr) = 3)();
assert(x == 3);
}
/*******************************************************************************
* 参照カウンタを生成
*/
RefCounted!T createRefCounted(T, Args...)(auto ref Args args) @trusted
if (isRefCounted!T)
{
return createRefCounted!(RefCountedTypeOf!T)(args);
}
/// ditto
RefCounted!T createRefCounted(T, Args...)(auto ref Args args) @trusted
if (is(T == class) && isCountedData!T)
{
return attachRefCounted!T(new T(args));
}
/// ditto
RefCounted!T createRefCounted(T, Args...)(auto ref Args args) @trusted
if (!isPointer!T && (is(T == struct) || is(T == union)) && isCountedData!T)
{
return attachRefCounted!T(T(args));
}
/// ditto
RefCounted!T createRefCounted(T, Args...)(auto ref Args args) @trusted
if (isPointer!T && (is(PointerTarget!T == struct) || is(PointerTarget!T == union)) && isCountedData!T)
{
alias Inst = PointerTarget!T;
return attachRefCounted!T(new Inst(args));
}
/// ditto
RefCounted!T createRefCounted(T, Args...)(auto ref Args args) @trusted
if (!isCountedData!T)
{
import std.conv: emplace;
CountedData!T ret;
static assert(is(RefType!T == CountedData!T));
ret._impl.initializeCountedInstance();
emplace!T(cast(void[])ret._impl.buffer, args);
return ret.attachRefCounted!T();
}
/// ditto
RefCounted!T createRefCounted(T, alias allocator, Args...)(auto ref Args args) @trusted
if (!isCountedData!T && isAllocator!allocator)
{
CountedData!T ret;
ret._impl.initializeCountedInstance(allocator);
return ret.attachRefCounted!T();
}
///
@system unittest
{
enum short initCnt = 1;
// class
static class C
{
short cnt;
this(int x) {cnt = 1;}
int release(){ cnt--; return cnt; }
int addRef(){ cnt++; return cnt;}
}
auto c = createRefCounted!C(1);
auto c2 = c;
assert(c.cnt == 2);
// struct
static struct S
{
short cnt;
int release(){ cnt--; return cnt; }
int addRef(){ cnt++; return cnt;}
}
// struct - for pointer
auto s1 = createRefCounted!(S*)(initCnt);
assert(s1.cnt == 1);
static assert(isCountedData!(S*));
// struct - for CountedData
auto s2 = createRefCounted!S(initCnt);
auto s3 = s1;
assert(s1.cnt == 2);
auto s4 = s2;
// s2, s4はCountedDataなので、インスタンスの中身ではなく
// CountedDataのcounterが増加する
assert(s2.cnt == 1);
assert(s2.counter == 2);
// for union
static union U
{
short cnt;
int release(){ cnt--; return cnt; }
int addRef(){ cnt++; return cnt;}
}
auto u1 = createRefCounted!(U*)(initCnt);
assert(u1.cnt == 1);
static assert(isCountedData!(U*));
auto u2 = createRefCounted!U(initCnt);
assert(u2.cnt == 1);
auto u3 = u1;
assert(u1.cnt == 2);
auto u4 = u2;
// u2, u4はCountedDataなので、インスタンスの中身ではなく
// CountedDataのcounterが増加する
assert(u2.cnt == 1);
assert(u2.counter == 2);
// for scalar data
auto int1 = createRefCounted!int(1);
// with allocator
auto long1 = createRefCounted!(long, defaultAllocatorByGC(long.sizeof))(1);
}
/*******************************************************************************
* 参照カウンタを追加せずにRefCountedを得る
*/
RefCounted!T attachRefCounted(T)(T newRefData)
if (isCountedData!T)
{
import voile.misc: assumeNogc;
return assumeNogc!(attachRefCountedImpl!T)(&newRefData);
}
/// ditto
RefCounted!T attachRefCounted(T)(RefType!T newRefData)
if (!isCountedData!T)
{
import voile.misc: assumeNogc;
return assumeNogc!(attachRefCountedImpl!T)(&newRefData);
}
private RefCounted!T attachRefCountedImpl(T)(void* newRefData)
{
import std.algorithm: move;
return move(*cast(RefCounted!T*)newRefData);
}
version (Windows) @system unittest
{
import core.sys.windows.com, std.stdio;
IUnknown x;
RefCounted!IUnknown dat;
dat = x;
dat = dat;
}
@system unittest
{
int a;
class XXX
{
int cnt;
int release(){ a = 1; cnt--;return cnt; }
int addRef(){ a = 2; cnt++; return cnt;}
}
assert(a == 0);
RefCounted!XXX dat2 = new XXX;
assert(dat2.cnt == 1);
assert(a == 2);
{
RefCounted!XXX dat3 = dat2;
assert(a == 2);
assert(dat3.cnt == 2);
dat2 = dat3;
assert(a == 1);
assert(dat3.cnt == 2);
}
assert(a == 1);
assert(dat2.cnt == 1);
}
private ref inout(CountedData!T) getCountedData(T)(inout ref RefCounted!T rc) @safe @nogc pure nothrow @property
if (!isCountedData!T || isInstanceOf!(CountedData, T))
{
static assert(is(typeof(__traits(getMember, rc, uniqueMemberName!(T, "_data"))) == inout(CountedData!T)));
return __traits(getMember, rc, uniqueMemberName!(T, "_data"));
}
/***************************************************************************
* バッファ領域へアクセス
*
* バッファ領域は、Tのインスタンスと拡張領域のメモリ領域全体を指す。
*
* Note:
* release後に触れた場合、ダングリングポインタへのアクセスの可能性がある。
* また、書き換えた場合、本来RefCountedで管理しているデータが損失する可能性がある。
*/
inout(ubyte)[] buffer(T)(inout ref RefCounted!T rc) @system @nogc pure nothrow @property
if (!isCountedData!T || isInstanceOf!(CountedData, T))
in (getCountedData(rc)._instance)
{
return getCountedData(rc).buffer;
}
///
@system unittest
{
auto dat = createRefCounted!int(1);
assert(dat.buffer.length == 4);
assert(dat == *cast(int*)dat.buffer.ptr);
}
/***************************************************************************
* 拡張データ領域へアクセス
*
* 初期化時にTのインスタンスより大きなバッファを与えることで、拡張データ領域を持つことができる。
* この関数は拡張データ領域へのアクセス手段を提供する。
*
* Note:
* release後に触れた場合、ダングリングポインタへのアクセスの可能性がある。
* また、書き換えた場合、本来RefCountedで管理しているデータが損失する可能性がある。
*/
inout(ubyte)[] extraBuffer(T)(inout ref RefCounted!T rc) @system @nogc pure nothrow @property
if (!isCountedData!T || isInstanceOf!(CountedData, T))
in (getCountedData(rc)._instance)
in (getCountedData(rc)._instance.rawData.length >= T.sizeof)
{
return getCountedData(rc).extra();
}
///
@system unittest
{
auto dat = createRefCounted!(int, defaultAllocatorByMalloc(int.sizeof + 4))(1);
assert(dat.buffer.length == 8);
assert(dat.extraBuffer.length == 4);
}
/***************************************************************************
* カウント値を得る
*/
int counter(T)(const ref RefCounted!T rc) @safe @nogc pure nothrow @property
if (!isCountedData!T || isInstanceOf!(CountedData, T))
in (getCountedData(rc)._instance)
in (getCountedData(rc)._instance.rawData.length >= T.sizeof)
{
return getCountedData(rc)._instance.counter;
}
///
@system unittest
{
auto dat1 = createRefCounted!int(1);
assert(dat1.counter == 1);
{
auto dat2 = dat1;
assert(dat1.counter == 2);
}
assert(dat1.counter == 1);
}
|
D
|
instance Mod_1019_KGD_Bamrad_MT (Npc_Default)
{
//-------- primary data --------
name = "Bramrad";
npctype = NPCTYPE_MAIN;
guild = GIL_OUT;
voice = 0;
id = 1019;
//-------- abilities --------
//-------- visuals --------
// animations
Mdl_SetVisual (self,"HUMANS.MDS");
Mdl_ApplyOverlayMds (self,"Humans_Militia.mds");
// body mesh ,bdytex,skin,head mesh ,headtex,teethtex,ruestung
Mdl_SetVisualBody (self,"hum_body_Naked0", 0, 1,"Hum_Head_Bald", 13, 1, SSLD_ARMOR);
Mdl_SetModelFatness(self,1);
fight_tactic = FAI_HUMAN_STRONG;
//-------- Talente --------
B_SetFightSkills (self, 60);
B_SetAttributesToChapter (self, 4);
//-------- inventory --------
EquipItem (self, ItMw_ShortSword4);
EquipItem (self, ItRw_Bow_M_01);
//-------------Daily Routine-------------
daily_routine = Rtn_start_1019;
};
FUNC VOID Rtn_start_1019 ()
{
TA_Sleep (22,00,07,00,"KG_006");
TA_Stand_WP (07,00,10,00,"MC_WA_BOW_1");
TA_Smalltalk (10,00,13,00,"MC_WA_BOW_1"); // mit Berdin
TA_Sit_Campfire (13,00,22,00,"MC_FP_2");
};
|
D
|
instance BAU_969_Bauer (Npc_Default)
{
// ------ NSC ------
name = NAME_BAUER;
guild = GIL_OUT;
id = 969;
voice = 7;
flags = 0; //NPC_FLAG_IMMORTAL oder 0
npctype = NPCTYPE_AMBIENT;
// ------ Attribute ------
B_SetAttributesToChapter (self, 1); //setzt Attribute und LEVEL entsprechend dem angegebenen Kapitel (1-6)
// ------ Kampf-Taktik ------
fight_tactic = FAI_HUMAN_COWARD; // MASTER / STRONG / COWARD
// ------ Equippte Waffen ------ //Munition wird automatisch generiert, darf aber angegeben werden
EquipItem (self, ItMw_1h_Bau_Axe);
// ------ Inventory ------
B_CreateAmbientInv (self);
// ------ visuals ------ //Muss NACH Attributen kommen, weil in B_SetNpcVisual die Breite abh. v. STR skaliert wird
B_SetNpcVisual (self, MALE, "Hum_Head_Bald", Face_P_Gilbert, BodyTex_P, ITAR_Bau_L);
Mdl_SetModelFatness (self, 0);
Mdl_ApplyOverlayMds (self, "Humans_Arrogance.mds"); // Tired / Militia / Mage / Arrogance / Relaxed
// ------ NSC-relevante Talente vergeben ------
B_GiveNpcTalents (self);
// ------ Kampf-Talente ------ //Der enthaltene B_AddFightSkill setzt Talent-Ani abhängig von TrefferChance% - alle Kampftalente werden gleichhoch gesetzt
B_SetFightSkills (self, 10); //Grenzen für Talent-Level liegen bei 30 und 60
// ------ TA anmelden ------
daily_routine = Rtn_Start_969;
};
FUNC VOID Rtn_Start_969 ()
{
TA_Pick_FP (08,00,22,00,"NW_FARM3_FIELD_01");
TA_Sit_Campfire (22,00,08,00,"NW_FARM3_STABLE_REST_02");
};
FUNC VOID Rtn_FleeFromPass_969 ()
{
TA_Sit_Campfire (08,00,22,00,"NW_BIGMILL_MALAKSVERSTECK_06");
TA_Sit_Campfire (22,00,08,00,"NW_BIGMILL_MALAKSVERSTECK_06");
};
|
D
|
/**
* OCSP
*
* Copyright:
* (C) 2012 Jack Lloyd
* (C) 2014-2015 Etienne Cimon
*
* License:
* Botan is released under the Simplified BSD License (see LICENSE.md)
*/
module botan.cert.x509.ocsp;
import botan.constants;
static if (BOTAN_HAS_X509_CERTIFICATES):
public import botan.cert.x509.cert_status;
public import botan.cert.x509.certstor;
public import botan.cert.x509.x509cert;
import botan.cert.x509.ocsp_types;
import botan.asn1.asn1_time;
import botan.asn1.x509_dn;
import botan.asn1.der_enc;
import botan.asn1.ber_dec;
import botan.asn1.asn1_obj;
import botan.cert.x509.x509_ext;
import botan.asn1.oids;
import botan.codec.base64;
import botan.pubkey.pubkey;
import botan.cert.x509.x509path;
import botan.utils.http_util.http_util;
import botan.utils.types;
import std.datetime;
import std.algorithm : splitter;
import core.sync.mutex;
import botan.utils.mem_ops;
alias OCSPResponse = RefCounted!OCSPResponseImpl;
struct OCSPRequest
{
public:
@disable this();
this(X509Certificate issuer_cert,
X509Certificate subject_cert)
{
logTrace("OCSPRequest: Issuer Cert: ", issuer_cert.toString());
logTrace("OCSPRequest: Subject Cert: ", subject_cert.toString());
m_issuer = issuer_cert;
m_subject = subject_cert;
}
Vector!ubyte BER_encode() const
{
CertID certid = CertID(m_issuer, m_subject);
return DEREncoder().startCons(ASN1Tag.SEQUENCE)
.startCons(ASN1Tag.SEQUENCE)
.startExplicit(0)
.encode(cast(size_t)(0)) // version #
.endExplicit()
.startCons(ASN1Tag.SEQUENCE)
.startCons(ASN1Tag.SEQUENCE)
.encode(certid)
.endCons()
.endCons()
.endCons()
.endCons().getContentsUnlocked();
}
string base64Encode() const
{
return .base64Encode(BER_encode());
}
const(X509Certificate) issuer() const { return m_issuer; }
const(X509Certificate) subject() const { return m_subject; }
private:
X509Certificate m_issuer, m_subject;
}
class OCSPResponseImpl
{
public:
this(in CertificateStore trusted_roots,
in string response_bits)
{
Vector!ubyte response_vec = Vector!ubyte(response_bits);
BERDecoder response_outer = BERDecoder(response_vec).startCons(ASN1Tag.SEQUENCE);
size_t resp_status = 0;
response_outer.decode(resp_status, ASN1Tag.ENUMERATED, ASN1Tag.UNIVERSAL);
if (resp_status != 0)
throw new Exception("OCSP response status " ~ to!string(resp_status));
if (response_outer.moreItems())
{
BERDecoder response_bytes = response_outer.startCons((cast(ASN1Tag) 0), ASN1Tag.CONTEXT_SPECIFIC).startCons(ASN1Tag.SEQUENCE);
response_bytes.decodeAndCheck(OID("1.3.6.1.5.5.7.48.1.1"), "Unknown response type in OCSP response");
BERDecoder basicresponse = BERDecoder(response_bytes.getNextOctetString()).startCons(ASN1Tag.SEQUENCE);
Vector!ubyte tbs_bits;
auto sig_algo = AlgorithmIdentifier();
Vector!ubyte signature;
Vector!X509Certificate certs;
basicresponse.startCons(ASN1Tag.SEQUENCE)
.rawBytes(tbs_bits)
.endCons()
.decode(sig_algo)
.decode(signature, ASN1Tag.BIT_STRING);
decodeOptionalList(basicresponse, (cast(ASN1Tag) 0), certs);
size_t responsedata_version;
X509DN name = X509DN();
Vector!ubyte key_hash;
X509Time produced_at = X509Time(Clock.currTime(UTC()));
X509Extensions extensions = X509Extensions(true);
BERDecoder(tbs_bits)
.decodeOptional(responsedata_version, (cast(ASN1Tag) 0), ASN1Tag.CONSTRUCTED | ASN1Tag.CONTEXT_SPECIFIC)
.decodeOptional(name, (cast(ASN1Tag)1), ASN1Tag.CONSTRUCTED | ASN1Tag.CONTEXT_SPECIFIC)
.decodeOptionalString(key_hash, ASN1Tag.OCTET_STRING, 2, ASN1Tag.CONSTRUCTED | ASN1Tag.CONTEXT_SPECIFIC)
.decode(produced_at)
.decodeList(m_responses)
.decodeOptional(extensions, (cast(ASN1Tag)1), ASN1Tag.CONSTRUCTED | ASN1Tag.CONTEXT_SPECIFIC);
if (certs.empty)
{
if (auto cert = trusted_roots.findCert(name, Vector!ubyte()))
certs.pushBack(cert);
else
throw new Exception("Could not find certificate that signed OCSP response");
}
checkSignature(tbs_bits, sig_algo, signature, trusted_roots, certs);
}
response_outer.endCons();
}
CertificateStatusCode statusFor(in X509Certificate issuer,
in X509Certificate subject) const
{
//logTrace("Responses: ", m_responses.length);
foreach (response; m_responses[])
{
if (response.certid().isIdFor(issuer, subject))
{
X509Time current_time = X509Time(Clock.currTime(UTC()));
if (response.certStatus() == 1)
return CertificateStatusCode.CERT_IS_REVOKED;
if (response.thisUpdate() > current_time)
return CertificateStatusCode.OCSP_NOT_YET_VALID;
if (response.nextUpdate().timeIsSet() && current_time > response.nextUpdate())
return CertificateStatusCode.OCSP_HAS_EXPIRED;
if (response.certStatus() == 0)
return CertificateStatusCode.OCSP_RESPONSE_GOOD;
else
return CertificateStatusCode.OCSP_BAD_STATUS;
}
}
return CertificateStatusCode.OCSP_CERT_NOT_LISTED;
}
@property bool empty() {
return m_responses.length == 0;
}
private:
Vector!( SingleResponse ) m_responses;
}
void decodeOptionalList(ref BERDecoder ber,
ASN1Tag tag,
ref Vector!X509Certificate output)
{
BERObject obj = ber.getNextObject();
if (obj.type_tag != tag || obj.class_tag != (ASN1Tag.CONTEXT_SPECIFIC | ASN1Tag.CONSTRUCTED))
{
ber.pushBack(obj);
return;
}
BERDecoder list = BERDecoder(obj.value);
while (list.moreItems())
{
BERObject certbits = list.getNextObject();
X509Certificate cert = X509Certificate(unlock(certbits.value));
output.pushBack(cert);
}
}
/// Does not use trusted roots
/// Throws if not trusted
void checkSignature(ALLOC)(auto const ref Vector!(ubyte, ALLOC) tbs_response,
const AlgorithmIdentifier sig_algo,
const ref Vector!ubyte signature,
const X509Certificate cert)
{
Unique!PublicKey pub_key = cert.subjectPublicKey();
const Vector!string sig_info = splitter(OIDS.lookup(sig_algo.oid), '/');
if (sig_info.length != 2 || sig_info[0] != pub_key.algoName)
throw new Exception("Information in OCSP response does not match cert");
string padding = sig_info[1];
SignatureFormat format = (pub_key.messageParts() >= 2) ? DER_SEQUENCE : IEEE_1363;
PKVerifier verifier = PKVerifier(*pub_key, padding, format);
if (!verifier.verifyMessage(putInSequence(tbs_response), signature))
throw new Exception("Signature on OCSP response does not verify");
}
/// Iterates over trusted roots certificate store
/// throws if not trusted
void checkSignature(ALLOC)(auto const ref Vector!(ubyte, ALLOC) tbs_response,
const AlgorithmIdentifier sig_algo,
const ref Vector!ubyte signature,
const CertificateStore trusted_roots,
const ref Vector!X509Certificate certs)
{
if (certs.length < 1)
throw new InvalidArgument("Short cert chain for checkSignature");
if (trusted_roots.certificateKnown(certs[0]))
return checkSignature(tbs_response, sig_algo, signature, certs[0]);
// Otherwise attempt to chain the signing cert to a trust root
if (!certs[0].allowedUsage("PKIX.OCSPSigning"))
throw new Exception("OCSP response cert does not allow OCSP signing");
auto result = x509PathValidate(certs, PathValidationRestrictions(), trusted_roots);
if (!result.successfulValidation())
throw new Exception("Certificate validation failure: " ~ result.resultString());
if (!trusted_roots.certificateKnown(result.trustRoot())) // not needed anymore?
throw new Exception("Certificate chain roots in unknown/untrusted CA");
checkSignature(tbs_response, sig_algo, signature, result.certPath()[0]);
}
//version(Have_vibe_d) import vibe.core.concurrency : Tid, send; else
import core.sync.mutex : Mutex;
/// Checks the certificate online
struct OnlineCheck {
size_t id;
OCSPResponse* resp;
const(X509Certificate)* issuer;
const(X509Certificate)* subject;
const(CertificateStore)* trusted_roots;
void run() {
/// TODO: Test OCSP with correct BER Decoding
logTrace("Checking OCSP online");
string responder_url;
if (!issuer) {
*cast(OCSPResponse*)resp = OCSPResponse.init;
return;
}
responder_url = (*cast(X509Certificate*)issuer).ocspResponder();
logTrace("Responder url: ", responder_url.length);
if (responder_url.length == 0) {
logTrace("Aborting OCSP for ID#", id.to!string);
*cast(OCSPResponse*)resp = OCSPResponse.init;
return;
}
OCSPRequest req = OCSPRequest(*cast(X509Certificate*)issuer, *cast(X509Certificate*)subject);
logTrace("POST_sync");
HTTPResponse res = POST_sync(responder_url, "application/ocsp-request", req.BER_encode());
res.throwUnlessOk();
// Check the MIME type?
*cast(OCSPResponse*)resp = OCSPResponse(*(cast(CertificateStore*)trusted_roots), res._body());
}
}
|
D
|
import core.sys.linux.epoll;
import std.exception;
import std.socket;
import std.stdio;
void main()
{
auto listener = new TcpSocket;
scope (exit) listener.close;
auto address = new InternetAddress("127.0.0.1", 10000);
listener.bind(address);
listener.listen(1024);
int epfd = epoll_create1(0);
socket_t listenfd = listener.handle();
{
epoll_data_t data;
data.fd = listenfd;
auto ev = epoll_event(EPOLLIN, data);
int ret = epoll_ctl(epfd, EPOLL_CTL_ADD, listenfd, &ev);
errnoEnforce(ret == 0);
}
Socket[socket_t] fd2buf;
epoll_event[1024] events;
while (true)
{
auto nfds = epoll_wait(epfd, events.ptr, events.length, -1);
errnoEnforce(nfds >= 0);
foreach (n; 0 .. nfds)
{
if (listenfd == cast(socket_t) events[n].data.fd)
{
auto stream = listener.accept();
socket_t fd = stream.handle();
fd2buf[fd] = stream;
writefln("accept: fd = %d", fd);
epoll_data_t data;
data.fd = fd;
auto ev = epoll_event(EPOLLIN, data);
epoll_ctl(epfd, EPOLL_CTL_ADD, fd, &ev);
}
else
{
auto fd = cast(socket_t) events[n].data.fd;
auto stream = fd2buf[fd];
ubyte[1024] buf;
auto ret = stream.receive(buf);
if (ret == 0)
{
epoll_data_t data;
data.fd = fd;
auto ev = epoll_event(EPOLLIN, data);
epoll_ctl(epfd, EPOLL_CTL_DEL, fd, &ev);
fd2buf[fd].close;
fd2buf.remove(fd);
writefln("closed: fd = %d", fd);
continue;
}
buf = buf[0..n];
writefln("read: fd = %d, buf = %s", fd, buf);
stream.send(buf);
}
}
}
}
|
D
|
module util.allocate;
public import std.experimental.allocator;
public import std.experimental.allocator.building_blocks;
public import std.experimental.allocator.typed;
alias rtmAllocator = Mallocator;
|
D
|
switch (a car's headlights) from a higher to a lower beam
become dim or lusterless
make dim or lusterless
make dim by comparison or conceal
become vague or indistinct
lacking in light
lacking clarity or distinctness
made dim or less bright
offering little or no hope
slow to learn or understand
|
D
|
module sleekui.dwt.util.PropertyResourceBundle;
import dwt.dwthelper.ResourceBundle;
import dwt.dwthelper.utils : ImportData, MissingResourceException;
class PropertyResourceBundle
{
alias get opCall;
protected ResourceBundle bundle;
package this(void[] data, char[] name = "")
{
this(ImportData(data, name));
}
this(ImportData data)
{
this([data]);
}
this(ImportData[] data)
{
bundle = ResourceBundle.getBundle(data);
}
bool has(char[] key)
{
return bundle.hasString(key);
}
char[] get(char[] key)
{
return bundle.getString(key);
}
char[] get(char[] key, char[] defaultValue)
{
try {
return get(key);
} catch (MissingResourceException) {
return defaultValue;
}
}
char[][] keys()
{
return bundle.getKeys();
}
}
debug unittest
{
const auto properties = `
a = hello
a.b = 5
a.b.c = true
`;
auto bundle = new PropertyResourceBundle(properties);
assert(bundle.has("a"));
assert(bundle.has("a.b"));
assert(bundle.has("a.b.c"));
assert(!bundle.has("a.c"));
assert(bundle("a") == "hello");
assert(bundle("a.b") == "5");
assert(bundle.get("a.b.c") == "true");
assert(bundle.get("a.c", "sweet") == "sweet");
}
|
D
|
import std.stdio;
import std.string;
import std.range;
import std.algorithm;
void main() {
auto s = readln.chomp.retro.array;
auto cands = ["dream", "dreamer", "erase", "eraser"].map!(s => s.retro.array).array;
int idx = 0;
while(true) {
bool succ;
if (idx >= s.length-1) break;
foreach(cand; cands) {
if (idx+cand.length <= s.length && s[idx..idx+cand.length] == cand) {
idx += cand.length;
succ = true;
break;
}
}
if (!succ) {
"NO".write;
return;
}
}
"YES".write;
}
|
D
|
instance TPL_1450_Templer(Npc_Default)
{
name[0] = NAME_MadTemplar2;
npcType = npctype_guard;
guild = GIL_GUR;
level = 100;
voice = 8;
id = 1450;
attribute[ATR_STRENGTH] = 70;
attribute[ATR_DEXTERITY] = 65;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 250;
attribute[ATR_HITPOINTS] = 250;
protection[PROT_BLUNT] = 1000;
protection[PROT_EDGE] = 1000;
protection[PROT_POINT] = 1000;
protection[PROT_FIRE] = 80;
protection[PROT_FLY] = 80;
protection[PROT_MAGIC] = 70;
Mdl_SetVisual(self,"HUMANS.MDS");
Mdl_ApplyOverlayMds(self,"Humans_Mage.mds");
Mdl_SetVisualBody(self,"hum_body_Naked0",1,1,"Hum_Head_Bald",117,2,tpl_armor_m);
B_Scale(self);
Mdl_SetModelFatness(self,-1);
fight_tactic = FAI_HUMAN_Strong;
Npc_SetTalentSkill(self,NPC_TALENT_2H,1);
CreateInvItem(self,ItMw_2H_Sword_Light_02);
CreateInvItem(self,ItFoSoup);
CreateInvItem(self,ItMiJoint_1);
CreateInvItem(self,ItFo_Potion_Health_02);
daily_routine = Rtn_OT_1450;
};
func void Rtn_start_1450()
{
TA_HostileGuard(0,0,8,0,"TPL_408");
TA_HostileGuard(8,0,24,0,"TPL_408");
};
func void Rtn_OT_1450()
{
TA_HostileGuard(0,0,8,0,"TPL_348");
TA_HostileGuard(8,0,24,0,"TPL_348");
};
|
D
|
// Written in the D programming language.
/**
JavaScript Object Notation
Copyright: Copyright Jeremie Pelletier 2008 - 2009.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Jeremie Pelletier, David Herberth
References: $(LINK http://json.org/), $(LINK http://seriot.ch/parsing_json.html)
Source: $(PHOBOSSRC std/json.d)
*/
/*
Copyright Jeremie Pelletier 2008 - 2009.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
module std.json;
import std.array;
import std.conv;
import std.range.primitives;
import std.traits;
///
@system unittest
{
import std.conv : to;
// parse a file or string of json into a usable structure
string s = `{ "language": "D", "rating": 3.5, "code": "42" }`;
JSONValue j = parseJSON(s);
// j and j["language"] return JSONValue,
// j["language"].str returns a string
assert(j["language"].str == "D");
assert(j["rating"].floating == 3.5);
// check a type
long x;
if (const(JSONValue)* code = "code" in j)
{
if (code.type() == JSONType.integer)
x = code.integer;
else
x = to!int(code.str);
}
// create a json struct
JSONValue jj = [ "language": "D" ];
// rating doesnt exist yet, so use .object to assign
jj.object["rating"] = JSONValue(3.5);
// create an array to assign to list
jj.object["list"] = JSONValue( ["a", "b", "c"] );
// list already exists, so .object optional
jj["list"].array ~= JSONValue("D");
string jjStr = `{"language":"D","list":["a","b","c","D"],"rating":3.5}`;
assert(jj.toString == jjStr);
}
/**
String literals used to represent special float values within JSON strings.
*/
enum JSONFloatLiteral : string
{
nan = "NaN", /// string representation of floating-point NaN
inf = "Infinite", /// string representation of floating-point Infinity
negativeInf = "-Infinite", /// string representation of floating-point negative Infinity
}
/**
Flags that control how json is encoded and parsed.
*/
enum JSONOptions
{
none, /// standard parsing
specialFloatLiterals = 0x1, /// encode NaN and Inf float values as strings
escapeNonAsciiChars = 0x2, /// encode non ascii characters with an unicode escape sequence
doNotEscapeSlashes = 0x4, /// do not escape slashes ('/')
strictParsing = 0x8, /// Strictly follow RFC-8259 grammar when parsing
}
/**
JSON type enumeration
*/
enum JSONType : byte
{
/// Indicates the type of a `JSONValue`.
null_,
string, /// ditto
integer, /// ditto
uinteger, /// ditto
float_, /// ditto
array, /// ditto
object, /// ditto
true_, /// ditto
false_, /// ditto
// FIXME: Find some way to deprecate the enum members below, which does NOT
// create lots of spam-like deprecation warnings, which can't be fixed
// by the user. See discussion on this issue at
// https://forum.dlang.org/post/feudrhtxkaxxscwhhhff@forum.dlang.org
/* deprecated("Use .null_") */ NULL = null_,
/* deprecated("Use .string") */ STRING = string,
/* deprecated("Use .integer") */ INTEGER = integer,
/* deprecated("Use .uinteger") */ UINTEGER = uinteger,
/* deprecated("Use .float_") */ FLOAT = float_,
/* deprecated("Use .array") */ ARRAY = array,
/* deprecated("Use .object") */ OBJECT = object,
/* deprecated("Use .true_") */ TRUE = true_,
/* deprecated("Use .false_") */ FALSE = false_,
}
deprecated("Use JSONType and the new enum member names") alias JSON_TYPE = JSONType;
/**
JSON value node
*/
struct JSONValue
{
import std.exception : enforce;
union Store
{
string str;
long integer;
ulong uinteger;
double floating;
JSONValue[string] object;
JSONValue[] array;
}
private Store store;
private JSONType type_tag;
/**
Returns the JSONType of the value stored in this structure.
*/
@property JSONType type() const pure nothrow @safe @nogc
{
return type_tag;
}
///
@safe unittest
{
string s = "{ \"language\": \"D\" }";
JSONValue j = parseJSON(s);
assert(j.type == JSONType.object);
assert(j["language"].type == JSONType.string);
}
/***
* Value getter/setter for `JSONType.string`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.string`.
*/
@property string str() const pure @trusted return scope
{
enforce!JSONException(type == JSONType.string,
"JSONValue is not a string");
return store.str;
}
/// ditto
@property string str(return string v) pure nothrow @nogc @trusted return // TODO make @safe
{
assign(v);
return v;
}
///
@safe unittest
{
JSONValue j = [ "language": "D" ];
// get value
assert(j["language"].str == "D");
// change existing key to new string
j["language"].str = "Perl";
assert(j["language"].str == "Perl");
}
/***
* Value getter/setter for `JSONType.integer`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.integer`.
*/
@property long integer() const pure @safe
{
enforce!JSONException(type == JSONType.integer,
"JSONValue is not an integer");
return store.integer;
}
/// ditto
@property long integer(long v) pure nothrow @safe @nogc
{
assign(v);
return store.integer;
}
/***
* Value getter/setter for `JSONType.uinteger`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.uinteger`.
*/
@property ulong uinteger() const pure @safe
{
enforce!JSONException(type == JSONType.uinteger,
"JSONValue is not an unsigned integer");
return store.uinteger;
}
/// ditto
@property ulong uinteger(ulong v) pure nothrow @safe @nogc
{
assign(v);
return store.uinteger;
}
/***
* Value getter/setter for `JSONType.float_`. Note that despite
* the name, this is a $(B 64)-bit `double`, not a 32-bit `float`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.float_`.
*/
@property double floating() const pure @safe
{
enforce!JSONException(type == JSONType.float_,
"JSONValue is not a floating type");
return store.floating;
}
/// ditto
@property double floating(double v) pure nothrow @safe @nogc
{
assign(v);
return store.floating;
}
/***
* Value getter/setter for boolean stored in JSON.
* Throws: `JSONException` for read access if `this.type` is not
* `JSONType.true_` or `JSONType.false_`.
*/
@property bool boolean() const pure @safe
{
if (type == JSONType.true_) return true;
if (type == JSONType.false_) return false;
throw new JSONException("JSONValue is not a boolean type");
}
/// ditto
@property bool boolean(bool v) pure nothrow @safe @nogc
{
assign(v);
return v;
}
///
@safe unittest
{
JSONValue j = true;
assert(j.boolean == true);
j.boolean = false;
assert(j.boolean == false);
j.integer = 12;
import std.exception : assertThrown;
assertThrown!JSONException(j.boolean);
}
/***
* Value getter/setter for `JSONType.object`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.object`.
* Note: this is @system because of the following pattern:
---
auto a = &(json.object());
json.uinteger = 0; // overwrite AA pointer
(*a)["hello"] = "world"; // segmentation fault
---
*/
@property ref inout(JSONValue[string]) object() inout pure @system return
{
enforce!JSONException(type == JSONType.object,
"JSONValue is not an object");
return store.object;
}
/// ditto
@property JSONValue[string] object(return JSONValue[string] v) pure nothrow @nogc @trusted // TODO make @safe
{
assign(v);
return v;
}
/***
* Value getter for `JSONType.object`.
* Unlike `object`, this retrieves the object by value and can be used in @safe code.
*
* A caveat is that, if the returned value is null, modifications will not be visible:
* ---
* JSONValue json;
* json.object = null;
* json.objectNoRef["hello"] = JSONValue("world");
* assert("hello" !in json.object);
* ---
*
* Throws: `JSONException` for read access if `type` is not
* `JSONType.object`.
*/
@property inout(JSONValue[string]) objectNoRef() inout pure @trusted
{
enforce!JSONException(type == JSONType.object,
"JSONValue is not an object");
return store.object;
}
/***
* Value getter/setter for `JSONType.array`.
* Throws: `JSONException` for read access if `type` is not
* `JSONType.array`.
* Note: this is @system because of the following pattern:
---
auto a = &(json.array());
json.uinteger = 0; // overwrite array pointer
(*a)[0] = "world"; // segmentation fault
---
*/
@property ref inout(JSONValue[]) array() inout pure @system
{
enforce!JSONException(type == JSONType.array,
"JSONValue is not an array");
return store.array;
}
/// ditto
@property JSONValue[] array(return JSONValue[] v) pure nothrow @nogc @trusted scope // TODO make @safe
{
assign(v);
return v;
}
/***
* Value getter for `JSONType.array`.
* Unlike `array`, this retrieves the array by value and can be used in @safe code.
*
* A caveat is that, if you append to the returned array, the new values aren't visible in the
* JSONValue:
* ---
* JSONValue json;
* json.array = [JSONValue("hello")];
* json.arrayNoRef ~= JSONValue("world");
* assert(json.array.length == 1);
* ---
*
* Throws: `JSONException` for read access if `type` is not
* `JSONType.array`.
*/
@property inout(JSONValue[]) arrayNoRef() inout pure @trusted
{
enforce!JSONException(type == JSONType.array,
"JSONValue is not an array");
return store.array;
}
/// Test whether the type is `JSONType.null_`
@property bool isNull() const pure nothrow @safe @nogc
{
return type == JSONType.null_;
}
/***
* Generic type value getter
* A convenience getter that returns this `JSONValue` as the specified D type.
* Note: only numeric, `bool`, `string`, `JSONValue[string]` and `JSONValue[]` types are accepted
* Throws: `JSONException` if `T` cannot hold the contents of this `JSONValue`
* `ConvException` in case of integer overflow when converting to `T`
*/
@property inout(T) get(T)() inout const pure @safe
{
static if (is(immutable T == immutable string))
{
return str;
}
else static if (is(immutable T == immutable bool))
{
return boolean;
}
else static if (isFloatingPoint!T)
{
switch (type)
{
case JSONType.float_:
return cast(T) floating;
case JSONType.uinteger:
return cast(T) uinteger;
case JSONType.integer:
return cast(T) integer;
default:
throw new JSONException("JSONValue is not a number type");
}
}
else static if (isIntegral!T)
{
switch (type)
{
case JSONType.uinteger:
return uinteger.to!T;
case JSONType.integer:
return integer.to!T;
default:
throw new JSONException("JSONValue is not a an integral type");
}
}
else
{
static assert(false, "Unsupported type");
}
}
// This specialization is needed because arrayNoRef requires inout
@property inout(T) get(T : JSONValue[])() inout pure @trusted /// ditto
{
return arrayNoRef;
}
/// ditto
@property inout(T) get(T : JSONValue[string])() inout pure @trusted
{
return object;
}
///
@safe unittest
{
import std.exception;
import std.conv;
string s =
`{
"a": 123,
"b": 3.1415,
"c": "text",
"d": true,
"e": [1, 2, 3],
"f": { "a": 1 },
"g": -45,
"h": ` ~ ulong.max.to!string ~ `,
}`;
struct a { }
immutable json = parseJSON(s);
assert(json["a"].get!double == 123.0);
assert(json["a"].get!int == 123);
assert(json["a"].get!uint == 123);
assert(json["b"].get!double == 3.1415);
assertThrown!JSONException(json["b"].get!int);
assert(json["c"].get!string == "text");
assert(json["d"].get!bool == true);
assertNotThrown(json["e"].get!(JSONValue[]));
assertNotThrown(json["f"].get!(JSONValue[string]));
static assert(!__traits(compiles, json["a"].get!a));
assertThrown!JSONException(json["e"].get!float);
assertThrown!JSONException(json["d"].get!(JSONValue[string]));
assertThrown!JSONException(json["f"].get!(JSONValue[]));
assert(json["g"].get!int == -45);
assertThrown!ConvException(json["g"].get!uint);
assert(json["h"].get!ulong == ulong.max);
assertThrown!ConvException(json["h"].get!uint);
assertNotThrown(json["h"].get!float);
}
private void assign(T)(T arg)
{
static if (is(T : typeof(null)))
{
type_tag = JSONType.null_;
}
else static if (is(T : string))
{
type_tag = JSONType.string;
string t = arg;
() @trusted { store.str = t; }();
}
// https://issues.dlang.org/show_bug.cgi?id=15884
else static if (isSomeString!T)
{
type_tag = JSONType.string;
// FIXME: std.Array.Array(Range) is not deduced as 'pure'
() @trusted {
import std.utf : byUTF;
store.str = cast(immutable)(arg.byUTF!char.array);
}();
}
else static if (is(T : bool))
{
type_tag = arg ? JSONType.true_ : JSONType.false_;
}
else static if (is(T : ulong) && isUnsigned!T)
{
type_tag = JSONType.uinteger;
store.uinteger = arg;
}
else static if (is(T : long))
{
type_tag = JSONType.integer;
store.integer = arg;
}
else static if (isFloatingPoint!T)
{
type_tag = JSONType.float_;
store.floating = arg;
}
else static if (is(T : Value[Key], Key, Value))
{
static assert(is(Key : string), "AA key must be string");
type_tag = JSONType.object;
static if (is(Value : JSONValue))
{
JSONValue[string] t = arg;
() @trusted { store.object = t; }();
}
else
{
JSONValue[string] aa;
foreach (key, value; arg)
aa[key] = JSONValue(value);
() @trusted { store.object = aa; }();
}
}
else static if (isArray!T)
{
type_tag = JSONType.array;
static if (is(ElementEncodingType!T : JSONValue))
{
JSONValue[] t = arg;
() @trusted { store.array = t; }();
}
else
{
JSONValue[] new_arg = new JSONValue[arg.length];
foreach (i, e; arg)
new_arg[i] = JSONValue(e);
() @trusted { store.array = new_arg; }();
}
}
else static if (is(T : JSONValue))
{
type_tag = arg.type;
store = arg.store;
}
else
{
static assert(false, text(`unable to convert type "`, T.Stringof, `" to json`));
}
}
private void assignRef(T)(ref T arg) if (isStaticArray!T)
{
type_tag = JSONType.array;
static if (is(ElementEncodingType!T : JSONValue))
{
store.array = arg;
}
else
{
JSONValue[] new_arg = new JSONValue[arg.length];
foreach (i, e; arg)
new_arg[i] = JSONValue(e);
store.array = new_arg;
}
}
/**
* Constructor for `JSONValue`. If `arg` is a `JSONValue`
* its value and type will be copied to the new `JSONValue`.
* Note that this is a shallow copy: if type is `JSONType.object`
* or `JSONType.array` then only the reference to the data will
* be copied.
* Otherwise, `arg` must be implicitly convertible to one of the
* following types: `typeof(null)`, `string`, `ulong`,
* `long`, `double`, an associative array `V[K]` for any `V`
* and `K` i.e. a JSON object, any array or `bool`. The type will
* be set accordingly.
*/
this(T)(T arg) if (!isStaticArray!T)
{
assign(arg);
}
/// Ditto
this(T)(ref T arg) if (isStaticArray!T)
{
assignRef(arg);
}
/// Ditto
this(T : JSONValue)(inout T arg) inout
{
store = arg.store;
type_tag = arg.type;
}
///
@safe unittest
{
JSONValue j = JSONValue( "a string" );
j = JSONValue(42);
j = JSONValue( [1, 2, 3] );
assert(j.type == JSONType.array);
j = JSONValue( ["language": "D"] );
assert(j.type == JSONType.object);
}
void opAssign(T)(T arg) if (!isStaticArray!T && !is(T : JSONValue))
{
assign(arg);
}
void opAssign(T)(ref T arg) if (isStaticArray!T)
{
assignRef(arg);
}
/***
* Array syntax for json arrays.
* Throws: `JSONException` if `type` is not `JSONType.array`.
*/
ref inout(JSONValue) opIndex(size_t i) inout pure @safe
{
auto a = this.arrayNoRef;
enforce!JSONException(i < a.length,
"JSONValue array index is out of range");
return a[i];
}
///
@safe unittest
{
JSONValue j = JSONValue( [42, 43, 44] );
assert( j[0].integer == 42 );
assert( j[1].integer == 43 );
}
/***
* Hash syntax for json objects.
* Throws: `JSONException` if `type` is not `JSONType.object`.
*/
ref inout(JSONValue) opIndex(return string k) inout pure @safe
{
auto o = this.objectNoRef;
return *enforce!JSONException(k in o,
"Key not found: " ~ k);
}
///
@safe unittest
{
JSONValue j = JSONValue( ["language": "D"] );
assert( j["language"].str == "D" );
}
/***
* Operator sets `value` for element of JSON object by `key`.
*
* If JSON value is null, then operator initializes it with object and then
* sets `value` for it.
*
* Throws: `JSONException` if `type` is not `JSONType.object`
* or `JSONType.null_`.
*/
void opIndexAssign(T)(auto ref T value, string key)
{
enforce!JSONException(type == JSONType.object || type == JSONType.null_,
"JSONValue must be object or null");
JSONValue[string] aa = null;
if (type == JSONType.object)
{
aa = this.objectNoRef;
}
aa[key] = value;
this.object = aa;
}
///
@safe unittest
{
JSONValue j = JSONValue( ["language": "D"] );
j["language"].str = "Perl";
assert( j["language"].str == "Perl" );
}
void opIndexAssign(T)(T arg, size_t i)
{
auto a = this.arrayNoRef;
enforce!JSONException(i < a.length,
"JSONValue array index is out of range");
a[i] = arg;
this.array = a;
}
///
@safe unittest
{
JSONValue j = JSONValue( ["Perl", "C"] );
j[1].str = "D";
assert( j[1].str == "D" );
}
JSONValue opBinary(string op : "~", T)(T arg)
{
auto a = this.arrayNoRef;
static if (isArray!T)
{
return JSONValue(a ~ JSONValue(arg).arrayNoRef);
}
else static if (is(T : JSONValue))
{
return JSONValue(a ~ arg.arrayNoRef);
}
else
{
static assert(false, "argument is not an array or a JSONValue array");
}
}
void opOpAssign(string op : "~", T)(T arg)
{
auto a = this.arrayNoRef;
static if (isArray!T)
{
a ~= JSONValue(arg).arrayNoRef;
}
else static if (is(T : JSONValue))
{
a ~= arg.arrayNoRef;
}
else
{
static assert(false, "argument is not an array or a JSONValue array");
}
this.array = a;
}
/**
* Support for the `in` operator.
*
* Tests wether a key can be found in an object.
*
* Returns:
* when found, the `const(JSONValue)*` that matches to the key,
* otherwise `null`.
*
* Throws: `JSONException` if the right hand side argument `JSONType`
* is not `object`.
*/
auto opBinaryRight(string op : "in")(string k) const @safe
{
return k in this.objectNoRef;
}
///
@safe unittest
{
JSONValue j = [ "language": "D", "author": "walter" ];
string a = ("author" in j).str;
}
bool opEquals(const JSONValue rhs) const @nogc nothrow pure @safe
{
return opEquals(rhs);
}
bool opEquals(ref const JSONValue rhs) const @nogc nothrow pure @trusted
{
// Default doesn't work well since store is a union. Compare only
// what should be in store.
// This is @trusted to remain nogc, nothrow, fast, and usable from @safe code.
final switch (type_tag)
{
case JSONType.integer:
switch (rhs.type_tag)
{
case JSONType.integer:
return store.integer == rhs.store.integer;
case JSONType.uinteger:
return store.integer == rhs.store.uinteger;
case JSONType.float_:
return store.integer == rhs.store.floating;
default:
return false;
}
case JSONType.uinteger:
switch (rhs.type_tag)
{
case JSONType.integer:
return store.uinteger == rhs.store.integer;
case JSONType.uinteger:
return store.uinteger == rhs.store.uinteger;
case JSONType.float_:
return store.uinteger == rhs.store.floating;
default:
return false;
}
case JSONType.float_:
switch (rhs.type_tag)
{
case JSONType.integer:
return store.floating == rhs.store.integer;
case JSONType.uinteger:
return store.floating == rhs.store.uinteger;
case JSONType.float_:
return store.floating == rhs.store.floating;
default:
return false;
}
case JSONType.string:
return type_tag == rhs.type_tag && store.str == rhs.store.str;
case JSONType.object:
return type_tag == rhs.type_tag && store.object == rhs.store.object;
case JSONType.array:
return type_tag == rhs.type_tag && store.array == rhs.store.array;
case JSONType.true_:
case JSONType.false_:
case JSONType.null_:
return type_tag == rhs.type_tag;
}
}
///
@safe unittest
{
assert(JSONValue(0u) == JSONValue(0));
assert(JSONValue(0u) == JSONValue(0.0));
assert(JSONValue(0) == JSONValue(0.0));
}
/// Implements the foreach `opApply` interface for json arrays.
int opApply(scope int delegate(size_t index, ref JSONValue) dg) @system
{
int result;
foreach (size_t index, ref value; array)
{
result = dg(index, value);
if (result)
break;
}
return result;
}
/// Implements the foreach `opApply` interface for json objects.
int opApply(scope int delegate(string key, ref JSONValue) dg) @system
{
enforce!JSONException(type == JSONType.object,
"JSONValue is not an object");
int result;
foreach (string key, ref value; object)
{
result = dg(key, value);
if (result)
break;
}
return result;
}
/***
* Implicitly calls `toJSON` on this JSONValue.
*
* $(I options) can be used to tweak the conversion behavior.
*/
string toString(in JSONOptions options = JSONOptions.none) const @safe
{
return toJSON(this, false, options);
}
///
void toString(Out)(Out sink, in JSONOptions options = JSONOptions.none) const
{
toJSON(sink, this, false, options);
}
/***
* Implicitly calls `toJSON` on this JSONValue, like `toString`, but
* also passes $(I true) as $(I pretty) argument.
*
* $(I options) can be used to tweak the conversion behavior
*/
string toPrettyString(in JSONOptions options = JSONOptions.none) const @safe
{
return toJSON(this, true, options);
}
///
void toPrettyString(Out)(Out sink, in JSONOptions options = JSONOptions.none) const
{
toJSON(sink, this, true, options);
}
}
// https://issues.dlang.org/show_bug.cgi?id=20874
@system unittest
{
static struct MyCustomType
{
public string toString () const @system { return null; }
alias toString this;
}
static struct B
{
public JSONValue asJSON() const @system { return JSONValue.init; }
alias asJSON this;
}
if (false) // Just checking attributes
{
JSONValue json;
MyCustomType ilovedlang;
json = ilovedlang;
json["foo"] = ilovedlang;
auto s = ilovedlang in json;
B b;
json ~= b;
json ~ b;
}
}
/**
Parses a serialized string and returns a tree of JSON values.
Throws: $(LREF JSONException) if string does not follow the JSON grammar or the depth exceeds the max depth,
$(LREF ConvException) if a number in the input cannot be represented by a native D type.
Params:
json = json-formatted string to parse
maxDepth = maximum depth of nesting allowed, -1 disables depth checking
options = enable decoding string representations of NaN/Inf as float values
*/
JSONValue parseJSON(T)(T json, int maxDepth = -1, JSONOptions options = JSONOptions.none)
if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T))
{
import std.ascii : isDigit, isHexDigit, toUpper, toLower;
import std.typecons : Nullable, Yes;
JSONValue root;
root.type_tag = JSONType.null_;
// Avoid UTF decoding when possible, as it is unnecessary when
// processing JSON.
static if (is(T : const(char)[]))
alias Char = char;
else
alias Char = Unqual!(ElementType!T);
int depth = -1;
Nullable!Char next;
int line = 1, pos = 0;
immutable bool strict = (options & JSONOptions.strictParsing) != 0;
void error(string msg)
{
throw new JSONException(msg, line, pos);
}
if (json.empty)
{
if (strict)
{
error("Empty JSON body");
}
return root;
}
bool isWhite(dchar c)
{
if (strict)
{
// RFC 7159 has a stricter definition of whitespace than general ASCII.
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
}
import std.ascii : isWhite;
// Accept ASCII NUL as whitespace in non-strict mode.
return c == 0 || isWhite(c);
}
Char popChar()
{
if (json.empty) error("Unexpected end of data.");
static if (is(T : const(char)[]))
{
Char c = json[0];
json = json[1..$];
}
else
{
Char c = json.front;
json.popFront();
}
if (c == '\n')
{
line++;
pos = 0;
}
else
{
pos++;
}
return c;
}
Char peekChar()
{
if (next.isNull)
{
if (json.empty) return '\0';
next = popChar();
}
return next.get;
}
Nullable!Char peekCharNullable()
{
if (next.isNull && !json.empty)
{
next = popChar();
}
return next;
}
void skipWhitespace()
{
while (true)
{
auto c = peekCharNullable();
if (c.isNull ||
!isWhite(c.get))
{
return;
}
next.nullify();
}
}
Char getChar(bool SkipWhitespace = false)()
{
static if (SkipWhitespace) skipWhitespace();
Char c;
if (!next.isNull)
{
c = next.get;
next.nullify();
}
else
c = popChar();
return c;
}
void checkChar(bool SkipWhitespace = true)(char c, bool caseSensitive = true)
{
static if (SkipWhitespace) skipWhitespace();
auto c2 = getChar();
if (!caseSensitive) c2 = toLower(c2);
if (c2 != c) error(text("Found '", c2, "' when expecting '", c, "'."));
}
bool testChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c)
{
static if (SkipWhitespace) skipWhitespace();
auto c2 = peekChar();
static if (!CaseSensitive) c2 = toLower(c2);
if (c2 != c) return false;
getChar();
return true;
}
wchar parseWChar()
{
wchar val = 0;
foreach_reverse (i; 0 .. 4)
{
auto hex = toUpper(getChar());
if (!isHexDigit(hex)) error("Expecting hex character");
val += (isDigit(hex) ? hex - '0' : hex - ('A' - 10)) << (4 * i);
}
return val;
}
string parseString()
{
import std.uni : isSurrogateHi, isSurrogateLo;
import std.utf : encode, decode;
auto str = appender!string();
Next:
switch (peekChar())
{
case '"':
getChar();
break;
case '\\':
getChar();
auto c = getChar();
switch (c)
{
case '"': str.put('"'); break;
case '\\': str.put('\\'); break;
case '/': str.put('/'); break;
case 'b': str.put('\b'); break;
case 'f': str.put('\f'); break;
case 'n': str.put('\n'); break;
case 'r': str.put('\r'); break;
case 't': str.put('\t'); break;
case 'u':
wchar wc = parseWChar();
dchar val;
// Non-BMP characters are escaped as a pair of
// UTF-16 surrogate characters (see RFC 4627).
if (isSurrogateHi(wc))
{
wchar[2] pair;
pair[0] = wc;
if (getChar() != '\\') error("Expected escaped low surrogate after escaped high surrogate");
if (getChar() != 'u') error("Expected escaped low surrogate after escaped high surrogate");
pair[1] = parseWChar();
size_t index = 0;
val = decode(pair[], index);
if (index != 2) error("Invalid escaped surrogate pair");
}
else
if (isSurrogateLo(wc))
error(text("Unexpected low surrogate"));
else
val = wc;
char[4] buf;
immutable len = encode!(Yes.useReplacementDchar)(buf, val);
str.put(buf[0 .. len]);
break;
default:
error(text("Invalid escape sequence '\\", c, "'."));
}
goto Next;
default:
// RFC 7159 states that control characters U+0000 through
// U+001F must not appear unescaped in a JSON string.
// Note: std.ascii.isControl can't be used for this test
// because it considers ASCII DEL (0x7f) to be a control
// character but RFC 7159 does not.
// Accept unescaped ASCII NULs in non-strict mode.
auto c = getChar();
if (c < 0x20 && (strict || c != 0))
error("Illegal control character.");
str.put(c);
goto Next;
}
return str.data.length ? str.data : "";
}
bool tryGetSpecialFloat(string str, out double val) {
switch (str)
{
case JSONFloatLiteral.nan:
val = double.nan;
return true;
case JSONFloatLiteral.inf:
val = double.infinity;
return true;
case JSONFloatLiteral.negativeInf:
val = -double.infinity;
return true;
default:
return false;
}
}
void parseValue(ref JSONValue value)
{
depth++;
if (maxDepth != -1 && depth > maxDepth) error("Nesting too deep.");
auto c = getChar!true();
switch (c)
{
case '{':
if (testChar('}'))
{
value.object = null;
break;
}
JSONValue[string] obj;
do
{
skipWhitespace();
if (!strict && peekChar() == '}')
{
break;
}
checkChar('"');
string name = parseString();
checkChar(':');
JSONValue member;
parseValue(member);
obj[name] = member;
}
while (testChar(','));
value.object = obj;
checkChar('}');
break;
case '[':
if (testChar(']'))
{
value.type_tag = JSONType.array;
break;
}
JSONValue[] arr;
do
{
skipWhitespace();
if (!strict && peekChar() == ']')
{
break;
}
JSONValue element;
parseValue(element);
arr ~= element;
}
while (testChar(','));
checkChar(']');
value.array = arr;
break;
case '"':
auto str = parseString();
// if special float parsing is enabled, check if string represents NaN/Inf
if ((options & JSONOptions.specialFloatLiterals) &&
tryGetSpecialFloat(str, value.store.floating))
{
// found a special float, its value was placed in value.store.floating
value.type_tag = JSONType.float_;
break;
}
value.assign(str);
break;
case '0': .. case '9':
case '-':
auto number = appender!string();
bool isFloat, isNegative;
void readInteger()
{
if (!isDigit(c)) error("Digit expected");
Next: number.put(c);
if (isDigit(peekChar()))
{
c = getChar();
goto Next;
}
}
if (c == '-')
{
number.put('-');
c = getChar();
isNegative = true;
}
if (strict && c == '0')
{
number.put('0');
if (isDigit(peekChar()))
{
error("Additional digits not allowed after initial zero digit");
}
}
else
{
readInteger();
}
if (testChar('.'))
{
isFloat = true;
number.put('.');
c = getChar();
readInteger();
}
if (testChar!(false, false)('e'))
{
isFloat = true;
number.put('e');
if (testChar('+')) number.put('+');
else if (testChar('-')) number.put('-');
c = getChar();
readInteger();
}
string data = number.data;
if (isFloat)
{
value.type_tag = JSONType.float_;
value.store.floating = parse!double(data);
}
else
{
if (isNegative)
{
value.store.integer = parse!long(data);
value.type_tag = JSONType.integer;
}
else
{
// only set the correct union member to not confuse CTFE
ulong u = parse!ulong(data);
if (u & (1UL << 63))
{
value.store.uinteger = u;
value.type_tag = JSONType.uinteger;
}
else
{
value.store.integer = u;
value.type_tag = JSONType.integer;
}
}
}
break;
case 'T':
if (strict) goto default;
goto case;
case 't':
value.type_tag = JSONType.true_;
checkChar!false('r', strict);
checkChar!false('u', strict);
checkChar!false('e', strict);
break;
case 'F':
if (strict) goto default;
goto case;
case 'f':
value.type_tag = JSONType.false_;
checkChar!false('a', strict);
checkChar!false('l', strict);
checkChar!false('s', strict);
checkChar!false('e', strict);
break;
case 'N':
if (strict) goto default;
goto case;
case 'n':
value.type_tag = JSONType.null_;
checkChar!false('u', strict);
checkChar!false('l', strict);
checkChar!false('l', strict);
break;
default:
error(text("Unexpected character '", c, "'."));
}
depth--;
}
parseValue(root);
if (strict)
{
skipWhitespace();
if (!peekCharNullable().isNull) error("Trailing non-whitespace characters");
}
return root;
}
@safe unittest
{
enum issue15742objectOfObject = `{ "key1": { "key2": 1 }}`;
static assert(parseJSON(issue15742objectOfObject).type == JSONType.object);
enum issue15742arrayOfArray = `[[1]]`;
static assert(parseJSON(issue15742arrayOfArray).type == JSONType.array);
}
@safe unittest
{
// Ensure we can parse and use JSON from @safe code
auto a = `{ "key1": { "key2": 1 }}`.parseJSON;
assert(a["key1"]["key2"].integer == 1);
assert(a.toString == `{"key1":{"key2":1}}`);
}
@system unittest
{
// Ensure we can parse JSON from a @system range.
struct Range
{
string s;
size_t index;
@system
{
bool empty() { return index >= s.length; }
void popFront() { index++; }
char front() { return s[index]; }
}
}
auto s = Range(`{ "key1": { "key2": 1 }}`);
auto json = parseJSON(s);
assert(json["key1"]["key2"].integer == 1);
}
// https://issues.dlang.org/show_bug.cgi?id=20527
@safe unittest
{
static assert(parseJSON(`{"a" : 2}`)["a"].integer == 2);
}
/**
Parses a serialized string and returns a tree of JSON values.
Throws: $(LREF JSONException) if the depth exceeds the max depth.
Params:
json = json-formatted string to parse
options = enable decoding string representations of NaN/Inf as float values
*/
JSONValue parseJSON(T)(T json, JSONOptions options)
if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T))
{
return parseJSON!T(json, -1, options);
}
/**
Takes a tree of JSON values and returns the serialized string.
Any Object types will be serialized in a key-sorted order.
If `pretty` is false no whitespaces are generated.
If `pretty` is true serialized string is formatted to be human-readable.
Set the $(LREF JSONOptions.specialFloatLiterals) flag is set in `options` to encode NaN/Infinity as strings.
*/
string toJSON(const ref JSONValue root, in bool pretty = false, in JSONOptions options = JSONOptions.none) @safe
{
auto json = appender!string();
toJSON(json, root, pretty, options);
return json.data;
}
///
void toJSON(Out)(
auto ref Out json,
const ref JSONValue root,
in bool pretty = false,
in JSONOptions options = JSONOptions.none)
if (isOutputRange!(Out,char))
{
void toStringImpl(Char)(string str)
{
json.put('"');
foreach (Char c; str)
{
switch (c)
{
case '"': json.put("\\\""); break;
case '\\': json.put("\\\\"); break;
case '/':
if (!(options & JSONOptions.doNotEscapeSlashes))
json.put('\\');
json.put('/');
break;
case '\b': json.put("\\b"); break;
case '\f': json.put("\\f"); break;
case '\n': json.put("\\n"); break;
case '\r': json.put("\\r"); break;
case '\t': json.put("\\t"); break;
default:
{
import std.ascii : isControl;
import std.utf : encode;
// Make sure we do UTF decoding iff we want to
// escape Unicode characters.
assert(((options & JSONOptions.escapeNonAsciiChars) != 0)
== is(Char == dchar), "JSONOptions.escapeNonAsciiChars needs dchar strings");
with (JSONOptions) if (isControl(c) ||
((options & escapeNonAsciiChars) >= escapeNonAsciiChars && c >= 0x80))
{
// Ensure non-BMP characters are encoded as a pair
// of UTF-16 surrogate characters, as per RFC 4627.
wchar[2] wchars; // 1 or 2 UTF-16 code units
size_t wNum = encode(wchars, c); // number of UTF-16 code units
foreach (wc; wchars[0 .. wNum])
{
json.put("\\u");
foreach_reverse (i; 0 .. 4)
{
char ch = (wc >>> (4 * i)) & 0x0f;
ch += ch < 10 ? '0' : 'A' - 10;
json.put(ch);
}
}
}
else
{
json.put(c);
}
}
}
}
json.put('"');
}
void toString(string str)
{
// Avoid UTF decoding when possible, as it is unnecessary when
// processing JSON.
if (options & JSONOptions.escapeNonAsciiChars)
toStringImpl!dchar(str);
else
toStringImpl!char(str);
}
// recursive @safe inference is broken here
// workaround: if json.put is @safe, we should be too,
// so annotate the recursion as @safe manually
static if (isSafe!({ json.put(""); }))
{
void delegate(ref const JSONValue, ulong) @safe toValue;
}
else
{
void delegate(ref const JSONValue, ulong) @system toValue;
}
void toValueImpl(ref const JSONValue value, ulong indentLevel)
{
void putTabs(ulong additionalIndent = 0)
{
if (pretty)
foreach (i; 0 .. indentLevel + additionalIndent)
json.put(" ");
}
void putEOL()
{
if (pretty)
json.put('\n');
}
void putCharAndEOL(char ch)
{
json.put(ch);
putEOL();
}
final switch (value.type)
{
case JSONType.object:
auto obj = value.objectNoRef;
if (!obj.length)
{
json.put("{}");
}
else
{
putCharAndEOL('{');
bool first = true;
void emit(R)(R names)
{
foreach (name; names)
{
auto member = obj[name];
if (!first)
putCharAndEOL(',');
first = false;
putTabs(1);
toString(name);
json.put(':');
if (pretty)
json.put(' ');
toValue(member, indentLevel + 1);
}
}
import std.algorithm.sorting : sort;
// https://issues.dlang.org/show_bug.cgi?id=14439
// auto names = obj.keys; // aa.keys can't be called in @safe code
auto names = new string[obj.length];
size_t i = 0;
foreach (k, v; obj)
{
names[i] = k;
i++;
}
sort(names);
emit(names);
putEOL();
putTabs();
json.put('}');
}
break;
case JSONType.array:
auto arr = value.arrayNoRef;
if (arr.empty)
{
json.put("[]");
}
else
{
putCharAndEOL('[');
foreach (i, el; arr)
{
if (i)
putCharAndEOL(',');
putTabs(1);
toValue(el, indentLevel + 1);
}
putEOL();
putTabs();
json.put(']');
}
break;
case JSONType.string:
toString(value.str);
break;
case JSONType.integer:
json.put(to!string(value.store.integer));
break;
case JSONType.uinteger:
json.put(to!string(value.store.uinteger));
break;
case JSONType.float_:
import std.math.traits : isNaN, isInfinity;
auto val = value.store.floating;
if (val.isNaN)
{
if (options & JSONOptions.specialFloatLiterals)
{
toString(JSONFloatLiteral.nan);
}
else
{
throw new JSONException(
"Cannot encode NaN. Consider passing the specialFloatLiterals flag.");
}
}
else if (val.isInfinity)
{
if (options & JSONOptions.specialFloatLiterals)
{
toString((val > 0) ? JSONFloatLiteral.inf : JSONFloatLiteral.negativeInf);
}
else
{
throw new JSONException(
"Cannot encode Infinity. Consider passing the specialFloatLiterals flag.");
}
}
else
{
import std.algorithm.searching : canFind;
import std.format : sformat;
// The correct formula for the number of decimal digits needed for lossless round
// trips is actually:
// ceil(log(pow(2.0, double.mant_dig - 1)) / log(10.0) + 1) == (double.dig + 2)
// Anything less will round off (1 + double.epsilon)
char[25] buf;
auto result = buf[].sformat!"%.18g"(val);
json.put(result);
if (!result.canFind('e') && !result.canFind('.'))
json.put(".0");
}
break;
case JSONType.true_:
json.put("true");
break;
case JSONType.false_:
json.put("false");
break;
case JSONType.null_:
json.put("null");
break;
}
}
toValue = &toValueImpl;
toValue(root, 0);
}
// https://issues.dlang.org/show_bug.cgi?id=12897
@safe unittest
{
JSONValue jv0 = JSONValue("test测试");
assert(toJSON(jv0, false, JSONOptions.escapeNonAsciiChars) == `"test\u6D4B\u8BD5"`);
JSONValue jv00 = JSONValue("test\u6D4B\u8BD5");
assert(toJSON(jv00, false, JSONOptions.none) == `"test测试"`);
assert(toJSON(jv0, false, JSONOptions.none) == `"test测试"`);
JSONValue jv1 = JSONValue("été");
assert(toJSON(jv1, false, JSONOptions.escapeNonAsciiChars) == `"\u00E9t\u00E9"`);
JSONValue jv11 = JSONValue("\u00E9t\u00E9");
assert(toJSON(jv11, false, JSONOptions.none) == `"été"`);
assert(toJSON(jv1, false, JSONOptions.none) == `"été"`);
}
// https://issues.dlang.org/show_bug.cgi?id=20511
@system unittest
{
import std.format.write : formattedWrite;
import std.range : nullSink, outputRangeObject;
outputRangeObject!(const(char)[])(nullSink)
.formattedWrite!"%s"(JSONValue.init);
}
// Issue 16432 - JSON incorrectly parses to string
@safe unittest
{
// Floating points numbers are rounded to the nearest integer and thus get
// incorrectly parsed
import std.math.operations : isClose;
string s = "{\"rating\": 3.0 }";
JSONValue j = parseJSON(s);
assert(j["rating"].type == JSONType.float_);
j = j.toString.parseJSON;
assert(j["rating"].type == JSONType.float_);
assert(isClose(j["rating"].floating, 3.0));
s = "{\"rating\": -3.0 }";
j = parseJSON(s);
assert(j["rating"].type == JSONType.float_);
j = j.toString.parseJSON;
assert(j["rating"].type == JSONType.float_);
assert(isClose(j["rating"].floating, -3.0));
// https://issues.dlang.org/show_bug.cgi?id=13660
auto jv1 = JSONValue(4.0);
auto textual = jv1.toString();
auto jv2 = parseJSON(textual);
assert(jv1.type == JSONType.float_);
assert(textual == "4.0");
assert(jv2.type == JSONType.float_);
}
@safe unittest
{
// Adapted from https://github.com/dlang/phobos/pull/5005
// Result from toString is not checked here, because this
// might differ (%e-like or %f-like output) depending
// on OS and compiler optimization.
import std.math.operations : isClose;
// test positive extreme values
JSONValue j;
j["rating"] = 1e18 - 65;
assert(isClose(j.toString.parseJSON["rating"].floating, 1e18 - 65));
j["rating"] = 1e18 - 64;
assert(isClose(j.toString.parseJSON["rating"].floating, 1e18 - 64));
// negative extreme values
j["rating"] = -1e18 + 65;
assert(isClose(j.toString.parseJSON["rating"].floating, -1e18 + 65));
j["rating"] = -1e18 + 64;
assert(isClose(j.toString.parseJSON["rating"].floating, -1e18 + 64));
}
/**
Exception thrown on JSON errors
*/
class JSONException : Exception
{
this(string msg, int line = 0, int pos = 0) pure nothrow @safe
{
if (line)
super(text(msg, " (Line ", line, ":", pos, ")"));
else
super(msg);
}
this(string msg, string file, size_t line) pure nothrow @safe
{
super(msg, file, line);
}
}
@system unittest
{
import std.exception;
JSONValue jv = "123";
assert(jv.type == JSONType.string);
assertNotThrown(jv.str);
assertThrown!JSONException(jv.integer);
assertThrown!JSONException(jv.uinteger);
assertThrown!JSONException(jv.floating);
assertThrown!JSONException(jv.object);
assertThrown!JSONException(jv.array);
assertThrown!JSONException(jv["aa"]);
assertThrown!JSONException(jv[2]);
jv = -3;
assert(jv.type == JSONType.integer);
assertNotThrown(jv.integer);
jv = cast(uint) 3;
assert(jv.type == JSONType.uinteger);
assertNotThrown(jv.uinteger);
jv = 3.0;
assert(jv.type == JSONType.float_);
assertNotThrown(jv.floating);
jv = ["key" : "value"];
assert(jv.type == JSONType.object);
assertNotThrown(jv.object);
assertNotThrown(jv["key"]);
assert("key" in jv);
assert("notAnElement" !in jv);
assertThrown!JSONException(jv["notAnElement"]);
const cjv = jv;
assert("key" in cjv);
assertThrown!JSONException(cjv["notAnElement"]);
foreach (string key, value; jv)
{
static assert(is(typeof(value) == JSONValue));
assert(key == "key");
assert(value.type == JSONType.string);
assertNotThrown(value.str);
assert(value.str == "value");
}
jv = [3, 4, 5];
assert(jv.type == JSONType.array);
assertNotThrown(jv.array);
assertNotThrown(jv[2]);
foreach (size_t index, value; jv)
{
static assert(is(typeof(value) == JSONValue));
assert(value.type == JSONType.integer);
assertNotThrown(value.integer);
assert(index == (value.integer-3));
}
jv = null;
assert(jv.type == JSONType.null_);
assert(jv.isNull);
jv = "foo";
assert(!jv.isNull);
jv = JSONValue("value");
assert(jv.type == JSONType.string);
assert(jv.str == "value");
JSONValue jv2 = JSONValue("value");
assert(jv2.type == JSONType.string);
assert(jv2.str == "value");
JSONValue jv3 = JSONValue("\u001c");
assert(jv3.type == JSONType.string);
assert(jv3.str == "\u001C");
}
// https://issues.dlang.org/show_bug.cgi?id=11504
@system unittest
{
JSONValue jv = 1;
assert(jv.type == JSONType.integer);
jv.str = "123";
assert(jv.type == JSONType.string);
assert(jv.str == "123");
jv.integer = 1;
assert(jv.type == JSONType.integer);
assert(jv.integer == 1);
jv.uinteger = 2u;
assert(jv.type == JSONType.uinteger);
assert(jv.uinteger == 2u);
jv.floating = 1.5;
assert(jv.type == JSONType.float_);
assert(jv.floating == 1.5);
jv.object = ["key" : JSONValue("value")];
assert(jv.type == JSONType.object);
assert(jv.object == ["key" : JSONValue("value")]);
jv.array = [JSONValue(1), JSONValue(2), JSONValue(3)];
assert(jv.type == JSONType.array);
assert(jv.array == [JSONValue(1), JSONValue(2), JSONValue(3)]);
jv = true;
assert(jv.type == JSONType.true_);
jv = false;
assert(jv.type == JSONType.false_);
enum E{True = true}
jv = E.True;
assert(jv.type == JSONType.true_);
}
@system pure unittest
{
// Adding new json element via array() / object() directly
JSONValue jarr = JSONValue([10]);
foreach (i; 0 .. 9)
jarr.array ~= JSONValue(i);
assert(jarr.array.length == 10);
JSONValue jobj = JSONValue(["key" : JSONValue("value")]);
foreach (i; 0 .. 9)
jobj.object[text("key", i)] = JSONValue(text("value", i));
assert(jobj.object.length == 10);
}
@system pure unittest
{
// Adding new json element without array() / object() access
JSONValue jarr = JSONValue([10]);
foreach (i; 0 .. 9)
jarr ~= [JSONValue(i)];
assert(jarr.array.length == 10);
JSONValue jobj = JSONValue(["key" : JSONValue("value")]);
foreach (i; 0 .. 9)
jobj[text("key", i)] = JSONValue(text("value", i));
assert(jobj.object.length == 10);
// No array alias
auto jarr2 = jarr ~ [1,2,3];
jarr2[0] = 999;
assert(jarr[0] == JSONValue(10));
}
@system unittest
{
// @system because JSONValue.array is @system
import std.exception;
// An overly simple test suite, if it can parse a serializated string and
// then use the resulting values tree to generate an identical
// serialization, both the decoder and encoder works.
auto jsons = [
`null`,
`true`,
`false`,
`0`,
`123`,
`-4321`,
`0.25`,
`-0.25`,
`""`,
`"hello\nworld"`,
`"\"\\\/\b\f\n\r\t"`,
`[]`,
`[12,"foo",true,false]`,
`{}`,
`{"a":1,"b":null}`,
`{"goodbye":[true,"or",false,["test",42,{"nested":{"a":23.5,"b":0.140625}}]],`
~`"hello":{"array":[12,null,{}],"json":"is great"}}`,
];
enum dbl1_844 = `1.8446744073709568`;
version (MinGW)
jsons ~= dbl1_844 ~ `e+019`;
else
jsons ~= dbl1_844 ~ `e+19`;
JSONValue val;
string result;
foreach (json; jsons)
{
try
{
val = parseJSON(json);
enum pretty = false;
result = toJSON(val, pretty);
assert(result == json, text(result, " should be ", json));
}
catch (JSONException e)
{
import std.stdio : writefln;
writefln(text(json, "\n", e.toString()));
}
}
// Should be able to correctly interpret unicode entities
val = parseJSON(`"\u003C\u003E"`);
assert(toJSON(val) == "\"\<\>\"");
assert(val.to!string() == "\"\<\>\"");
val = parseJSON(`"\u0391\u0392\u0393"`);
assert(toJSON(val) == "\"\Α\Β\Γ\"");
assert(val.to!string() == "\"\Α\Β\Γ\"");
val = parseJSON(`"\u2660\u2666"`);
assert(toJSON(val) == "\"\♠\♦\"");
assert(val.to!string() == "\"\♠\♦\"");
//0x7F is a control character (see Unicode spec)
val = parseJSON(`"\u007F"`);
assert(toJSON(val) == "\"\\u007F\"");
assert(val.to!string() == "\"\\u007F\"");
with(parseJSON(`""`))
assert(str == "" && str !is null);
with(parseJSON(`[]`))
assert(!array.length);
// Formatting
val = parseJSON(`{"a":[null,{"x":1},{},[]]}`);
assert(toJSON(val, true) == `{
"a": [
null,
{
"x": 1
},
{},
[]
]
}`);
}
@safe unittest
{
auto json = `"hello\nworld"`;
const jv = parseJSON(json);
assert(jv.toString == json);
assert(jv.toPrettyString == json);
}
@system pure unittest
{
// https://issues.dlang.org/show_bug.cgi?id=12969
JSONValue jv;
jv["int"] = 123;
assert(jv.type == JSONType.object);
assert("int" in jv);
assert(jv["int"].integer == 123);
jv["array"] = [1, 2, 3, 4, 5];
assert(jv["array"].type == JSONType.array);
assert(jv["array"][2].integer == 3);
jv["str"] = "D language";
assert(jv["str"].type == JSONType.string);
assert(jv["str"].str == "D language");
jv["bool"] = false;
assert(jv["bool"].type == JSONType.false_);
assert(jv.object.length == 4);
jv = [5, 4, 3, 2, 1];
assert(jv.type == JSONType.array);
assert(jv[3].integer == 2);
}
@safe unittest
{
auto s = q"EOF
[
1,
2,
3,
potato
]
EOF";
import std.exception;
auto e = collectException!JSONException(parseJSON(s));
assert(e.msg == "Unexpected character 'p'. (Line 5:3)", e.msg);
}
// handling of special float values (NaN, Inf, -Inf)
@safe unittest
{
import std.exception : assertThrown;
import std.math.traits : isNaN, isInfinity;
// expected representations of NaN and Inf
enum {
nanString = '"' ~ JSONFloatLiteral.nan ~ '"',
infString = '"' ~ JSONFloatLiteral.inf ~ '"',
negativeInfString = '"' ~ JSONFloatLiteral.negativeInf ~ '"',
}
// with the specialFloatLiterals option, encode NaN/Inf as strings
assert(JSONValue(float.nan).toString(JSONOptions.specialFloatLiterals) == nanString);
assert(JSONValue(double.infinity).toString(JSONOptions.specialFloatLiterals) == infString);
assert(JSONValue(-real.infinity).toString(JSONOptions.specialFloatLiterals) == negativeInfString);
// without the specialFloatLiterals option, throw on encoding NaN/Inf
assertThrown!JSONException(JSONValue(float.nan).toString);
assertThrown!JSONException(JSONValue(double.infinity).toString);
assertThrown!JSONException(JSONValue(-real.infinity).toString);
// when parsing json with specialFloatLiterals option, decode special strings as floats
JSONValue jvNan = parseJSON(nanString, JSONOptions.specialFloatLiterals);
JSONValue jvInf = parseJSON(infString, JSONOptions.specialFloatLiterals);
JSONValue jvNegInf = parseJSON(negativeInfString, JSONOptions.specialFloatLiterals);
assert(jvNan.floating.isNaN);
assert(jvInf.floating.isInfinity && jvInf.floating > 0);
assert(jvNegInf.floating.isInfinity && jvNegInf.floating < 0);
// when parsing json without the specialFloatLiterals option, decode special strings as strings
jvNan = parseJSON(nanString);
jvInf = parseJSON(infString);
jvNegInf = parseJSON(negativeInfString);
assert(jvNan.str == JSONFloatLiteral.nan);
assert(jvInf.str == JSONFloatLiteral.inf);
assert(jvNegInf.str == JSONFloatLiteral.negativeInf);
}
pure nothrow @safe @nogc unittest
{
JSONValue testVal;
testVal = "test";
testVal = 10;
testVal = 10u;
testVal = 1.0;
testVal = (JSONValue[string]).init;
testVal = JSONValue[].init;
testVal = null;
assert(testVal.isNull);
}
// https://issues.dlang.org/show_bug.cgi?id=15884
pure nothrow @safe unittest
{
import std.typecons;
void Test(C)() {
C[] a = ['x'];
JSONValue testVal = a;
assert(testVal.type == JSONType.string);
testVal = a.idup;
assert(testVal.type == JSONType.string);
}
Test!char();
Test!wchar();
Test!dchar();
}
// https://issues.dlang.org/show_bug.cgi?id=15885
@safe unittest
{
enum bool realInDoublePrecision = real.mant_dig == double.mant_dig;
static bool test(const double num0)
{
import std.math.operations : feqrel;
const json0 = JSONValue(num0);
const num1 = to!double(toJSON(json0));
static if (realInDoublePrecision)
return feqrel(num1, num0) >= (double.mant_dig - 1);
else
return num1 == num0;
}
assert(test( 0.23));
assert(test(-0.23));
assert(test(1.223e+24));
assert(test(23.4));
assert(test(0.0012));
assert(test(30738.22));
assert(test(1 + double.epsilon));
assert(test(double.min_normal));
static if (realInDoublePrecision)
assert(test(-double.max / 2));
else
assert(test(-double.max));
const minSub = double.min_normal * double.epsilon;
assert(test(minSub));
assert(test(3*minSub));
}
// https://issues.dlang.org/show_bug.cgi?id=17555
@safe unittest
{
import std.exception : assertThrown;
assertThrown!JSONException(parseJSON("\"a\nb\""));
}
// https://issues.dlang.org/show_bug.cgi?id=17556
@safe unittest
{
auto v = JSONValue("\U0001D11E");
auto j = toJSON(v, false, JSONOptions.escapeNonAsciiChars);
assert(j == `"\uD834\uDD1E"`);
}
// https://issues.dlang.org/show_bug.cgi?id=5904
@safe unittest
{
string s = `"\uD834\uDD1E"`;
auto j = parseJSON(s);
assert(j.str == "\U0001D11E");
}
// https://issues.dlang.org/show_bug.cgi?id=17557
@safe unittest
{
assert(parseJSON("\"\xFF\"").str == "\xFF");
assert(parseJSON("\"\U0001D11E\"").str == "\U0001D11E");
}
// https://issues.dlang.org/show_bug.cgi?id=17553
@safe unittest
{
auto v = JSONValue("\xFF");
assert(toJSON(v) == "\"\xFF\"");
}
@safe unittest
{
import std.utf;
assert(parseJSON("\"\xFF\"".byChar).str == "\xFF");
assert(parseJSON("\"\U0001D11E\"".byChar).str == "\U0001D11E");
}
// JSONOptions.doNotEscapeSlashes (https://issues.dlang.org/show_bug.cgi?id=17587)
@safe unittest
{
assert(parseJSON(`"/"`).toString == `"\/"`);
assert(parseJSON(`"\/"`).toString == `"\/"`);
assert(parseJSON(`"/"`).toString(JSONOptions.doNotEscapeSlashes) == `"/"`);
assert(parseJSON(`"\/"`).toString(JSONOptions.doNotEscapeSlashes) == `"/"`);
}
// JSONOptions.strictParsing (https://issues.dlang.org/show_bug.cgi?id=16639)
@safe unittest
{
import std.exception : assertThrown;
// Unescaped ASCII NULs
assert(parseJSON("[\0]").type == JSONType.array);
assertThrown!JSONException(parseJSON("[\0]", JSONOptions.strictParsing));
assert(parseJSON("\"\0\"").str == "\0");
assertThrown!JSONException(parseJSON("\"\0\"", JSONOptions.strictParsing));
// Unescaped ASCII DEL (0x7f) in strings
assert(parseJSON("\"\x7f\"").str == "\x7f");
assert(parseJSON("\"\x7f\"", JSONOptions.strictParsing).str == "\x7f");
// "true", "false", "null" case sensitivity
assert(parseJSON("true").type == JSONType.true_);
assert(parseJSON("true", JSONOptions.strictParsing).type == JSONType.true_);
assert(parseJSON("True").type == JSONType.true_);
assertThrown!JSONException(parseJSON("True", JSONOptions.strictParsing));
assert(parseJSON("tRUE").type == JSONType.true_);
assertThrown!JSONException(parseJSON("tRUE", JSONOptions.strictParsing));
assert(parseJSON("false").type == JSONType.false_);
assert(parseJSON("false", JSONOptions.strictParsing).type == JSONType.false_);
assert(parseJSON("False").type == JSONType.false_);
assertThrown!JSONException(parseJSON("False", JSONOptions.strictParsing));
assert(parseJSON("fALSE").type == JSONType.false_);
assertThrown!JSONException(parseJSON("fALSE", JSONOptions.strictParsing));
assert(parseJSON("null").type == JSONType.null_);
assert(parseJSON("null", JSONOptions.strictParsing).type == JSONType.null_);
assert(parseJSON("Null").type == JSONType.null_);
assertThrown!JSONException(parseJSON("Null", JSONOptions.strictParsing));
assert(parseJSON("nULL").type == JSONType.null_);
assertThrown!JSONException(parseJSON("nULL", JSONOptions.strictParsing));
// Whitespace characters
assert(parseJSON("[\f\v]").type == JSONType.array);
assertThrown!JSONException(parseJSON("[\f\v]", JSONOptions.strictParsing));
assert(parseJSON("[ \t\r\n]").type == JSONType.array);
assert(parseJSON("[ \t\r\n]", JSONOptions.strictParsing).type == JSONType.array);
// Empty input
assert(parseJSON("").type == JSONType.null_);
assertThrown!JSONException(parseJSON("", JSONOptions.strictParsing));
// Numbers with leading '0's
assert(parseJSON("01").integer == 1);
assertThrown!JSONException(parseJSON("01", JSONOptions.strictParsing));
assert(parseJSON("-01").integer == -1);
assertThrown!JSONException(parseJSON("-01", JSONOptions.strictParsing));
assert(parseJSON("0.01").floating == 0.01);
assert(parseJSON("0.01", JSONOptions.strictParsing).floating == 0.01);
assert(parseJSON("0e1").floating == 0);
assert(parseJSON("0e1", JSONOptions.strictParsing).floating == 0);
// Trailing characters after JSON value
assert(parseJSON(`""asdf`).str == "");
assertThrown!JSONException(parseJSON(`""asdf`, JSONOptions.strictParsing));
assert(parseJSON("987\0").integer == 987);
assertThrown!JSONException(parseJSON("987\0", JSONOptions.strictParsing));
assert(parseJSON("987\0\0").integer == 987);
assertThrown!JSONException(parseJSON("987\0\0", JSONOptions.strictParsing));
assert(parseJSON("[]]").type == JSONType.array);
assertThrown!JSONException(parseJSON("[]]", JSONOptions.strictParsing));
assert(parseJSON("123 \t\r\n").integer == 123); // Trailing whitespace is OK
assert(parseJSON("123 \t\r\n", JSONOptions.strictParsing).integer == 123);
}
@system unittest
{
import std.algorithm.iteration : map;
import std.array : array;
import std.exception : assertThrown;
string s = `{ "a" : [1,2,3,], }`;
JSONValue j = parseJSON(s);
assert(j["a"].array().map!(i => i.integer()).array == [1,2,3]);
assertThrown(parseJSON(s, -1, JSONOptions.strictParsing));
}
@system unittest
{
import std.algorithm.iteration : map;
import std.array : array;
import std.exception : assertThrown;
string s = `{ "a" : { } , }`;
JSONValue j = parseJSON(s);
assert("a" in j);
auto t = j["a"].object();
assert(t.empty);
assertThrown(parseJSON(s, -1, JSONOptions.strictParsing));
}
// https://issues.dlang.org/show_bug.cgi?id=20330
@safe unittest
{
import std.array : appender;
string s = `{"a":[1,2,3]}`;
JSONValue j = parseJSON(s);
auto app = appender!string();
j.toString(app);
assert(app.data == s, app.data);
}
// https://issues.dlang.org/show_bug.cgi?id=20330
@safe unittest
{
import std.array : appender;
import std.format.write : formattedWrite;
string s =
`{
"a": [
1,
2,
3
]
}`;
JSONValue j = parseJSON(s);
auto app = appender!string();
j.toPrettyString(app);
assert(app.data == s, app.data);
}
|
D
|
/**
* All file formats
*
* License:
* Copyright Devisualization (Richard Andrew Cattermole) 2014 - 2017.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module devisualization.image.fileformats;
public import devisualization.image.fileformats.defs;
public import devisualization.image.fileformats.png;
|
D
|
worn or faded from being on display in a store
repeated too often
|
D
|
a drug that causes contraction of body tissues and canals
sour or bitter in taste
tending to draw together or constrict soft organic tissue
|
D
|
put in motion or move to act
give an incentive for action
|
D
|
import provider;
struct LuaEntry{
string name;
string fullName;
string shortcut;
ubyte[] customData;
}
struct Entry{
LuaEntry luaEntry;
alias luaEntry this;//make luaEntry members directly accessible
Provider provider;
}
|
D
|
; Copyright (C) 2008 The Android Open Source Project
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
.source T_aput_short_2.java
.class public dot.junit.opcodes.aput_short.d.T_aput_short_2
.super java/lang/Object
.method public <init>()V
.limit regs 1
invoke-direct {v0}, java/lang/Object/<init>()V
return-void
.end method
.method public run([SDS)V
.limit regs 11
aput-short v10, v7, v8
return-void
.end method
|
D
|
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.build/Container/Container.swift.o : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceID.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Deprecated.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Service.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceCache.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Extendable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Config/Config.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Provider/Provider.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/Container.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/SubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicSubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/ServiceError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/ContainerAlias.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Services.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Environment/Environment.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/BasicServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.build/Container~partial.swiftmodule : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceID.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Deprecated.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Service.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceCache.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Extendable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Config/Config.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Provider/Provider.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/Container.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/SubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicSubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/ServiceError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/ContainerAlias.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Services.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Environment/Environment.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/BasicServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.build/Container~partial.swiftdoc : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceID.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Deprecated.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Service.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceCache.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Extendable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Config/Config.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Provider/Provider.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/Container.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/SubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicSubContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/BasicContainer.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/ServiceError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Container/ContainerAlias.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/Services.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Utilities/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Environment/Environment.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/ServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/BasicServiceFactory.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/service.git--3029908809087319447/Sources/Service/Services/TypeServiceFactory.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
instance Mod_1604_SLD_Soeldner_FM (Npc_Default)
{
//-------- primary data --------
name = NAME_soeldner;
guild = GIL_mil;
npctype = npctype_fm_soeldner;
level = 20;
voice = 0;
id = 1604;
//-------- abilities --------
B_SetAttributesToChapter (self, 4);
EquipItem (self, ItMw_GrobesKurzschwert);
//-------- visuals --------
// animations
B_SetNpcVisual (self, MALE, "Hum_Head_FatBald",3, 0, Itar_SLD_L);
Mdl_ApplyOverlayMds (self,"Humans_Militia.mds");
fight_tactic = FAI_HUMAN_STRONG;
//-------- Talente --------
Npc_SetTalentSkill (self, NPC_TALENT_1H,1);
Npc_SetTalentSkill (self, NPC_TALENT_1H,1);
Npc_SetTalentSkill (self, NPC_TALENT_CROSSBOW,1);
//-------- inventory --------
//-------------Daily Routine-------------
daily_routine = Rtn_FMstart_1604;
};
FUNC VOID Rtn_FMstart_1604 () //FM
{
TA_Stand_Guarding (0,00,13,00, "FM_133");
TA_Stand_Guarding (13,00,00,00, "FM_133");
};
|
D
|
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module flow.engine.impl.transformer.Identity;
import flow.engine.impl.transformer.AbstractTransformer;
import std.concurrency : initOnce;
/**
*
*
* @author Esteban Robles Luna
*/
class Identity : AbstractTransformer {
//private static Identity instance = new Identity();
//
//public static synchronized Identity getInstance() {
// if (instance is null) {
// instance = new Identity();
// }
// return instance;
//}
//
//private Identity() {
//
//}
static Identity getInstance() {
__gshared Identity inst;
return initOnce!inst(new Identity());
}
override
protected Object primTransform(Object anObject) {
return anObject;
}
}
|
D
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module dwt.events.TraverseEvent;
import dwt.widgets.Event;
import dwt.events.KeyEvent;
import tango.text.convert.Format;
import dwt.dwthelper.utils;
/**
* Instances of this class are sent as a result of
* widget traversal actions.
* <p>
* The traversal event allows fine control over keyboard traversal
* in a control both to implement traversal and override the default
* traversal behavior defined by the system. This is achieved using
* two fields, <code>detail</code> and <code>doit</code>.
* </p><p>
* When a control is traversed, a traverse event is sent. The detail
* describes the type of traversal and the doit field indicates the default
* behavior of the system. For example, when a right arrow key is pressed
* in a text control, the detail field is <code>TRAVERSE_ARROW_NEXT</code>
* and the doit field is <code>false</code>, indicating that the system
* will not traverse to the next tab item and the arrow key will be
* delivered to the text control. If the same key is pressed in a radio
* button, the doit field will be <code>true</code>, indicating that
* traversal is to proceed to the next tab item, possibly another radio
* button in the group and that the arrow key is not to be delivered
* to the radio button.
* </p><p>
* How can the traversal event be used to implement traversal?
* When a tab key is pressed in a canvas, the detail field will be
* <code>TRAVERSE_TAB_NEXT</code> and the doit field will be
* <code>false</code>. The default behavior of the system is to
* provide no traversal for canvas controls. This means that by
* default in a canvas, a key listener will see every key that the
* user types, including traversal keys. To understand why this
* is so, it is important to understand that only the widget implementor
* can decide which traversal is appropriate for the widget. Returning
* to the <code>TRAVERSE_TAB_NEXT</code> example, a text widget implemented
* by a canvas would typically want to use the tab key to insert a
* tab character into the widget. A list widget implementation, on the
* other hand, would like the system default traversal behavior. Using
* only the doit flag, both implementations are possible. The text widget
* implementor sets doit to <code>false</code>, ensuring that the system
* will not traverse and that the tab key will be delivered to key listeners.
* The list widget implementor sets doit to <code>true</code>, indicating
* that the system should perform tab traversal and that the key should not
* be delivered to the list widget.
* </p><p>
* How can the traversal event be used to override system traversal?
* When the return key is pressed in a single line text control, the
* detail field is <code>TRAVERSE_RETURN</code> and the doit field
* is <code>true</code>. This means that the return key will be processed
* by the default button, not the text widget. If the text widget has
* a default selection listener, it will not run because the return key
* will be processed by the default button. Imagine that the text control
* is being used as an in-place editor and return is used to dispose the
* widget. Setting doit to <code>false</code> will stop the system from
* activating the default button but the key will be delivered to the text
* control, running the key and selection listeners for the text. How
* can <code>TRAVERSE_RETURN</code> be implemented so that the default button
* will not be activated and the text widget will not see the return key?
* This is achieved by setting doit to <code>true</code>, and the detail
* to <code>TRAVERSE_NONE</code>.
* </p><p>
* Note: A widget implementor will typically implement traversal using
* only the doit flag to either enable or disable system traversal.
* </p>
*
* @see TraverseListener
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public final class TraverseEvent : KeyEvent {
/**
* The traversal type.
* <p><ul>
* <li>{@link dwt.DWT#TRAVERSE_NONE}</li>
* <li>{@link dwt.DWT#TRAVERSE_ESCAPE}</li>
* <li>{@link dwt.DWT#TRAVERSE_RETURN}</li>
* <li>{@link dwt.DWT#TRAVERSE_TAB_NEXT}</li>
* <li>{@link dwt.DWT#TRAVERSE_TAB_PREVIOUS}</li>
* <li>{@link dwt.DWT#TRAVERSE_ARROW_NEXT}</li>
* <li>{@link dwt.DWT#TRAVERSE_ARROW_PREVIOUS}</li>
* <li>{@link dwt.DWT#TRAVERSE_MNEMONIC}</li>
* <li>{@link dwt.DWT#TRAVERSE_PAGE_NEXT}</li>
* <li>{@link dwt.DWT#TRAVERSE_PAGE_PREVIOUS}</li>
* </ul></p>
*
* Setting this field will change the type of traversal.
* For example, setting the detail to <code>TRAVERSE_NONE</code>
* causes no traversal action to be taken.
*
* When used in conjunction with the <code>doit</code> field, the
* traversal detail field can be useful when overriding the default
* traversal mechanism for a control. For example, setting the doit
* field to <code>false</code> will cancel the operation and allow
* the traversal key stroke to be delivered to the control. Setting
* the doit field to <code>true</code> indicates that the traversal
* described by the detail field is to be performed.
*/
public int detail;
//static final long serialVersionUID = 3257565105301239349L;
/**
* Constructs a new instance of this class based on the
* information in the given untyped event.
*
* @param e the untyped event containing the information
*/
public this(Event e) {
super(e);
this.detail = e.detail;
}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the event
*/
public override String toString() {
return Format( "{} detail={}}", super.toString[ 0 .. $-2 ], detail );
}
}
|
D
|
module helix.h_helix;
struct user{
int id;
string login;
}
|
D
|
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
module dwt.internal.cocoa.NSURLAuthenticationChallenge;
import dwt.dwthelper.utils;
import cocoa = dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSURLCredential;
import dwt.internal.cocoa.NSURLProtectionSpace;
import dwt.internal.cocoa.OS;
import dwt.internal.objc.cocoa.Cocoa;
import objc = dwt.internal.objc.runtime;
public class NSURLAuthenticationChallenge : NSObject {
public this() {
super();
}
public this(objc.id id) {
super(id);
}
public this(cocoa.id id) {
super(id);
}
public NSInteger previousFailureCount() {
return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_previousFailureCount);
}
public NSURLCredential proposedCredential() {
objc.id result = OS.objc_msgSend(this.id, OS.sel_proposedCredential);
return result !is null ? new NSURLCredential(result) : null;
}
public NSURLProtectionSpace protectionSpace() {
objc.id result = OS.objc_msgSend(this.id, OS.sel_protectionSpace);
return result !is null ? new NSURLProtectionSpace(result) : null;
}
public cocoa.id sender() {
objc.id result = OS.objc_msgSend(this.id, OS.sel_sender);
return result !is null ? new cocoa.id(result) : null;
}
}
|
D
|
/**
* Module for space and dimension manipulation.
*
* Authors:
* Jacob Jensen
* License:
* https://github.com/PoisonEngine/poison-ui/blob/master/LICENSE
*/
module poison.ui.space;
import poison.core : Point, Size, Edge, Location, EventObserver, ChangeEventArgs;
/// A wrapper around a space.
class Space : EventObserver {
private:
/// The position.
Point _position;
/// The size.
Size _size;
/// The margin.
Edge _margin;
/// The padding.
Edge _padding;
public:
/**
* Creates a new space.
* Params:
* position = The position.
* size = The size.
*/
this(Point position, Size size) {
assert(position !is null);
assert(size !is null);
_position = position;
_size = size;
_margin = new Edge(0,0,0,0);
_padding = new Edge(0,0,0,0);
}
@property {
/// Gets the position of the space.
Point position() { return _position; }
/// Sets the position of the space.
void position(Point newPosition) {
auto oldPosition = _position;
_position = newPosition;
fireEvent("position", new ChangeEventArgs!Point(oldPosition, _position));
}
/// Gets the x coordinate of the space.
ptrdiff_t x() { return _position.x; }
/// Gets the y coordinate of the space.
ptrdiff_t y() { return _position.y; }
/// Gets the size of the space.
Size size() { return _size; }
/// Sets the size of the space.
void size(Size newSize) {
auto oldSize = _size;
_size = newSize;
fireEvent("size", new ChangeEventArgs!Size(oldSize, _size));
}
/// Gets the width of the space.
size_t width() { return _size.width; }
/// Gets the height of the space.
size_t height() { return _size.height; }
/// Gets the margin of the space.
Edge margin() { return _margin; }
/// Sets the margin of the space.
void margin(Edge newMargin) {
auto oldMargin = _margin;
_margin = newMargin;
fireEvent("margin", new ChangeEventArgs!Edge(oldMargin, _margin));
}
/// Gets the top margin of the space.
ptrdiff_t topMargin() { return _margin.top; }
/// Gets the right margin of the space.
ptrdiff_t rightMargin() { return _margin.right; }
/// Gets the bottom margin of the space.
ptrdiff_t bottomMargin() { return _margin.bottom; }
/// Gets the left margin of the space.
ptrdiff_t leftMargin() { return _margin.left; }
/// Gets the padding of the space.
Edge padding() { return _padding; }
/// Sets the padding of the space.
void padding(Edge newPadding) {
auto oldPadding = _padding;
_padding = newPadding;
fireEvent("padding", new ChangeEventArgs!Edge(oldPadding, _padding));
}
}
/**
* Moves the space to another space.
* Params:
* target = The target of the space.
*/
void moveTo(Location location)(Space target) {
assert(target !is null);
auto newX = target.x;
auto newY = target.y;
static if (location == Location.northWest) {
newX -= width + target.marginLeft;
newY -= height + target.marginTop;
}
else static if (location == Location.north) {
newY -= height + target.marginTop;
}
else static if (location == Location.northEast) {
newX += target.width + target.marginRight;
newY -= height + target.marginTop;
}
else static if (location == Location.east) {
newX += target.width + target.marginRight;
}
else static if (location == Location.southEast) {
newX += target.width + target.marginRight;
newY += target.height + target.marginBottom;
}
else static if (location == Location.south) {
newY += target.height + target.marginBottom;
}
else static if (location == Location.southWest) {
newX -= width + target.marginLeft;
newY += target.height + target.marginBottom;
}
else static if (location == Location.west) {
newX -= width + target.marginLeft;
}
else {
static assert(0);
}
position = new Point(newX, newY);
}
/**
* Moves the space into another space.
* Params:
* target = The space to move the space into.
*/
void moveIn(Location location)(Space target) {
assert(target !is null);
auto newX = target.x;
auto newY = target.y;
static if (location == Location.northWest) {
newX += target.paddingLeft;
newY += target.paddingTop;
}
else static if (location == Location.north) {
newX += (target.width / 2) - (width / 2);
newY += target.paddingTop;
}
else static if (location == Location.northEast) {
newX += target.width - (target.paddingRight + width);
}
else static if (location == Location.east) {
newX += target.width - (target.paddingRight + width);
newY += (target.height / 2) - (height / 2);
}
else static if (location == Location.southEast) {
newX += target.width - (target.paddingRight + width);
newY += targer.height - (target.paddingBottom + height);
}
else static if (location == Location.south) {
newX += (targer.width / 2) - (width / 2);
newY += targer.height - (target.paddingBottom + height);
}
else static if (location == Location.southWest) {
newX += target.paddingLeft;
newY += target.height - (target.paddingBottom + height);
}
else static if (location == Location.west) {
newX += target.paddingLeft;
newY += (target.height / 2) - (height / 2);
}
else {
static assert(0);
}
position = new Point(newX, newY);
}
/**
* Centers the x coordinate of the space relative to another space.
* Params:
* target = The target to be relative to.
*/
void centerX(Space target) {
position = new Point((target.width / 2) - (width / 2), y);
}
/**
* Centers the y coordinate of the space relative to another space.
* Params:
* target = The target to be relative to.
*/
void centerY(Space target) {
position = new Point(x, (target.height / 2) - (height / 2));
}
/**
* Centers the space relative to another space.
* Params:
* target = The target to be relative to.
*/
void center(Space target) {
position = new Point((target.width / 2) - (width / 2), (target.height / 2) - (height / 2));
}
void moveX(ptrdiff_t amount) {
position = new Point(x + amount, y);
}
void moveY(ptrdiff_t amount) {
position = new Point(x, y + amount);
}
/**
* Checks whether the space intersects with a point.
* Params:
* p = The point to check for intersection with.
* Returns:
* If the space intersects with the point.
*/
bool intersect(Point p) {
return (p.x > this.x) &&
(p.x < (this.x + cast(ptrdiff_t)this.width)) &&
(p.y > this.y) &&
(p.y < (this.y + cast(ptrdiff_t)this.height));
}
/**
* Checks whether the space intersects with another space.
* Params:
* target = The space to check for intersection with.
* Returns:
* True if the two spaces intersects.
*/
bool intersect(Space target) {
return(target.x < this.x + cast(ptrdiff_t)this.width) &&
(this.x < (target.x + cast(ptrdiff_t)target.width)) &&
(target.y < this.y + cast(ptrdiff_t)this.height) &&
(this.y < target.y + cast(ptrdiff_t)target.height);
}
}
|
D
|
/**
This module implements a $(LINK2 http://dlang.org/template-mixin.html,
template mixin) containing a program to search a list of directories
for all .d files therein, then writes a D program to run all unit
tests in those files using unit_threaded. The program
implemented by this mixin only writes out a D file that itself must be
compiled and run.
To use this as a runnable program, simply mix in and compile:
-----
#!/usr/bin/rdmd
import unit_threaded;
mixin genUtMain;
-----
Generally however, this code will be used by the gen_ut_main
dub configuration via `dub run`.
By default, genUtMain will look for unit tests in CWD
and write a program out to a temporary file. To change
the file to write to, use the $(D -f) option. To change what
directories to look in, simply pass them in as the remaining
command-line arguments.
The resulting file is also a program that must be compiled and, when
run, will run the unit tests found. By default, it will run all
tests. To run one test or all tests in a particular package, pass them
in as command-line arguments. The $(D -h) option will list all
command-line options.
Examples (assuming the generated file is called $(D ut.d)):
-----
rdmd -unittest ut.d // run all tests
rdmd -unittest ut.d tests.foo tests.bar // run all tests from these packages
rdmd ut.d -h // list command-line options
-----
*/
module unit_threaded.runtime.runtime;
import unit_threaded.from;
mixin template genUtMain() {
int main(string[] args) {
try {
writeUtMainFile(args);
return 0;
} catch(Exception ex) {
import std.stdio: stderr;
stderr.writeln(ex.msg);
return 1;
}
}
}
struct Options {
bool verbose;
string fileName;
string[] dirs;
string dubBinary;
bool help;
bool showVersion;
string[] includes;
string[] files;
bool earlyReturn() @safe pure nothrow const {
return help || showVersion;
}
}
Options getGenUtOptions(string[] args) {
import std.getopt;
import std.range: empty;
import std.stdio: writeln;
Options options;
auto getOptRes = getopt(
args,
"verbose|v", "Verbose mode.", &options.verbose,
"file|f", "The filename to write. Will use a temporary if not set.", &options.fileName,
"dub|d", "The dub binary to use.", &options.dubBinary,
"I", "Import paths as would be passed to the compiler", &options.includes,
"version", "Show version.", &options.showVersion,
);
if (getOptRes.helpWanted) {
defaultGetoptPrinter("Usage: gen_ut_main [options] [testDir1] [testDir2]...", getOptRes.options);
options.help = true;
return options;
}
if (options.showVersion) {
writeln("unit_threaded.runtime version v0.6.1");
return options;
}
options.dirs = args.length <= 1 ? ["."] : args[1 .. $];
if (options.verbose) {
writeln(__FILE__, ": finding all test cases in ", options.dirs);
}
if (options.dubBinary.empty) {
options.dubBinary = "dub";
}
return options;
}
from!"std.file".DirEntry[] findModuleEntries(in Options options) {
import std.algorithm: splitter, canFind, map, startsWith, filter;
import std.array: array, empty;
import std.file: DirEntry, isDir, dirEntries, SpanMode;
import std.path: dirSeparator, buildNormalizedPath;
import std.exception: enforce;
// dub list of files, don't bother reading the filesystem since
// dub has done it already
if(!options.files.empty && options.dirs == ["."]) {
return dubFilesToAbsPaths(options.fileName, options.files)
.map!toDirEntry
.array;
}
DirEntry[] modules;
foreach (dir; options.dirs) {
enforce(isDir(dir), dir ~ " is not a directory name");
auto entries = dirEntries(dir, "*.d", SpanMode.depth);
auto normalised = entries.map!(a => buildNormalizedPath(a.name));
bool isHiddenDir(string p) { return p.startsWith("."); }
bool anyHiddenDir(string p) { return p.splitter(dirSeparator).canFind!isHiddenDir; }
modules ~= normalised.
filter!(a => !anyHiddenDir(a)).
map!toDirEntry.array;
}
return modules;
}
auto toDirEntry(string a) {
import std.file: DirEntry;
return DirEntry(removePackage(a));
}
// package.d files will show up as foo.bar.package
// remove .package from the end
string removePackage(string name) {
import std.algorithm: endsWith;
import std.array: replace;
enum toRemove = "/package.d";
return name.endsWith(toRemove)
? name.replace(toRemove, "")
: name;
}
string[] dubFilesToAbsPaths(in string fileName, in string[] files) {
import std.algorithm: filter, map;
import std.array: array;
import std.path: buildNormalizedPath;
// dub list of files, don't bother reading the filesystem since
// dub has done it already
return files
.filter!(a => a != fileName)
.map!(a => removePackage(a))
.map!(a => buildNormalizedPath(a))
.array;
}
string[] findModuleNames(in Options options) {
import std.path : dirSeparator, stripExtension, absolutePath, relativePath;
import std.algorithm: endsWith, startsWith, filter, map;
import std.array: replace, array;
import std.path: baseName, absolutePath;
// if a user passes -Isrc and a file is called src/foo/bar.d,
// the module name should be foo.bar, not src.foo.bar,
// so this function subtracts import path options
string relativeToImportDirs(string path) {
foreach(string importPath; options.includes) {
importPath = relativePath(importPath);
if(!importPath.endsWith(dirSeparator)) importPath ~= dirSeparator;
if(path.startsWith(importPath)) {
return path.replace(importPath, "");
}
}
return path;
}
return findModuleEntries(options).
filter!(a => a.baseName != "reggaefile.d").
filter!(a => a.absolutePath != options.fileName.absolutePath).
map!(a => relativeToImportDirs(a.name)).
map!(a => replace(a.stripExtension, dirSeparator, ".")).
array;
}
string writeUtMainFile(string[] args) {
auto options = getGenUtOptions(args);
return writeUtMainFile(options);
}
string writeUtMainFile(Options options) {
if (options.earlyReturn) {
return options.fileName;
}
return writeUtMainFile(options, findModuleNames(options));
}
private string writeUtMainFile(Options options, in string[] modules) {
import std.path: buildPath, dName = dirName;
import std.stdio: writeln, File;
import std.file: tempDir, getcwd, mkdirRecurse, exists;
import std.algorithm: map;
import std.array: join;
import std.format : format;
if (!options.fileName) {
options.fileName = buildPath(tempDir, getcwd[1..$], "ut.d");
}
if(!haveToUpdate(options, modules)) {
if(options.verbose) writeln("Not writing to ", options.fileName, ": no changes detected");
return options.fileName;
} else {
if(options.verbose) writeln("Writing to unit test main file ", options.fileName);
}
const dirName = options.fileName.dName;
dirName.exists || mkdirRecurse(dirName);
auto wfile = File(options.fileName, "w");
wfile.write(modulesDbList(modules));
wfile.writeln(format(q{
//Automatically generated by unit_threaded.gen_ut_main, do not edit by hand.
import unit_threaded.runner : runTestsMain;
mixin runTestsMain!(%(%s, %));
}, modules));
wfile.close();
return options.fileName;
}
private bool haveToUpdate(in Options options, in string[] modules) {
import std.file: exists;
import std.stdio: File;
import std.array: join;
import std.string: strip;
if (!options.fileName.exists) {
return true;
}
auto file = File(options.fileName);
return file.readln.strip != modulesDbList(modules);
}
//used to not update the file if the file list hasn't changed
private string modulesDbList(in string[] modules) @safe pure nothrow {
import std.array: join;
return "//" ~ modules.join(",");
}
|
D
|
module picodon;
public import picodon.platform;
public import picodon.interpreter;
public import picodon.include;
public import picodon.parse;
|
D
|
# FIXED
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag.c
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/string.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/linkage.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/std.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdarg.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stddef.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/std.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/M3.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/std.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdint.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/System.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/xdc.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/package.defs.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types__epilogue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/Main_Module_GateProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error__epilogue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Memory.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/Memory_HeapProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags__epilogue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert__epilogue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/ISystemSupport.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_SupportProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/ISystemSupport.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_Module_GateProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_SupportProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_Module_GateProxy.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS__prologue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/package.defs.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/BIOS_RtsGateProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS__epilogue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/BIOS_RtsGateProxy.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/package.defs.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Text.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log__epilogue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITimer.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/package/package.defs.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Swi.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Clock_TimerProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITimer.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Clock_TimerProxy.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Semaphore.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITaskSupport.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Task_SupportProxy.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITaskSupport.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task__epilogue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event__prologue.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event__epilogue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/Power.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/package/package.defs.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/IPower.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h
Application/SensorTag.obj: C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/PowerCC2650.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/icall/include/ICall.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdbool.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/yvals.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdarg.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/_lock.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/gatt.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/bcomdef.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/comdef.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/../_common/cc26xx/_hal_types.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_defs.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/limits.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Memory.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Timers.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/att.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/l2cap.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/hci.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/controller/CC26xx/include/ll.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_assert.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/include/gapgattserver.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/include/gattservapp.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/Roles/gapbondmgr.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/gap.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/sm.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/osal_snv.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/ICall/Include/ICallBleAPIMSG.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/common/cc26xx/util.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Semaphore.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/bsp_i2c.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_memmap.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/bsp_spi.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Revision.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/sensor.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/CC26XXST_0120/Board.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/drivers/PIN.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stddef.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/ioc.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ioc.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ints.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/interrupt.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_nvic.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/debug.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/cpu.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/rom.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/gpio.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_gpio.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Task_SupportProxy.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/DevInfo/devinfoservice.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/movementservice.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/st_util.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/registerservice.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Tmp.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/Roles/CC26xx/peripheral.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Hum.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Bar.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Mov.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Opt.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Keys.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_IO.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/devices/ext_flash.h
Application/SensorTag.obj: C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/ext_flash_layout.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/sensortag_connctrl.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/OAD/cc26xxST/oad_target.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/OAD/cc26xxST/oad.h
Application/SensorTag.obj: C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h
Application/SensorTag.obj: C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag.c:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/string.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/linkage.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/std.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdarg.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stddef.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/std.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/arm/elf/M3.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/targets/std.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdint.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/System.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/xdc.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/package.defs.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types__epilogue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/Main_Module_GateProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error__epilogue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Memory.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/Memory_HeapProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags__epilogue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert__epilogue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/ISystemSupport.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_SupportProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/ISystemSupport.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_Module_GateProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_SupportProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/package/System_Module_GateProxy.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS__prologue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/package.defs.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/BIOS_RtsGateProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IGateProvider.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/BIOS__epilogue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/package/BIOS_RtsGateProxy.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/package.defs.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Main.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Text.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log__epilogue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITimer.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/package/package.defs.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Swi.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Clock_TimerProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITimer.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Clock_TimerProxy.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Semaphore.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IHeap.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITaskSupport.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Error.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Task_SupportProxy.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/ITaskSupport.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task__epilogue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IInstance.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event__prologue.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Diags.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Log.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Event__epilogue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/Power.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/package/package.defs.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Assert.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/interfaces/IPower.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/Types.h:
C:/ti/xdctools_3_31_01_33_core/packages/xdc/runtime/IModule.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/family/arm/cc26xx/PowerCC2650.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/icall/include/ICall.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdbool.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/yvals.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdarg.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/_lock.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/gatt.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/bcomdef.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/comdef.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/../_common/cc26xx/_hal_types.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_defs.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/limits.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Memory.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/OSAL_Timers.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/att.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/l2cap.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/hci.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/controller/CC26xx/include/ll.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/include/hal_assert.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/include/gapgattserver.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/include/gattservapp.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/Roles/gapbondmgr.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/gap.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/ble/include/sm.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/osal/include/osal_snv.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/ICall/Include/ICallBleAPIMSG.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/common/cc26xx/util.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Semaphore.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/bsp_i2c.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_memmap.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/bsp_spi.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Revision.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/interfaces/sensor.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/CC26XXST_0120/Board.h:
C:/ti/tirtos_simplelink_2_13_00_06/packages/ti/drivers/PIN.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stddef.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_types.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_chip_def.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/ioc.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ioc.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_ints.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/interrupt.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_nvic.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/debug.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/cpu.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/rom.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/driverlib/gpio.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/cc26xxware_2_21_01_15600/inc/hw_gpio.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Task.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/package/Task_SupportProxy.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/DevInfo/devinfoservice.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/movementservice.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/st_util.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/SensorProfile/cc26xx/registerservice.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Tmp.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/Roles/CC26xx/peripheral.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Clock.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Hum.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Bar.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Mov.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Opt.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_Keys.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/SensorTag_IO.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/Board_patch/devices/ext_flash.h:
C:/ti/ccsv6/tools/compiler/ti-cgt-arm_5.2.5/include/stdlib.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/ext_flash_layout.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/SensorTag/CC26xx/Source/Application/sensortag_connctrl.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/OAD/cc26xxST/oad_target.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Projects/ble/Profiles/OAD/cc26xxST/oad.h:
C:/ti/simplelink/ble_cc26xx_2_01_01_44627/Components/hal/target/CC2650TIRTOS/hal_types.h:
C:/ti/tirtos_simplelink_2_13_00_06/products/bios_6_42_00_08/packages/ti/sysbios/knl/Queue.h:
|
D
|
/*******************************************************************************
copyright: Copyright (c) 2004 Kris Bell. All rights reserved
license: BSD style: $(LICENSE)
version: Initial release: Aug 2006
author: Kris
*******************************************************************************/
module hurt.net.internet6address;
private import core.sys.posix.netdb,
core.sys.posix.arpa.inet,
core.sys.posix.netinet.in_;
//private import tango.text.Stringz,
private import hurt.net.nethost;
public import hurt.net.address;
import hurt.string.stringutil;
import hurt.conv.conv;
/*******************************************************************************
IPv6 is the next-generation Internet Protocol version
designated as the successor to IPv4, the first
implementation used in the Internet that is still in
dominant use currently.
More information: http://ipv6.com/
IPv6 supports 128-bit address space as opposed to 32-bit
address space of IPv4.
IPv6 is written as 8 blocks of 4 octal digits (16 bit)
separated by a colon (":"). Zero block can be replaced by "::".
For example:
---
0000:0000:0000:0000:0000:0000:0000:0001
is equal
::0001
is equal
::1
is analogue IPv4 127.0.0.1
0000:0000:0000:0000:0000:0000:0000:0000
is equal
::
is analogue IPv4 0.0.0.0
2001:cdba:0000:0000:0000:0000:3257:9652
is equal
2001:cdba::3257:9652
IPv4 address can be submitted through IPv6 as ::ffff:xx.xx.xx.xx,
where xx.xx.xx.xx 32-bit IPv4 addresses.
::ffff:51b0:ec6d
is equal
::ffff:81.176.236.109
is analogue IPv4 81.176.236.109
The URL for the IPv6 address will be of the form:
http://[2001:cdba:0000:0000:0000:0000:3257:9652]/
If needed to specify a port, it will be listed after the
closing square bracket followed by a colon.
http://[2001:cdba:0000:0000:0000:0000:3257:9652]:8080/
address: "2001:cdba:0000:0000:0000:0000:3257:9652"
port: 8080
IPv6Address can be used as well as IPv4Address.
scope addr = new Internet6Address(8080);
address: "::"
port: 8080
scope addr_2 = new Internet6Address("::1", 8081);
address: "::1"
port: 8081
scope addr_3 = new Internet6Address("::1");
address: "::1"
port: PORT_ANY
Also in the IPv6Address constructor can specify the service name
or port as string
scope addr_3 = new Internet6Address("::", "ssh");
address: "::"
port: 22 (ssh service port)
scope addr_4 = new Internet6Address("::", "8080");
address: "::"
port: 8080
---
*******************************************************************************/
class Internet6Address : Address
{
protected sockaddr_in6 sin;
/***********************************************************************
***********************************************************************/
override sockaddr* name()
{
return cast(sockaddr*)&sin;
}
/***********************************************************************
***********************************************************************/
override uint nameLen()
{
return sin.sizeof;
}
public:
/***********************************************************************
***********************************************************************/
override AddressFamily addressFamily()
{
return AddressFamily.INET6;
}
const ushort PORT_ANY = 0;
/***********************************************************************
***********************************************************************/
ushort port()
{
return ntohs(this.sin.sin6_port);
}
/***********************************************************************
Create IPv6Address with zero address
***********************************************************************/
this (int port)
{
this ("::", port);
}
/***********************************************************************
-port- can be PORT_ANY
-addr- is an IP address or host name
***********************************************************************/
this (const(char)[] addr, int port = PORT_ANY)
{
version (Win32)
{
if (!getaddrinfo)
exception ("This platform does not support IPv6.");
}
addrinfo* info;
addrinfo hints;
hints.ai_family = AddressFamily.INET6;
int error = getaddrinfo((addr ~ '\0').ptr, null, &hints, &info);
if (error != 0)
throw new AddressException("failed to create IPv6Address: ");
this.sin = *cast(sockaddr_in6*)(info.ai_addr);
this.sin.sin6_port = htons(cast(ushort) port);
}
/***********************************************************************
-service- can be a port number or service name
-addr- is an IP address or host name
***********************************************************************/
this (char[] addr, char[] service)
{
version (Win32)
{
if(! getaddrinfo)
exception ("This platform does not support IPv6.");
}
addrinfo* info;
addrinfo hints;
hints.ai_family = AddressFamily.INET6;
int error = getaddrinfo((addr ~ '\0').ptr, (service ~ '\0').ptr, &hints, &info);
if (error != 0)
throw new AddressException("failed to create IPv6Address: ");
sin = *cast(sockaddr_in6*)(info.ai_addr);
}
/***********************************************************************
***********************************************************************/
this(sockaddr_in6* sin)
{
// copy structure
this.sin = *sin;
}
/***********************************************************************
***********************************************************************/
ubyte[] addr()
{
return cast(ubyte[this.sin.sin6_addr.sizeof])this.sin.sin6_addr;
}
/***********************************************************************
***********************************************************************/
version (Posix)
override immutable(char)[] toAddrString()
{
char[100] buff = 0;
return fromStringz(inet_ntop(AddressFamily.INET6, &sin.sin6_addr, buff.ptr, 100)).idup;
}
/***********************************************************************
***********************************************************************/
override immutable(char)[] toPortString()
{
return conv!(int,string)(this.port());
}
/***********************************************************************
***********************************************************************/
override immutable(char)[] toString()
{
return ("[" ~ toAddrString ~ "]:" ~ toPortString).idup;
}
}
/*******************************************************************************
*******************************************************************************/
unittest
{
auto ia = new Internet6Address("7628:0d18:11a3:09d7:1f34:8a2e:07a0:765d", 8080);
assert(ia.toString() == "[7628:d18:11a3:9d7:1f34:8a2e:7a0:765d]:8080");
//assert(ia.toString() == "[7628:0d18:11a3:09d7:1f34:8a2e:07a0:765d]:8080");
}
|
D
|
module nxt.typedoc;
/** Returns: Documentation String for Enumeration Type $(D EnumType). */
string enumDoc(EnumType, string separator = `|`)() @safe pure nothrow
{
/* import std.traits: EnumMembers; */
/* return EnumMembers!EnumType.join(separator); */
/* auto subsSortingNames = EnumMembers!EnumType; */
auto x = __traits(allMembers, EnumType);
string doc = ``;
foreach (ix, name; x)
{
if (ix >= 1) { doc ~= separator; }
doc ~= name;
}
return doc;
}
/** Returns: Default Documentation String for value $(D a) of for Type $(D T). */
string defaultDoc(T)(in T a) @safe pure
{
import std.conv: to;
return (` (type:` ~ T.stringof ~
`, default:` ~ to!string(a) ~
`).`) ;
}
|
D
|
// Written in the D programming language
/++
This implements a DOM for representing an XML 1.0 document. $(LREF parseDOM)
uses an $(REF EntityRange, dxml, parser) to parse the document, and
$(LREF DOMEntity) recursively represents the DOM tree.
See the documentation for $(MREF dxml, parser) and
$(REF EntityRange, dxml, parser) for details on the parser and its
configuration options.
For convenience, $(REF EntityType, dxml, parser) and
$(REF simpleXML, dxml, parser) are publicly imported by this module,
since $(REF_ALTTEXT EntityType, EntityType, dxml, parser) is required
to correctly use $(LREF DOMEntity), and
$(REF_ALTTEXT simpleXML, simpleXML, dxml, parser) is highly likely to
be used when calling $(LREF parseDOM).
Copyright: Copyright 2018 - 2020
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(HTTPS jmdavisprog.com, Jonathan M Davis)
Source: $(LINK_TO_SRC dxml/_dom.d)
See_Also: $(LINK2 http://www.w3.org/TR/REC-xml/, Official Specification for XML 1.0)
+/
module dxml.dom;
///
unittest
{
import std.range.primitives : empty;
auto xml = "<!-- comment -->\n" ~
"<root>\n" ~
" <foo>some text<whatever/></foo>\n" ~
" <bar/>\n" ~
" <baz></baz>\n" ~
"</root>";
{
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 2);
assert(dom.children[0].type == EntityType.comment);
assert(dom.children[0].text == " comment ");
auto root = dom.children[1];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 3);
auto foo = root.children[0];
assert(foo.type == EntityType.elementStart);
assert(foo.name == "foo");
assert(foo.children.length == 2);
assert(foo.children[0].type == EntityType.text);
assert(foo.children[0].text == "some text");
assert(foo.children[1].type == EntityType.elementEmpty);
assert(foo.children[1].name == "whatever");
assert(root.children[1].type == EntityType.elementEmpty);
assert(root.children[1].name == "bar");
assert(root.children[2].type == EntityType.elementStart);
assert(root.children[2].name == "baz");
assert(root.children[2].children.length == 0);
}
{
auto dom = parseDOM!simpleXML(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 3);
auto foo = root.children[0];
assert(foo.type == EntityType.elementStart);
assert(foo.name == "foo");
assert(foo.children.length == 2);
assert(foo.children[0].type == EntityType.text);
assert(foo.children[0].text == "some text");
assert(foo.children[1].type == EntityType.elementStart);
assert(foo.children[1].name == "whatever");
assert(foo.children[1].children.length == 0);
assert(root.children[1].type == EntityType.elementStart);
assert(root.children[1].name == "bar");
assert(root.children[1].children.length == 0);
assert(root.children[2].type == EntityType.elementStart);
assert(root.children[2].name == "baz");
assert(root.children[2].children.length == 0);
}
}
import std.range.primitives;
import std.traits;
public import dxml.parser : EntityType, simpleXML;
import dxml.parser : Config, EntityRange;
/++
Represents an entity in an XML document as a DOM tree.
parseDOM either takes a range of characters or an
$(REF EntityRange, dxml, parser) and generates a DOMEntity from that XML.
When parseDOM processes the XML, it returns a DOMEntity representing the
entire document. Even though the XML document itself isn't technically an
entity in the XML document, it's simplest to treat it as if it were an
$(REF_ALTTEXT EntityType.elementStart, EntityType.elementStart, dxml, parser)
with an empty $(LREF2 name, _DOMEntity.name). That DOMEntity then contains
child entities that recursively define the DOM tree through their children.
For DOMEntities of type
$(REF_ALTTEXT EntityType.elementStart, EntityType.elementStart, dxml, parser),
$(LREF _DOMEntity.children) gives access to all of the child entities of
that start tag. Other DOMEntities have no children.
Note that the $(LREF2 type, _DOMEntity.type) determines which
properties of the DOMEntity can be used, and it can determine whether
functions which a DOMEntity is passed to are allowed to be called. Each
function lists which $(REF_ALTTEXT EntityType, EntityType, dxml, parser)s
are allowed, and it is an error to call them with any other
$(REF_ALTTEXT EntityType, EntityType, dxml, parser).
If parseDOM is given a range of characters, it in turn passes that to
$(REF parseXML, dxml, parser) to do the actual XML parsing. As such, that
overload accepts an optional $(REF Config, dxml, parser) as a template
argument to configure the parser.
If parseDOM is given an
$(REF_ALTTEXT EntityRange, EntityRange, dxml, parser), the range does
not have to be at the start of the document. It can be used to create a DOM
for a portion of the document. When a character range is passed to it, it
will return a DOMEntity with the $(LREF2 type, _DOMEntity.type)
$(REF_ALTTEXT EntityType.elementStart, EntityType.elementStart, dxml, parser)
and an empty $(LREF2 name, _DOMEntity.name). It will iterate the range until
it either reaches the end of the range, or it reaches the end tag which
matches the start tag which is the parent of the entity that was the
$(D front) of the range when it was passed to parseDOM. The
$(REF_ALTTEXT EntityType.elementStart, EntityType.elementStart, dxml, parser)
is passed by $(K_REF), so if it was not at the top level when it was passed
to parseDOM (and thus still has elements in it when parseDOM returns), the
range will then be at the entity after that matching end tag, and the
application can continue to process the range after that if it so chooses.
Params:
config = The $(REF Config, dxml, parser) to use with
$(REF parseXML, dxml, parser) if the range passed to parseDOM
is a range of characters.
range = Either a range of characters representing an entire XML document
or a $(REF EntityRange, dxml, parser) which may refer to some
or all of an XML document.
Returns: A DOMEntity representing the DOM tree from the point in the
document that was passed to parseDOM (the start of the document if
a range of characters was passed, and wherever in the document the
range was if an
$(REF_ALTTEXT EntityRange, EntityRange dxml, parser) was passed).
Throws: $(REF_ALTTEXT XMLParsingException, XMLParsingException, dxml, parser)
if the parser encounters invalid XML.
+/
struct DOMEntity(R)
{
public:
import std.algorithm.searching : canFind;
import std.range : only, takeExactly;
import std.typecons : Tuple;
import dxml.parser : TextPos;
private enum compileInTests = is(R == DOMCompileTests);
/++
The type used when any slice of the original range of characters is
used. If the range was a string or supports slicing, then SliceOfR is
the same type as the range; otherwise, it's the result of calling
$(PHOBOS_REF takeExactly, std, range) on it.
---
import std.algorithm : filter;
import std.range : takeExactly;
static assert(is(DOMEntity!string.SliceOfR == string));
auto range = filter!(a => true)("some xml");
static assert(is(DOMEntity!(typeof(range)).SliceOfR ==
typeof(takeExactly(range, 42))));
---
+/
static if(isDynamicArray!R || hasSlicing!R)
alias SliceOfR = R;
else
alias SliceOfR = typeof(takeExactly(R.init, 42));
// https://issues.dlang.org/show_bug.cgi?id=11133 prevents this from being
// a ddoc-ed unit test.
static if(compileInTests) @safe unittest
{
import std.algorithm : filter;
import std.range : takeExactly;
static assert(is(DOMEntity!string.SliceOfR == string));
auto range = filter!(a => true)("some xml");
static assert(is(DOMEntity!(typeof(range)).SliceOfR ==
typeof(takeExactly(range, 42))));
}
/++
The exact instantiation of $(PHOBOS_REF Tuple, std, typecons) that
$(LREF2 attributes, DOMEntity) returns a range of.
See_Also: $(LREF2 attributes, DOMEntity)
+/
alias Attribute = Tuple!(SliceOfR, "name", SliceOfR, "value", TextPos, "pos");
/++
The $(REF_ALTTEXT EntityType, EntityType, dxml, parser) for this
DOMEntity.
The type can never be
$(REF_ALTTEXT EntityType.elementEnd, EntityType.elementEnd, dxml, parser),
because the end of $(LREF2 children, DOMEntity.children) already
indicates where the contents of the start tag end.
type determines which properties of the DOMEntity can be used, and it
can determine whether functions which a DOMEntity is passed to are
allowed to be called. Each function lists which
$(REF_ALTTEXT EntityType, EntityType, dxml, parser)s are allowed, and it
is an error to call them with any other
$(REF_ALTTEXT EntityType, EntityType, dxml, parser).
+/
@property EntityType type() @safe const pure nothrow @nogc
{
return _type;
}
///
static if(compileInTests) unittest
{
import std.range.primitives;
auto xml = "<root>\n" ~
" <!--no comment-->\n" ~
" <![CDATA[cdata run]]>\n" ~
" <text>I am text!</text>\n" ~
" <empty/>\n" ~
" <?pi?>\n" ~
"</root>";
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 5);
assert(root.children[0].type == EntityType.comment);
assert(root.children[0].text == "no comment");
assert(root.children[1].type == EntityType.cdata);
assert(root.children[1].text == "cdata run");
auto textTag = root.children[2];
assert(textTag.type == EntityType.elementStart);
assert(textTag.name == "text");
assert(textTag.children.length == 1);
assert(textTag.children[0].type == EntityType.text);
assert(textTag.children[0].text == "I am text!");
assert(root.children[3].type == EntityType.elementEmpty);
assert(root.children[3].name == "empty");
assert(root.children[4].type == EntityType.pi);
assert(root.children[4].name == "pi");
}
/++
The position in the the original text where the entity starts.
See_Also: $(REF_ALTTEXT TextPos, TextPos, dxml, parser)$(BR)
$(REF_ALTTEXT XMLParsingException._pos, XMLParsingException._pos, dxml, parser)
+/
@property TextPos pos() @safe const pure nothrow @nogc
{
return _pos;
}
///
static if(compileInTests) unittest
{
import std.range.primitives : empty;
import dxml.parser : TextPos;
import dxml.util : stripIndent;
auto xml = "<root>\n" ~
" <foo>\n" ~
" Foo and bar. Always foo and bar...\n" ~
" </foo>\n" ~
"</root>";
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.pos == TextPos(1, 1));
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.pos == TextPos(1, 1));
auto foo = root.children[0];
assert(foo.type == EntityType.elementStart);
assert(foo.name == "foo");
assert(foo.pos == TextPos(2, 5));
auto text = foo.children[0];
assert(text.type == EntityType.text);
assert(text.text.stripIndent() ==
"Foo and bar. Always foo and bar...");
assert(text.pos == TextPos(2, 10));
}
/++
Gives the name of this DOMEntity.
Note that this is the direct name in the XML for this entity and
does not contain any of the names of any of the parent entities that
this entity has.
$(TABLE
$(TR $(TH Supported $(LREF EntityType)s:))
$(TR $(TD $(REF_ALTTEXT elementStart, EntityType.elementStart, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT elementEnd, EntityType.elementEnd, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT elementEmpty, EntityType.elementEmpty, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT pi, EntityType.pi, dxml, parser)))
)
See_Also: $(LREF2 path, DOMEntity.path)
+/
@property SliceOfR name()
{
import dxml.internal : checkedSave;
with(EntityType)
{
import std.format : format;
assert(only(elementStart, elementEnd, elementEmpty, pi).canFind(_type),
format("name cannot be called with %s", _type));
}
return checkedSave(_name);
}
///
static if(compileInTests) unittest
{
import std.range.primitives : empty;
auto xml = "<root>\n" ~
" <empty/>\n" ~
" <?pi?>\n" ~
"</root>";
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children[0].type == EntityType.elementEmpty);
assert(root.children[0].name == "empty");
assert(root.children[1].type == EntityType.pi);
assert(root.children[1].name == "pi");
}
/++
Gives the list of the names of the parent start tags of this DOMEntity.
The name of the current entity (if it has one) is not included in the
path.
Note that if parseDOM were given an
$(REF_ALTTEXT EntityRange, EntityRange, dxml, parser), the path
starts where the range started. So, it doesn't necessarily contain the
entire path from the start of the XML document.
See_Also: $(LREF2 name, DOMEntity.name)
+/
@property SliceOfR[] path()
{
return _path;
}
///
static if(compileInTests) unittest
{
import std.range.primitives : empty;
auto xml = "<root>\n" ~
" <bar>\n" ~
" <baz>\n" ~
" <xyzzy/>\n" ~
" </baz>\n" ~
" <frobozz>\n" ~
" <!-- comment -->\n" ~
" It's magic!\n" ~
" </frobozz>\n" ~
" </bar>\n" ~
" <foo></foo>\n" ~
"</root>";
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.path.empty);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.path.empty);
auto bar = root.children[0];
assert(bar.type == EntityType.elementStart);
assert(bar.name == "bar");
assert(bar.path == ["root"]);
auto baz = bar.children[0];
assert(baz.type == EntityType.elementStart);
assert(baz.name == "baz");
assert(baz.path == ["root", "bar"]);
auto xyzzy = baz.children[0];
assert(xyzzy.type == EntityType.elementEmpty);
assert(xyzzy.name == "xyzzy");
assert(xyzzy.path == ["root", "bar", "baz"]);
auto frobozz = bar.children[1];
assert(frobozz.type == EntityType.elementStart);
assert(frobozz.name == "frobozz");
assert(frobozz.path == ["root", "bar"]);
auto comment = frobozz.children[0];
assert(comment.type == EntityType.comment);
assert(comment.text == " comment ");
assert(comment.path == ["root", "bar", "frobozz"]);
auto text = frobozz.children[1];
assert(text.type == EntityType.text);
assert(text.text == "\n It's magic!\n ");
assert(text.path == ["root", "bar", "frobozz"]);
auto foo = root.children[1];
assert(foo.type == EntityType.elementStart);
assert(foo.name == "foo");
assert(foo.path == ["root"]);
}
/++
Returns a dynamic array of attributes for a start tag where each
attribute is represented as a$(BR)
$(D $(PHOBOS_REF_ALTTEXT Tuple, Tuple, std, typecons)!(
$(LREF2 SliceOfR, EntityRange), $(D_STRING "name"),
$(LREF2 SliceOfR, EntityRange), $(D_STRING "value"),
$(REF_ALTTEXT TextPos, TextPos, dxml, parser), $(D_STRING "pos"))).
$(TABLE
$(TR $(TH Supported $(LREF EntityType)s:))
$(TR $(TD $(REF_ALTTEXT elementStart, EntityType.elementStart, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT elementEmpty, EntityType.elementEmpty, dxml, parser)))
)
See_Also: $(LREF DomEntity.Attribute)$(BR)
$(REF normalize, dxml, util)$(BR)
$(REF asNormalized, dxml, util)
+/
@property auto attributes()
{
with(EntityType)
{
import std.format : format;
assert(_type == elementStart || _type == elementEmpty,
format("attributes cannot be called with %s", _type));
}
return _attributes;
}
///
static if(compileInTests) unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : filter;
import std.range.primitives : empty;
import dxml.parser : TextPos;
{
auto xml = "<root/>";
auto root = parseDOM(xml).children[0];
assert(root.type == EntityType.elementEmpty);
assert(root.attributes.empty);
static assert(is(ElementType!(typeof(root.attributes)) ==
typeof(root).Attribute));
}
{
auto xml = "<root a='42' q='29' w='hello'/>";
auto root = parseDOM(xml).children[0];
assert(root.type == EntityType.elementEmpty);
auto attrs = root.attributes;
assert(attrs.length == 3);
assert(attrs[0].name == "a");
assert(attrs[0].value == "42");
assert(attrs[0].pos == TextPos(1, 7));
assert(attrs[1].name == "q");
assert(attrs[1].value == "29");
assert(attrs[1].pos == TextPos(1, 14));
assert(attrs[2].name == "w");
assert(attrs[2].value == "hello");
assert(attrs[2].pos == TextPos(1, 21));
}
// Because the type of name and value is SliceOfR, == with a string
// only works if the range passed to parseXML was string.
{
auto xml = filter!"true"("<root a='42' q='29' w='hello'/>");
auto root = parseDOM(xml).children[0];
assert(root.type == EntityType.elementEmpty);
auto attrs = root.attributes;
assert(attrs.length == 3);
assert(equal(attrs[0].name, "a"));
assert(equal(attrs[0].value, "42"));
assert(attrs[0].pos == TextPos(1, 7));
assert(equal(attrs[1].name, "q"));
assert(equal(attrs[1].value, "29"));
assert(attrs[1].pos == TextPos(1, 14));
assert(equal(attrs[2].name, "w"));
assert(equal(attrs[2].value, "hello"));
assert(attrs[2].pos == TextPos(1, 21));
}
}
/++
Returns the textual value of this DOMEntity.
In the case of
$(REF_ALTTEXT EntityType.pi, EntityType.pi, dxml, parser), this is the
text that follows the name, whereas in the other cases, the text is the
entire contents of the entity (save for the delimeters on the ends if
that entity has them).
$(TABLE
$(TR $(TH Supported $(LREF EntityType)s:))
$(TR $(TD $(REF_ALTTEXT cdata, EntityType.cdata, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT comment, EntityType.comment, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT pi, EntityType.pi, dxml, parser)))
$(TR $(TD $(REF_ALTTEXT _text, EntityType._text, dxml, parser)))
)
See_Also: $(REF normalize, dxml, util)$(BR)
$(REF asNormalized, dxml, util)$(BR)
$(REF stripIndent, dxml, util)$(BR)
$(REF withoutIndent, dxml, util)
+/
@property SliceOfR text()
{
import dxml.internal : checkedSave;
with(EntityType)
{
import std.format : format;
assert(only(cdata, comment, pi, text).canFind(_type),
format("text cannot be called with %s", _type));
}
return checkedSave(_text);
}
///
static if(compileInTests) unittest
{
import std.range.primitives : empty;
auto xml = "<?xml version='1.0'?>\n" ~
"<?instructionName?>\n" ~
"<?foo here is something to say?>\n" ~
"<root>\n" ~
" <![CDATA[ Yay! random text >> << ]]>\n" ~
" <!-- some random comment -->\n" ~
" <p>something here</p>\n" ~
" <p>\n" ~
" something else\n" ~
" here</p>\n" ~
"</root>";
auto dom = parseDOM(xml);
// "<?instructionName?>\n" ~
auto pi1 = dom.children[0];
assert(pi1.type == EntityType.pi);
assert(pi1.name == "instructionName");
assert(pi1.text.empty);
// "<?foo here is something to say?>\n" ~
auto pi2 = dom.children[1];
assert(pi2.type == EntityType.pi);
assert(pi2.name == "foo");
assert(pi2.text == "here is something to say");
// "<root>\n" ~
auto root = dom.children[2];
assert(root.type == EntityType.elementStart);
// " <![CDATA[ Yay! random text >> << ]]>\n" ~
auto cdata = root.children[0];
assert(cdata.type == EntityType.cdata);
assert(cdata.text == " Yay! random text >> << ");
// " <!-- some random comment -->\n" ~
auto comment = root.children[1];
assert(comment.type == EntityType.comment);
assert(comment.text == " some random comment ");
// " <p>something here</p>\n" ~
auto p1 = root.children[2];
assert(p1.type == EntityType.elementStart);
assert(p1.name == "p");
assert(p1.children[0].type == EntityType.text);
assert(p1.children[0].text == "something here");
// " <p>\n" ~
// " something else\n" ~
// " here</p>\n" ~
auto p2 = root.children[3];
assert(p2.type == EntityType.elementStart);
assert(p2.children[0].type == EntityType.text);
assert(p2.children[0].text == "\n something else\n here");
}
/++
Returns the child entities of the current entity.
They are in the same order that they were in the XML document.
$(TABLE
$(TR $(TH Supported $(LREF EntityType)s:))
$(TR $(TD $(REF_ALTTEXT elementStart, elementStart.elementStart, dxml, parser)))
)
+/
@property DOMEntity[] children()
{
import std.format : format;
assert(_type == EntityType.elementStart,
format!"children cannot be called with %s"(_type));
return _children;
}
///
static if(compileInTests) unittest
{
auto xml = "<potato>\n" ~
" <!--comment-->\n" ~
" <foo>bar</foo>\n" ~
" <tag>\n" ~
" <silly>you</silly>\n" ~
" <empty/>\n" ~
" <nocontent></nocontent>\n" ~
" </tag>\n" ~
"</potato>\n" ~
"<!--the end-->";
auto dom = parseDOM(xml);
assert(dom.children.length == 2);
auto potato = dom.children[0];
assert(potato.type == EntityType.elementStart);
assert(potato.name == "potato");
assert(potato.children.length == 3);
auto comment = potato.children[0];
assert(comment.type == EntityType.comment);
assert(comment.text == "comment");
auto foo = potato.children[1];
assert(foo.type == EntityType.elementStart);
assert(foo.name == "foo");
assert(foo.children.length == 1);
assert(foo.children[0].type == EntityType.text);
assert(foo.children[0].text == "bar");
auto tag = potato.children[2];
assert(tag.type == EntityType.elementStart);
assert(tag.name == "tag");
assert(tag.children.length == 3);
auto silly = tag.children[0];
assert(silly.type == EntityType.elementStart);
assert(silly.name == "silly");
assert(silly.children.length == 1);
assert(silly.children[0].type == EntityType.text);
assert(silly.children[0].text == "you");
auto empty = tag.children[1];
assert(empty.type == EntityType.elementEmpty);
assert(empty.name == "empty");
auto nocontent = tag.children[2];
assert(nocontent.type == EntityType.elementStart);
assert(nocontent.name == "nocontent");
assert(nocontent.children.length == 0);
auto endComment = dom.children[1];
assert(endComment.type == EntityType.comment);
assert(endComment.text == "the end");
}
// Reduce the chance of bugs if reference-type ranges are involved.
static if(!isDynamicArray!R) this(this)
{
with(EntityType) final switch(_type)
{
case cdata: goto case text;
case comment: goto case text;
case elementStart:
{
_name = _name.save;
break;
}
case elementEnd: goto case elementStart;
case elementEmpty: goto case elementStart;
case text:
{
_text = _text.save;
break;
}
case pi:
{
_text = _text.save;
goto case elementStart;
}
}
}
private:
this(EntityType type, TextPos pos)
{
_type = type;
_pos = pos;
// None of these initializations should be required. https://issues.dlang.org/show_bug.cgi?id=13945
_name = typeof(_name).init;
_text = typeof(_text).init;
}
auto _type = EntityType.elementStart;
TextPos _pos;
SliceOfR _name;
SliceOfR[] _path;
Attribute[] _attributes;
SliceOfR _text;
DOMEntity[] _children;
}
/// Ditto
DOMEntity!R parseDOM(Config config = Config.init, R)(R range)
if(isForwardRange!R && isSomeChar!(ElementType!R))
{
import dxml.parser : parseXML;
auto entityRange = parseXML!config(range);
typeof(return) retval;
_parseDOM(entityRange, retval);
return retval;
}
/// Ditto
DOMEntity!(ER.Input) parseDOM(ER)(ref ER range)
if(isInstanceOf!(EntityRange, ER))
{
typeof(return) retval;
if(range.empty)
return retval;
retval._pos = range.front.pos;
if(range.front.type == EntityType.elementEnd)
return retval;
_parseDOM(range, retval);
return retval;
}
/++
parseDOM with the default $(REF_ALTTEXT Config, Config, dxml, parser) and a
range of characters.
+/
@safe unittest
{
import std.range.primitives;
auto xml = "<root>\n" ~
" <!-- no comment -->\n" ~
" <foo></foo>\n" ~
" <baz>\n" ~
" <xyzzy>It's an adventure!</xyzzy>\n" ~
" </baz>\n" ~
" <tag/>\n" ~
"</root>";
auto dom = parseDOM(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 4);
assert(root.children[0].type == EntityType.comment);
assert(root.children[0].text == " no comment ");
assert(root.children[1].type == EntityType.elementStart);
assert(root.children[1].name == "foo");
assert(root.children[1].children.length == 0);
auto baz = root.children[2];
assert(baz.type == EntityType.elementStart);
assert(baz.name == "baz");
assert(baz.children.length == 1);
auto xyzzy = baz.children[0];
assert(xyzzy.type == EntityType.elementStart);
assert(xyzzy.name == "xyzzy");
assert(xyzzy.children.length == 1);
assert(xyzzy.children[0].type == EntityType.text);
assert(xyzzy.children[0].text == "It's an adventure!");
assert(root.children[3].type == EntityType.elementEmpty);
assert(root.children[3].name == "tag");
}
/++
parseDOM with $(REF_ALTTEXT simpleXML, simpleXML, dxml, parser) and a range
of characters.
+/
unittest
{
import std.range.primitives : empty;
auto xml = "<root>\n" ~
" <!-- no comment -->\n" ~
" <foo></foo>\n" ~
" <baz>\n" ~
" <xyzzy>It's an adventure!</xyzzy>\n" ~
" </baz>\n" ~
" <tag/>\n" ~
"</root>";
auto dom = parseDOM!simpleXML(xml);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 3);
assert(root.children[0].type == EntityType.elementStart);
assert(root.children[0].name == "foo");
assert(root.children[0].children.length == 0);
auto baz = root.children[1];
assert(baz.type == EntityType.elementStart);
assert(baz.name == "baz");
assert(baz.children.length == 1);
auto xyzzy = baz.children[0];
assert(xyzzy.type == EntityType.elementStart);
assert(xyzzy.name == "xyzzy");
assert(xyzzy.children.length == 1);
assert(xyzzy.children[0].type == EntityType.text);
assert(xyzzy.children[0].text == "It's an adventure!");
assert(root.children[2].type == EntityType.elementStart);
assert(root.children[2].name == "tag");
assert(root.children[2].children.length == 0);
}
/++
parseDOM with $(REF_ALTTEXT simpleXML, simpleXML, dxml, parser) and an
$(REF_ALTTEXT EntityRange, EntityRange, dxml, parser).
+/
unittest
{
import std.range.primitives : empty;
import dxml.parser : parseXML;
auto xml = "<root>\n" ~
" <!-- no comment -->\n" ~
" <foo></foo>\n" ~
" <baz>\n" ~
" <xyzzy>It's an adventure!</xyzzy>\n" ~
" </baz>\n" ~
" <tag/>\n" ~
"</root>";
auto range = parseXML!simpleXML(xml);
auto dom = parseDOM(range);
assert(range.empty);
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.name == "root");
assert(root.children.length == 3);
assert(root.children[0].type == EntityType.elementStart);
assert(root.children[0].name == "foo");
assert(root.children[0].children.length == 0);
auto baz = root.children[1];
assert(baz.type == EntityType.elementStart);
assert(baz.name == "baz");
assert(baz.children.length == 1);
auto xyzzy = baz.children[0];
assert(xyzzy.type == EntityType.elementStart);
assert(xyzzy.name == "xyzzy");
assert(xyzzy.children.length == 1);
assert(xyzzy.children[0].type == EntityType.text);
assert(xyzzy.children[0].text == "It's an adventure!");
assert(root.children[2].type == EntityType.elementStart);
assert(root.children[2].name == "tag");
assert(root.children[2].children.length == 0);
}
/++
parseDOM with an $(REF_ALTTEXT EntityRange, EntityRange, dxml, parser)
which is not at the start of the document.
+/
unittest
{
import std.range.primitives : empty;
import dxml.parser : parseXML, skipToPath;
auto xml = "<root>\n" ~
" <!-- no comment -->\n" ~
" <foo></foo>\n" ~
" <baz>\n" ~
" <xyzzy>It's an adventure!</xyzzy>\n" ~
" </baz>\n" ~
" <tag/>\n" ~
"</root>";
auto range = parseXML!simpleXML(xml).skipToPath("baz/xyzzy");
assert(range.front.type == EntityType.elementStart);
assert(range.front.name == "xyzzy");
auto dom = parseDOM(range);
assert(range.front.type == EntityType.elementStart);
assert(range.front.name == "tag");
assert(dom.type == EntityType.elementStart);
assert(dom.name.empty);
assert(dom.children.length == 1);
auto xyzzy = dom.children[0];
assert(xyzzy.type == EntityType.elementStart);
assert(xyzzy.name == "xyzzy");
assert(xyzzy.children.length == 1);
assert(xyzzy.children[0].type == EntityType.text);
assert(xyzzy.children[0].text == "It's an adventure!");
}
/// parseDOM at compile-time
unittest
{
enum xml = "<!-- comment -->\n" ~
"<root>\n" ~
" <foo>some text<whatever/></foo>\n" ~
" <bar/>\n" ~
" <baz></baz>\n" ~
"</root>";
enum dom = parseDOM(xml);
static assert(dom.type == EntityType.elementStart);
static assert(dom.name.empty);
static assert(dom.children.length == 2);
static assert(dom.children[0].type == EntityType.comment);
static assert(dom.children[0].text == " comment ");
}
// This is purely to provide a way to trigger the unittest blocks in DOMEntity
// without compiling them in normally.
private struct DOMCompileTests
{
@property bool empty() @safe pure nothrow @nogc { assert(0); }
@property char front() @safe pure nothrow @nogc { assert(0); }
void popFront() @safe pure nothrow @nogc { assert(0); }
@property typeof(this) save() @safe pure nothrow @nogc { assert(0); }
}
unittest
{
DOMEntity!DOMCompileTests _domTests;
}
private:
void _parseDOM(ER, DE)(ref ER range, ref DE parent, ER.SliceOfR[] path = null)
{
assert(!range.empty);
assert(range.front.type != EntityType.elementEnd);
import std.array : appender, array;
auto children = appender!(DE[])();
while(!range.empty)
{
auto entity = range.front;
range.popFront();
if(entity.type == EntityType.elementEnd)
break;
auto child = DE(entity.type, entity.pos);
child._path = path;
with(EntityType) final switch(entity.type)
{
case cdata: goto case text;
case comment: goto case text;
case elementStart:
{
child._name = entity.name;
child._attributes = entity.attributes.array();
if(range.front.type == EntityType.elementEnd)
range.popFront();
else
{
if(!entity.name.empty)
path ~= entity.name;
// TODO The explicit instantiation doesn't hurt, but it
// shouldn't be necessary, and if it's not there, we get
// a compiler error. It should be reduced and reported.
_parseDOM!(ER, DE)(range, child, path);
--path.length;
}
break;
}
case elementEnd: assert(0);
case elementEmpty:
{
child._name = entity.name;
child._attributes = entity.attributes.array();
break;
}
case text:
{
child._text = entity.text;
break;
}
case pi:
{
child._name = entity.name;
child._text = entity.text;
break;
}
}
put(children, child);
}
parent._children = children.data;
}
unittest
{
import std.algorithm.comparison : equal;
import dxml.internal : testRangeFuncs;
import dxml.parser : parseXML, TextPos;
static void testChildren(ER, size_t line = __LINE__)(ref ER entityRange, int row, int col, EntityType[] expected...)
{
import core.exception : AssertError;
import std.exception : enforce;
auto temp = entityRange.save;
auto dom = parseDOM(temp);
enforce!AssertError(dom.type == EntityType.elementStart, "unittest 1", __FILE__, line);
enforce!AssertError(dom.children.length == expected.length, "unittest 2", __FILE__, line);
foreach(i; 0 .. dom._children.length)
enforce!AssertError(dom._children[i].type == expected[i], "unittest 3", __FILE__, line);
enforce!AssertError(dom.pos == TextPos(row, col), "unittest 4", __FILE__, line);
if(!entityRange.empty)
entityRange.popFront();
}
static foreach(func; testRangeFuncs)
{{
{
foreach(i, xml; ["<!-- comment -->\n" ~
"<?pi foo?>\n" ~
"<su></su>",
"<!-- comment -->\n" ~
"<?pi foo?>\n" ~
"<su/>"])
{
auto range = parseXML(func(xml));
foreach(j; 0 .. 4 - i)
{
auto temp = range.save;
auto dom = parseDOM(temp);
assert(dom.type == EntityType.elementStart);
assert(dom.children.length == 3 - j);
if(j <= 2)
{
assert(dom.children[2 - j].type ==
(i == 0 ? EntityType.elementStart : EntityType.elementEmpty));
assert(equal(dom.children[2 - j].name, "su"));
if(j <= 1)
{
assert(dom.children[1 - j].type == EntityType.pi);
assert(equal(dom.children[1 - j].name, "pi"));
assert(equal(dom.children[1 - j].text, "foo"));
if(j == 0)
{
assert(dom.children[0].type == EntityType.comment);
assert(equal(dom.children[0].text, " comment "));
}
}
}
range.popFront();
}
assert(range.empty);
auto dom = parseDOM(range);
assert(dom.type == EntityType.elementStart);
assert(dom.name is typeof(dom.name).init);
assert(dom.children.length == 0);
}
}
{
auto xml = "<root>\n" ~
" <foo>\n" ~
" <bar>\n" ~
" <baz>\n" ~
" It's silly, Charley\n" ~
" </baz>\n" ~
" <frobozz>\n" ~
" <is>the Wiz</is>\n" ~
" </frobozz>\n" ~
" <empty></empty>\n" ~
" <xyzzy/>\n" ~
" </bar>\n" ~
" </foo>\n" ~
" <!--This isn't the end-->\n" ~
"</root>\n" ~
"<?Poirot?>\n" ~
"<!--It's the end!-->";
{
auto range = parseXML(func(xml));
with(EntityType)
{
testChildren(range, 1, 1, elementStart, pi, comment); // <root>
testChildren(range, 2, 5, elementStart, comment); // <foo>
testChildren(range, 3, 9, elementStart); // <bar>
testChildren(range, 4, 13, elementStart, elementStart, elementStart, elementEmpty); // <baz>
testChildren(range, 4, 18, text); // It's silly, Charley
testChildren(range, 6, 13); // </baz>
testChildren(range, 7, 13, elementStart, elementStart, elementEmpty); // <frobozz>
testChildren(range, 8, 17, elementStart); // <is>
testChildren(range, 8, 21, text); // the Wiz
testChildren(range, 8, 28); // </is>
testChildren(range, 9, 13); // </frobozz>
testChildren(range, 10, 13, elementStart, elementEmpty); // <empty>
testChildren(range, 10, 20); // </empty>
testChildren(range, 11, 13, elementEmpty); // <xyzzy/>
testChildren(range, 12, 9); // </bar>
testChildren(range, 13, 5); // </foo>
testChildren(range, 14, 5, comment); // <!--This isn't the end-->
testChildren(range, 15, 1); // </root>
testChildren(range, 16, 1, pi, comment); // <?Poirot?>
testChildren(range, 17, 1, comment); // <!--It's the end-->"
testChildren(range, 1, 1); // empty range
}
}
{
auto dom = parseDOM(func(xml));
assert(dom.children.length == 3);
auto root = dom.children[0];
assert(root.type == EntityType.elementStart);
assert(root.pos == TextPos(1, 1));
assert(root.children.length == 2);
assert(equal(root.name, "root"));
auto foo = root.children[0];
assert(foo.type == EntityType.elementStart);
assert(foo.pos == TextPos(2, 5));
assert(foo.children.length == 1);
assert(equal(foo.name, "foo"));
auto bar = foo.children[0];
assert(bar.type == EntityType.elementStart);
assert(bar.pos == TextPos(3, 9));
assert(bar.children.length == 4);
assert(equal(bar.name, "bar"));
auto baz = bar.children[0];
assert(baz.type == EntityType.elementStart);
assert(baz.pos == TextPos(4, 13));
assert(baz.children.length == 1);
assert(equal(baz.name, "baz"));
auto silly = baz.children[0];
assert(silly.type == EntityType.text);
assert(silly.pos == TextPos(4, 18));
assert(equal(silly.text, "\n It's silly, Charley\n "));
auto frobozz = bar.children[1];
assert(frobozz.type == EntityType.elementStart);
assert(frobozz.pos == TextPos(7, 13));
assert(frobozz.children.length == 1);
assert(equal(frobozz.name, "frobozz"));
auto is_ = frobozz.children[0];
assert(is_.type == EntityType.elementStart);
assert(is_.pos == TextPos(8, 17));
assert(is_.children.length == 1);
assert(equal(is_.name, "is"));
auto wiz = is_.children[0];
assert(wiz.type == EntityType.text);
assert(wiz.pos == TextPos(8, 21));
assert(equal(wiz.text, "the Wiz"));
auto empty = bar.children[2];
assert(empty.type == EntityType.elementStart);
assert(empty.pos == TextPos(10, 13));
assert(empty.children.length == 0);
assert(equal(empty.name, "empty"));
auto xyzzy = bar.children[3];
assert(xyzzy.type == EntityType.elementEmpty);
assert(xyzzy.pos == TextPos(11, 13));
assert(equal(xyzzy.name, "xyzzy"));
auto comment = root.children[1];
assert(comment.type == EntityType.comment);
assert(comment.pos == TextPos(14, 5));
assert(equal(comment.text, "This isn't the end"));
auto poirot = dom.children[1];
assert(poirot.type == EntityType.pi);
assert(poirot.pos == TextPos(16, 1));
assert(equal(poirot.name, "Poirot"));
assert(poirot.text.empty);
auto endComment = dom.children[2];
assert(endComment.type == EntityType.comment);
assert(endComment.pos == TextPos(17, 1));
assert(equal(endComment.text, "It's the end!"));
}
}
}}
}
|
D
|
/*
* All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*/
module hunt.quartz.utils.HikariCpPoolingConnectionProvider;
// import com.zaxxer.hikari.HikariDataSource;
// import hunt.quartz.Exceptions;
// import java.sql.Connection;
// import java.sql.SQLException;
// import java.util.Properties;
// /**
// * <p>
// * A <code>ConnectionProvider</code> implementation that creates its own
// * pool of connections.
// * </p>
// *
// * <p>
// * This class uses HikariCP (https://brettwooldridge.github.io/HikariCP/) as
// * the underlying pool implementation.</p>
// *
// * @see DBConnectionManager
// * @see ConnectionProvider
// *
// * @author Ludovic Orban
// */
// class HikariCpPoolingConnectionProvider : PoolingConnectionProvider {
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Constants.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// /** This pooling provider name. */
// enum string POOLING_PROVIDER_NAME = "hikaricp";
// /** Discard connections after they have been idle this many seconds. 0 disables the feature. Default is 0.*/
// private enum string DB_DISCARD_IDLE_CONNECTIONS_SECONDS = "discardIdleConnectionsSeconds";
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Data members.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// private HikariDataSource datasource;
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Constructors.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// HikariCpPoolingConnectionProvider(string dbDriver, string dbURL,
// string dbUser, string dbPassword, int maxConnections,
// string dbValidationQuery) {
// initialize(
// dbDriver, dbURL, dbUser, dbPassword,
// maxConnections, dbValidationQuery, 0);
// }
// /**
// * Create a connection pool using the given properties.
// *
// * <p>
// * The properties passed should contain:
// * <UL>
// * <LI>{@link #DB_DRIVER}- The database driver class name
// * <LI>{@link #DB_URL}- The database URL
// * <LI>{@link #DB_USER}- The database user
// * <LI>{@link #DB_PASSWORD}- The database password
// * <LI>{@link #DB_MAX_CONNECTIONS}- The maximum # connections in the pool,
// * optional
// * <LI>{@link #DB_VALIDATION_QUERY}- The sql validation query, optional
// * </UL>
// * </p>
// *
// * @param config
// * configuration properties
// */
// HikariCpPoolingConnectionProvider(Properties config) {
// PropertiesParser cfg = new PropertiesParser(config);
// initialize(
// cfg.getStringProperty(DB_DRIVER),
// cfg.getStringProperty(DB_URL),
// cfg.getStringProperty(DB_USER, ""),
// cfg.getStringProperty(DB_PASSWORD, ""),
// cfg.getIntProperty(DB_MAX_CONNECTIONS, DEFAULT_DB_MAX_CONNECTIONS),
// cfg.getStringProperty(DB_VALIDATION_QUERY),
// cfg.getIntProperty(DB_DISCARD_IDLE_CONNECTIONS_SECONDS, 0));
// }
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Interface.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// /**
// * Create the underlying C3PO ComboPooledDataSource with the
// * default supported properties.
// * @throws SchedulerException
// */
// private void initialize(
// string dbDriver,
// string dbURL,
// string dbUser,
// string dbPassword,
// int maxConnections,
// string dbValidationQuery,
// int maxIdleSeconds) {
// if (dbURL is null) {
// throw new SQLException(
// "DBPool could not be created: DB URL cannot be null");
// }
// if (dbDriver is null) {
// throw new SQLException(
// "DBPool '" ~ dbURL ~ "' could not be created: " ~
// "DB driver class name cannot be null!");
// }
// if (maxConnections < 0) {
// throw new SQLException(
// "DBPool '" ~ dbURL ~ "' could not be created: " ~
// "Max connections must be greater than zero!");
// }
// datasource = new HikariDataSource();
// datasource.setDriverClassName(dbDriver);
// datasource.setJdbcUrl(dbURL);
// datasource.setUsername(dbUser);
// datasource.setPassword(dbPassword);
// datasource.setMaximumPoolSize(maxConnections);
// datasource.setIdleTimeout(maxIdleSeconds);
// if (dbValidationQuery !is null) {
// datasource.setConnectionTestQuery(dbValidationQuery);
// }
// }
// /**
// * Get the HikariCP HikariDataSource created during initialization.
// *
// * <p>
// * This can be used to set additional data source properties in a
// * subclass's constructor.
// * </p>
// */
// HikariDataSource getDataSource() {
// return datasource;
// }
// Connection getConnection() {
// return datasource.getConnection();
// }
// void shutdown() {
// datasource.close();
// }
// void initialize() {
// // do nothing, already initialized during constructor call
// }
// }
|
D
|
/**
* Copyright: Mike Wey 2011
* License: zlib (See accompanying LICENSE file)
* Authors: Mike Wey
*/
module dmagick.Geometry;
import std.conv;
import std.ascii;
import std.string;
import dmagick.c.geometry;
import dmagick.c.magickString;
import dmagick.c.magickType;
alias ptrdiff_t ssize_t;
/**
* Geometry provides a convenient means to specify a geometry argument.
*/
struct Geometry
{
size_t width; ///
size_t height; ///
ssize_t xOffset; ///
ssize_t yOffset; ///
bool percent; /// The width and/or height are percentages of the original.
bool minimum; /// The specified width and/or height is the minimum value.
bool keepAspect = true; ///Retain the aspect ratio.
bool greater; /// Resize only if the image is greater than the width and/or height.
bool less; /// Resize only if the image is smaller than the width and/or height.
/**
* Create a Geometry form a Imagemagick / X11 geometry string.
*
* The string constist of a size and a optional offset, the size
* can be a width, a height (prefixed with an x), or both
* ( $(D widthxheight) ).
*
* When a offset is needed ammend the size with an x an y offset
* ( signs are required ) like this: $(D {size}+x+Y).
*
* The way the size is interpreted can be determined by the
* following flags:
*
* $(TABLE
* $(HEADERS Flag, Explanation)
* $(ROW $(D %), Normally the attributes are treated as pixels.
* Use this flag when the width and height
* attributes represent percentages.)
* $(ROW $(D !), Use this flag when you want to force the new
* image to have exactly the size specified by the
* the width and height attributes.)
* $(ROW $(D <), Use this flag when you want to change the size
* of the image only if both its width and height
* are smaller the values specified by those
* attributes. The image size is changed
* proportionally.)
* $(ROW $(D >), Use this flag when you want to change the size
* of the image if either its width and height
* exceed the values specified by those attributes.
* The image size is changed proportionally.)
* $(ROW $(D ^), Use ^ to set a minimum image size limit. The
* geometry $(D 640x480^) means the image width
* will not be less than 640 and the image height
* will not be less than 480 pixels after the
* resize. One of those dimensions will match
* the requested size. But the image will likely
* overflow the space requested to preserve its
* aspect ratio.)
* )
*/
this(string geometry)
{
MagickStatusType flags;
//If the string starts with a letter assume it's a Page Geometry.
if ( isAlpha(geometry[0]) )
{
char* geo = GetPageGeometry(toStringz(geometry));
if( geo !is null )
{
geometry = to!(string)(geo);
DestroyString(geo);
}
}
flags = GetGeometry(toStringz(geometry), &xOffset, &yOffset, &width, &height);
percent = ( flags & GeometryFlags.PercentValue ) != 0;
minimum = ( flags & GeometryFlags.MinimumValue ) != 0;
keepAspect = ( flags & GeometryFlags.AspectValue ) == 0;
greater = ( flags & GeometryFlags.GreaterValue ) != 0;
less = ( flags & GeometryFlags.LessValue ) != 0;
}
unittest
{
Geometry geo = Geometry("200x150-50+25!");
assert( geo.width == 200 && geo.xOffset == -50 );
assert( geo.keepAspect == false );
geo = Geometry("A4");
assert( geo.width == 595 && geo.height == 842);
}
/**
* Initialize with width heigt and offsets.
*/
this(size_t width, size_t height, ssize_t xOffset = 0, ssize_t yOffset = 0)
{
this.width = width;
this.height = height;
this.xOffset = xOffset;
this.yOffset = yOffset;
}
/** */
package this(RectangleInfo rectangle)
{
this.width = rectangle.width;
this.height = rectangle.height;
this.xOffset = rectangle.x;
this.yOffset = rectangle.y;
}
/**
* Convert Geometry into a Imagemagick geometry string.
*/
string toString()
{
string geometry;
if ( width > 0 )
geometry ~= to!(string)(width);
if ( height > 0 )
geometry ~= "x" ~ to!(string)(height);
geometry ~= format("%s%s%s%s%s",
percent ? "%" : "",
minimum ? "^" : "",
keepAspect ? "" : "!",
less ? "<" : "",
greater ? ">" : "");
if ( xOffset != 0 && yOffset != 0 )
geometry ~= format("%+s%+s", xOffset, yOffset);
return geometry;
}
unittest
{
Geometry geo = Geometry("200x150!-50+25");
assert( geo.toString == "200x150!-50+25");
}
/**
* Calculate the absolute width and height based on the flags,
* and the profided width and height.
*/
Geometry toAbsolute(size_t width, size_t height)
{
ssize_t x, y;
ParseMetaGeometry(toStringz(toString()), &x, &y, &width, &height);
return Geometry(width, height, x, y);
}
unittest
{
Geometry percentage = Geometry("50%");
Geometry absolute = percentage.toAbsolute(100, 100);
assert(absolute.width == 50);
assert(absolute.height == 50);
}
/** */
package RectangleInfo rectangleInfo()
{
RectangleInfo info;
info.width = width;
info.height = height;
info.x = xOffset;
info.y = yOffset;
return info;
}
/** */
size_t opCmp(ref const Geometry geometry)
{
return width*height - geometry.width*geometry.height;
}
}
|
D
|
/Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/SMTP.build/Email/Address/EmailAddressRepresentable.swift.o : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Sockets.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/SMTP.build/EmailAddressRepresentable~partial.swiftmodule : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Sockets.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/SMTP.build/EmailAddressRepresentable~partial.swiftdoc : /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSUUID+SMTPMessageID.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Utility/NSDate+SMTP.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Send.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPAuthMethod.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Convenience.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddressRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachmentRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBodyRepresentable.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress+StringLiteralConvertible.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Authorize.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPGreeting.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPCredential.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Email.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/EHLOExtension.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClientError.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Address/EmailAddress.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Transmit.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Attachment/EmailAttachment.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Email/Body/EmailBody.swift /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/checkouts/engine.git-3311994267206676365/Sources/SMTP/Client/SMTPClient+Reply.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Sockets.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/Transport.swiftmodule /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Documents/VaporProject/HerokuChat/.build/x86_64-apple-macosx10.10/debug/CSQLite.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
/******************************************************************************
This module contains the parser part of the compiler. This uses a lexer to
get a stream of tokens, and parses the tokens into an AST.
License:
Copyright (c) 2008 Jarrett Billingsley
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
******************************************************************************/
module minid.parser;
import minid.ast;
import minid.compilertypes;
import minid.interpreter;
import minid.lexer;
import minid.types;
struct Parser
{
private ICompiler c;
private Lexer* l;
private uword dummyNameCounter = 0;
// ================================================================================================================================================
// Public
// ================================================================================================================================================
/**
*/
public static Parser opCall(ICompiler compiler, Lexer* lexer)
{
Parser ret;
ret.c = compiler;
ret.l = lexer;
return ret;
}
/**
*/
public string parseName()
{
return l.expect(Token.Ident).stringValue;
}
/**
*/
public Identifier parseIdentifier()
{
auto tmp = l.expect(Token.Ident);
return new(c) Identifier(c, tmp.loc, tmp.stringValue);
}
/**
Parse a comma-separated list of expressions, such as for argument lists.
*/
public Expression[] parseArguments()
{
scope args = new List!(Expression)(c.alloc);
args ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
args ~= parseExpression();
}
return args.toArray();
}
/**
Parse a module.
*/
public Module parseModule()
{
auto location = l.loc;
Decorator dec;
if(l.type == Token.At)
dec = parseDecorators();
l.expect(Token.Module);
scope names = new List!(string)(c.alloc);
names ~= parseName();
while(l.type == Token.Dot)
{
l.next();
names ~= parseName();
}
auto endLocation = l.loc;
l.statementTerm();
scope statements = new List!(Statement)(c.alloc);
while(l.type != Token.EOF)
statements ~= parseStatement();
auto stmts = new(c) BlockStmt(c, location, l.loc, statements.toArray());
l.expect(Token.EOF);
return new(c) Module(c, location, l.loc, names.toArray(), stmts, dec);
}
/**
Parse a list of statements into a function definition that takes a variadic number of arguments.
Params:
name = The name to use for error messages and debug locations.
*/
public FuncDef parseStatements(string name)
{
auto location = l.loc;
scope statements = new List!(Statement)(c.alloc);
while(l.type != Token.EOF)
statements ~= parseStatement();
auto endLocation = statements.length > 0 ? statements[statements.length - 1].endLocation : location;
auto code = new(c) BlockStmt(c, location, endLocation, statements.toArray());
scope params = new List!(FuncDef.Param)(c.alloc);
params ~= FuncDef.Param(new(c) Identifier(c, l.loc, c.newString("this")));
return new(c) FuncDef(c, location, new(c) Identifier(c, location, c.newString(name)), params.toArray(), true, code);
}
/**
Parse an expression into a function definition that takes a variadic number of arguments and returns the value
of the expression when called.
Params:
name = The name to use for error messages and debug locations.
*/
public FuncDef parseExpressionFunc(string name)
{
auto location = l.loc;
scope statements = new List!(Statement)(c.alloc);
scope exprs = new List!(Expression)(c.alloc);
exprs ~= parseExpression();
if(l.type != Token.EOF)
c.exception(l.loc, "Extra unexpected code after expression");
statements ~= new(c) ReturnStmt(c, exprs[0].location, exprs[0].endLocation, exprs.toArray());
auto code = new(c) BlockStmt(c, location, statements[0].endLocation, statements.toArray());
scope params = new List!(FuncDef.Param)(c.alloc);
params ~= FuncDef.Param(new(c) Identifier(c, l.loc, c.newString("this")));
return new(c) FuncDef(c, location, new(c) Identifier(c, location, c.newString(name)), params.toArray(), true, code);
}
/**
Parse a statement.
Params:
needScope = If true, and the statement is a block statement, the block will be wrapped
in a ScopeStmt. Else, the raw block statement will be returned.
*/
public Statement parseStatement(bool needScope = true)
{
switch(l.type)
{
case
Token.CharLiteral,
Token.Colon,
Token.Dec,
Token.False,
Token.FloatLiteral,
Token.Ident,
Token.Inc,
Token.IntLiteral,
Token.LBracket,
Token.Length,
Token.LParen,
Token.Null,
Token.Or,
Token.StringLiteral,
Token.Super,
Token.This,
Token.True,
Token.Vararg,
Token.Yield:
return parseExpressionStmt();
case
Token.Class,
Token.Function,
Token.Global,
Token.Local,
Token.Namespace,
Token.At:
return parseDeclStmt();
case Token.LBrace:
if(needScope)
{
// don't inline this; memory management stuff.
auto stmt = parseBlockStmt();
return new(c) ScopeStmt(c, stmt);
}
else
return parseBlockStmt();
case Token.Assert: return parseAssertStmt();
case Token.Break: return parseBreakStmt();
case Token.Continue: return parseContinueStmt();
case Token.Do: return parseDoWhileStmt();
case Token.For: return parseForStmt();
case Token.Foreach: return parseForeachStmt();
case Token.If: return parseIfStmt();
case Token.Import: return parseImportStmt();
case Token.Return: return parseReturnStmt();
case Token.Scope: return parseScopeActionStmt();
case Token.Switch: return parseSwitchStmt();
case Token.Throw: return parseThrowStmt();
case Token.Try: return parseTryStmt();
case Token.While: return parseWhileStmt();
case Token.Semicolon:
c.exception(l.loc, "Empty statements ( ';' ) are not allowed (use {{} for an empty statement)");
default:
l.expected("statement");
}
assert(false);
}
/**
*/
public Statement parseExpressionStmt()
{
auto stmt = parseStatementExpr();
l.statementTerm();
return stmt;
}
/**
*/
public Decorator parseDecorators()
{
Decorator parseDecorator()
{
l.expect(Token.At);
Expression func = parseIdentExp();
while(l.type == Token.Dot)
{
l.next();
auto tok = l.expect(Token.Ident);
func = new(c) DotExp(c, func, new(c) StringExp(c, tok.loc, tok.stringValue));
}
Expression[] argsArr;
Expression context;
CompileLoc endLocation = void;
if(l.type == Token.Dollar)
{
l.next();
scope args = new List!(Expression)(c.alloc);
args ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
args ~= parseExpression();
}
argsArr = args.toArray();
}
else if(l.type == Token.LParen)
{
l.next();
if(l.type == Token.With)
{
l.next();
context = parseExpression();
if(l.type == Token.Comma)
{
l.next();
argsArr = parseArguments();
}
}
else if(l.type != Token.RParen)
argsArr = parseArguments();
scope(failure)
c.alloc.freeArray(argsArr);
endLocation = l.expect(Token.RParen).loc;
}
else
endLocation = func.endLocation;
return new(c) Decorator(c, func.location, endLocation, func, context, argsArr, null);
}
auto first = parseDecorator();
auto cur = first;
while(l.type == Token.At)
{
cur.nextDec = parseDecorator();
cur = cur.nextDec;
}
return first;
}
/**
*/
public Statement parseDeclStmt()
{
Decorator deco;
if(l.type == Token.At)
deco = parseDecorators();
switch(l.type)
{
case Token.Local, Token.Global:
switch(l.peek.type)
{
case Token.Ident:
if(deco !is null)
c.exception(l.loc, "Cannot put decorators on variable declarations");
auto ret = parseVarDecl();
l.statementTerm();
return ret;
case Token.Function: return parseFuncDecl(deco);
case Token.Class: return parseClassDecl(deco);
case Token.Namespace: return parseNamespaceDecl(deco);
default:
c.exception(l.loc, "Illegal token '{}' after '{}'", l.peek.typeString(), l.tok.typeString());
}
case Token.Function: return parseFuncDecl(deco);
case Token.Class: return parseClassDecl(deco);
case Token.Namespace: return parseNamespaceDecl(deco);
default:
l.expected("Declaration");
}
assert(false);
}
/**
Parse a local or global variable declaration.
*/
public VarDecl parseVarDecl()
{
auto location = l.loc;
auto protection = Protection.Local;
if(l.type == Token.Global)
{
protection = Protection.Global;
l.next();
}
else
l.expect(Token.Local);
scope names = new List!(Identifier)(c.alloc);
names ~= parseIdentifier();
while(l.type == Token.Comma)
{
l.next();
names ~= parseIdentifier();
}
auto namesArr = names.toArray();
auto endLocation = namesArr[$ - 1].location;
scope(failure)
c.alloc.freeArray(namesArr);
Expression[] initializer;
if(l.type == Token.Assign)
{
l.next();
scope exprs = new List!(Expression)(c.alloc);
exprs ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
exprs ~= parseExpression();
}
initializer = exprs.toArray();
endLocation = initializer[$ - 1].endLocation;
}
return new(c) VarDecl(c, location, endLocation, protection, namesArr, initializer);
}
/**
Parse a function declaration, optional protection included.
*/
public FuncDecl parseFuncDecl(Decorator deco)
{
auto location = l.loc;
auto protection = Protection.Default;
if(l.type == Token.Global)
{
protection = Protection.Global;
l.next();
}
else if(l.type == Token.Local)
{
protection = Protection.Local;
l.next();
}
auto def = parseSimpleFuncDef();
return new(c) FuncDecl(c, location, protection, def, deco);
}
/**
Parse everything starting from the left-paren of the parameter list to the end of the body.
Params:
location = Where the function actually started.
name = The name of the function. Must be non-null.
Returns:
The completed function definition.
*/
public FuncDef parseFuncBody(CompileLoc location, Identifier name)
{
l.expect(Token.LParen);
bool isVararg;
auto params = parseFuncParams(isVararg);
scope(failure)
c.alloc.freeArray(params);
l.expect(Token.RParen);
Statement code;
if(l.type == Token.Assign)
{
l.next;
scope dummy = new List!(Expression)(c.alloc);
dummy ~= parseExpression();
auto arr = dummy.toArray();
code = new(c) ReturnStmt(c, arr[0].location, arr[0].endLocation, arr);
}
else
{
code = parseStatement();
if(!code.as!(BlockStmt))
{
scope dummy = new List!(Statement)(c.alloc);
dummy ~= code;
auto arr = dummy.toArray();
code = new(c) BlockStmt(c, code.location, code.endLocation, arr);
}
}
return new(c) FuncDef(c, location, name, params, isVararg, code);
}
/**
Parse a function parameter list, opening and closing parens included.
Params:
isVararg = Return value to indicate if the parameter list ended with 'vararg'.
Returns:
An array of Param structs.
*/
public FuncDef.Param[] parseFuncParams(out bool isVararg)
{
alias FuncDef.Param Param;
alias FuncDef.TypeMask TypeMask;
scope ret = new List!(Param)(c.alloc);
scope(failure)
foreach(ref p; ret)
c.alloc.freeArray(p.classTypes);
void parseParam()
{
Param p = void;
p.name = parseIdentifier();
if(l.type == Token.Colon)
{
l.next();
p.typeMask = parseParamType(p.classTypes);
}
else
{
p.typeMask = TypeMask.Any;
p.classTypes = null;
}
if(l.type == Token.Assign)
{
l.next();
p.defValue = parseExpression();
// Having a default parameter implies allowing null as a parameter type
p.typeMask |= TypeMask.Null;
}
else
p.defValue = null;
ret ~= p;
}
void parseRestOfParams()
{
while(l.type == Token.Comma)
{
l.next();
if(l.type == Token.Vararg)
{
isVararg = true;
l.next();
break;
}
parseParam();
}
}
if(l.type == Token.This)
{
Param p = void;
p.name = new(c) Identifier(c, l.loc, c.newString("this"));
l.next();
l.expect(Token.Colon);
p.typeMask = parseParamType(p.classTypes);
p.defValue = null;
ret ~= p;
if(l.type == Token.Comma)
parseRestOfParams();
}
else
{
ret ~= Param(new(c) Identifier(c, l.loc, c.newString("this")));
if(l.type == Token.Ident)
{
parseParam();
parseRestOfParams();
}
else if(l.type == Token.Vararg)
{
isVararg = true;
l.next();
}
}
return ret.toArray();
}
/**
Parse a parameter type. This corresponds to the Type element of the grammar.
Returns the type mask, as well as an optional list of class types that this
parameter can accept in the classTypes parameter.
*/
public ushort parseParamType(out Expression[] classTypes)
{
alias FuncDef.TypeMask TypeMask;
ushort ret = 0;
scope objTypes = new List!(Expression)(c.alloc);
void addConstraint(MDValue.Type t)
{
if((ret & (1 << cast(uint)t)) && t != MDValue.Type.Instance)
c.exception(l.loc, "Duplicate parameter type constraint for type '{}'", MDValue.typeString(t));
ret |= 1 << cast(uint)t;
}
Expression parseIdentList(Token t)
{
l.next();
auto t2 = l.expect(Token.Ident);
auto exp = new(c) DotExp(c, new(c) IdentExp(c, new(c) Identifier(c, t.loc, t.stringValue)), new(c) StringExp(c, t2.loc, t2.stringValue));
while(l.type == Token.Dot)
{
l.next();
t2 = l.expect(Token.Ident);
exp = new(c) DotExp(c, exp, new(c) StringExp(c, t2.loc, t2.stringValue));
}
return exp;
}
void parseSingleType()
{
switch(l.type)
{
case Token.Null: addConstraint(MDValue.Type.Null); l.next(); break;
case Token.Function: addConstraint(MDValue.Type.Function); l.next(); break;
case Token.Namespace: addConstraint(MDValue.Type.Namespace); l.next(); break;
case Token.Class: addConstraint(MDValue.Type.Class); l.next(); break;
default:
auto t = l.expect(Token.Ident);
if(l.type == Token.Dot)
{
addConstraint(MDValue.Type.Instance);
objTypes ~= parseIdentList(t);
}
else
{
switch(t.stringValue)
{
case "bool": addConstraint(MDValue.Type.Bool); break;
case "int": addConstraint(MDValue.Type.Int); break;
case "float": addConstraint(MDValue.Type.Float); break;
case "char": addConstraint(MDValue.Type.Char); break;
case "string": addConstraint(MDValue.Type.String); break;
case "table": addConstraint(MDValue.Type.Table); break;
case "array": addConstraint(MDValue.Type.Array); break;
case "thread": addConstraint(MDValue.Type.Thread); break;
case "nativeobj": addConstraint(MDValue.Type.NativeObj); break;
case "weakref": addConstraint(MDValue.Type.WeakRef); break;
case "instance":
addConstraint(MDValue.Type.Instance);
if(l.type == Token.LParen)
{
l.next();
objTypes ~= parseExpression();
l.expect(Token.RParen);
}
else if(l.type == Token.Ident)
{
auto tt = l.expect(Token.Ident);
if(l.type == Token.Dot)
{
addConstraint(MDValue.Type.Instance);
objTypes ~= parseIdentList(tt);
}
else
{
addConstraint(MDValue.Type.Instance);
objTypes ~= new(c) IdentExp(c, new(c) Identifier(c, tt.loc, tt.stringValue));
}
}
else if(l.type != Token.Or && l.type != Token.Comma && l.type != Token.RParen)
l.expected("class type");
break;
default:
addConstraint(MDValue.Type.Instance);
objTypes ~= new(c) IdentExp(c, new(c) Identifier(c, t.loc, t.stringValue));
break;
}
}
break;
}
}
if(l.type == Token.Not)
{
l.next();
l.expect(Token.Null);
ret = TypeMask.NotNull;
}
else if(l.type == Token.Ident && l.tok.stringValue == "any")
{
l.next();
ret = TypeMask.Any;
}
else
{
while(true)
{
parseSingleType();
if(l.type == Token.Or)
l.next;
else
break;
}
}
assert(ret !is 0);
classTypes = objTypes.toArray();
return ret;
}
/**
Parse a simple function declaration. This is basically a function declaration without
any preceding 'local' or 'global'. The function must have a name.
*/
public FuncDef parseSimpleFuncDef()
{
auto location = l.expect(Token.Function).loc;
auto name = parseIdentifier();
return parseFuncBody(location, name);
}
/**
Parse a function literal. The name is optional, and one will be autogenerated for the
function if none exists.
*/
public FuncDef parseFuncLiteral()
{
auto location = l.expect(Token.Function).loc;
Identifier name;
if(l.type == Token.Ident)
name = parseIdentifier();
else
name = dummyFuncLiteralName(location);
return parseFuncBody(location, name);
}
/**
Parse a Haskell-style function literal, like "\f -> f + 1" or "\a, b { ... }".
*/
public FuncDef parseHaskellFuncLiteral()
{
auto location = l.expect(Token.Backslash).loc;
auto name = dummyFuncLiteralName(location);
bool isVararg;
auto params = parseFuncParams(isVararg);
scope(failure)
c.alloc.freeArray(params);
Statement code;
if(l.type == Token.Arrow)
{
l.next();
scope dummy = new List!(Expression)(c.alloc);
dummy ~= parseExpression();
auto arr = dummy.toArray();
code = new(c) ReturnStmt(c, arr[0].location, arr[0].endLocation, arr);
}
else
code = parseBlockStmt();
return new(c) FuncDef(c, location, name, params, isVararg, code);
}
/**
Parse a class declaration, optional protection included.
*/
public ClassDecl parseClassDecl(Decorator deco)
{
auto location = l.loc;
auto protection = Protection.Default;
if(l.type == Token.Global)
{
protection = Protection.Global;
l.next();
}
else if(l.type == Token.Local)
{
protection = Protection.Local;
l.next();
}
auto def = parseClassDef(false);
return new(c) ClassDecl(c, location, protection, def, deco);
}
/**
Parse a class definition.
Params:
nameOptional = If true, the name is optional (such as with class literal expressions).
Otherwise, the name is required (such as with class declarations).
Returns:
An instance of ClassDef.
*/
public ClassDef parseClassDef(bool nameOptional)
{
auto location = l.expect(Token.Class).loc;
Identifier name;
if(nameOptional)
{
if(l.type == Token.Ident)
name = parseIdentifier();
else
name = dummyClassLiteralName(location);
}
else
name = parseIdentifier();
Expression baseClass;
if(l.type == Token.Colon)
{
l.next();
baseClass = parseExpression();
}
else
baseClass = new(c) IdentExp(c, new(c) Identifier(c, l.loc, c.newString("Object")));
l.expect(Token.LBrace);
auto fieldMap = newTable(c.thread);
scope(exit)
pop(c.thread);
alias ClassDef.Field Field;
scope fields = new List!(Field)(c.alloc);
void addField(Identifier name, Expression v)
{
pushString(c.thread, name.name);
if(opin(c.thread, -1, fieldMap))
{
pop(c.thread);
c.exception(name.location, "Redeclaration of field '{}'", name.name);
}
pushBool(c.thread, true);
idxa(c.thread, fieldMap);
fields ~= Field(name.name, v);
}
void addMethod(FuncDef m)
{
addField(m.name, new(c) FuncLiteralExp(c, m.location, m));
}
while(l.type != Token.RBrace)
{
switch(l.type)
{
case Token.Function:
addMethod(parseSimpleFuncDef());
break;
case Token.This:
auto loc = l.expect(Token.This).loc;
addMethod(parseFuncBody(loc, new(c) Identifier(c, loc, c.newString("constructor"))));
break;
case Token.At:
auto dec = parseDecorators();
Identifier fieldName = void;
Expression init = void;
if(l.type == Token.Function || l.type == Token.This)
{
FuncDef fd = void;
if(l.type == Token.Function)
fd = parseSimpleFuncDef();
else
{
auto loc = l.expect(Token.This).loc;
fd = parseFuncBody(loc, new(c) Identifier(c, loc, c.newString("constructor")));
}
fieldName = fd.name;
init = new(c) FuncLiteralExp(c, fd.location, fd);
}
else
{
fieldName = parseIdentifier();
if(l.type == Token.Assign)
{
l.next();
init = parseExpression();
}
else
init = new(c) NullExp(c, fieldName.location);
l.statementTerm();
}
scope args = new List!(Expression)(c.alloc);
args ~= init;
args ~= dec.args;
Expression call;
if(auto f = dec.func.as!(DotExp))
call = new(c) MethodCallExp(c, dec.location, dec.endLocation, f.op, f.name, dec.context, args.toArray(), false);
else
call = new(c) CallExp(c, dec.endLocation, dec.func, dec.context, args.toArray());
addField(fieldName, call);
break;
case Token.Ident:
auto id = parseIdentifier();
Expression v;
if(l.type == Token.Assign)
{
l.next();
v = parseExpression();
}
else
v = new(c) NullExp(c, id.location);
l.statementTerm();
addField(id, v);
break;
case Token.EOF:
c.eofException(location, "Class is missing its closing brace");
default:
l.expected("Class method or field");
}
}
auto endLocation = l.expect(Token.RBrace).loc;
return new(c) ClassDef(c, location, endLocation, name, baseClass, fields.toArray());
}
/**
Parse a namespace declaration, optional protection included.
*/
public NamespaceDecl parseNamespaceDecl(Decorator deco)
{
auto location = l.loc;
auto protection = Protection.Default;
if(l.type == Token.Global)
{
protection = Protection.Global;
l.next();
}
else if(l.type == Token.Local)
{
protection = Protection.Local;
l.next();
}
auto def = parseNamespaceDef();
return new(c) NamespaceDecl(c, location, protection, def, deco);
}
/**
Parse a namespace. Both literals and declarations require a name.
Returns:
An instance of this class.
*/
public NamespaceDef parseNamespaceDef()
{
auto location = l.loc;
l.expect(Token.Namespace);
auto name = parseIdentifier();
Expression parent;
if(l.type == Token.Colon)
{
l.next();
parent = parseExpression();
}
l.expect(Token.LBrace);
auto fieldMap = newTable(c.thread);
scope(exit)
pop(c.thread);
alias NamespaceDef.Field Field;
scope fields = new List!(Field)(c.alloc);
void addField(string name, Expression v)
{
pushString(c.thread, name);
if(opin(c.thread, -1, fieldMap))
{
pop(c.thread);
c.exception(v.location, "Redeclaration of member '{}'", name);
}
pushBool(c.thread, true);
idxa(c.thread, fieldMap);
fields ~= Field(name, v);
}
while(l.type != Token.RBrace)
{
switch(l.type)
{
case Token.Function:
auto fd = parseSimpleFuncDef();
addField(fd.name.name, new(c) FuncLiteralExp(c, fd.location, fd));
break;
case Token.At:
auto dec = parseDecorators();
Identifier fieldName = void;
Expression init = void;
if(l.type == Token.Function)
{
auto fd = parseSimpleFuncDef();
fieldName = fd.name;
init = new(c) FuncLiteralExp(c, fd.location, fd);
}
else
{
fieldName = parseIdentifier();
if(l.type == Token.Assign)
{
l.next();
init = parseExpression();
}
else
init = new(c) NullExp(c, fieldName.location);
l.statementTerm();
}
scope args = new List!(Expression)(c.alloc);
args ~= init;
args ~= dec.args;
Expression call;
if(auto f = dec.func.as!(DotExp))
call = new(c) MethodCallExp(c, dec.location, dec.endLocation, f.op, f.name, dec.context, args.toArray(), false);
else
call = new(c) CallExp(c, dec.endLocation, dec.func, dec.context, args.toArray());
addField(fieldName.name, call);
break;
case Token.Ident:
auto loc = l.loc;
auto fieldName = parseName();
Expression v;
if(l.type == Token.Assign)
{
l.next();
v = parseExpression();
}
else
v = new(c) NullExp(c, loc);
l.statementTerm();
addField(fieldName, v);
break;
case Token.EOF:
c.eofException(location, "Namespace is missing its closing brace");
default:
l.expected("Namespace member");
}
}
auto endLocation = l.expect(Token.RBrace).loc;
return new(c) NamespaceDef(c, location, endLocation, name, parent, fields.toArray());
}
/**
*/
public BlockStmt parseBlockStmt()
{
auto location = l.expect(Token.LBrace).loc;
scope statements = new List!(Statement)(c.alloc);
while(l.type != Token.RBrace)
statements ~= parseStatement();
auto endLocation = l.expect(Token.RBrace).loc;
return new(c) BlockStmt(c, location, endLocation, statements.toArray());
}
/**
*/
public AssertStmt parseAssertStmt()
{
auto location = l.expect(Token.Assert).loc;
l.expect(Token.LParen);
auto cond = parseExpression();
Expression msg;
if(l.type == Token.Comma)
{
l.next();
msg = parseExpression();
}
auto endLocation = l.expect(Token.RParen).loc;
l.statementTerm();
return new(c) AssertStmt(c, location, endLocation, cond, msg);
}
/**
*/
public BreakStmt parseBreakStmt()
{
auto location = l.expect(Token.Break).loc;
l.statementTerm();
return new(c) BreakStmt(c, location);
}
/**
*/
public ContinueStmt parseContinueStmt()
{
auto location = l.expect(Token.Continue).loc;
l.statementTerm();
return new(c) ContinueStmt(c, location);
}
/**
*/
public DoWhileStmt parseDoWhileStmt()
{
auto location = l.expect(Token.Do).loc;
auto doBody = parseStatement(false);
l.expect(Token.While);
l.expect(Token.LParen);
auto condition = parseExpression();
auto endLocation = l.expect(Token.RParen).loc;
return new(c) DoWhileStmt(c, location, endLocation, doBody, condition);
}
/**
This function will actually parse both C-style and numeric for loops. The return value
can be either one.
*/
public Statement parseForStmt()
{
auto location = l.expect(Token.For).loc;
l.expect(Token.LParen);
alias ForStmt.Init Init;
scope init = new List!(Init)(c.alloc);
void parseInitializer()
{
Init tmp = void;
if(l.type == Token.Local)
{
tmp.isDecl = true;
tmp.decl = parseVarDecl();
}
else
{
tmp.isDecl = false;
tmp.stmt = parseStatementExpr();
}
init ~= tmp;
}
if(l.type == Token.Semicolon)
l.next();
else if(l.type == Token.Ident && (l.peek.type == Token.Colon || l.peek.type == Token.Semicolon))
{
auto index = parseIdentifier();
l.next();
auto lo = parseExpression();
l.expect(Token.DotDot);
auto hi = parseExpression();
Expression step;
if(l.type == Token.Comma)
{
l.next();
step = parseExpression();
}
else
step = new(c) IntExp(c, l.loc, 1);
l.expect(Token.RParen);
auto code = parseStatement();
return new(c) ForNumStmt(c, location, index, lo, hi, step, code);
}
else
{
parseInitializer();
while(l.type == Token.Comma)
{
l.next();
parseInitializer();
}
l.expect(Token.Semicolon);
}
Expression condition;
if(l.type == Token.Semicolon)
l.next();
else
{
condition = parseExpression();
l.expect(Token.Semicolon);
}
scope increment = new List!(Statement)(c.alloc);
if(l.type == Token.RParen)
l.next();
else
{
increment ~= parseStatementExpr();
while(l.type == Token.Comma)
{
l.next();
increment ~= parseStatementExpr();
}
l.expect(Token.RParen);
}
auto code = parseStatement(false);
return new(c) ForStmt(c, location, init.toArray(), condition, increment.toArray(), code);
}
/**
*/
public ForeachStmt parseForeachStmt()
{
auto location = l.expect(Token.Foreach).loc;
l.expect(Token.LParen);
scope indices = new List!(Identifier)(c.alloc);
indices ~= parseIdentifier();
while(l.type == Token.Comma)
{
l.next();
indices ~= parseIdentifier();
}
Identifier[] indicesArr;
if(indices.length == 1)
{
indices ~= cast(Identifier)null;
indicesArr = indices.toArray();
for(uword i = indicesArr.length - 1; i > 0; i--)
indicesArr[i] = indicesArr[i - 1];
indicesArr[0] = dummyForeachIndex(indicesArr[1].location);
}
else
indicesArr = indices.toArray();
scope(failure)
c.alloc.freeArray(indicesArr);
l.expect(Token.Semicolon);
scope container = new List!(Expression)(c.alloc);
container ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
container ~= parseExpression();
}
if(container.length > 3)
c.exception(location, "'foreach' may have a maximum of three container expressions");
l.expect(Token.RParen);
auto code = parseStatement();
return new(c) ForeachStmt(c, location, indicesArr, container.toArray(), code);
}
/**
*/
public IfStmt parseIfStmt()
{
auto location = l.expect(Token.If).loc;
l.expect(Token.LParen);
IdentExp condVar;
if(l.type == Token.Local)
{
l.next();
condVar = parseIdentExp();
l.expect(Token.Assign);
}
auto condition = parseExpression();
l.expect(Token.RParen);
auto ifBody = parseStatement();
Statement elseBody;
auto endLocation = ifBody.endLocation;
if(l.type == Token.Else)
{
l.next();
elseBody = parseStatement();
endLocation = elseBody.endLocation;
}
return new(c) IfStmt(c, location, endLocation, condVar, condition, ifBody, elseBody);
}
/**
Parse an import statement.
*/
public ImportStmt parseImportStmt()
{
auto location = l.loc;
l.expect(Token.Import);
Identifier importName;
Expression expr;
if(l.type == Token.Ident && l.peek.type == Token.Assign)
{
importName = parseIdentifier();
l.next();
}
if(l.type == Token.LParen)
{
l.next();
expr = parseExpression();
l.expect(Token.RParen);
}
else
{
scope name = new List!(char)(c.alloc);
name ~= cast(char[])parseName();
while(l.type == Token.Dot)
{
l.next();
name ~= cast(char[])".";
name ~= cast(char[])parseName();
}
auto arr = name.toArray();
expr = new(c) StringExp(c, location, c.newString(cast(string)arr));
c.alloc.freeArray(arr);
}
scope symbols = new List!(Identifier)(c.alloc);
scope symbolNames = new List!(Identifier)(c.alloc);
void parseSelectiveImport()
{
auto id = parseIdentifier();
if(l.type == Token.Assign)
{
l.next();
symbolNames ~= id;
symbols ~= parseIdentifier();
}
else
{
symbolNames ~= id;
symbols ~= id;
}
}
if(l.type == Token.Colon)
{
l.next();
parseSelectiveImport();
while(l.type == Token.Comma)
{
l.next();
parseSelectiveImport();
}
}
auto endLocation = l.loc;
l.statementTerm();
return new(c) ImportStmt(c, location, endLocation, importName, expr, symbols.toArray(), symbolNames.toArray());
}
/**
*/
public ReturnStmt parseReturnStmt()
{
auto location = l.expect(Token.Return).loc;
if(l.isStatementTerm())
{
auto endLocation = l.loc;
l.statementTerm();
return new(c) ReturnStmt(c, location, endLocation, null);
}
else
{
assert(l.loc.line == location.line);
scope exprs = new List!(Expression)(c.alloc);
exprs ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
exprs ~= parseExpression();
}
auto arr = exprs.toArray();
auto endLocation = arr[$ - 1].endLocation;
scope(failure)
c.alloc.freeArray(arr);
l.statementTerm();
return new(c) ReturnStmt(c, location, endLocation, arr);
}
}
/**
*/
public SwitchStmt parseSwitchStmt()
{
auto location = l.expect(Token.Switch).loc;
l.expect(Token.LParen);
auto condition = parseExpression();
l.expect(Token.RParen);
l.expect(Token.LBrace);
scope cases = new List!(CaseStmt)(c.alloc);
cases ~= parseCaseStmt();
while(l.type == Token.Case)
cases ~= parseCaseStmt();
DefaultStmt caseDefault;
if(l.type == Token.Default)
caseDefault = parseDefaultStmt();
auto endLocation = l.expect(Token.RBrace).loc;
return new(c) SwitchStmt(c, location, endLocation, condition, cases.toArray(), caseDefault);
}
/**
*/
public CaseStmt parseCaseStmt()
{
auto location = l.expect(Token.Case).loc;
alias CaseStmt.CaseCond CaseCond;
scope conditions = new List!(CaseCond)(c.alloc);
conditions ~= CaseCond(parseExpression());
Expression highRange;
if(l.type == Token.DotDot)
{
l.next();
highRange = parseExpression();
}
else while(l.type == Token.Comma)
{
l.next();
conditions ~= CaseCond(parseExpression());
}
l.expect(Token.Colon);
scope statements = new List!(Statement)(c.alloc);
while(l.type != Token.Case && l.type != Token.Default && l.type != Token.RBrace)
statements ~= parseStatement();
auto endLocation = l.loc;
auto code = new(c) ScopeStmt(c, new(c) BlockStmt(c, location, endLocation, statements.toArray()));
return new(c) CaseStmt(c, location, endLocation, conditions.toArray(), highRange, code);
}
/**
*/
public DefaultStmt parseDefaultStmt()
{
auto location = l.loc;
l.expect(Token.Default);
l.expect(Token.Colon);
scope statements = new List!(Statement)(c.alloc);
while(l.type != Token.RBrace)
statements ~= parseStatement();
auto endLocation = l.loc;
auto code = new(c) ScopeStmt(c, new(c) BlockStmt(c, location, endLocation, statements.toArray()));
return new(c) DefaultStmt(c, location, endLocation, code);
}
/**
*/
public ThrowStmt parseThrowStmt()
{
auto location = l.expect(Token.Throw).loc;
auto exp = parseExpression();
l.statementTerm();
return new(c) ThrowStmt(c, location, exp);
}
/**
*/
public ScopeActionStmt parseScopeActionStmt()
{
auto location = l.expect(Token.Scope).loc;
l.expect(Token.LParen);
auto id = l.expect(Token.Ident);
ubyte type = void;
if(id.stringValue == "exit")
type = ScopeActionStmt.Exit;
else if(id.stringValue == "success")
type = ScopeActionStmt.Success;
else if(id.stringValue == "failure")
type = ScopeActionStmt.Failure;
else
c.exception(location, "Expected one of 'exit', 'success', or 'failure' for scope statement, not '{}'", id.stringValue);
l.expect(Token.RParen);
auto stmt = parseStatement();
return new(c) ScopeActionStmt(c, location, type, stmt);
}
/**
*/
public TryStmt parseTryStmt()
{
auto location = l.expect(Token.Try).loc;
auto tryBodyStmt = parseStatement();
auto tryBody = new(c) ScopeStmt(c, tryBodyStmt);
Identifier catchVar;
Statement catchBody;
CompileLoc endLocation;
if(l.type == Token.Catch)
{
l.next();
l.expect(Token.LParen);
catchVar = parseIdentifier();
l.expect(Token.RParen);
auto catchBodyStmt = parseStatement();
catchBody = new(c) ScopeStmt(c, catchBodyStmt);
endLocation = catchBody.endLocation;
}
Statement finallyBody;
if(l.type == Token.Finally)
{
l.next();
auto finallyBodyStmt = parseStatement();
finallyBody = new(c) ScopeStmt(c, finallyBodyStmt);
endLocation = finallyBody.endLocation;
}
if(catchBody is null && finallyBody is null)
c.eofException(location, "Try statement must be followed by a catch, finally, or both");
return new(c) TryStmt(c, location, endLocation, tryBody, catchVar, catchBody, finallyBody);
}
/**
*/
public WhileStmt parseWhileStmt()
{
auto location = l.expect(Token.While).loc;
l.expect(Token.LParen);
IdentExp condVar;
if(l.type == Token.Local)
{
l.next();
condVar = parseIdentExp();
l.expect(Token.Assign);
}
auto condition = parseExpression();
l.expect(Token.RParen);
auto code = parseStatement(false);
return new(c) WhileStmt(c, location, condVar, condition, code);
}
/**
Parse any expression which can be executed as a statement, i.e. any expression which
can have side effects, as well as assignments, function calls, yields, ?:, &&, and ||
expressions. The parsed expression is checked for side effects before being returned.
*/
public Statement parseStatementExpr()
{
auto location = l.loc;
if(l.type == Token.Inc)
{
l.next();
auto exp = parsePrimaryExp();
return new(c) IncStmt(c, location, location, exp);
}
else if(l.type == Token.Dec)
{
l.next();
auto exp = parsePrimaryExp();
return new(c) DecStmt(c, location, location, exp);
}
Expression exp;
if(l.type == Token.Length)
exp = parseUnExp();
else
exp = parsePrimaryExp();
if(l.tok.isOpAssign())
return parseOpAssignStmt(exp);
else if(l.type == Token.Assign || l.type == Token.Comma)
return parseAssignStmt(exp);
else if(l.type == Token.Inc)
{
l.next();
return new(c) IncStmt(c, location, location, exp);
}
else if(l.type == Token.Dec)
{
l.next();
return new(c) DecStmt(c, location, location, exp);
}
else if(l.type == Token.OrOr)
exp = parseOrOrExp(exp);
else if(l.type == Token.AndAnd)
exp = parseAndAndExp(exp);
else if(l.type == Token.Question)
exp = parseCondExp(exp);
exp.checkToNothing(c);
return new(c) ExpressionStmt(c, exp);
}
/**
Parse an assignment.
Params:
firstLHS = Since you can't tell if you're on an assignment until you parse
at least one item in the left-hand-side, this parameter should be the first
item on the left-hand-side. Therefore this function parses everything $(I but)
the first item on the left-hand-side.
*/
public AssignStmt parseAssignStmt(Expression firstLHS)
{
auto location = l.loc;
scope lhs = new List!(Expression)(c.alloc);
lhs ~= firstLHS;
while(l.type == Token.Comma)
{
l.next();
if(l.type == Token.Length)
lhs ~= parseUnExp();
else
lhs ~= parsePrimaryExp();
}
l.expect(Token.Assign);
scope rhs = new List!(Expression)(c.alloc);
rhs ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
rhs ~= parseExpression();
}
auto rhsArr = rhs.toArray();
return new(c) AssignStmt(c, location, rhsArr[$ - 1].endLocation, lhs.toArray(), rhsArr);
}
/**
Parse a reflexive assignment.
Params:
exp1 = The left-hand-side of the assignment. As with normal assignments, since
you can't actually tell that something is an assignment until the LHS is
at least parsed, this has to be passed as a parameter.
*/
public Statement parseOpAssignStmt(Expression exp1)
{
auto location = l.loc;
static string makeCase(string tok, string type)
{
return
"case Token." ~ tok ~ ":"
"l.next();"
"auto exp2 = parseExpression();"
"return new(c) " ~ type ~ "(c, location, exp2.endLocation, exp1, exp2);";
}
mixin(
"switch(l.type)"
"{"
~ makeCase("AddEq", "AddAssignStmt")
~ makeCase("SubEq", "SubAssignStmt")
~ makeCase("CatEq", "CatAssignStmt")
~ makeCase("MulEq", "MulAssignStmt")
~ makeCase("DivEq", "DivAssignStmt")
~ makeCase("ModEq", "ModAssignStmt")
~ makeCase("ShlEq", "ShlAssignStmt")
~ makeCase("ShrEq", "ShrAssignStmt")
~ makeCase("UShrEq", "UShrAssignStmt")
~ makeCase("XorEq", "XorAssignStmt")
~ makeCase("OrEq", "OrAssignStmt")
~ makeCase("AndEq", "AndAssignStmt")
~ makeCase("DefaultEq", "CondAssignStmt") ~
"default: assert(false, \"OpEqExp parse switch\");"
"}");
}
/**
Parse an expression.
*/
public Expression parseExpression()
{
return parseCondExp();
}
/**
Parse a conditional (?:) expression.
Params:
exp1 = Conditional expressions can occur as statements, in which case the first
expression must be parsed in order to see what kind of expression it is.
In this case, the first expression is passed in as a parameter. Otherwise,
it defaults to null and this function parses the first expression itself.
*/
public Expression parseCondExp(Expression exp1 = null)
{
auto location = l.loc;
Expression exp2;
Expression exp3;
if(exp1 is null)
exp1 = parseOrOrExp();
while(l.type == Token.Question)
{
l.next();
exp2 = parseExpression();
l.expect(Token.Colon);
exp3 = parseCondExp();
exp1 = new(c) CondExp(c, location, exp3.endLocation, exp1, exp2, exp3);
location = l.loc;
}
return exp1;
}
/**
Parse a logical or (||) expression.
Params:
exp1 = Or-or expressions can occur as statements, in which case the first
expression must be parsed in order to see what kind of expression it is.
In this case, the first expression is passed in as a parameter. Otherwise,
it defaults to null and this function parses the first expression itself.
*/
public Expression parseOrOrExp(Expression exp1 = null)
{
auto location = l.loc;
Expression exp2;
if(exp1 is null)
exp1 = parseAndAndExp();
while(l.type == Token.OrOr)
{
l.next();
exp2 = parseAndAndExp();
exp1 = new(c) OrOrExp(c, location, exp2.endLocation, exp1, exp2);
location = l.loc;
}
return exp1;
}
/**
Parse a logical and (&&) expression.
Params:
exp1 = And-and expressions can occur as statements, in which case the first
expression must be parsed in order to see what kind of expression it is.
In this case, the first expression is passed in as a parameter. Otherwise,
it defaults to null and this function parses the first expression itself.
*/
public Expression parseAndAndExp(Expression exp1 = null)
{
auto location = l.loc;
Expression exp2;
if(exp1 is null)
exp1 = parseOrExp();
while(l.type == Token.AndAnd)
{
l.next();
exp2 = parseOrExp();
exp1 = new(c) AndAndExp(c, location, exp2.endLocation, exp1, exp2);
location = l.loc;
}
return exp1;
}
/**
*/
public Expression parseOrExp()
{
auto location = l.loc;
Expression exp1;
Expression exp2;
exp1 = parseXorExp();
while(l.type == Token.Or)
{
l.next();
exp2 = parseXorExp();
exp1 = new(c) OrExp(c, location, exp2.endLocation, exp1, exp2);
location = l.loc;
}
return exp1;
}
/**
*/
public Expression parseXorExp()
{
auto location = l.loc;
Expression exp1;
Expression exp2;
exp1 = parseAndExp();
while(l.type == Token.Xor)
{
l.next();
exp2 = parseAndExp();
exp1 = new(c) XorExp(c, location, exp2.endLocation, exp1, exp2);
location = l.loc;
}
return exp1;
}
/**
*/
public Expression parseAndExp()
{
CompileLoc location = l.loc;
Expression exp1;
Expression exp2;
exp1 = parseCmpExp();
while(l.type == Token.And)
{
l.next();
exp2 = parseCmpExp();
exp1 = new(c) AndExp(c, location, exp2.endLocation, exp1, exp2);
location = l.loc;
}
return exp1;
}
/**
Parse a comparison expression. This is any of ==, !=, is, !is, <, <=, >, >=,
<=>, as, in, and !in.
*/
public Expression parseCmpExp()
{
auto location = l.loc;
auto exp1 = parseShiftExp();
Expression exp2;
switch(l.type)
{
case Token.EQ:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) EqualExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.NE:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) NotEqualExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.Not:
if(l.peek.type == Token.Is)
{
l.next();
l.next();
exp2 = parseShiftExp();
exp1 = new(c) NotIsExp(c, location, exp2.endLocation, exp1, exp2);
}
else if(l.peek.type == Token.In)
{
l.next();
l.next();
exp2 = parseShiftExp();
exp1 = new(c) NotInExp(c, location, exp2.endLocation, exp1, exp2);
}
// no, there should not be an 'else' here
break;
case Token.Is:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) IsExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.LT:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) LTExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.LE:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) LEExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.GT:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) GTExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.GE:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) GEExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.As:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) AsExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.In:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) InExp(c, location, exp2.endLocation, exp1, exp2);
break;
case Token.Cmp3:
l.next();
exp2 = parseShiftExp();
exp1 = new(c) Cmp3Exp(c, location, exp2.endLocation, exp1, exp2);
break;
default:
break;
}
return exp1;
}
/**
*/
public Expression parseShiftExp()
{
auto location = l.loc;
auto exp1 = parseAddExp();
Expression exp2;
while(true)
{
switch(l.type)
{
case Token.Shl:
l.next();
exp2 = parseAddExp();
exp1 = new(c) ShlExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.Shr:
l.next();
exp2 = parseAddExp();
exp1 = new(c) ShrExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.UShr:
l.next();
exp2 = parseAddExp();
exp1 = new(c) UShrExp(c, location, exp2.endLocation, exp1, exp2);
continue;
default:
break;
}
break;
}
return exp1;
}
/**
This function parses not only addition and subtraction expressions, but also
concatenation expressions.
*/
public Expression parseAddExp()
{
auto location = l.loc;
auto exp1 = parseMulExp();
Expression exp2;
while(true)
{
switch(l.type)
{
case Token.Add:
l.next();
exp2 = parseMulExp();
exp1 = new(c) AddExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.Sub:
l.next();
exp2 = parseMulExp();
exp1 = new(c) SubExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.Cat:
l.next();
exp2 = parseMulExp();
exp1 = new(c) CatExp(c, location, exp2.endLocation, exp1, exp2);
continue;
default:
break;
}
break;
}
return exp1;
}
/**
*/
public Expression parseMulExp()
{
auto location = l.loc;
auto exp1 = parseUnExp();
Expression exp2;
while(true)
{
switch(l.type)
{
case Token.Mul:
l.next();
exp2 = parseUnExp();
exp1 = new(c) MulExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.Div:
l.next();
exp2 = parseUnExp();
exp1 = new(c) DivExp(c, location, exp2.endLocation, exp1, exp2);
continue;
case Token.Mod:
l.next();
exp2 = parseUnExp();
exp1 = new(c) ModExp(c, location, exp2.endLocation, exp1, exp2);
continue;
default:
break;
}
break;
}
return exp1;
}
/**
Parse a unary expression. This parses negation (-), not (!), complement (~),
length (#), and coroutine expressions. '#vararg' is also incidentally parsed.
*/
public Expression parseUnExp()
{
auto location = l.loc;
Expression exp;
switch(l.type)
{
case Token.Sub:
l.next();
exp = parseUnExp();
exp = new(c) NegExp(c, location, exp);
break;
case Token.Not:
l.next();
exp = parseUnExp();
exp = new(c) NotExp(c, location, exp);
break;
case Token.Cat:
l.next();
exp = parseUnExp();
exp = new(c) ComExp(c, location, exp);
break;
case Token.Length:
l.next();
exp = parseUnExp();
if(exp.as!(VarargExp))
exp = new(c) VargLenExp(c, location, exp.endLocation);
else
exp = new(c) LenExp(c, location, exp);
break;
case Token.Coroutine:
l.next();
exp = parseUnExp();
exp = new(c) CoroutineExp(c, exp.endLocation, exp);
break;
default:
exp = parsePrimaryExp();
break;
}
return exp;
}
/**
Parse a primary expression. Will also parse any postfix expressions attached
to the primary exps.
*/
public Expression parsePrimaryExp()
{
Expression exp;
auto location = l.loc;
switch(l.type)
{
case Token.Ident: exp = parseIdentExp(); break;
case Token.This: exp = parseThisExp(); break;
case Token.Null: exp = parseNullExp(); break;
case Token.True, Token.False: exp = parseBoolExp(); break;
case Token.Vararg: exp = parseVarargExp(); break;
case Token.CharLiteral: exp = parseCharExp(); break;
case Token.IntLiteral: exp = parseIntExp(); break;
case Token.FloatLiteral: exp = parseFloatExp(); break;
case Token.StringLiteral: exp = parseStringExp(); break;
case Token.Function: exp = parseFuncLiteralExp(); break;
case Token.Backslash: exp = parseHaskellFuncLiteralExp(); break;
case Token.Class: exp = parseClassLiteralExp(); break;
case Token.LParen: exp = parseParenExp(); break;
case Token.LBrace: exp = parseTableCtorExp(); break;
case Token.LBracket: exp = parseArrayCtorExp(); break;
case Token.Namespace: exp = parseNamespaceCtorExp(); break;
case Token.Yield: exp = parseYieldExp(); break;
case Token.Super: exp = parseSuperCallExp(); break;
case Token.Colon: exp = parseMemberExp(); break;
default:
l.expected("Expression");
}
return parsePostfixExp(exp);
}
/**
*/
public IdentExp parseIdentExp()
{
auto id = parseIdentifier();
return new(c) IdentExp(c, id);
}
/**
*/
public ThisExp parseThisExp()
{
auto tmp = l.expect(Token.This);
return new(c) ThisExp(c, tmp.loc);
}
/**
*/
public NullExp parseNullExp()
{
auto tmp = l.expect(Token.Null);
return new(c) NullExp(c, tmp.loc);
}
/**
*/
public BoolExp parseBoolExp()
{
auto loc = l.loc;
if(l.type == Token.True)
{
l.expect(Token.True);
return new(c) BoolExp(c, loc, true);
}
else
{
l.expect(Token.False);
return new(c) BoolExp(c, loc, false);
}
}
/**
*/
public VarargExp parseVarargExp()
{
auto tmp = l.expect(Token.Vararg);
return new(c) VarargExp(c, tmp.loc);
}
/**
*/
public CharExp parseCharExp()
{
auto tmp = l.expect(Token.CharLiteral);
return new(c) CharExp(c, tmp.loc, cast(dchar)tmp.intValue);
}
/**
*/
public IntExp parseIntExp()
{
auto tmp = l.expect(Token.IntLiteral);
return new(c) IntExp(c, tmp.loc, tmp.intValue);
}
/**
*/
public FloatExp parseFloatExp()
{
auto tmp = l.expect(Token.FloatLiteral);
return new(c) FloatExp(c, tmp.loc, tmp.floatValue);
}
/**
*/
public StringExp parseStringExp()
{
auto tmp = l.expect(Token.StringLiteral);
return new(c) StringExp(c, tmp.loc, tmp.stringValue);
}
/**
*/
public FuncLiteralExp parseFuncLiteralExp()
{
auto location = l.loc;
auto def = parseFuncLiteral();
return new(c) FuncLiteralExp(c, location, def);
}
/**
*/
public FuncLiteralExp parseHaskellFuncLiteralExp()
{
auto location = l.loc;
auto def = parseHaskellFuncLiteral();
return new(c) FuncLiteralExp(c, location, def);
}
/**
*/
public ClassLiteralExp parseClassLiteralExp()
{
auto location = l.loc;
auto def = parseClassDef(true);
return new(c) ClassLiteralExp(c, location, def);
}
/**
Parse a parenthesized expression.
*/
public Expression parseParenExp()
{
auto location = l.expect(Token.LParen).loc;
auto exp = parseExpression();
auto endLocation = l.expect(Token.RParen).loc;
return new(c) ParenExp(c, location, endLocation, exp);
}
/**
*/
public Expression parseTableCtorExp()
{
auto location = l.expect(Token.LBrace).loc;
alias TableCtorExp.Field Field;
scope fields = new List!(Field)(c.alloc);
if(l.type != Token.RBrace)
{
void parseField()
{
Expression k;
Expression v;
switch(l.type)
{
case Token.LBracket:
l.next();
k = parseExpression();
l.expect(Token.RBracket);
l.expect(Token.Assign);
v = parseExpression();
break;
case Token.Function:
auto fd = parseSimpleFuncDef();
k = new(c) StringExp(c, fd.location, fd.name.name);
v = new(c) FuncLiteralExp(c, fd.location, fd);
break;
default:
Identifier id = parseIdentifier();
l.expect(Token.Assign);
k = new(c) StringExp(c, id.location, id.name);
v = parseExpression();
break;
}
fields ~= Field(k, v);
}
bool firstWasBracketed = l.type == Token.LBracket;
parseField();
if(firstWasBracketed && l.type == Token.For)
{
auto forComp = parseForComprehension();
auto endLocation = l.expect(Token.RBrace).loc;
auto dummy = fields.toArray();
auto key = dummy[0].key;
auto value = dummy[0].value;
c.alloc.freeArray(dummy);
return new(c) TableComprehension(c, location, endLocation, key, value, forComp);
}
if(l.type == Token.Comma)
l.next();
while(l.type != Token.RBrace)
{
parseField();
if(l.type == Token.Comma)
l.next();
}
}
auto endLocation = l.expect(Token.RBrace).loc;
return new(c) TableCtorExp(c, location, endLocation, fields.toArray());
}
/**
*/
public PrimaryExp parseArrayCtorExp()
{
auto location = l.expect(Token.LBracket).loc;
scope values = new List!(Expression)(c.alloc);
if(l.type != Token.RBracket)
{
auto exp = parseExpression();
if(l.type == Token.For)
{
auto forComp = parseForComprehension();
auto endLocation = l.expect(Token.RBracket).loc;
return new(c) ArrayComprehension(c, location, endLocation, exp, forComp);
}
else
{
values ~= exp;
if(l.type == Token.Comma)
l.next();
while(l.type != Token.RBracket)
{
values ~= parseExpression();
if(l.type == Token.Comma)
l.next();
}
}
}
auto endLocation = l.expect(Token.RBracket).loc;
return new(c) ArrayCtorExp(c, location, endLocation, values.toArray());
}
/**
*/
public NamespaceCtorExp parseNamespaceCtorExp()
{
auto location = l.loc;
auto def = parseNamespaceDef();
return new(c) NamespaceCtorExp(c, location, def);
}
/**
*/
public YieldExp parseYieldExp()
{
auto location = l.expect(Token.Yield).loc;
l.expect(Token.LParen);
Expression[] args;
if(l.type != Token.RParen)
args = parseArguments();
auto endLocation = l.expect(Token.RParen).loc;
return new(c) YieldExp(c, location, endLocation, args);
}
/**
*/
public MethodCallExp parseSuperCallExp()
{
auto location = l.expect(Token.Super).loc;
Expression method;
if(l.type == Token.Dot)
{
l.next();
if(l.type == Token.Ident)
{
auto tmp = l.expect(Token.Ident);
method = new(c) StringExp(c, location, tmp.stringValue);
}
else
{
l.expect(Token.LParen);
method = parseExpression();
l.expect(Token.RParen);
}
}
else
method = new(c) StringExp(c, location, c.newString("constructor"));
Expression[] args;
CompileLoc endLocation;
if(l.type == Token.LParen)
{
l.next();
if(l.type != Token.RParen)
args = parseArguments();
endLocation = l.expect(Token.RParen).loc;
}
else
{
l.expect(Token.Dollar);
scope a = new List!(Expression)(c.alloc);
a ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
a ~= parseExpression();
}
args = a.toArray();
endLocation = args[$ - 1].endLocation;
}
return new(c) MethodCallExp(c, location, endLocation, null, method, null, args, true);
}
/**
Parse a member exp (:a). This is a shorthand expression for "this.a". This
also works with super (:super) and paren (:("a")) versions.
*/
public Expression parseMemberExp()
{
auto loc = l.expect(Token.Colon).loc;
CompileLoc endLoc;
if(l.type == Token.LParen)
{
l.next();
auto exp = parseExpression();
endLoc = l.expect(Token.RParen).loc;
return new(c) DotExp(c, new(c) ThisExp(c, loc), exp);
}
else if(l.type == Token.Super)
{
endLoc = l.loc;
l.next();
return new(c) DotSuperExp(c, endLoc, new(c) ThisExp(c, loc));
}
else
{
endLoc = l.loc;
auto name = parseName();
return new(c) DotExp(c, new(c) ThisExp(c, loc), new(c) StringExp(c, endLoc, name));
}
}
/**
Parse a postfix expression. This includes dot expressions (.ident, .super, and .(expr)),
function calls, indexing, slicing, and vararg slicing.
Params:
exp = The expression to which the resulting postfix expression will be attached.
*/
public Expression parsePostfixExp(Expression exp)
{
while(true)
{
auto location = l.loc;
switch(l.type)
{
case Token.Dot:
l.next();
if(l.type == Token.Ident)
{
auto loc = l.loc;
auto name = parseName();
exp = new(c) DotExp(c, exp, new(c) StringExp(c, loc, name));
}
else if(l.type == Token.Super)
{
auto endLocation = l.loc;
l.next();
exp = new(c) DotSuperExp(c, endLocation, exp);
}
else
{
l.expect(Token.LParen);
auto subExp = parseExpression();
l.expect(Token.RParen);
exp = new(c) DotExp(c, exp, subExp);
}
continue;
case Token.Dollar:
l.next();
scope args = new List!(Expression)(c.alloc);
args ~= parseExpression();
while(l.type == Token.Comma)
{
l.next();
args ~= parseExpression();
}
auto arr = args.toArray();
if(auto dot = exp.as!(DotExp))
exp = new(c) MethodCallExp(c, dot.location, arr[$ - 1].endLocation, dot.op, dot.name, null, arr, false);
else
exp = new(c) CallExp(c, arr[$ - 1].endLocation, exp, null, arr);
continue;
case Token.LParen:
if(exp.endLocation.line != l.loc.line)
c.exception(l.loc, "ambiguous left-paren (function call or beginning of new statement?)");
l.next();
Expression context;
Expression[] args;
if(l.type == Token.With)
{
l.next();
context = parseExpression();
if(l.type == Token.Comma)
{
l.next();
args = parseArguments();
}
}
else if(l.type != Token.RParen)
args = parseArguments();
auto endLocation = l.expect(Token.RParen).loc;
if(auto dot = exp.as!(DotExp))
exp = new(c) MethodCallExp(c, dot.location, endLocation, dot.op, dot.name, context, args, false);
else
exp = new(c) CallExp(c, endLocation, exp, context, args);
continue;
case Token.LBracket:
l.next();
Expression loIndex;
Expression hiIndex;
CompileLoc endLocation;
if(l.type == Token.RBracket)
{
// a[]
loIndex = new(c) NullExp(c, l.loc);
hiIndex = new(c) NullExp(c, l.loc);
endLocation = l.expect(Token.RBracket).loc;
}
else if(l.type == Token.DotDot)
{
loIndex = new(c) NullExp(c, l.loc);
l.next();
if(l.type == Token.RBracket)
{
// a[ .. ]
hiIndex = new(c) NullExp(c, l.loc);
endLocation = l.expect(Token.RBracket).loc;
}
else
{
// a[ .. 0]
hiIndex = parseExpression();
endLocation = l.expect(Token.RBracket).loc;
}
}
else
{
loIndex = parseExpression();
if(l.type == Token.DotDot)
{
l.next();
if(l.type == Token.RBracket)
{
// a[0 .. ]
hiIndex = new(c) NullExp(c, l.loc);
endLocation = l.expect(Token.RBracket).loc;
}
else
{
// a[0 .. 0]
hiIndex = parseExpression();
endLocation = l.expect(Token.RBracket).loc;
}
}
else
{
// a[0]
endLocation = l.expect(Token.RBracket).loc;
if(exp.as!(VarargExp))
exp = new(c) VargIndexExp(c, location, endLocation, loIndex);
else
exp = new(c) IndexExp(c, endLocation, exp, loIndex);
// continue here since this isn't a slice
continue;
}
}
if(exp.as!(VarargExp))
exp = new(c) VargSliceExp(c, location, endLocation, loIndex, hiIndex);
else
exp = new(c) SliceExp(c, endLocation, exp, loIndex, hiIndex);
continue;
default:
return exp;
}
}
}
/**
Parse a for comprehension. Note that in the grammar, this actually includes an optional
if comprehension and optional for comprehension after it, meaning that an entire array
or table comprehension is parsed in one call.
*/
public ForComprehension parseForComprehension()
{
auto loc = l.expect(Token.For).loc;
scope names = new List!(Identifier)(c.alloc);
names ~= parseIdentifier();
while(l.type == Token.Comma)
{
l.next();
names ~= parseIdentifier();
}
l.expect(Token.In);
auto exp = parseExpression();
if(l.type == Token.DotDot)
{
if(names.length > 1)
c.exception(loc, "Numeric for comprehension may only have one index");
l.next();
auto exp2 = parseExpression();
Expression step;
if(l.type == Token.Comma)
{
l.next();
step = parseExpression();
}
else
step = new(c) IntExp(c, l.loc, 1);
IfComprehension ifComp;
if(l.type == Token.If)
ifComp = parseIfComprehension();
ForComprehension forComp;
if(l.type == Token.For)
forComp = parseForComprehension();
auto arr = names.toArray();
auto name = arr[0];
c.alloc.freeArray(arr);
return new(c) ForNumComprehension(c, loc, name, exp, exp2, step, ifComp, forComp);
}
else
{
Identifier[] namesArr;
if(names.length == 1)
{
names ~= cast(Identifier)null;
namesArr = names.toArray();
for(uword i = namesArr.length - 1; i > 0; i--)
namesArr[i] = namesArr[i - 1];
namesArr[0] = dummyForeachIndex(namesArr[1].location);
}
else
namesArr = names.toArray();
scope(failure)
c.alloc.freeArray(namesArr);
scope container = new List!(Expression)(c.alloc);
container ~= exp;
while(l.type == Token.Comma)
{
l.next();
container ~= parseExpression();
}
if(container.length > 3)
c.exception(container[0].location, "Too many expressions in container");
IfComprehension ifComp;
if(l.type == Token.If)
ifComp = parseIfComprehension();
ForComprehension forComp;
if(l.type == Token.For)
forComp = parseForComprehension();
return new(c) ForeachComprehension(c, loc, namesArr, container.toArray(), ifComp, forComp);
}
}
/**
*/
public IfComprehension parseIfComprehension()
{
auto loc = l.expect(Token.If).loc;
auto condition = parseExpression();
return new(c) IfComprehension(c, loc, condition);
}
// ================================================================================================================================================
// Private
// ================================================================================================================================================
private Identifier dummyForeachIndex(CompileLoc loc)
{
pushFormat(c.thread, "__dummy{}", dummyNameCounter++);
auto str = c.newString(getString(c.thread, -1));
pop(c.thread);
return new(c) Identifier(c, loc, str);
}
private Identifier dummyFuncLiteralName(CompileLoc loc)
{
pushFormat(c.thread, "<literal at {}({}:{})>", loc.file, loc.line, loc.col);
auto str = c.newString(getString(c.thread, -1));
pop(c.thread);
return new(c) Identifier(c, loc, str);
}
private Identifier dummyClassLiteralName(CompileLoc loc)
{
pushFormat(c.thread, "<class at {}({}:{})>", loc.file, loc.line, loc.col);
auto str = c.newString(getString(c.thread, -1));
pop(c.thread);
return new(c) Identifier(c, loc, str);
}
}
|
D
|
void main() {
auto ip = readAs!(int[]), N = ip[0], K = ip[1];
auto V = readAs!(int[]);
}
// ===================================
import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;
T readAs(T)() if (isBasicType!T) {
return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
return readln.split.to!T;
}
T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
auto res = new T[][](height, width);
foreach(i; 0..height) {
res[i] = readAs!(T[]);
}
return res;
}
T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
auto res = new T[][](height, width);
foreach(i; 0..height) {
auto s = rs;
foreach(j; 0..width) res[i][j] = s[j].to!T;
}
return res;
}
int ri() {
return readAs!int;
}
double rd() {
return readAs!double;
}
string rs() {
return readln.chomp;
}
|
D
|
/** Arbitrary-precision ('bignum') arithmetic
*
* Performance is optimized for numbers below ~1000 decimal digits.
* For X86 machines, highly optimised assembly routines are used.
*
* The following algorithms are currently implemented:
* $(UL
* $(LI Karatsuba multiplication)
* $(LI Squaring is optimized independently of multiplication)
* $(LI Divide-and-conquer division)
* $(LI Binary exponentiation)
* )
*
* For very large numbers, consider using the $(WEB gmplib.org, GMP library) instead.
*
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Don Clugston
* Source: $(PHOBOSSRC std/_bigint.d)
*/
/* Copyright Don Clugston 2008 - 2010.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module std.bigint;
private import std.internal.math.biguintcore;
private import std.format : FormatSpec, FormatException;
private import std.traits;
/** A struct representing an arbitrary precision integer
*
* All arithmetic operations are supported, except
* unsigned shift right (>>>). Logical operations are not currently supported.
*
* BigInt implements value semantics using copy-on-write. This means that
* assignment is cheap, but operations such as x++ will cause heap
* allocation. (But note that for most bigint operations, heap allocation is
* inevitable anyway).
Example:
----------------------------------------------------
BigInt a = "9588669891916142";
BigInt b = "7452469135154800";
auto c = a * b;
assert(c == BigInt("71459266416693160362545788781600"));
auto d = b * a;
assert(d == BigInt("71459266416693160362545788781600"));
assert(d == c);
d = c * BigInt("794628672112");
assert(d == BigInt("56783581982794522489042432639320434378739200"));
auto e = c + d;
assert(e == BigInt("56783581982865981755459125799682980167520800"));
auto f = d + c;
assert(f == e);
auto g = f - c;
assert(g == d);
g = f - d;
assert(g == c);
e = 12345678;
g = c + e;
auto h = g / b;
auto i = g % b;
assert(h == a);
assert(i == e);
BigInt j = "-0x9A56_57f4_7B83_AB78";
j ^^= 11;
----------------------------------------------------
*
*/
struct BigInt
{
private:
BigUint data; // BigInt adds signed arithmetic to BigUint.
bool sign = false;
public:
/// Construct a BigInt from a decimal or hexadecimal string.
/// The number must be in the form of a D decimal or hex literal:
/// It may have a leading + or - sign; followed by "0x" if hexadecimal.
/// Underscores are permitted.
/// BUG: Should throw a IllegalArgumentException/ConvError if invalid character found
this(T : const(char)[] )(T s) pure
{
bool neg = false;
if (s[0] == '-') {
neg = true;
s = s[1..$];
} else if (s[0] == '+') {
s = s[1..$];
}
data = 0UL;
auto q = 0X3;
bool ok;
assert(isZero());
if (s.length > 2 && (s[0..2] == "0x" || s[0..2] == "0X"))
{
ok = data.fromHexString(s[2..$]);
} else {
ok = data.fromDecimalString(s);
}
assert(ok);
if (isZero())
neg = false;
sign = neg;
}
///
this(T)(T x) pure if (isIntegral!T)
{
data = data.init; // @@@: Workaround for compiler bug
opAssign(x);
}
///
BigInt opAssign(T)(T x) pure if (isIntegral!T)
{
data = cast(ulong)absUnsign(x);
sign = (x < 0);
return this;
}
///
BigInt opAssign(T:BigInt)(T x) pure
{
data = x.data;
sign = x.sign;
return this;
}
// BigInt op= integer
BigInt opOpAssign(string op, T)(T y) pure
if ((op=="+" || op=="-" || op=="*" || op=="/" || op=="%"
|| op==">>" || op=="<<" || op=="^^") && isIntegral!T)
{
ulong u = absUnsign(y);
static if (op=="+")
{
data = BigUint.addOrSubInt(data, u, sign != (y<0), sign);
}
else static if (op=="-")
{
data = BigUint.addOrSubInt(data, u, sign == (y<0), sign);
}
else static if (op=="*")
{
if (y == 0) {
sign = false;
data = 0UL;
} else {
sign = ( sign != (y<0) );
data = BigUint.mulInt(data, u);
}
}
else static if (op=="/")
{
assert(y!=0, "Division by zero");
static assert(!is(T == long) && !is(T == ulong));
data = BigUint.divInt(data, cast(uint)u);
sign = data.isZero() ? false : sign ^ (y < 0);
}
else static if (op=="%")
{
assert(y!=0, "Division by zero");
static if (is(immutable(T) == immutable(long)) || is( immutable(T) == immutable(ulong) ))
{
this %= BigInt(y);
}
else
{
data = cast(ulong)BigUint.modInt(data, cast(uint)u);
}
// x%y always has the same sign as x.
// This is not the same as mathematical mod.
}
else static if (op==">>" || op=="<<")
{
// Do a left shift if y>0 and <<, or
// if y<0 and >>; else do a right shift.
if (y == 0)
return this;
else if ((y > 0) == (op=="<<"))
{
// Sign never changes during left shift
data = data.opShl(u);
} else
{
data = data.opShr(u);
if (data.isZero())
sign = false;
}
}
else static if (op=="^^")
{
sign = (y & 1) ? sign : false;
data = BigUint.pow(data, u);
}
else static assert(0, "BigInt " ~ op[0..$-1] ~ "= " ~ T.stringof ~ " is not supported");
return this;
}
// BigInt op= BigInt
BigInt opOpAssign(string op, T)(T y) pure
if ((op=="+" || op== "-" || op=="*" || op=="/" || op=="%")
&& is (T: BigInt))
{
static if (op == "+")
{
data = BigUint.addOrSub(data, y.data, sign != y.sign, &sign);
}
else static if (op == "-")
{
data = BigUint.addOrSub(data, y.data, sign == y.sign, &sign);
}
else static if (op == "*")
{
data = BigUint.mul(data, y.data);
sign = isZero() ? false : sign ^ y.sign;
}
else static if (op == "/")
{
y.checkDivByZero();
if (!isZero())
{
data = BigUint.div(data, y.data);
sign = isZero() ? false : sign ^ y.sign;
}
}
else static if (op == "%")
{
y.checkDivByZero();
if (!isZero())
{
data = BigUint.mod(data, y.data);
// x%y always has the same sign as x.
if (isZero())
sign = false;
}
}
else static assert(0, "BigInt " ~ op[0..$-1] ~ "= " ~ T.stringof ~ " is not supported");
return this;
}
// BigInt op BigInt
BigInt opBinary(string op, T)(T y) pure
if ((op=="+" || op == "*" || op=="-" || op=="/" || op=="%")
&& is (T: BigInt))
{
BigInt r = this;
return r.opOpAssign!(op)(y);
}
// BigInt op integer
BigInt opBinary(string op, T)(T y) pure
if ((op=="+" || op == "*" || op=="-" || op=="/"
|| op==">>" || op=="<<" || op=="^^") && isIntegral!T)
{
BigInt r = this;
return r.opOpAssign!(op)(y);
}
//
int opBinary(string op, T : int)(T y) pure
if (op == "%" && isIntegral!T)
{
assert(y!=0);
uint u = absUnsign(y);
int rem = BigUint.modInt(data, u);
// x%y always has the same sign as x.
// This is not the same as mathematical mod.
return sign ? -rem : rem;
}
// Commutative operators
BigInt opBinaryRight(string op, T)(T y) pure
if ((op=="+" || op=="*") && isIntegral!T)
{
return opBinary!(op)(y);
}
// BigInt = integer op BigInt
BigInt opBinaryRight(string op, T)(T y) pure
if (op == "-" && isIntegral!T)
{
ulong u = absUnsign(y);
BigInt r;
static if (op == "-")
{
r.sign = sign;
r.data = BigUint.addOrSubInt(data, u, sign == (y<0), r.sign);
r.negate();
}
return r;
}
// integer = integer op BigInt
T opBinaryRight(string op, T)(T x) pure
if ((op=="%" || op=="/") && isIntegral!T)
{
static if (op == "%")
{
checkDivByZero();
// x%y always has the same sign as x.
if (data.ulongLength() > 1)
return x;
ulong u = absUnsign(x);
ulong rem = u % data.peekUlong(0);
// x%y always has the same sign as x.
return cast(T)((x<0) ? -rem : rem);
}
else static if (op == "/")
{
checkDivByZero();
if (data.ulongLength() > 1)
return 0;
return cast(T)(x / data.peekUlong(0));
}
}
// const unary operations
BigInt opUnary(string op)() pure /*const*/ if (op=="+" || op=="-")
{
static if (op=="-")
{
BigInt r = this;
r.negate();
return r;
}
else static if (op=="+")
return this;
}
// non-const unary operations
BigInt opUnary(string op)() pure if (op=="++" || op=="--")
{
static if (op=="++")
{
data = BigUint.addOrSubInt(data, 1UL, sign, sign);
return this;
}
else static if (op=="--")
{
data = BigUint.addOrSubInt(data, 1UL, !sign, sign);
return this;
}
}
///
bool opEquals()(auto ref const BigInt y) const pure
{
return sign == y.sign && y.data == data;
}
///
bool opEquals(T)(T y) const pure if (isIntegral!T)
{
if (sign != (y<0))
return 0;
return data.opEquals(cast(ulong)absUnsign(y));
}
///
T opCast(T:bool)() pure
{
return !isZero();
}
// Hack to make BigInt's typeinfo.compare work properly.
// Note that this must appear before the other opCmp overloads, otherwise
// DMD won't find it.
int opCmp(ref const BigInt y) const
{
// Simply redirect to the "real" opCmp implementation.
return this.opCmp!BigInt(y);
}
///
int opCmp(T)(T y) pure if (isIntegral!T)
{
if (sign != (y<0) )
return sign ? -1 : 1;
int cmp = data.opCmp(cast(ulong)absUnsign(y));
return sign? -cmp: cmp;
}
///
int opCmp(T:BigInt)(const T y) pure const
{
if (sign!=y.sign)
return sign ? -1 : 1;
int cmp = data.opCmp(y.data);
return sign? -cmp: cmp;
}
/// Returns the value of this BigInt as a long,
/// or +- long.max if outside the representable range.
long toLong() pure const
{
return (sign ? -1 : 1) *
(data.ulongLength() == 1 && (data.peekUlong(0) <= sign+cast(ulong)(long.max)) // 1+long.max = |long.min|
? cast(long)(data.peekUlong(0))
: long.max);
}
/// Returns the value of this BigInt as an int,
/// or +- int.max if outside the representable range.
int toInt() pure const
{
return (sign ? -1 : 1) *
(data.uintLength() == 1 && (data.peekUint(0) <= sign+cast(uint)(int.max)) // 1+int.max = |int.min|
? cast(int)(data.peekUint(0))
: int.max);
}
/// Number of significant uints which are used in storing this number.
/// The absolute value of this BigInt is always < 2^^(32*uintLength)
@property size_t uintLength() pure const
{
return data.uintLength();
}
/// Number of significant ulongs which are used in storing this number.
/// The absolute value of this BigInt is always < 2^^(64*ulongLength)
@property size_t ulongLength() pure const
{
return data.ulongLength();
}
/** Convert the BigInt to string, passing it to 'sink'.
*
* $(TABLE The output format is controlled via formatString:
* $(TR $(TD "d") $(TD Decimal))
* $(TR $(TD "x") $(TD Hexadecimal, lower case))
* $(TR $(TD "X") $(TD Hexadecimal, upper case))
* $(TR $(TD "s") $(TD Default formatting (same as "d") ))
* $(TR $(TD null) $(TD Default formatting (same as "d") ))
* )
*/
void toString(scope void delegate(const (char)[]) sink, string formatString) const
{
auto f = FormatSpec!char(formatString);
f.writeUpToNextSpec(sink);
toString(sink, f);
}
void toString(scope void delegate(const(char)[]) sink, ref FormatSpec!char f) const
{
auto hex = (f.spec == 'x' || f.spec == 'X');
if (!(f.spec == 's' || f.spec == 'd' || hex))
throw new FormatException("Format specifier not understood: %" ~ f.spec);
char[] buff =
hex ? data.toHexString(0, '_', 0, f.flZero ? '0' : ' ')
: data.toDecimalString(0);
assert(buff.length > 0);
char signChar = isNegative() ? '-' : 0;
auto minw = buff.length + (signChar ? 1 : 0);
if (!hex && !signChar && (f.width == 0 || minw < f.width))
{
if (f.flPlus)
signChar = '+', ++minw;
else if (f.flSpace)
signChar = ' ', ++minw;
}
auto maxw = minw < f.width ? f.width : minw;
auto difw = maxw - minw;
if (!f.flDash && !f.flZero)
foreach (i; 0 .. difw)
sink(" ");
if (signChar)
sink((&signChar)[0..1]);
if (!f.flDash && f.flZero)
foreach (i; 0 .. difw)
sink("0");
sink(buff);
if (f.flDash)
foreach (i; 0 .. difw)
sink(" ");
}
/+
private:
/// Convert to a hexadecimal string, with an underscore every
/// 8 characters.
string toHex()
{
string buff = data.toHexString(1, '_');
if (isNegative())
buff[0] = '-';
else
buff = buff[1..$];
return buff;
}
+/
private:
void negate() pure nothrow @safe
{
if (!data.isZero())
sign = !sign;
}
bool isZero() pure const nothrow @safe
{
return data.isZero();
}
bool isNegative() pure const nothrow @safe
{
return sign;
}
// Generate a runtime error if division by zero occurs
void checkDivByZero() pure const @safe
{
if (isZero())
throw new Error("BigInt division by zero");
}
// Implement toHash so that BigInt works properly as an AA key.
size_t toHash() const @trusted nothrow
{
return data.toHash() + sign;
}
}
string toDecimalString(BigInt x)
{
string outbuff="";
void sink(const(char)[] s) { outbuff ~= s; }
x.toString(&sink, "%d");
return outbuff;
}
string toHex(BigInt x)
{
string outbuff="";
void sink(const(char)[] s) { outbuff ~= s; }
x.toString(&sink, "%x");
return outbuff;
}
// Returns the absolute value of x converted to the corresponding unsigned type
Unsigned!T absUnsign(T)(T x) if (isIntegral!T)
{
static if (isSigned!T)
{
import std.conv;
/* This returns the correct result even when x = T.min
* on two's complement machines because unsigned(T.min) = |T.min|
* even though -T.min = T.min.
*/
return unsigned((x < 0) ? -x : x);
}
else
{
return x;
}
}
unittest {
// Radix conversion
assert( toDecimalString(BigInt("-1_234_567_890_123_456_789"))
== "-1234567890123456789");
assert( toHex(BigInt("0x1234567890123456789")) == "123_45678901_23456789");
assert( toHex(BigInt("0x00000000000000000000000000000000000A234567890123456789"))
== "A23_45678901_23456789");
assert( toHex(BigInt("0x000_00_000000_000_000_000000000000_000000_")) == "0");
assert(BigInt(-0x12345678).toInt() == -0x12345678);
assert(BigInt(-0x12345678).toLong() == -0x12345678);
assert(BigInt(0x1234_5678_9ABC_5A5AL).ulongLength == 1);
assert(BigInt(0x1234_5678_9ABC_5A5AL).toLong() == 0x1234_5678_9ABC_5A5AL);
assert(BigInt(-0x1234_5678_9ABC_5A5AL).toLong() == -0x1234_5678_9ABC_5A5AL);
assert(BigInt(0xF234_5678_9ABC_5A5AL).toLong() == long.max);
assert(BigInt(-0x123456789ABCL).toInt() == -int.max);
char[] s1 = "123".dup; // bug 8164
assert(BigInt(s1) == 123);
char[] s2 = "0xABC".dup;
assert(BigInt(s2) == 2748);
assert((BigInt(-2) + BigInt(1)) == BigInt(-1));
BigInt a = ulong.max - 5;
auto b = -long.max % a;
assert( b == -long.max % (ulong.max - 5));
b = long.max / a;
assert( b == long.max /(ulong.max - 5));
assert(BigInt(1) - 1 == 0);
assert((-4) % BigInt(5) == -4); // bug 5928
assert(BigInt(-4) % BigInt(5) == -4);
assert(BigInt(2)/BigInt(-3) == BigInt(0)); // bug 8022
assert(BigInt("-1") > long.min); // bug 9548
}
unittest // Minimum signed value bug tests.
{
assert(BigInt("-0x8000000000000000") == BigInt(long.min));
assert(BigInt("-0x8000000000000000")+1 > BigInt(long.min));
assert(BigInt("-0x80000000") == BigInt(int.min));
assert(BigInt("-0x80000000")+1 > BigInt(int.min));
assert(BigInt(long.min).toLong() == long.min); // lossy toLong bug for long.min
assert(BigInt(int.min).toInt() == int.min); // lossy toInt bug for int.min
assert(BigInt(long.min).ulongLength == 1);
assert(BigInt(int.min).uintLength == 1); // cast/sign extend bug in opAssign
BigInt a;
a += int.min;
assert(a == BigInt(int.min));
a = int.min - BigInt(int.min);
assert(a == 0);
a = int.min;
assert(a == BigInt(int.min));
assert(int.min % (BigInt(int.min)-1) == int.min);
assert((BigInt(int.min)-1)%int.min == -1);
}
unittest // Recursive division, bug 5568
{
enum Z = 4843;
BigInt m = (BigInt(1) << (Z*8) ) - 1;
m -= (BigInt(1) << (Z*6)) - 1;
BigInt oldm = m;
BigInt a = (BigInt(1) << (Z*4) )-1;
BigInt b = m % a;
m /= a;
m *= a;
assert( m + b == oldm);
m = (BigInt(1) << (4846 + 4843) ) - 1;
a = (BigInt(1) << 4846 ) - 1;
b = (BigInt(1) << (4846*2 + 4843)) - 1;
BigInt c = (BigInt(1) << (4846*2 + 4843*2)) - 1;
BigInt w = c - b + a;
assert(w % m == 0);
// Bug 6819. ^^
BigInt z1 = BigInt(10)^^64;
BigInt w1 = BigInt(10)^^128;
assert(z1^^2 == w1);
BigInt z2 = BigInt(1)<<64;
BigInt w2 = BigInt(1)<<128;
assert(z2^^2 == w2);
// Bug 7993
BigInt n7793 = 10;
assert( n7793 / 1 == 10);
// Bug 7973
auto a7973 = 10_000_000_000_000_000;
const c7973 = 10_000_000_000_000_000;
immutable i7973 = 10_000_000_000_000_000;
BigInt v7973 = 2551700137;
v7973 %= a7973;
assert(v7973 == 2551700137);
v7973 %= c7973;
assert(v7973 == 2551700137);
v7973 %= i7973;
assert(v7973 == 2551700137);
// 8165
BigInt[2] a8165;
a8165[0] = a8165[1] = 1;
}
unittest
{
import std.array;
import std.format;
immutable string[][] table = [
/* fmt, +10 -10 */
["%d", "10", "-10"],
["%+d", "+10", "-10"],
["%-d", "10", "-10"],
["%+-d", "+10", "-10"],
["%4d", " 10", " -10"],
["%+4d", " +10", " -10"],
["%-4d", "10 ", "-10 "],
["%+-4d", "+10 ", "-10 "],
["%04d", "0010", "-010"],
["%+04d", "+010", "-010"],
["%-04d", "10 ", "-10 "],
["%+-04d", "+10 ", "-10 "],
["% 04d", " 010", "-010"],
["%+ 04d", "+010", "-010"],
["%- 04d", " 10 ", "-10 "],
["%+- 04d", "+10 ", "-10 "],
];
auto w1 = appender!(char[])();
auto w2 = appender!(char[])();
foreach (entry; table)
{
immutable fmt = entry[0];
formattedWrite(w1, fmt, BigInt(10));
formattedWrite(w2, fmt, 10);
assert(w1.data == w2.data);
assert(w1.data == entry[1]);
w1.clear();
w2.clear();
formattedWrite(w1, fmt, BigInt(-10));
formattedWrite(w2, fmt, -10);
assert(w1.data == w2.data);
assert(w1.data == entry[2]);
w1.clear();
w2.clear();
}
}
unittest
{
import std.array;
import std.format;
immutable string[][] table = [
/* fmt, +10 -10 */
["%X", "A", "-A"],
["%+X", "A", "-A"],
["%-X", "A", "-A"],
["%+-X", "A", "-A"],
["%4X", " A", " -A"],
["%+4X", " A", " -A"],
["%-4X", "A ", "-A "],
["%+-4X", "A ", "-A "],
["%04X", "000A", "-00A"],
["%+04X", "000A", "-00A"],
["%-04X", "A ", "-A "],
["%+-04X", "A ", "-A "],
["% 04X", "000A", "-00A"],
["%+ 04X", "000A", "-00A"],
["%- 04X", "A ", "-A "],
["%+- 04X", "A ", "-A "],
];
auto w1 = appender!(char[])();
auto w2 = appender!(char[])();
foreach (entry; table)
{
immutable fmt = entry[0];
formattedWrite(w1, fmt, BigInt(10));
formattedWrite(w2, fmt, 10);
assert(w1.data == w2.data); // Equal only positive BigInt
assert(w1.data == entry[1]);
w1.clear();
w2.clear();
formattedWrite(w1, fmt, BigInt(-10));
//formattedWrite(w2, fmt, -10);
//assert(w1.data == w2.data);
assert(w1.data == entry[2]);
w1.clear();
//w2.clear();
}
}
// 6448
unittest
{
import std.array;
import std.format;
auto w1 = appender!string();
auto w2 = appender!string();
int x = 100;
formattedWrite(w1, "%010d", x);
BigInt bx = x;
formattedWrite(w2, "%010d", bx);
assert(w1.data == w2.data);
//8011
BigInt y = -3;
++y;
assert(y.toLong() == -2);
y = 1;
--y;
assert(y.toLong() == 0);
--y;
assert(y.toLong() == -1);
--y;
assert(y.toLong() == -2);
}
unittest
{
import std.math:abs;
auto r = abs(BigInt(-1000)); // 6486
assert(r == 1000);
// opCast!bool
BigInt one = 1, zero;
assert(one && !zero);
}
unittest // 6850
{
pure long pureTest() {
BigInt a = 1;
BigInt b = 1336;
a += b;
return a.toLong();
}
assert(pureTest() == 1337);
}
unittest // 8435 & 10118
{
auto i = BigInt(100);
auto j = BigInt(100);
// Two separate BigInt instances representing same value should have same
// hash.
assert(typeid(i).getHash(&i) == typeid(j).getHash(&j));
assert(typeid(i).compare(&i, &j) == 0);
// BigInt AA keys should behave consistently.
int[BigInt] aa;
aa[BigInt(123)] = 123;
assert(BigInt(123) in aa);
aa[BigInt(123)] = 321;
assert(aa[BigInt(123)] == 321);
auto keys = aa.byKey;
assert(keys.front == BigInt(123));
keys.popFront();
assert(keys.empty);
}
|
D
|
/**
* Compiler implementation of the D programming language
* http://dlang.org
*
* Copyright: Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
* Authors: Walter Bright, http://www.digitalmars.com
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/root/filename.d, root/_filename.d)
* Documentation: https://dlang.org/phobos/dmd_root_filename.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/root/filename.d
*/
module dmd.root.filename;
import core.stdc.ctype;
import core.stdc.errno;
import core.stdc.string;
import core.sys.posix.stdlib;
import core.sys.posix.sys.stat;
import core.sys.windows.winbase;
import core.sys.windows.windef;
import core.sys.windows.winnls;
import dmd.root.array;
import dmd.root.file;
import dmd.root.outbuffer;
import dmd.root.port;
import dmd.root.rmem;
import dmd.root.rootobject;
import dmd.utils;
nothrow
{
version (Windows) extern (Windows) DWORD GetFullPathNameW(LPCWSTR, DWORD, LPWSTR, LPWSTR*) @nogc;
version (Windows) extern (Windows) void SetLastError(DWORD) @nogc;
version (Windows) extern (C) char* getcwd(char* buffer, size_t maxlen);
version (Posix) extern (C) char* canonicalize_file_name(const char*);
version (Posix) import core.sys.posix.unistd : getcwd;
}
alias Strings = Array!(const(char)*);
alias Files = Array!(File*);
/***********************************************************
* Encapsulate path and file names.
*/
struct FileName
{
nothrow:
private const(char)[] str;
///
extern (D) this(const(char)[] str)
{
this.str = str.xarraydup;
}
/// Compare two name according to the platform's rules (case sensitive or not)
extern (C++) static bool equals(const(char)* name1, const(char)* name2) pure
{
return equals(name1.toDString, name2.toDString);
}
/// Ditto
extern (D) static bool equals(const(char)[] name1, const(char)[] name2) pure
{
if (name1.length != name2.length)
return false;
version (Windows)
{
return Port.memicmp(name1.ptr, name2.ptr, name1.length) == 0;
}
else
{
return name1 == name2;
}
}
/************************************
* Determine if path is absolute.
* Params:
* name = path
* Returns:
* true if absolute path name.
*/
extern (C++) static bool absolute(const(char)* name) pure
{
return absolute(name.toDString);
}
/// Ditto
extern (D) static bool absolute(const(char)[] name) pure
{
if (!name.length)
return false;
version (Windows)
{
return (name[0] == '\\') || (name[0] == '/')
|| (name.length >= 2 && name[1] == ':');
}
else version (Posix)
{
return (name[0] == '/');
}
else
{
assert(0);
}
}
unittest
{
assert(absolute("/"[]) == true);
assert(absolute(""[]) == false);
}
/**
Return the given name as an absolute path
Params:
name = path
base = the absolute base to prefix name with if it is relative
Returns: name as an absolute path relative to base
*/
extern (C++) static const(char)* toAbsolute(const(char)* name, const(char)* base = null)
{
const name_ = name.toDString();
const base_ = base ? base.toDString() : getcwd(null, 0).toDString();
return absolute(name_) ? name : combine(base_, name_).ptr;
}
/********************************
* Determine file name extension as slice of input.
* Params:
* str = file name
* Returns:
* filename extension (read-only).
* Points past '.' of extension.
* If there isn't one, return null.
*/
extern (C++) static const(char)* ext(const(char)* str) pure
{
return ext(str.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] ext(const(char)[] str) nothrow pure @safe @nogc
{
foreach_reverse (idx, char e; str)
{
switch (e)
{
case '.':
return str[idx + 1 .. $];
version (Posix)
{
case '/':
return null;
}
version (Windows)
{
case '\\':
case ':':
case '/':
return null;
}
default:
continue;
}
}
return null;
}
unittest
{
assert(ext("/foo/bar/dmd.conf"[]) == "conf");
assert(ext("object.o"[]) == "o");
assert(ext("/foo/bar/dmd"[]) == null);
assert(ext(".objdir.o/object"[]) == null);
assert(ext([]) == null);
}
extern (C++) const(char)* ext() const pure
{
return ext(str).ptr;
}
/********************************
* Return file name without extension.
*
* TODO:
* Once slice are used everywhere and `\0` is not assumed,
* this can be turned into a simple slicing.
*
* Params:
* str = file name
*
* Returns:
* mem.xmalloc'd filename with extension removed.
*/
extern (C++) static const(char)* removeExt(const(char)* str)
{
return removeExt(str.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] removeExt(const(char)[] str)
{
auto e = ext(str);
if (e.length)
{
const len = (str.length - e.length) - 1; // -1 for the dot
char* n = cast(char*)mem.xmalloc(len + 1);
memcpy(n, str.ptr, len);
n[len] = 0;
return n[0 .. len];
}
return mem.xstrdup(str.ptr)[0 .. str.length];
}
unittest
{
assert(removeExt("/foo/bar/object.d"[]) == "/foo/bar/object");
assert(removeExt("/foo/bar/frontend.di"[]) == "/foo/bar/frontend");
}
/********************************
* Return filename name excluding path (read-only).
*/
extern (C++) static const(char)* name(const(char)* str) pure
{
return name(str.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] name(const(char)[] str) pure
{
foreach_reverse (idx, char e; str)
{
switch (e)
{
version (Posix)
{
case '/':
return str[idx + 1 .. $];
}
version (Windows)
{
case '/':
case '\\':
return str[idx + 1 .. $];
case ':':
/* The ':' is a drive letter only if it is the second
* character or the last character,
* otherwise it is an ADS (Alternate Data Stream) separator.
* Consider ADS separators as part of the file name.
*/
if (idx == 1 || idx == str.length - 1)
return str[idx + 1 .. $];
break;
}
default:
break;
}
}
return str;
}
extern (C++) const(char)* name() const pure
{
return name(str).ptr;
}
unittest
{
assert(name("/foo/bar/object.d"[]) == "object.d");
assert(name("/foo/bar/frontend.di"[]) == "frontend.di");
}
/**************************************
* Return path portion of str.
* Path will does not include trailing path separator.
*/
extern (C++) static const(char)* path(const(char)* str)
{
return path(str.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] path(const(char)[] str)
{
const n = name(str);
bool hasTrailingSlash;
if (n.length < str.length)
{
version (Posix)
{
if (str[$ - n.length - 1] == '/')
hasTrailingSlash = true;
}
else version (Windows)
{
if (str[$ - n.length - 1] == '\\' || str[$ - n.length - 1] == '/')
hasTrailingSlash = true;
}
else
{
assert(0);
}
}
const pathlen = str.length - n.length - (hasTrailingSlash ? 1 : 0);
char* path = cast(char*)mem.xmalloc(pathlen + 1);
memcpy(path, str.ptr, pathlen);
path[pathlen] = 0;
return path[0 .. pathlen];
}
unittest
{
assert(path("/foo/bar"[]) == "/foo");
assert(path("foo"[]) == "");
}
/**************************************
* Replace filename portion of path.
*/
extern (D) static const(char)[] replaceName(const(char)[] path, const(char)[] name)
{
if (absolute(name))
return name;
auto n = FileName.name(path);
if (n == path)
return name;
return combine(path[0 .. $ - n.length], name);
}
/**
Combine a `path` and a file `name`
Params:
path = Path to append to
name = Name to append to path
Returns:
The `\0` terminated string which is the combination of `path` and `name`
and a valid path.
*/
extern (C++) static const(char)* combine(const(char)* path, const(char)* name)
{
if (!path)
return name;
return combine(path.toDString, name.toDString).ptr;
}
/// Ditto
extern(D) static const(char)[] combine(const(char)[] path, const(char)[] name)
{
if (!path.length)
return name;
char* f = cast(char*)mem.xmalloc(path.length + 1 + name.length + 1);
memcpy(f, path.ptr, path.length);
bool trailingSlash = false;
version (Posix)
{
if (path[$ - 1] != '/')
{
f[path.length] = '/';
trailingSlash = true;
}
}
else version (Windows)
{
if (path[$ - 1] != '\\' && path[$ - 1] != '/' && path[$ - 1] != ':')
{
f[path.length] = '\\';
trailingSlash = true;
}
}
else
{
assert(0);
}
const len = path.length + trailingSlash;
memcpy(f + len, name.ptr, name.length);
// Note: At the moment `const(char)*` are being transitioned to
// `const(char)[]`. To avoid bugs crippling in, we `\0` terminate
// slices, but don't include it in the slice so `.ptr` can be used.
f[len + name.length] = '\0';
return f[0 .. len + name.length];
}
unittest
{
version (Windows)
assert(combine("foo"[], "bar"[]) == "foo\\bar");
else
assert(combine("foo"[], "bar"[]) == "foo/bar");
assert(combine("foo/"[], "bar"[]) == "foo/bar");
}
static const(char)* buildPath(const(char)* path, const(char)*[] names...)
{
foreach (const(char)* name; names)
path = combine(path, name);
return path;
}
// Split a path into an Array of paths
extern (C++) static Strings* splitPath(const(char)* path)
{
char c = 0; // unnecessary initializer is for VC /W4
const(char)* p;
OutBuffer buf;
Strings* array;
array = new Strings();
if (path)
{
p = path;
do
{
char instring = 0;
while (isspace(cast(char)*p)) // skip leading whitespace
p++;
buf.reserve(strlen(p) + 1); // guess size of path
for (;; p++)
{
c = *p;
switch (c)
{
case '"':
instring ^= 1; // toggle inside/outside of string
continue;
version (OSX)
{
case ',':
}
version (Windows)
{
case ';':
}
version (Posix)
{
case ':':
}
p++;
break;
// note that ; cannot appear as part
// of a path, quotes won't protect it
case 0x1A:
// ^Z means end of file
case 0:
break;
case '\r':
continue;
// ignore carriage returns
version (Posix)
{
case '~':
{
char* home = getenv("HOME");
if (home)
buf.writestring(home);
else
buf.writestring("~");
continue;
}
}
version (none)
{
case ' ':
case '\t':
// tabs in filenames?
if (!instring) // if not in string
break;
// treat as end of path
}
default:
buf.writeByte(c);
continue;
}
break;
}
if (buf.offset) // if path is not empty
{
array.push(buf.extractString());
}
}
while (c);
}
return array;
}
/**
* Add the extension `ext` to `name`, regardless of the content of `name`
*
* Params:
* name = Path to append the extension to
* ext = Extension to add (should not include '.')
*
* Returns:
* A newly allocated string (free with `FileName.free`)
*/
extern(D) static char[] addExt(const(char)[] name, const(char)[] ext)
{
const len = name.length + ext.length + 2;
auto s = cast(char*)mem.xmalloc(len);
s[0 .. name.length] = name[];
s[name.length] = '.';
s[name.length + 1 .. len - 1] = ext[];
s[len - 1] = '\0';
return s[0 .. len - 1];
}
/***************************
* Free returned value with FileName::free()
*/
extern (C++) static const(char)* defaultExt(const(char)* name, const(char)* ext)
{
return defaultExt(name.toDString, ext.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] defaultExt(const(char)[] name, const(char)[] ext)
{
auto e = FileName.ext(name);
if (e.length) // it already has an extension
return name.xarraydup;
return addExt(name, ext);
}
unittest
{
assert(defaultExt("/foo/object.d"[], "d") == "/foo/object.d");
assert(defaultExt("/foo/object"[], "d") == "/foo/object.d");
assert(defaultExt("/foo/bar.d"[], "o") == "/foo/bar.d");
}
/***************************
* Free returned value with FileName::free()
*/
extern (C++) static const(char)* forceExt(const(char)* name, const(char)* ext)
{
return forceExt(name.toDString, ext.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] forceExt(const(char)[] name, const(char)[] ext)
{
if (auto e = FileName.ext(name))
return addExt(name[0 .. $ - e.length - 1], ext);
return defaultExt(name, ext); // doesn't have one
}
unittest
{
assert(forceExt("/foo/object.d"[], "d") == "/foo/object.d");
assert(forceExt("/foo/object"[], "d") == "/foo/object.d");
assert(forceExt("/foo/bar.d"[], "o") == "/foo/bar.o");
}
/// Returns:
/// `true` if `name`'s extension is `ext`
extern (C++) static bool equalsExt(const(char)* name, const(char)* ext) pure
{
return equalsExt(name.toDString, ext.toDString);
}
/// Ditto
extern (D) static bool equalsExt(const(char)[] name, const(char)[] ext) pure
{
auto e = FileName.ext(name);
if (!e.length && !ext.length)
return true;
if (!e.length || !ext.length)
return false;
return FileName.equals(e, ext);
}
unittest
{
assert(!equalsExt("foo.bar"[], "d"));
assert(equalsExt("foo.bar"[], "bar"));
assert(equalsExt("object.d"[], "d"));
assert(!equalsExt("object"[], "d"));
}
/******************************
* Return !=0 if extensions match.
*/
extern (C++) bool equalsExt(const(char)* ext) const pure
{
return equalsExt(str, ext.toDString());
}
/*************************************
* Search Path for file.
* Input:
* cwd if true, search current directory before searching path
*/
extern (C++) static const(char)* searchPath(Strings* path, const(char)* name, bool cwd)
{
return searchPath(path, name.toDString, cwd).ptr;
}
extern (D) static const(char)[] searchPath(Strings* path, const(char)[] name, bool cwd)
{
if (absolute(name))
{
return exists(name) ? name : null;
}
if (cwd)
{
if (exists(name))
return name;
}
if (path)
{
foreach (p; *path)
{
auto n = combine(p.toDString, name);
if (exists(n))
return n;
}
}
return null;
}
/*************************************
* Search Path for file in a safe manner.
*
* Be wary of CWE-22: Improper Limitation of a Pathname to a Restricted Directory
* ('Path Traversal') attacks.
* http://cwe.mitre.org/data/definitions/22.html
* More info:
* https://www.securecoding.cert.org/confluence/display/c/FIO02-C.+Canonicalize+path+names+originating+from+tainted+sources
* Returns:
* NULL file not found
* !=NULL mem.xmalloc'd file name
*/
extern (C++) static const(char)* safeSearchPath(Strings* path, const(char)* name)
{
version (Windows)
{
// don't allow leading / because it might be an absolute
// path or UNC path or something we'd prefer to just not deal with
if (*name == '/')
{
return null;
}
/* Disallow % \ : and .. in name characters
* We allow / for compatibility with subdirectories which is allowed
* on dmd/posix. With the leading / blocked above and the rest of these
* conservative restrictions, we should be OK.
*/
for (const(char)* p = name; *p; p++)
{
char c = *p;
if (c == '\\' || c == ':' || c == '%' || (c == '.' && p[1] == '.') || (c == '/' && p[1] == '/'))
{
return null;
}
}
return FileName.searchPath(path, name, false);
}
else version (Posix)
{
/* Even with realpath(), we must check for // and disallow it
*/
for (const(char)* p = name; *p; p++)
{
char c = *p;
if (c == '/' && p[1] == '/')
{
return null;
}
}
if (path)
{
/* Each path is converted to a cannonical name and then a check is done to see
* that the searched name is really a child one of the the paths searched.
*/
for (size_t i = 0; i < path.dim; i++)
{
const(char)* cname = null;
const(char)* cpath = canonicalName((*path)[i]);
//printf("FileName::safeSearchPath(): name=%s; path=%s; cpath=%s\n",
// name, (char *)path.data[i], cpath);
if (cpath is null)
goto cont;
cname = canonicalName(combine(cpath, name));
//printf("FileName::safeSearchPath(): cname=%s\n", cname);
if (cname is null)
goto cont;
//printf("FileName::safeSearchPath(): exists=%i "
// "strncmp(cpath, cname, %i)=%i\n", exists(cname),
// strlen(cpath), strncmp(cpath, cname, strlen(cpath)));
// exists and name is *really* a "child" of path
if (exists(cname) && strncmp(cpath, cname, strlen(cpath)) == 0)
{
.free(cast(void*)cpath);
const(char)* p = mem.xstrdup(cname);
.free(cast(void*)cname);
return p;
}
cont:
if (cpath)
.free(cast(void*)cpath);
if (cname)
.free(cast(void*)cname);
}
}
return null;
}
else
{
assert(0);
}
}
/**
Check if the file the `path` points to exists
Returns:
0 if it does not exists
1 if it exists and is not a directory
2 if it exists and is a directory
*/
extern (C++) static int exists(const(char)* name)
{
return exists(name.toDString);
}
/// Ditto
extern (D) static int exists(const(char)[] name)
{
if (!name.length)
return 0;
version (Posix)
{
stat_t st;
if (name.toCStringThen!((v) => stat(v.ptr, &st)) < 0)
return 0;
if (S_ISDIR(st.st_mode))
return 2;
return 1;
}
else version (Windows)
{
return name.toCStringThen!((cstr) => cstr.toWStringzThen!((wname)
{
const dw = GetFileAttributesW(&wname[0]);
if (dw == -1)
return 0;
else if (dw & FILE_ATTRIBUTE_DIRECTORY)
return 2;
else
return 1;
}));
}
else
{
assert(0);
}
}
/**
Ensure that the provided path exists
Accepts a path to either a file or a directory.
In the former case, the basepath (path to the containing directory)
will be checked for existence, and created if it does not exists.
In the later case, the directory pointed to will be checked for existence
and created if needed.
Params:
path = a path to a file or a directory
Returns:
`true` if the directory exists or was successfully created
*/
extern (C++) static bool ensurePathExists(const(char)* path)
{
//printf("FileName::ensurePathExists(%s)\n", path ? path : "");
if (!path || !(*path))
return true;
if (exists(path))
return true;
// We were provided with a file name
// We need to call ourselves recursively to ensure parent dir exist
const(char)* p = FileName.path(path);
if (*p)
{
version (Windows)
{
const len = strlen(path);
const plen = strlen(p);
// Note: Windows filename comparison should be case-insensitive,
// however p is a subslice of path so we don't need it
if (len == plen ||
(len > 2 && path[1] == ':' && path[2 .. len] == p[0 .. plen]))
{
mem.xfree(cast(void*)p);
return true;
}
}
const r = ensurePathExists(p);
mem.xfree(cast(void*)p);
if (!r)
return r;
}
version (Windows)
const r = _mkdir(path.toDString);
version (Posix)
{
errno = 0;
const r = mkdir(path, (7 << 6) | (7 << 3) | 7);
}
if (r == 0)
return true;
// Don't error out if another instance of dmd just created
// this directory
version (Windows)
{
import core.sys.windows.winerror : ERROR_ALREADY_EXISTS;
if (GetLastError() == ERROR_ALREADY_EXISTS)
return true;
}
version (Posix)
{
if (errno == EEXIST)
return true;
}
return false;
}
/******************************************
* Return canonical version of name in a malloc'd buffer.
* This code is high risk.
*/
extern (C++) static const(char)* canonicalName(const(char)* name)
{
return canonicalName(name.toDString).ptr;
}
/// Ditto
extern (D) static const(char)[] canonicalName(const(char)[] name)
{
version (Posix)
{
// NULL destination buffer is allowed and preferred
return name.toCStringThen!((n) => realpath(n.ptr, null)).toDString;
}
else version (Windows)
{
// Convert to wstring first since otherwise the Win32 APIs have a character limit
return name.toWStringzThen!((wname)
{
/* Apparently, there is no good way to do this on Windows.
* GetFullPathName isn't it, but use it anyway.
*/
// First find out how long the buffer has to be.
auto fullPathLength = GetFullPathNameW(&wname[0], 0, null, null);
if (!fullPathLength) return null;
auto fullPath = new wchar[fullPathLength];
// Actually get the full path name
const fullPathLengthNoTerminator = GetFullPathNameW(
&wname[0], cast(uint)fullPath.length, &fullPath[0], null /*filePart*/);
// Unfortunately, when the buffer is large enough the return value is the number of characters
// _not_ counting the null terminator, so fullPathLengthNoTerminator should be smaller
assert(fullPathLength > fullPathLengthNoTerminator);
// Find out size of the converted string
const retLength = WideCharToMultiByte(
0 /*codepage*/, 0 /*flags*/, &fullPath[0], fullPathLength, null, 0, null, null);
auto ret = new char[retLength];
// Actually convert to char
const retLength2 = WideCharToMultiByte(
0 /*codepage*/, 0 /*flags*/, &fullPath[0], cast(int)fullPath.length, &ret[0], cast(int)ret.length, null, null);
assert(retLength == retLength2);
return ret;
});
}
else
{
assert(0);
}
}
/********************************
* Free memory allocated by FileName routines
*/
extern (C++) static void free(const(char)* str)
{
if (str)
{
assert(str[0] != cast(char)0xAB);
memset(cast(void*)str, 0xAB, strlen(str) + 1); // stomp
}
mem.xfree(cast(void*)str);
}
extern (C++) const(char)* toChars() const pure nothrow @trusted
{
// Since we can return an empty slice (but '\0' terminated),
// we don't do bounds check (as `&str[0]` does)
return str.ptr;
}
const(char)[] toString() const pure nothrow @trusted
{
return str;
}
}
version(Windows)
{
/****************************************************************
* The code before used the POSIX function `mkdir` on Windows. That
* function is now deprecated and fails with long paths, so instead
* we use the newer `CreateDirectoryW`.
*
* `CreateDirectoryW` is the unicode version of the generic macro
* `CreateDirectory`. `CreateDirectoryA` has a file path
* limitation of 248 characters, `mkdir` fails with less and might
* fail due to the number of consecutive `..`s in the
* path. `CreateDirectoryW` also normally has a 248 character
* limit, unless the path is absolute and starts with `\\?\`. Note
* that this is different from starting with the almost identical
* `\\?`.
*
* Params:
* path = The path to create.
*
* Returns:
* 0 on success, 1 on failure.
*
* References:
* https://msdn.microsoft.com/en-us/library/windows/desktop/aa363855(v=vs.85).aspx
*/
private int _mkdir(const(char)[] path) nothrow
{
const createRet = path.extendedPathThen!(
p => CreateDirectoryW(&p[0], null /*securityAttributes*/));
// different conventions for CreateDirectory and mkdir
return createRet == 0 ? 1 : 0;
}
/**************************************
* Converts a path to one suitable to be passed to Win32 API
* functions that can deal with paths longer than 248
* characters then calls the supplied function on it.
*
* Params:
* path = The Path to call F on.
*
* Returns:
* The result of calling F on path.
*
* References:
* https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
*/
package auto extendedPathThen(alias F)(const(char)[] path)
{
if (!path.length)
return F((wchar[]).init);
return path.toWStringzThen!((wpath)
{
// GetFullPathNameW expects a sized buffer to store the result in. Since we don't
// know how large it has to be, we pass in null and get the needed buffer length
// as the return code.
const pathLength = GetFullPathNameW(&wpath[0],
0 /*length8*/,
null /*output buffer*/,
null /*filePartBuffer*/);
if (pathLength == 0)
{
return F((wchar[]).init);
}
// wpath is the UTF16 version of path, but to be able to use
// extended paths, we need to prefix with `\\?\` and the absolute
// path.
static immutable prefix = `\\?\`w;
// prefix only needed for long names and non-UNC names
const needsPrefix = pathLength >= MAX_PATH && (wpath[0] != '\\' || wpath[1] != '\\');
const prefixLength = needsPrefix ? prefix.length : 0;
// +1 for the null terminator
const bufferLength = pathLength + prefixLength + 1;
wchar[1024] absBuf = void;
wchar[] absPath = bufferLength > absBuf.length
? new wchar[bufferLength] : absBuf[0 .. bufferLength];
absPath[0 .. prefixLength] = prefix[0 .. prefixLength];
const absPathRet = GetFullPathNameW(&wpath[0],
cast(uint)(absPath.length - prefixLength - 1),
&absPath[prefixLength],
null /*filePartBuffer*/);
if (absPathRet == 0 || absPathRet > absPath.length - prefixLength)
{
return F((wchar[]).init);
}
absPath[$ - 1] = '\0';
// Strip null terminator from the slice
return F(absPath[0 .. $ - 1]);
});
}
/**********************************
* Converts a slice of UTF-8 characters to an array of wchar that's null
* terminated so it can be passed to Win32 APIs then calls the supplied
* function on it.
*
* Params:
* str = The string to convert.
*
* Returns:
* The result of calling F on the UTF16 version of str.
*/
private auto toWStringzThen(alias F)(const(char)[] str) nothrow
{
if (!str.length) return F(""w.ptr);
import core.stdc.string: strlen;
import core.stdc.stdlib: malloc, free;
import core.sys.windows.winnls: MultiByteToWideChar;
wchar[1024] buf;
// first find out how long the buffer must be to store the result
const length = MultiByteToWideChar(0 /*codepage*/, 0 /*flags*/, &str[0], cast(int)str.length, null, 0);
if (!length) return F(""w);
wchar[] ret = length >= buf.length
? (cast(wchar*)malloc(length * wchar.sizeof))[0 .. length + 1]
: buf[0 .. length + 1];
scope (exit)
{
if (&ret[0] != &buf[0])
free(&ret[0]);
}
// actually do the conversion
const length2 = MultiByteToWideChar(
0 /*codepage*/, 0 /*flags*/, &str[0], cast(int)str.length, &ret[0], cast(int)length);
assert(str.length == length2); // should always be true according to the API
// Add terminating `\0`
ret[$ - 1] = '\0';
return F(ret[0 .. $ - 1]);
}
}
version (Posix)
{
/**
Takes a callable F and applies it to the result of converting
`fileName` to an absolute file path (char*)
Params:
fileName = The file name to be converted to an absolute path
Returns: Whatever `F` returns.
*/
auto absPathThen(alias F)(const(char)[] fileName)
{
import core.sys.posix.stdlib: realpath, free;
char* absPath = fileName.toCStringThen!((fn) => realpath(&fn[0], null /* realpath allocates */));
scope(exit) free(absPath);
return F(absPath.toDString());
}
}
else
{
/**
Takes a callable F and applies it to the result of converting
`fileName` to an absolute file path (char*)
Params:
fileName = The file name to be converted to an absolute path
Returns: Whatever `F` returns.
*/
auto absPathThen(alias F)(const(char)[] fileName)
{
import core.sys.windows.winnls: WideCharToMultiByte;
import core.stdc.stdlib: malloc, free;
return fileName.extendedPathThen!((wpath) {
// first find out how long the buffer must be to store the result
const length = WideCharToMultiByte(0, // code page
0, // flags
&wpath[0],
-1, // wpath len, -1 is null terminated
null, // multibyte output ptr
0, // multibyte output length
null, // default char
null, // if used default char
);
if (!length) return F((char[]).init);
char[1024] buf = void;
scope multibyteBuf = length > buf.length
? (cast(char*)malloc(length * char.sizeof))[0 .. length]
: buf[0 .. length];
scope (exit)
{
if (multibyteBuf.ptr != buf.ptr)
free(multibyteBuf.ptr);
}
// now store the result
const length2 = WideCharToMultiByte(0, // code page
0, // flags
&wpath[0],
-1, // wpath len, -1 is null terminated
multibyteBuf.ptr,
length,
null, // default char
null, // if used default char
);
assert(length == length2);
return F(multibyteBuf[0 .. length - 1]);
});
}
}
|
D
|
/Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/Objects-normal/x86_64/RxTableViewSectionedAnimatedDataSource.o : /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Deprecated.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/TableViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/CollectionViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/IntegerType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/FloatingPointType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/String+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/UI+SectionedViewType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/AnimationConfiguration.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/ViewTransition.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxPickerViewAdapter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/DataSources.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Array+Extensions.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Modules/RxCocoa.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Modules/Differentiator.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxCocoa/RxCocoa-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/Differentiator/Differentiator-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxDataSources/RxDataSources-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/RxCocoa.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Headers/RxCocoa-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Headers/Differentiator-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Headers/RxSwift-Swift.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/unextended-module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxCocoa.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Differentiator.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/Objects-normal/x86_64/RxTableViewSectionedAnimatedDataSource~partial.swiftmodule : /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Deprecated.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/TableViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/CollectionViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/IntegerType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/FloatingPointType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/String+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/UI+SectionedViewType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/AnimationConfiguration.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/ViewTransition.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxPickerViewAdapter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/DataSources.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Array+Extensions.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Modules/RxCocoa.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Modules/Differentiator.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxCocoa/RxCocoa-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/Differentiator/Differentiator-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxDataSources/RxDataSources-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/RxCocoa.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Headers/RxCocoa-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Headers/Differentiator-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Headers/RxSwift-Swift.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/unextended-module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxCocoa.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Differentiator.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/Objects-normal/x86_64/RxTableViewSectionedAnimatedDataSource~partial.swiftdoc : /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Deprecated.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedReloadDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/TableViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/CollectionViewSectionedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxTableViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxCollectionViewSectionedAnimatedDataSource.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/IntegerType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/FloatingPointType+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/String+IdentifiableType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/UI+SectionedViewType.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/AnimationConfiguration.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/ViewTransition.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/RxPickerViewAdapter.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/DataSources.swift /Users/sunchuyue/Documents/test/RX_Product/Pods/RxDataSources/Sources/RxDataSources/Array+Extensions.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Modules/RxCocoa.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Modules/Differentiator.swiftmodule/x86_64.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Modules/RxSwift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RX.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxCocoa/RxCocoa-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/Differentiator/Differentiator-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxDataSources/RxDataSources-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/Target\ Support\ Files/RxSwift/RxSwift-umbrella.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/RxCocoa.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXObjCRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/RxCocoaRuntime.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXKVOObserver.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxCocoa/RxCocoa.framework/Headers/RxCocoa-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/Differentiator/Differentiator.framework/Headers/Differentiator-Swift.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Products/Debug-iphonesimulator/RxSwift/RxSwift.framework/Headers/RxSwift-Swift.h /Users/sunchuyue/Documents/test/RX_Product/Pods/RxCocoa/RxCocoa/Runtime/include/_RXDelegateProxy.h /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxDataSources.build/unextended-module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxCocoa.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Differentiator.build/module.modulemap /Users/sunchuyue/Documents/test/RX_Product/DerivedData/RX_Product/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RxSwift.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
class Outer
{
int m;
class Inner
{
int foo()
{
return m; // Ok to access member of Outer
}
}
}
void func()
{
int m;
class Inner
{
int foo()
{
return m; // Ok to access local variable m of func()
}
}
}
class Outer
{
int m;
static int n;
static class Inner
{
int foo()
{
return m; // Error, Inner is static and m needs a this
return n; // Ok, n is static
}
}
}
void func()
{
int m;
static int n;
static class Inner
{
int foo()
{
return m; // Error, Inner is static and m is local to the stack
return n; // Ok, n is static
}
}
}
class Outer
{
class Inner { }
static class SInner { }
}
void func()
{
class Nested { }
Outer o = new Outer; // Ok
Outer.Inner oi = new Outer.Inner; // Error, no 'this' for Outer
Outer.SInner os = new Outer.SInner; // Ok
Nested n = new Nested; // Ok
}
class Outer
{
int a;
class Inner
{
int foo()
{
return a;
}
}
}
int bar()
{
Outer o = new Outer;
o.a = 3;
Outer.Inner oi = o.new Inner;
return oi.foo(); // returns 3
}
class Outer
{
class Inner
{
Outer foo()
{
return this.outer;
}
}
void bar()
{
Inner i = new Inner;
assert(this == i.foo());
}
}
void test()
{
Outer o = new Outer;
o.bar();
}
|
D
|
/**
* C preprocessor
* Copyright: 2013 by Digital Mars
* License: $(LINK2 http://boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Walter Bright
*/
module cmdline;
import main;
import std.stdio;
import std.range;
import std.path;
import std.array;
import std.algorithm;
import core.stdc.stdlib;
/*********************
* Initialized with the command line arguments.
*/
struct Params
{
string[] sourceFilenames;
string[] outFilenames;
string depFilename;
string[] defines;
string[] includes;
string[] sysincludes;
bool verbose;
bool stdout;
}
/******************************************
* Parse the command line.
* Input:
* args arguments from command line
* Returns:
* Params filled in
*/
Params parseCommandLine(string[] args)
{
import std.getopt;
if (args.length == 1)
{
writeln(
"C Preprocessor
Copyright (c) 2013 by Digital Mars
http://boost.org/LICENSE_1_0.txt
Options:
filename... source file name(s)
-D macro[=value] define macro
--dep filename generate dependencies to output file
-I path path to #include files
--isystem path path to system #include files
-o filename preprocessed output file
--stdout output to stdout
-v verbose
");
exit(EXIT_SUCCESS);
}
Params p;
p.includes ~= ".";
getopt(args,
std.getopt.config.passThrough,
std.getopt.config.caseSensitive,
"include|I", &p.includes,
"define|D", &p.defines,
"isystem", &p.sysincludes,
"dep", &p.depFilename,
"output|o", &p.outFilenames,
"stdout", &p.stdout,
"v", &p.verbose);
// Fix up -Dname=value stuff. This will be superseded by
// D-Programming-Language/phobos#1779, but won't hurt even then.
for (size_t i = 1; i < args.length; )
{
if (!args[i].startsWith("-D"))
{
++i;
continue;
}
p.defines ~= args[i][2 .. $];
args = args.remove(i);
}
assert(args.length >= 1);
p.sourceFilenames = args[1 .. $];
if (p.outFilenames.length == 0)
{
/* Output file names are not supplied, so build them by
* stripping any .c or .cpp extension and appending .i
*/
foreach (filename; p.sourceFilenames)
{
string outname, ext = ".ii";
if (extension(filename) == ".c")
{
outname = baseName(filename, ".c");
ext = ".i";
}
else if ([".cpp", "cxx", ".hpp"].canFind(extension(filename)))
outname = baseName(filename, ".cpp");
else
outname = baseName(filename);
p.outFilenames ~= outname ~ ext;
}
}
/* Check for errors
*/
if (p.sourceFilenames.length == p.outFilenames.length)
{
// Look for duplicate file names
auto s = chain(p.sourceFilenames, p.outFilenames, (&p.depFilename)[0..1]).
array.
sort!((a,b) => filenameCmp(a,b) < 0).
findAdjacent!((a,b) => filenameCmp(a,b) == 0);
if (!s.empty)
{
err_fatal("duplicate file names %s", s.front);
}
}
else
{
err_fatal("%s source files, but %s output files", p.sourceFilenames.length, p.outFilenames.length);
}
return p;
}
unittest
{
auto p = parseCommandLine([
"dmpp",
"foo.c",
"-D", "macro=value",
"--dep", "out.dep",
"-I", "path1",
"-I", "path2",
"--isystem", "sys1",
"--isystem", "sys2",
"-o", "out.i"]);
assert(p.sourceFilenames == ["foo.c"]);
assert(p.defines == ["macro=value"]);
assert(p.depFilename == "out.dep");
assert(p.includes == [".", "path1", "path2"]);
assert(p.sysincludes == ["sys1", "sys2"]);
assert(p.outFilenames == ["out.i"]);
}
/***********************************
* Construct the total search path from the regular include paths and the
* system include paths.
* Input:
* includePaths regular include paths
* sysIncludePaths system include paths
* Output:
* paths combined result
* sysIndex paths[sysIndex] is where the system paths start
*/
void combineSearchPaths(const string[] includePaths, const string[] sysIncludePaths,
out string[] paths, out size_t sysIndex)
{
/* Each element of the paths may contain multiple paths separated by
* pathSeparator, so straighten that out
*/
auto incpaths = includePaths.map!(a => splitter(a, pathSeparator)).join;
auto syspaths = sysIncludePaths.map!(a => splitter(a, pathSeparator)).join;
/* Concatenate incpaths[] and syspaths[] into paths[]
* but remove from incpaths[] any that are also in syspaths[]
*/
paths = incpaths.filter!((a) => !syspaths.canFind(a)).array;
sysIndex = paths.length;
paths ~= syspaths;
}
unittest
{
string[] paths;
size_t sysIndex;
combineSearchPaths(["a" ~ pathSeparator ~ "b","c","d"], ["e","c","f"], paths, sysIndex);
assert(sysIndex == 3);
assert(paths == ["a","b","d","e","c","f"]);
}
|
D
|
/**
Convenience wrappers for executing subprocesses.
Copyright: © 2019 Arne Ludwig <arne.ludwig@posteo.de>
License: Subject to the terms of the MIT license, as written in the
included LICENSE file.
Authors: Arne Ludwig <arne.ludwig@posteo.de>
*/
module dalicious.process;
import std.algorithm :
endsWith,
filter;
import std.array : array;
import std.process :
kill,
Redirect,
Config,
pipeProcess,
pipeShell,
ProcessPipes,
wait;
import std.range.primitives;
import std.traits : isSomeString;
import vibe.data.json : toJson = serializeToJson;
import std.range.primitives :
ElementType,
isInputRange;
import std.traits : isSomeString;
import std.typecons : Flag, Yes;
import dalicious.log : LogLevel;
/**
Execute command and return the output. Logs execution and throws an
exception on failure.
Params:
command = A range that is first filtered for non-null values. The
zeroth element of the resulting range is the program and
any remaining elements are the command-line arguments.
workdir = The working directory for the new process. By default the
child process inherits the parent's working directory.
logLevel = Log level to log execution on.
Returns:
Output of command.
Throws:
std.process.ProcessException on command failure
*/
string executeCommand(Range)(
Range command,
const string workdir = null,
LogLevel logLevel = LogLevel.diagnostic,
)
if (isInputRange!Range && isSomeString!(ElementType!Range))
{
import std.process : Config, execute;
string output = command.executeWrapper!("command",
sCmd => execute(sCmd, null, // env
Config.none, size_t.max, workdir))(logLevel);
return output;
}
///
unittest
{
auto greeting = executeCommand(["echo", "hello", "world"]);
assert(greeting == "hello world\n");
}
/**
Execute shellCommand and return the output. Logs execution on
LogLevel.diagnostic and throws an exception on failure.
Params:
shellCommand = A range command that first filtered for non-null
values, then joined by spaces and then passed verbatim
to the shell.
workdir = The working directory for the new process. By default
the child process inherits the parent's
working directory.
logLevel = Log level to log execution on.
Returns:
Output of command.
Throws:
std.process.ProcessException on command failure
*/
string executeShell(Range)(
Range shellCommand,
const string workdir = null,
LogLevel logLevel = LogLevel.diagnostic,
)
if (isInputRange!Range && isSomeString!(ElementType!Range))
{
import std.algorithm : joiner;
import std.conv : to;
import std.process : Config, executeShell;
string output = shellCommand.executeWrapper!("shell",
sCmd => executeShell(sCmd.joiner(" ").to!string, null, // env
Config.none, size_t.max, workdir))(logLevel);
return output;
}
///
unittest
{
auto greeting = executeShell(["echo", "hello", "world", "|", "rev"]);
assert(greeting == "dlrow olleh\n");
}
/**
Execute script and return the output. Logs execution on
LogLevel.diagnostic and throws an exception on failure.
Params:
script = A range command that first filtered for non-null values and
escaped by std.process.escapeShellCommand. The output of
this script is piped to a shell in
[Unofficial Bash Strict Mode][ubsc], ie `sh -seu o pipefail`.
workdir = The working directory for the new process. By default the
child process inherits the parent's working directory.
logLevel = Log level to log execution on.
Returns:
Output of command.
Throws:
std.process.ProcessException on command failure
[ubsc]: http://redsymbol.net/articles/unofficial-bash-strict-mode/
*/
string executeScript(Range)(
Range script,
const string workdir = null,
LogLevel logLevel = LogLevel.diagnostic,
)
if (isInputRange!Range && isSomeString!(ElementType!Range))
{
import std.process : Config, executeShell;
string output = script.executeWrapper!("script",
sCmd => executeShell(sCmd.buildScriptLine, null, // env
Config.none, size_t.max, workdir))(logLevel);
return output;
}
///
unittest
{
auto greeting = executeScript(["echo", "echo", "rock", "&&", "echo", "roll"]);
assert(greeting == "rock\nroll\n");
}
private string executeWrapper(string type, alias execCall, Range)(Range command, LogLevel logLevel)
if (isInputRange!Range && isSomeString!(ElementType!Range))
{
import dalicious.log : logJson;
import std.array : array;
import std.algorithm :
filter,
map,
min;
import std.format : format;
import std.process : ProcessException;
import std.string : lineSplitter;
import vibe.data.json : Json;
auto sanitizedCommand = command.filter!"a != null".array;
logJson(
logLevel,
"action", "execute",
"type", type,
"command", sanitizedCommand.map!Json.array,
"state", "pre",
);
auto result = execCall(sanitizedCommand);
logJson(
logLevel,
"action", "execute",
"type", type,
"command", sanitizedCommand.map!Json.array,
"output", result
.output[0 .. min(1024, $)]
.lineSplitter
.map!Json
.array,
"exitStatus", result.status,
"state", "post",
);
if (result.status > 0)
{
throw new ProcessException(
format("process %s returned with non-zero exit code %d: %s",
sanitizedCommand[0], result.status, result.output));
}
return result.output;
}
private string buildScriptLine(in string[] command)
{
import std.process : escapeShellCommand;
return escapeShellCommand(command) ~ " | sh -seu o pipefail";
}
/**
Run command and returns an input range of the output lines.
*/
auto pipeLines(Range)(Range command, in string workdir = null)
if (isInputRange!Range && isSomeString!(ElementType!Range))
{
auto sanitizedCommand = command.filter!"a != null".array;
return new LinesPipe!ProcessInfo(ProcessInfo(sanitizedCommand, workdir));
}
/// ditto
auto pipeLines(in string shellCommand, in string workdir = null)
{
return new LinesPipe!ShellInfo(ShellInfo(shellCommand, workdir));
}
unittest
{
import std.algorithm : equal;
import std.range : only, take;
auto cheers = pipeLines("yes 'Cheers!'");
assert(cheers.take(5).equal([
"Cheers!",
"Cheers!",
"Cheers!",
"Cheers!",
"Cheers!",
]));
auto helloWorld = pipeLines(only("echo", "Hello World!"));
assert(helloWorld.equal(["Hello World!"]));
}
private struct ProcessInfo
{
const(string[]) command;
const(string) workdir;
}
private struct ShellInfo
{
const(string) command;
const(string) workdir;
}
private static final class LinesPipe(CommandInfo)
{
static enum lineTerminator = "\n";
private CommandInfo processInfo;
private ProcessPipes process;
private string currentLine;
this(CommandInfo processInfo)
{
this.processInfo = processInfo;
}
~this()
{
if (!(process.pid is null))
releaseProcess();
}
void releaseProcess()
{
if (!process.stdout.isOpen)
return;
process.stdout.close();
version (Posix)
{
import core.sys.posix.signal : SIGKILL;
process.pid.kill(SIGKILL);
}
else
{
static assert(0, "Only intended for use on POSIX compliant OS.");
}
process.pid.wait();
}
private void ensureInitialized()
{
if (!(process.pid is null))
return;
process = launchProcess();
if (!empty)
popFront();
}
static if (is(CommandInfo == ProcessInfo))
ProcessPipes launchProcess()
{
return pipeProcess(
processInfo.command,
Redirect.stdout,
null,
Config.none,
processInfo.workdir,
);
}
else static if (is(CommandInfo == ShellInfo))
ProcessPipes launchProcess()
{
return pipeShell(
processInfo.command,
Redirect.stdout,
null,
Config.none,
processInfo.workdir,
);
}
void popFront()
{
ensureInitialized();
assert(!empty, "Attempting to popFront an empty LinesPipe");
currentLine = process.stdout.readln();
if (currentLine.empty)
{
currentLine = null;
releaseProcess();
}
if (currentLine.endsWith(lineTerminator))
currentLine = currentLine[0 .. $ - lineTerminator.length];
}
@property string front()
{
ensureInitialized();
assert(!empty, "Attempting to fetch the front of an empty LinesPipe");
return currentLine;
}
@property bool empty()
{
ensureInitialized();
if (!process.stdout.isOpen || process.stdout.eof)
{
releaseProcess();
return true;
}
else
{
return false;
}
}
}
/**
Returns true iff `name` can be executed via the process function in
`std.process`. By default, `PATH` will be searched if `name` does not
contain directory separators.
Params:
name = Path to file or name of executable
searchPath = Determines wether or not the path should be searched.
*/
version (Posix) bool isExecutable(scope string name, Flag!"searchPath" searchPath = Yes.searchPath)
{
// Implementation is analogous to logic in `std.process.spawnProcessImpl`.
import std.algorithm : any;
import std.path : isDirSeparator;
if (!searchPath || any!isDirSeparator(name))
return isExecutableFile(name);
else
return searchPathFor(name) !is null;
}
version (Posix) private bool isExecutableFile(scope string path) nothrow
{
// Implementation is analogous to private function `std.process.isExecutable`.
import core.sys.posix.unistd : access, X_OK;
import std.string : toStringz;
return (access(path.toStringz(), X_OK) == 0);
}
version (Posix) private string searchPathFor(scope string executable)
{
// Implementation is analogous to private function `std.process.searchPathFor`.
import std.algorithm.iteration : splitter;
import std.conv : to;
import std.path : buildPath;
static import core.stdc.stdlib;
auto pathz = core.stdc.stdlib.getenv("PATH");
if (pathz == null) return null;
foreach (dir; splitter(to!string(pathz), ':'))
{
auto execPath = buildPath(dir, executable);
if (isExecutableFile(execPath))
return execPath;
}
return null;
}
|
D
|
module ext.opengl.gl_1_3;
import std.c.stdio, std.c.stdarg;
import ext.opengl.gl_1_0, ext.opengl.gl_1_1, ext.opengl.gl_1_2;
enum : GLenum{
GL_TEXTURE0 = 0x84C0,
GL_TEXTURE1 = 0x84C1,
GL_TEXTURE2 = 0x84C2,
GL_TEXTURE3 = 0x84C3,
GL_TEXTURE4 = 0x84C4,
GL_TEXTURE5 = 0x84C5,
GL_TEXTURE6 = 0x84C6,
GL_TEXTURE7 = 0x84C7,
GL_TEXTURE8 = 0x84C8,
GL_TEXTURE9 = 0x84C9,
GL_TEXTURE10 = 0x84CA,
GL_TEXTURE11 = 0x84CB,
GL_TEXTURE12 = 0x84CC,
GL_TEXTURE13 = 0x84CD,
GL_TEXTURE14 = 0x84CE,
GL_TEXTURE15 = 0x84CF,
GL_TEXTURE16 = 0x84D0,
GL_TEXTURE17 = 0x84D1,
GL_TEXTURE18 = 0x84D2,
GL_TEXTURE19 = 0x84D3,
GL_TEXTURE20 = 0x84D4,
GL_TEXTURE21 = 0x84D5,
GL_TEXTURE22 = 0x84D6,
GL_TEXTURE23 = 0x84D7,
GL_TEXTURE24 = 0x84D8,
GL_TEXTURE25 = 0x84D9,
GL_TEXTURE26 = 0x84DA,
GL_TEXTURE27 = 0x84DB,
GL_TEXTURE28 = 0x84DC,
GL_TEXTURE29 = 0x84DD,
GL_TEXTURE30 = 0x84DE,
GL_TEXTURE31 = 0x84DF,
GL_ACTIVE_TEXTURE = 0x84E0,
GL_CLIENT_ACTIVE_TEXTURE = 0x84E1,
GL_MAX_TEXTURE_UNITS = 0x84E2,
GL_NORMAL_MAP = 0x8511,
GL_REFLECTION_MAP = 0x8512,
GL_TEXTURE_CUBE_MAP = 0x8513,
GL_TEXTURE_BINDING_CUBE_MAP = 0x8514,
GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
GL_PROXY_TEXTURE_CUBE_MAP = 0x851B,
GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C,
GL_COMPRESSED_ALPHA = 0x84E9,
GL_COMPRESSED_LUMINANCE = 0x84EA,
GL_COMPRESSED_LUMINANCE_ALPHA = 0x84EB,
GL_COMPRESSED_INTENSITY = 0x84EC,
GL_COMPRESSED_RGB = 0x84ED,
GL_COMPRESSED_RGBA = 0x84EE,
GL_TEXTURE_COMPRESSION_HINT = 0x84EF,
GL_TEXTURE_COMPRESSED_IMAGE_SIZE = 0x86A0,
GL_TEXTURE_COMPRESSED = 0x86A1,
GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3,
GL_MULTISAMPLE = 0x809D,
GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
GL_SAMPLE_ALPHA_TO_ONE = 0x809F,
GL_SAMPLE_COVERAGE = 0x80A0,
GL_SAMPLE_BUFFERS = 0x80A8,
GL_SAMPLES = 0x80A9,
GL_SAMPLE_COVERAGE_VALUE = 0x80AA,
GL_SAMPLE_COVERAGE_INVERT = 0x80AB,
GL_MULTISAMPLE_BIT = 0x20000000,
GL_TRANSPOSE_MODELVIEW_MATRIX = 0x84E3,
GL_TRANSPOSE_PROJECTION_MATRIX = 0x84E4,
GL_TRANSPOSE_TEXTURE_MATRIX = 0x84E5,
GL_TRANSPOSE_COLOR_MATRIX = 0x84E6,
GL_COMBINE = 0x8570,
GL_COMBINE_RGB = 0x8571,
GL_COMBINE_ALPHA = 0x8572,
GL_SOURCE0_RGB = 0x8580,
GL_SOURCE1_RGB = 0x8581,
GL_SOURCE2_RGB = 0x8582,
GL_SOURCE0_ALPHA = 0x8588,
GL_SOURCE1_ALPHA = 0x8589,
GL_SOURCE2_ALPHA = 0x858A,
GL_OPERAND0_RGB = 0x8590,
GL_OPERAND1_RGB = 0x8591,
GL_OPERAND2_RGB = 0x8592,
GL_OPERAND0_ALPHA = 0x8598,
GL_OPERAND1_ALPHA = 0x8599,
GL_OPERAND2_ALPHA = 0x859A,
GL_RGB_SCALE = 0x8573,
GL_ADD_SIGNED = 0x8574,
GL_INTERPOLATE = 0x8575,
GL_SUBTRACT = 0x84E7,
GL_CONSTANT = 0x8576,
GL_PRIMARY_COLOR = 0x8577,
GL_PREVIOUS = 0x8578,
GL_DOT3_RGB = 0x86AE,
GL_DOT3_RGBA = 0x86AF,
GL_CLAMP_TO_BORDER = 0x812D,
}
/* 1.3 functions */
extern (System){
GLvoid function(GLenum) glActiveTexture;
GLvoid function(GLenum) glClientActiveTexture;
GLvoid function(GLenum, GLdouble) glMultiTexCoord1d;
GLvoid function(GLenum, GLdouble*) glMultiTexCoord1dv;
GLvoid function(GLenum, GLfloat) glMultiTexCoord1f;
GLvoid function(GLenum, GLfloat*) glMultiTexCoord1fv;
GLvoid function(GLenum, GLint) glMultiTexCoord1i;
GLvoid function(GLenum, GLint*) glMultiTexCoord1iv;
GLvoid function(GLenum, GLshort) glMultiTexCoord1s;
GLvoid function(GLenum, GLshort*) glMultiTexCoord1sv;
GLvoid function(GLenum, GLdouble, GLdouble) glMultiTexCoord2d;
GLvoid function(GLenum, GLdouble*) glMultiTexCoord2dv;
GLvoid function(GLenum, GLfloat, GLfloat) glMultiTexCoord2f;
GLvoid function(GLenum, GLfloat*) glMultiTexCoord2fv;
GLvoid function(GLenum, GLint, GLint) glMultiTexCoord2i;
GLvoid function(GLenum, GLint*) glMultiTexCoord2iv;
GLvoid function(GLenum, GLshort, GLshort) glMultiTexCoord2s;
GLvoid function(GLenum, GLshort*) glMultiTexCoord2sv;
GLvoid function(GLenum, GLdouble, GLdouble, GLdouble) glMultiTexCoord3d;
GLvoid function(GLenum, GLdouble*) glMultiTexCoord3dv;
GLvoid function(GLenum, GLfloat, GLfloat, GLfloat) glMultiTexCoord3f;
GLvoid function(GLenum, GLfloat*) glMultiTexCoord3fv;
GLvoid function(GLenum, GLint, GLint, GLint) glMultiTexCoord3i;
GLvoid function(GLenum, GLint*) glMultiTexCoord3iv;
GLvoid function(GLenum, GLshort, GLshort, GLshort) glMultiTexCoord3s;
GLvoid function(GLenum, GLshort*) glMultiTexCoord3sv;
GLvoid function(GLenum, GLdouble, GLdouble, GLdouble, GLdouble) glMultiTexCoord4d;
GLvoid function(GLenum, GLdouble*) glMultiTexCoord4dv;
GLvoid function(GLenum, GLfloat, GLfloat, GLfloat, GLfloat) glMultiTexCoord4f;
GLvoid function(GLenum, GLfloat*) glMultiTexCoord4fv;
GLvoid function(GLenum, GLint, GLint, GLint, GLint) glMultiTexCoord4i;
GLvoid function(GLenum, GLint*) glMultiTexCoord4iv;
GLvoid function(GLenum, GLshort, GLshort, GLshort, GLshort) glMultiTexCoord4s;
GLvoid function(GLenum, GLshort*) glMultiTexCoord4sv;
GLvoid function(GLdouble*) glLoadTransposeMatrixd;
GLvoid function(GLfloat*) glLoadTransposeMatrixf;
GLvoid function(GLdouble*) glMultTransposeMatrixd;
GLvoid function(GLfloat*) glMultTransposeMatrixf;
GLvoid function(GLclampf, GLboolean) glSampleCoverage;
GLvoid function(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, GLvoid*) glCompressedTexImage1D;
GLvoid function(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, GLvoid*) glCompressedTexImage2D;
GLvoid function(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei depth, GLint, GLsizei, GLvoid*) glCompressedTexImage3D;
GLvoid function(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, GLvoid*) glCompressedTexSubImage1D;
GLvoid function(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, GLvoid*) glCompressedTexSubImage2D;
GLvoid function(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, GLvoid*) glCompressedTexSubImage3D;
GLvoid function(GLenum, GLint, GLvoid*) glGetCompressedTexImage;
}
|
D
|
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/SQL.build/SQLDropTableBuilder.swift.o : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBind.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoinMethod.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSerializable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDataType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdate.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDelete.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBoolLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDefaultLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoin.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCollation.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKeyAction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLConnection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDirection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnDefinition.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDeleteBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsertBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLRawBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndexBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryFetcher.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIndexModifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBinaryOperator.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelect.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDistinct.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunctionArgument.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsert.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLGroupBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLOrderBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPrimaryKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/SQL.build/SQLDropTableBuilder~partial.swiftmodule : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBind.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoinMethod.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSerializable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDataType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdate.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDelete.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBoolLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDefaultLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoin.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCollation.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKeyAction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLConnection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDirection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnDefinition.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDeleteBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsertBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLRawBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndexBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryFetcher.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIndexModifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBinaryOperator.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelect.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDistinct.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunctionArgument.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsert.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLGroupBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLOrderBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPrimaryKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/SQL.build/SQLDropTableBuilder~partial.swiftdoc : /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBind.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoinMethod.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSerializable.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDataType.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdate.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDelete.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBoolLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDefaultLiteral.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraintAlgorithm.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLJoin.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectExpression.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCollation.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKeyAction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLConnection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDirection.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunction.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnDefinition.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLAlterTableBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLUpdateBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDeleteBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPredicateGroupBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelectBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsertBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLRawBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndexBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryBuilder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryEncoder.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQueryFetcher.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIndexModifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnIdentifier.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLError.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLBinaryOperator.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/Exports.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLSelect.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDistinct.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLFunctionArgument.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLTableConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLColumnConstraint.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLInsert.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLCreateIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLDropIndex.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLGroupBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLOrderBy.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLForeignKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLPrimaryKey.swift /Users/godemodegame/Desktop/ATMApp/.build/checkouts/sql.git-2678105727451989607/Sources/SQL/SQLQuery.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/ifaddrs-android.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/CNIODarwin.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/CNIOLinux.h /Users/godemodegame/Desktop/ATMApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CCryptoOpenSSL.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/godemodegame/Desktop/ATMApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module org.eclipse.swt.widgets.Caret;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.IME;
import java.lang.all;
/**
* Instances of this class provide an i-beam that is typically used
* as the insertion point for text.
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>(none)</dd>
* <dt><b>Events:</b></dt>
* <dd>(none)</dd>
* </dl>
* <p>
* IMPORTANT: This class is intended to be subclassed <em>only</em>
* within the SWT implementation.
* </p>
*
* @see <a href="http://www.eclipse.org/swt/snippets/#caret">Caret snippets</a>
* @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample, Canvas tab</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public class Caret : Widget {
Canvas parent;
int x, y, width, height;
bool moved, resized;
bool isVisible_;
Image image;
Font font;
LOGFONT* oldFont;
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* lists the style constants that are applicable to the class.
* Style bits are also inherited from superclasses.
* </p>
*
* @param parent a composite control which will be the parent of the new instance (cannot be null)
* @param style the style of control to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public this(Canvas parent, int style) {
super(parent, style);
this.parent = parent;
createWidget();
}
void createWidget() {
isVisible_ = true;
if (parent.getCaret() is null) {
parent.setCaret(this);
}
}
HFONT defaultFont() {
auto hwnd = parent.handle;
auto hwndIME = OS.ImmGetDefaultIMEWnd(hwnd);
HFONT hFont;
if (hwndIME !is null) {
hFont = cast(HFONT) OS.SendMessage(hwndIME, OS.WM_GETFONT, 0, 0);
}
if (hFont is null) {
hFont = cast(HFONT) OS.SendMessage(hwnd, OS.WM_GETFONT, 0, 0);
}
if (hFont is null)
return parent.defaultFont();
return hFont;
}
/**
* Returns a rectangle describing the receiver's size and location
* relative to its parent (or its display if its parent is null).
*
* @return the receiver's bounding rectangle
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Rectangle getBounds() {
checkWidget();
if (image !is null) {
Rectangle rect = image.getBounds();
return new Rectangle(x, y, rect.width, rect.height);
}
else {
if (!OS.IsWinCE && width is 0) {
int buffer;
if (OS.SystemParametersInfo(OS.SPI_GETCARETWIDTH, 0, &buffer, 0)) {
return new Rectangle(x, y, buffer, height);
}
}
}
return new Rectangle(x, y, width, height);
}
/**
* Returns the font that the receiver will use to paint textual information.
*
* @return the receiver's font
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Font getFont() {
checkWidget();
if (font is null) {
HFONT hFont = defaultFont();
return Font.win32_new(display, hFont);
}
return font;
}
/**
* Returns the image that the receiver will use to paint the caret.
*
* @return the receiver's image
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Image getImage() {
checkWidget();
return image;
}
/**
* Returns a point describing the receiver's location relative
* to its parent (or its display if its parent is null).
*
* @return the receiver's location
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Point getLocation() {
checkWidget();
return new Point(x, y);
}
/**
* Returns the receiver's parent, which must be a <code>Canvas</code>.
*
* @return the receiver's parent
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Canvas getParent() {
checkWidget();
return parent;
}
/**
* Returns a point describing the receiver's size.
*
* @return the receiver's size
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public Point getSize() {
checkWidget();
if (image !is null) {
Rectangle rect = image.getBounds();
return new Point(rect.width, rect.height);
}
else {
if (!OS.IsWinCE && width is 0) {
int buffer;
if (OS.SystemParametersInfo(OS.SPI_GETCARETWIDTH, 0, &buffer, 0)) {
return new Point(buffer, height);
}
}
}
return new Point(width, height);
}
/**
* Returns <code>true</code> if the receiver is visible, and
* <code>false</code> otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, this method
* may still indicate that it is considered visible even though
* it may not actually be showing.
* </p>
*
* @return the receiver's visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public bool getVisible() {
checkWidget();
return isVisible_;
}
bool hasFocus() {
return parent.handle is OS.GetFocus();
}
bool isFocusCaret() {
return parent.caret is this && hasFocus();
}
/**
* Returns <code>true</code> if the receiver is visible and all
* of the receiver's ancestors are visible and <code>false</code>
* otherwise.
*
* @return the receiver's visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see #getVisible
*/
public bool isVisible() {
checkWidget();
return isVisible_ && parent.isVisible() && hasFocus();
}
void killFocus() {
OS.DestroyCaret();
restoreIMEFont();
}
void move() {
moved = false;
if (!OS.SetCaretPos(x, y))
return;
resizeIME();
}
void resizeIME() {
if (!OS.IsDBLocale)
return;
POINT ptCurrentPos;
if (!OS.GetCaretPos(&ptCurrentPos))
return;
auto hwnd = parent.handle;
auto hIMC = OS.ImmGetContext(hwnd);
IME ime = parent.getIME();
if (ime !is null && ime.isInlineEnabled()) {
Point size = getSize();
CANDIDATEFORM lpCandidate;
lpCandidate.dwStyle = OS.CFS_EXCLUDE;
lpCandidate.ptCurrentPos = ptCurrentPos;
//lpCandidate.rcArea = new RECT ();
OS.SetRect(&lpCandidate.rcArea, ptCurrentPos.x, ptCurrentPos.y,
ptCurrentPos.x + size.x, ptCurrentPos.y + size.y);
OS.ImmSetCandidateWindow(hIMC, &lpCandidate);
}
else {
RECT rect;
OS.GetClientRect(hwnd, &rect);
COMPOSITIONFORM lpCompForm;
lpCompForm.dwStyle = OS.CFS_RECT;
lpCompForm.ptCurrentPos.x = ptCurrentPos.x;
lpCompForm.ptCurrentPos.y = ptCurrentPos.y;
lpCompForm.rcArea.left = rect.left;
lpCompForm.rcArea.right = rect.right;
lpCompForm.rcArea.top = rect.top;
lpCompForm.rcArea.bottom = rect.bottom;
OS.ImmSetCompositionWindow(hIMC, &lpCompForm);
}
OS.ImmReleaseContext(hwnd, hIMC);
}
override void releaseParent() {
super.releaseParent();
if (this is parent.getCaret())
parent.setCaret(null);
}
override void releaseWidget() {
super.releaseWidget();
parent = null;
image = null;
font = null;
oldFont = null;
}
void resize() {
resized = false;
auto hwnd = parent.handle;
OS.DestroyCaret();
auto hBitmap = image !is null ? image.handle : null;
int width = this.width;
if (!OS.IsWinCE && image is null && width is 0) {
int buffer;
if (OS.SystemParametersInfo(OS.SPI_GETCARETWIDTH, 0, &buffer, 0)) {
width = buffer;
}
}
OS.CreateCaret(hwnd, hBitmap, width, height);
OS.SetCaretPos(x, y);
OS.ShowCaret(hwnd);
move();
}
void restoreIMEFont() {
if (!OS.IsDBLocale)
return;
if (oldFont is null)
return;
auto hwnd = parent.handle;
auto hIMC = OS.ImmGetContext(hwnd);
OS.ImmSetCompositionFont(hIMC, oldFont);
OS.ImmReleaseContext(hwnd, hIMC);
oldFont = null;
}
/**
* Sets the receiver's size and location to the rectangular
* area specified by the arguments. The <code>x</code> and
* <code>y</code> arguments are relative to the receiver's
* parent (or its display if its parent is null).
*
* @param x the new x coordinate for the receiver
* @param y the new y coordinate for the receiver
* @param width the new width for the receiver
* @param height the new height for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setBounds(int x, int y, int width, int height) {
checkWidget();
bool samePosition = this.x is x && this.y is y;
bool sameExtent = this.width is width && this.height is height;
if (samePosition && sameExtent)
return;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
if (sameExtent) {
moved = true;
if (isVisible_ && hasFocus())
move();
}
else {
resized = true;
if (isVisible_ && hasFocus())
resize();
}
}
/**
* Sets the receiver's size and location to the rectangular
* area specified by the argument. The <code>x</code> and
* <code>y</code> fields of the rectangle are relative to
* the receiver's parent (or its display if its parent is null).
*
* @param rect the new bounds for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setBounds(Rectangle rect) {
if (rect is null)
error(SWT.ERROR_NULL_ARGUMENT);
setBounds(rect.x, rect.y, rect.width, rect.height);
}
void setFocus() {
auto hwnd = parent.handle;
HBITMAP hBitmap;
if (image !is null)
hBitmap = image.handle;
int width = this.width;
if (!OS.IsWinCE && image is null && width is 0) {
int buffer;
if (OS.SystemParametersInfo(OS.SPI_GETCARETWIDTH, 0, &buffer, 0)) {
width = buffer;
}
}
OS.CreateCaret(hwnd, hBitmap, width, height);
move();
setIMEFont();
if (isVisible_)
OS.ShowCaret(hwnd);
}
/**
* Sets the font that the receiver will use to paint textual information
* to the font specified by the argument, or to the default font for that
* kind of control if the argument is null.
*
* @param font the new font (or null)
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if the font has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setFont(Font font) {
checkWidget();
if (font !is null && font.isDisposed()) {
error(SWT.ERROR_INVALID_ARGUMENT);
}
this.font = font;
if (hasFocus())
setIMEFont();
}
/**
* Sets the image that the receiver will use to paint the caret
* to the image specified by the argument, or to the default
* which is a filled rectangle if the argument is null
*
* @param image the new image (or null)
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if the image has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setImage(Image image) {
checkWidget();
if (image !is null && image.isDisposed()) {
error(SWT.ERROR_INVALID_ARGUMENT);
}
this.image = image;
if (isVisible_ && hasFocus())
resize();
}
void setIMEFont() {
if (!OS.IsDBLocale)
return;
HFONT hFont;
if (font !is null)
hFont = font.handle;
if (hFont is null)
hFont = defaultFont();
auto hwnd = parent.handle;
auto hIMC = OS.ImmGetContext(hwnd);
/* Save the current IME font */
if (oldFont is null) {
oldFont = new LOGFONT;
if (!OS.ImmGetCompositionFont(hIMC, oldFont))
oldFont = null;
}
/* Set new IME font */
LOGFONT logFont;
if (OS.GetObject(hFont, LOGFONT.sizeof, &logFont) !is 0) {
OS.ImmSetCompositionFont(hIMC, &logFont);
}
OS.ImmReleaseContext(hwnd, hIMC);
}
/**
* Sets the receiver's location to the point specified by
* the arguments which are relative to the receiver's
* parent (or its display if its parent is null).
*
* @param x the new x coordinate for the receiver
* @param y the new y coordinate for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLocation(int x, int y) {
checkWidget();
if (this.x is x && this.y is y)
return;
this.x = x;
this.y = y;
moved = true;
if (isVisible_ && hasFocus())
move();
}
/**
* Sets the receiver's location to the point specified by
* the argument which is relative to the receiver's
* parent (or its display if its parent is null).
*
* @param location the new location for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLocation(Point location) {
checkWidget();
if (location is null)
error(SWT.ERROR_NULL_ARGUMENT);
setLocation(location.x, location.y);
}
/**
* Sets the receiver's size to the point specified by the arguments.
*
* @param width the new width for the receiver
* @param height the new height for the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSize(int width, int height) {
checkWidget();
if (this.width is width && this.height is height)
return;
this.width = width;
this.height = height;
resized = true;
if (isVisible_ && hasFocus())
resize();
}
/**
* Sets the receiver's size to the point specified by the argument.
*
* @param size the new extent for the receiver
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the point is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setSize(Point size) {
checkWidget();
if (size is null)
error(SWT.ERROR_NULL_ARGUMENT);
setSize(size.x, size.y);
}
/**
* Marks the receiver as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, marking
* it visible may not actually cause it to be displayed.
* </p>
*
* @param visible the new visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setVisible(bool visible) {
checkWidget();
if (visible is isVisible_)
return;
isVisible_ = visible;
auto hwnd = parent.handle;
if (OS.GetFocus() !is hwnd)
return;
if (!isVisible_) {
OS.HideCaret(hwnd);
}
else {
if (resized) {
resize();
}
else {
if (moved)
move();
}
OS.ShowCaret(hwnd);
}
}
}
|
D
|
/Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Exponential.o : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule
/Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Exponential~partial.swiftmodule : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule
/Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/Objects-normal/armv7/Exponential~partial.swiftdoc : /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Trigonometry.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/FFT.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Convolution.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Signal/Hilbert.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Power.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Sort.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Utilities.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Exponential.swift /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/Source/Complex.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/NumSwift/NumSwift.h /Users/DboyLiao/Works/Projects/lipsync_tools/mobile/NumSwift/NumSwift/DerivedData/NumSwift/Build/Intermediates/NumSwift.build/Debug-iphoneos/NumSwift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreImage.swiftmodule
|
D
|
prototype Mst_Default_OrcBiter(C_Npc)
{
name[0] = "Орочий кусач";
guild = GIL_WOLF;
aivar[AIV_MM_REAL_ID] = ID_OrcBiter;
level = 9;
attribute[ATR_STRENGTH] = 90;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 250;
attribute[ATR_HITPOINTS] = 250;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
damagetype = DAM_EDGE;
fight_tactic = FAI_SCAVENGER;
senses = SENSE_HEAR | SENSE_SEE | SENSE_SMELL;
senses_range = 3000;
aivar[AIV_MM_FollowTime] = 10;
aivar[AIV_MM_FollowInWater] = TRUE;
start_aistate = ZS_MM_AllScheduler;
aivar[AIV_MM_RestStart] = OnlyRoutine;
};
func void Set_OrcBiter_Visuals()
{
Mdl_SetVisual(self,"Scavenger.mds");
Mdl_ApplyOverlayMds(self,"Orcbiter.mds");
Mdl_SetVisualBody(self,"Sc2_Body",DEFAULT,DEFAULT,"",DEFAULT,DEFAULT,-1);
};
instance OrcBiter(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 90;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 250;
attribute[ATR_HITPOINTS] = 250;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
instance OrcBiter_Falk_01(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 190;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 750;
attribute[ATR_HITPOINTS] = 750;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
instance OrcBiter_Falk_02(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 190;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 750;
attribute[ATR_HITPOINTS] = 750;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
instance OrcBiter_Falk_03(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 190;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 750;
attribute[ATR_HITPOINTS] = 750;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
instance OrcBiter_Falk_04(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 190;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 750;
attribute[ATR_HITPOINTS] = 750;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
instance OrcBiter_Falk_05(Mst_Default_OrcBiter)
{
name[0] = "Орочий кусач";
aivar[AIV_Gender] = TRUE;
level = 9;
attribute[ATR_STRENGTH] = 190;
attribute[ATR_DEXTERITY] = 140;
attribute[ATR_HITPOINTS_MAX] = 750;
attribute[ATR_HITPOINTS] = 750;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
protection[PROT_BLUNT] = 125;
protection[PROT_EDGE] = 125;
protection[PROT_POINT] = 15;
protection[PROT_FIRE] = 20;
protection[PROT_FLY] = 30;
protection[PROT_MAGIC] = 10;
Set_OrcBiter_Visuals();
Npc_SetToFistMode(self);
};
|
D
|
//######################################################
//
// Dokumentation zum Skriptpaket "Ikarus"
// Autor : Sektenspinner
// Version : 1.1.4
//
//######################################################
/*
Inhalt
I. ) Abgrenzung
II. ) Voraussetzungen / Setup
1. Ikarus unter Gothic 2
2. Ikarus unter Gothic 1
3. Setup
III. ) Zu Grunde liegende Konzepte
1. Der Speicher, Adressen und Zeiger
2. Klassen
3. Nicht darstellbare primitive Datentypen
IV. ) Klassen
V. ) Funktionen
1. Elementarer Speicherzugriff
2. Parser Zeug
3. Sprünge
4. String Funktionen
5. Menü-Funktionen
6. Globale Instanzen initialisieren
7. Ini Zugriff
* 7.1. Tastenzuordnungen
8. Tastendrücke erkennen
9. Maschinencode ausführen
10. Enginefunktionen aufrufen
11. Externe Biblioteken
12. Verschiedenes
13. "Obskure" Funktionen
VI. ) Gefahren
VII. ) Beispiele
*/
//######################################
// I. Abgrenzung
//######################################
"Ikarus" ist eine Sammlung von Engine Klassen (bzw. ihrem Speicherbild)
und einigen Funktionen, die helfen mit diesen Klassen umzugehen. Ikarus
ist nützlich um jenseits der Grenzen von Daedalus aber innerhalb der
Grenzen der ZenGin zu arbeiten. Dadurch können einige sonst
unerreichbare Daten und Objekte ausgewertet und verändert werden,
darunter einige, die für Modder durchaus interessant sind. Ferner können
mit fortgesschrittenen Methoden auch Engine Funktionen aus den Skripten
heraus aufgerufen werden.
Ikarus eröffnet nur sehr begrenzte Möglichkeiten das Verhalten der
ZenGin selbst zu verändern.
//######################################
// II. Voraussetzungen / Setup
//######################################
Dieses Skriptpaket setzt ein Verständnis grundlegender
Programmierkonzepte und eine gute Portion Ausdauer und Forschungsgeist
voraus. Die meisten Klasseneigenschaften sind nicht dokumentiert, das
heißt oft muss man ausprobieren ob sie das tun, was man erwartet.
Das WoG-Editing Forum ist ein guter Ort um Erfahrungen mit den Klassen
und Eigenschaften auszutauschen, damit das Rad nicht ständig neu
erfunden werden muss.
//--------------------------------------
// 1.) Ikarus unter Gothic 2
//--------------------------------------
Dieses Skriptpaket ist nur auf einer Gothic 2 Reportversion lauffähig.
Auf anderen Gothic Versionen wird die Nutzung dieser Skripte zu
Abstürzen führen. Wer sich also dazu entscheidet, dieses Skriptpaket zu
verwenden, muss dafür sorgen, dass die Spieler der Mod ebenfalls die
Reportversion nutzen.
Neuere Reportversionen als 2.6.0.0 (zur Zeit bei Nico in Planung) werden
KEINE Probleme bereiten und werden voll mit diesem Paket kompatibel sein.
//--------------------------------------
// 2.) Ikarus unter Gothic 1
//--------------------------------------
Ikarus wurde ursprünglich nur für Gothic 2 erstellt. Mittlerweile ist
Ikarus aber relativ gut mit Gothic 1 in der Version 1.08k_mod (neuste
Playerkit-Version) lauffähig. Allerdings sind noch nicht alle Klassen an
Gothic 1 angepasst. Nicht angepasste Klassen tragen ein ".unverified" im
Namen. Zur Zeit (Stand September 2010) ist insbesondere zCMenuItem
fehlerhaft, weshalb auch diesbetreffende Ikarus Funktionen abstürzen
werden. oCAIHuman und zCCamera sind ebenfalls noch nicht angepasst.
Abgesehen davon sind mir keine Fehler bekannt.
//--------------------------------------
// 3.) Setup
//--------------------------------------
Ikarus besteht aus drei Teilen, Konstanten, Klassen und dem Ikarus-Kern,
die in genau dieser Reihenfolge geparst werden müssen. Der Ikarus-Kern
ist für Gothic 1 und 2 identisch und besteht aus der einzigen Datei
Ikarus.d. Für die Konstanten und Klassen gibt es dagegen jeweils eine
Gothic 1 und eine Gothic 2 Version von der natürlich jeweils genau die
richtige geparst werden muss. Ikarus nutzt einen C_NPC und muss daher
nach der C_NPC Klasse (nach der Datei classes.d) geparst werden. Andere
Abhängigkeiten gibt es nicht.
In der Konstantendatei gibt es ein paar Nutzervariablen mit denen unter
anderem die Debugausgabe von Ikarus geregelt wird.
Beispielsweise könnte man in einer Gothic 2 Installation die
Ikarus-Dateien in das Verzeichnis _intern packen und die Gothic.src so
verändern, dass sie folgendermaßen beginnt:
//******************
_INTERN\CONSTANTS.D
_INTERN\CLASSES.D
_INTERN\Ikarus_Const_G2.d
_INTERN\EngineClasses_G2\*.d
_INTERN\Ikarus.d
AI\AI_INTERN\AI_CONSTANTS.D
[...]
//******************
//######################################
// III. Zu Grunde liegende Konzepte
//######################################
Ich habe versucht den folgenden Text so zu schreiben, dass auch
programmiertechnisch Unbedarfte sich ein Bild davon machen können, worum
es hier geht. Das soll nicht heißen, dass programmiertechnisch
Unbedarfte das Paket nach lesen dieses Textes sofort effektiv nutzen
können. Aber ich wollte lieber etwas zu viel schreiben, als zu wenig.
Wer sich mit Programmieren auskennt sollte mindestens Punkt 1 und 2
problemlos überspringen können.
//--------------------------------------
// 1.) Der Speicher, Adressen und Zeiger
Der Speicher ist eine große Tabelle von Daten. Die Positionen in der
Tabelle werden durch Adressen benannt, also positive ganze Zahlen. An
jeder so identifizierten Speicherzelle steht ein Byte mit Daten (also
ein Wort, das aus 8 binären Ziffern (0 oder 1) besteht, zum Beispiel
00101010). Meistens erstreckt sich ein Datum (also eine Dateneinheit)
über mehrere zusammenhängende Speicherzellen, oft 4 Stück.
Wenn Gothic ausgeführt wird, liegt Gothic im Speicher herum. "Gothic"
ist im dem Fall sowohl das Programm selbst (der Maschinencode) als auch
die Daten auf denen Gothic arbeitet. Programm und Daten sind in
getrennten Bereichen (Segmenten), für die getrennte
Zugriffsberechtigungen gelten. Auf das Datensegment darf lesend und
schreibend zugegriffen werden und das ist auch das Segment mit dem sich
dieses Skriptpaket beschäftigt.
Während Gothic arbeitet, werden immer wieder neue Objekte angelegt und
nicht mehr benötigte Objekte zerstört, was es schwierig machen kann, ein
bestimmtes Objekt, sagen wir eine bestimmte Truhe zu finden, da man
nicht von vorneherein wissen kann, wo die Daten zu dieser Truhe im
Speicher aufbewahrt werden.
Ganz bestimmte Objekte kann man aber sehr leicht finden. Das sind
meistens sehr wichtige Objekte, die es nur einmal gibt (und irgendetwas
muss ja leicht zu finden sein, sonst könnte die Engine selbst ja gar
nicht arbeiten). Oft ist vereinbahrt, dass ein solches wichtiges Objekt
immer an einer ganz bestimmten Speicherstelle zu finden ist (man weiß
schon, wo man suchen muss, bevor man das Programm ausführt). In diesem
Fall, muss man nur auf die passende Speicherstelle zugreifen und hat die
Daten gefunden, die man will.
Wenn die Position des Objekts im Speicher nicht bekannt ist, gibt es
manchmal eine Stelle im Speicher, an der man die aktuelle Adresse des
Objekts nachschauen kann. Dann kann man das Objekt indirekt finden, in
dem man zunächst an einem wohlbekannten Ort nachschlägt, wo das Objekt
liegt und mit diesem Wissen anschließend darauf zugreift.
Vergleichbar ist das mit einem Buch: Angenommen wir suchen Kapitel 5.
Wenn wir wissen, dass Kapitel 5 auf Seite 42 anfängt, können wir das
Buch direkt richtig aufschlagen.
Im Allgemeinen wird es aber so sein, dass wir das nicht wissen (denn bei
verschiedenen Büchern sind die Kapitelanfänge im Allgemeinen auf
verschiedenen Seiten). Zum Glück gibt es die Vereinbahrung, dass das
Inhaltsverzeichnis immer am Anfang des Buches ist, das heißt wir können
das Inhaltsverzeichnis finden und dort nachschauen wo Kapitel 5 anfängt.
Mit diesem Wissen ist dann Kapitel 5 leicht zu finden.
Navigation im Speicher ist im Grunde genau dies: Von wenigen Objekten
ist bekannt, wo sie herumliegen. Sie dienen als eine Art
Inhaltsverzeichnis und beinhalten Verweise auf andere Objekte. Diese
Verweise nennt man auch Zeiger oder Pointer.
Beispiel:
An Speicherstelle 0xAB0884 (das ist hexadezimal für 11208836, also auch
nur eine Zahl) steht immer die Adresse das aktuellen oGame (das ist eine
Datensammlung, die wichtige Informationen zur aktuellen Spielsitzung
enthält). Wenn man diesem Verweis folgt, findet man also ein Objekt vom
Typ oCGame. Dieses Objekt beinhaltet verschiedene Eigenschaften, unter
anderem die Eigenschaft "world". Hier findet sich abermals eine Adresse,
die diesmal auf ein Objekt vom Typ oWorld zeigt. Hier findet sich
widerum ein Verweis auf einen zCSkyController_Outdoor, der hat unter
anderem eine Textur, die widerum Daten hat... So kann man sich nach und
nach vom großen Ganzen auf einen einzelnen Pixel am Himmel vorhangeln.
//--------------------------------------
// 2.) Klassen
Ich habe bereits von Objekten gesprochen, die Eigenschaften haben. Es
ist aber so, dass Speicher im Computer etwas unstrukturiertes,
"untypisiertes" ist. Man sieht einem Speicherbereich nicht an, ob es
sich bei seinem Inhalt zum Beispiel um eine Kommazahl, eine Zeichenkette
oder um Farbwerte handelt. Das heißt, selbst wenn man sich überlegt, was
man unter einem Baum, einer Truhe oder einem Npc versteht, muss man
genau festlegen in welcher Reihenfolge welche Daten abgelegt werden. Das
nennt man auch das Speicherlayout eines Objekts und wird in Daedalus als
Klasse notiert. Beispiel:
class cSandwich {
var cToast oben;
var cKäse käse;
var cToast unten;
};
Dies beschreibt eine Klasse, die drei Unterobjekte beinhaltet. Direkt am
Anfang der Klasse steht ein Objekt vom Typ cToast, dann kommt ein Objekt
vom Typ cKäse und dann noch ein Objekt vom Typ cToast. Leider kann man
das in Daedalus nicht so hinschreiben, sondern die Unterobjekte müssen
in primitive Typen heruntergebrochen werden. Wenn man verfolgt, was ein
cToast und cKäse ist, könnte man das Speicherbild von cSandwich
vielleicht so beschreiben:
class cSandwich {
//var cToast oben;
var int oben_bräunungsgrad;
var int oben_Gebuttert;
//var cKäse käse;
var string käse_name;
var int käse_fettgehalt;
//var cToast unten;
var int unten_bräunungsgrad;
var int unten_Gebuttert;
};
Wenn man ein konkretes Sandwich sw vorliegen hätte, könnte sw.käse_name
zum Beispiel "Edammer" sein und sw.unten_gebuttert könnte 1 sein, das
heißt der untere Toast wäre mit Butter bestrichen.
Mit dem Wissen, dass eine Ganzzahl (int) immer 4 Byte groß ist und ein
string immer 20 Byte, weiß man schon viel über die Klasse.
Angenommen, ein cSandwich stünde an Speicherposition 123452 (das heißt,
das Objekt beginnt dort), dann findet man an Position 123452 den Wert
"oben_bräunungsgrad", an Position 123456 den wert "oben_Gebuttert", an
Position 123460 die Zeichenkette "käse_name", an Position 123480 den
Wert "käse_fettgehalt" usw..
Auch wenn dieser Hintergrund nicht unbedingt notwendig ist, um dieses
Paket zu benutzen, halte ich es für nützlich dies zu verstehen.
//--------------------------------------
// 3.) Nicht darstellbare primitive Datentypen
Nicht alle primitiven Datentypen ("primitiv" heißt nicht weiter sinnvoll
zerteilbar) die die ZenGin kennt, sind in Daedalus auch verfügbar.
Deadalus kennt nur Ganzzahlen (int) und Zeichenketten (string). Das
heißt aber nicht, dass man mit anderen Datentypen nicht auch arbeiten
könnte, aber man muss darauf achten die Datentypen korrekt zu behandeln.
Ein bisschen ist das, als hätte man einen Chemieschrank und auf jeder
Flasche steht "Destilliertes Wasser", obwohl sich in bei weitem nicht
allen Flaschen genau das verbirgt. Die Chemikalien funktionieren
natürlich noch genauso gut, solange man weiß, was wirklich hinter den
Ettiketten steckt. Wenn man aber eine Säure behandelt, als wäre sie
Wasser, wird einen das Ettikett nicht eines besseren belehren und es
knallt (unter Umständen).
Das "Destillierte Wasser" ist in unserem Fall eine Ganzzahl, also ein
integer der Größe 32 bit. Alles was nicht gerade Zeichenkette ist, ist
in den Klassen dieses Pakets als solche Ganzzahl deklariert. Was sich
wirklich dahinter verbirgt, geht aus den Kommentaren hervor.
Einige wichtige Datentypen sind:
//##### int ######
Wenn es nicht nur als int deklariert ist, sondern auch im Kommentar
steht, dass es ein int ist, dann ist es ein int! Also eine gewöhnliche 4
Byte große Ganzzahl mit Vorzeichen.
//##### zREAL ####
Ein zREAL ist ein 4 Byte IEEE Float, oft mit "single" bezeichnet. Das
ist eine Gleitkommazahl mit der man in Daedalus normalerweise nicht
rechnen kann. Ich habe aber mal Funktionen geschrieben, die solche
Zahlen verarbeiten können:
http://forum.worldofplayers.de/forum/showthread.php?t=500080
Zum Beispiel bietet diese Skriptsammlung eine Funktion roundf, die einen
solchen zREAL in eine Ganzzahl umwandelt (rundet).
//##### zBOOL ####
(Sinnloserweise) auch 4 Byte groß. Ein zBOOL ist wie eine Ganzzahl, aber
mit der Vereinbahrung, dass nur zwischen "der Wert ist 0" und "der Wert
ist nicht 0" unterschieden wird. Ein zBOOL hat also die Bedeutung eines
Wahrheitswerts. 0 steht für falsch/unzutreffend, 1 steht für
wahr/zutreffend.
//##### zDWORD ####
Eine 4 Byte große Zahl ohne Vorzeichen. Das heißt die
Vergleichsoperationen <, <=, >, >= liefern mitunter falsche Ergebnisse,
da ein sehr großes zDWORD als negative Zahl interpretiert wird, obwohl
eine positive Zahl gemeint ist. Das sollte aber nur in Außnahmefällen
von Bedeutung sein, im Regelfall kann ein zDWORD behandelt werden wie
ein Integer, solange man nicht versucht negative Werte hineinzuschreiben.
//#### zCOLOR ####
Ein 4 Byte großes Speicherwort, bei dem jedes Byte für einen Farbkanal
steht: blau, grün, rot und alpha. Jeder Kanal ist also mit 8 bit
aufgelöst. Die Farbe "orange" würde als Hexadezimalzahl interpretiert so
aussehen:
0xFFFF7F00
blauer Kanal: 00, es ist kein Blauanteil in der Farbe.
grüner Kanal: 7F, also mittelstark vertreten
roter Kanal: FF, also so rot als möglich.
alpha Kanal: FF, also volle Opazität.
Die scheinbar umgekehrte Reihenfolge kommt daher, dass die
niederwertigen Bytes auch an den kleineren Adressen steht. Im Speicher
sieht die Farbe so aus:
Byte0: 00
Byte1: 7F
Byte2: FF
Byte3: FF
Siehe dazu auch "little Endian" z.B. in der Wikipedia.
//##### zVEC3 #####
Dies ist kein primitiver Datentyp, wird aber oft verwendet: Es ist ein
Trippel aus drei zREALs und stellt einen Vektor im dreidimensionalen
Raum dar. Deklariert habe ich solche zVEC3 in der Regel als integer
Arrays der Länge 3.
//## Zeigertypen ###
Ein Zeiger ist ein vier Byte großes Speicherwort und enthält die Adresse
eines anderen Objekts. In aller Regel weiß man von welchem Typ das
Objekt ist, auf das der Zeiger zeigt. Als Datentyp des Zeigers gibt man
den Datentyp des Objekts an, auf das gezeigt wird und versieht diesen
mit einem *. Nehmen wir mal an, wir treffen auf folgendes:
var int ptr; //cSandwich*
Dass ptr als Integer deklariert ist, soll uns nicht weiter stören, der
wahre Datentyp steht im Kommentar: Es ist (kein cSandwich aber) ein
Zeiger auf ein cSandwich (die Klasse aus dem vorherigen Abschnitt). Das
heißt, nimmt man den Wert von ptr her und interpretiert ihn als Adresse,
wird man an dieser Adresse ein cSandwich im Speicher vorfinden. An
folgenden Adressen ist also folgendes zu finden:
ptr + 0 : int oben_bräunungsgrad
ptr + 4 : int oben_Gebuttert
ptr + 8 : string käse_name
ptr + 28 : int käse_fettgehalt
ptr + 32 : int unten_bräunungsgrad
ptr + 36 : int unten_Gebuttert
(man beachte, dass ein Integer 4 Byte und ein String 20 Byte groß ist)
Es kann auch sein, dass ein Zeiger auf gar kein Objekt zeigt. Dann ist
sein Wert (als Zahl interpretiert) 0. Man spricht von einem Null-Zeiger.
Zum Beispiel könnte ein Zeiger auf die aktuelle Spielsitzung Null sein,
solange der Spieler noch im Hauptmenü ist und gar keine Sitzung
existiert.
Natürlich gibt es auch Zeiger auf Zeiger. Diese sind dann entsprechend
mit zusätzlichen Sternen gekennzeichnet.
//######################################
// IV. Die Klassen
//######################################
Die Klassen, die ich herausgesucht habe, sind bei weitem nicht alle
Klassen der Engine (es gibt viel mehr). Aber es sind die Klassen, von
denen ich glaube, dass sie für Modder am interessantesten sein können.
Ich habe versucht zu jeder Klasse unter dem Punkt "nützlich für" ein
Beispiel zu nennen, wofür man das Wissen über und den Zugriff auf diese
Klassen nutzen könnte. Vielleicht sind manche der genannten Sachen
schwieriger als ich vermute. Ich habe das meiste nämlich nicht
ausprobiert.
//########### oCGame #############
Hält Eigenschaften der Session und Referenzen auf zahlreiche globalen
Objekte, zum Beispiel die Welt oder den InfoManager. Einige
Einstellungen sind auch interessant.
Nützlich für:
-Marvin Modus an und ausschalten (game_testmode)
-Spiel pausieren (singleStep)
-Interface ausschalten wie mit toggle Desktop (game_drawall)
-uvm.
//##### oCInformationManager #####
Das Objekt, dass die Anzeige von Dialogen übernimmt. Kümmert sich zum
Beispiel darum, dass in den Views die passenden Dinge angezeigt werden.
Nützlich für:
-Diry Hacks mit isDone, z.B. um während eines Dialogs ein Dokument
anzuzeigen
-herausfinden, was im Dialog gerade passiert, z.B ob der Spieler gerade
eine Auswahl treffen muss.
-?
//######## oCInfoManager #########
Hält eine Liste aller Skript-Infos (oCInfo).
Nützlich für:
-?
//########## oCInfo ##############
In weiten Teilen schon in Daedalus bekannt. Zusätzlich ist eine Liste
von Choices erreichbar sowieso die Eigenschaft "told", die in Daedalus
über Npc_KnowsInfo gelesen werden kann.
Nützlich für:
-Choiceliste bearbeiten. Man könnte eine Funktion implementieren, die
nur selektiv eine Choice aus der Liste entfernt.
-Nach Choicewahl durch den Nutzer entscheiden, welche Choice gewählt
wurde, selbst wenn alle Choices die selbe Funktion benutzen (man kann
sich unbegrenzt viele Dialogoptionen zur Laufzeit überlegen).
-Einen nicht permanenten, schon erhaltenen Dialog wieder freischalten.
//######## oCInfoChoice ##########
Hält einen Beschreibungstext und den Symbolindex der Funktion, die
aufgerufen werden soll.
//#### oCMob und Unterklassen ####
Die verschiedenen Mobs sind aus dem Spacer bekannt. Besonders die
verschließbaren Mobs sind interessant.
Nützlich für:
-Das vom Spieler fokussierte Mob (oCNpc.focus_vob) bearbeiten, zum
Beispiel Truhen durch Zauber öffnen.
-Von Npc geöffnete Tür wieder verschließen.
//######## zCVob und oCNpc #######
Sind vollständig von Nico übernommen. Einen oCNpc vollständig zu kennen
hat dieses Skriptpaket erst möglich gemacht!
Nützlich für:
-Positionsdaten auslesen und verändern.
-Heldenfokus analysieren
-Zugriff auf einen ganzen Haufen anderer Dinge
//############ oCItem ############
Vobs mit bekannten Skripteigenschaften. Zusätzlich lässt die Eigenschaft
"instanz" auf die Skriptinstanz des Items schließen. "amount" (für
fallengelassenen Itemstapel) sollte nicht vergessen werden zu
berücksichtigen, wo nötig.
Nützlich für:
-Items für den Helden beim Tauchen aufheben
-Telekinese?
//######### zCCamera #############
Die Kamera eben. :-)
Aber Vorsicht: Die zCCamera ist kein zCVob. Sie hält aber eine Referenz
auf ein Hilfsvob (connectedVob).
Nützlich für:
-Positionsdaten ermitteln
-Screenblende einbauen (i.d.R. aber über VFX leichter möglich).
//##### zCMenu / zCMenuItem ######
Das Hauptmenü ist ein Menü. Der "Spiel starten" Button ist ein
Menüelement. Es gibt aber noch mehr Menüs (zum Beispiel das Statusmenü)
die ihrerseits Menüitems beinhalten.
Vorsicht: Zum Teil werden diese Objekte nur beim ersten mal erstellt und
dann im Speicher behalten (auch beim Laden eines anderen Savegames!) zum
Teil werden sie bei jeder Benutzung neu erzeugt.
Nützlich für:
-Charaktermenü überarbeiten (ziemlich fummlig)
-Speichern Menü-Item unter bestimmten Umständen deaktivieren
(Realisierung von Speicherpunkten / Speicherzonen).
//########## zCOption ############
Kapselt die Informationen der Gothic.ini und der [ModName].ini.
Funktionen um die Daten zu lesen und zu verändern stehen in Ikarus
bereit.
Nützlich für:
-Daten Sessionübergreifend festhalten (Lade / Speicherverhalten,
Schwierigkeitsgrad...)
-Einstellungen des Spielers lesen (zum Beispiel Sichtweite)
//########## zCParser ############
Der Parser ist nicht nur die Klasse, die beim Kompilieren der Skripte
meckert sondern auch eine virtuelle Maschine, die den kompilierten Code
ausführt. Der Parser hält zudem die Symboltabelle.
Nützlich für:
-Daedalus Code zur Laufzeit bearbeiten (Parser Stack).
//######## zCPar_Symbol ##########
Jedes logische Konstrukt (Variable, Instanz, Funktion, Klasse) wird über
ein Symbol identifiziert. Im Grunde sind alle diese Objekte der Reihe
nach durchnummeriert. Mit dieser Nummer erreicht man über die
Symboltabelle des Parsers diese Symbole. Ein Symbol hat einen Namen und
seinen Inhalt, der verschiedenen Typs sein kann.
Nützlich für:
-"call by reference"
-Funktionen anhand ihres Namens aufrufen
-Instance-Offsets bearbeiten.
//#### zCSkyController_Outdoor ####
Beinhaltet alles, was mit dem Himmel zu tun hat. Insbesondere die
Planeten (Sonne und Mond), eine Farbtabelle zur Beleuchtung (je nach
Tageszeit verschieden) (nicht aber die Lightmap selbst, die ist auf die
Polys verteilt) sowie aktuelle Regeneinstellungen.
Nützlich für:
-Regen starten
-Das Sonnenlicht umfärben
-Aussehen der Planeten (Sonne / Mond) ändern
//## zCTrigger und Unterklassen ###
zCTrigger, oCTriggerScript, oCTriggerChangeLevel und oCMover sind aus
dem Spacer bekannt. Jetzt kann man auch auf sie zugreifen.
Nützlich für:
-Ziel eines oCTriggerScripts verändern
-Triggerschleife bauen, die jeden Frame feuert, indem nach einem
Wld_SendTrigger die Eigenschaft _zCVob_nextOnTimer auf die aktuelle Zeit
gesetzt wird (siehe zTimer).
//####### zCWaynet und Co #########
Das zCWaynet beinhaltet eine Liste von allen zCWaypoints und allen
oCWays (das sind die roten Linien zwischen den Waypoints). zCWaypoints
sind keine Vobs, aber jeder zCWaypoint hat ein Hilfsvob in der Welt
(einen zCVobWaypoint), der auch wirklich ein Vob ist, aber sonst nichts
kann.
Jeder oCWay kennt die beiden beteiligten zCWaypoints zwischen denen er
verläuft und jeder zCWaypoints kennt alle oCWays, die von ihm ausgehen.
Nützlich für:
-?
//########### oWorld ##############
Hält neben dem Vobbaum, in dem alle Vobs enthalten sind auch Dinge wie
SkyController und Waynet. Außerdem gibt es neben dem sehr technischen
Bsp-Tree noch die activeVobList, die alle Vobs enthält die auf
irgendeine Art selbst aktiv sind. Das sind Npcs, Trigger usw. In jedem
Frame wird die activeVobList in die walkList kopiert. Die walkList wird
dann sequenziell durchlaufen.
Nützlich für:
-Objekte in der Welt suchen, zum Beispiel Npcs (voblist_npcs), items
(voblist_items), alle Vobs mit AI, z.B. auch Trigger (activeVobList)
-Mir ist es mit rumgehacke an activeVobList und walklist gelungen alles
außer den Helden einzufrieren und später zu reaktivieren
//######## zCZoneZFog #############
Fogzones sind Gebiete mit (möglicherweise farbigem) Nebel, der die
Sichtweite beeinflusst.
Nützlich für:
-evtl. mysteriöse Orte mit obskuren Farbwechseln
-möglicherweise automatische Sichtweiten Korrektur abhängig von der
Framerate
//####### VERSCHIEDENES ###########
//zCTree
Ein Knoten in einem Baum. Das kann ein innerer Knoten oder ein
Blattknoten sein.
Es gibt Zeiger auf das erste Kind, den linken und rechten
Geschwisterknoten sowie den Elternknoten.
Natürlich gibt es auch einen Zeiger auf die Daten.
Der Vobtree ist aus zCTrees aufgebaut.
//zCArray
Ein zCArray dient zur Verwaltung eines Felds von Daten. Das zCArray hat
einen Zeiger auf die Speicherzelle in der das Feld beginnt.
Die Daten sind in diesem Feld einfach aneinandergereit. Das zCArray
kennt zudem die Anzahl der Objekte im Feld (wichtig um nicht jenseits
des Feldendes zu lesen). Unter Umständen ist mehr Speicher alloziert als
das Feld gerade groß ist, daher kennt das zCArray neben der Größe des
Feldes auch die Größe des reservierten Speichers.
//zCArraySort
Wie ein Array, nur dass die Objekte immer auf bestimmte Art und Weise
geordnet sind (es sei denn, du machst diese Ordnung kaputt).
//zList
Sehr gewöhnungsbedürftige generische Liste, die mit der Eigenschaft
"next" des generischen Typs arbeitet. Kaum verwendet.
//zCList
Ein Listenelement. Beinhaltet den Zeiger auf genau ein Objekt (die
Daten) und einen Zeiger auf das nächste Listenelement.
//zCListSort
Wie ein Listenelement, nur dass die Gesamtheit der Listenelemente auf
bestimmte Art und Weise geordnet ist (es sei denn du machst diese
Ordnung kaputt).
//zCTimer
Man kann ablesen wie lange ein Frame braucht und es gibt Tuning
Parameter für minimale und maximale Framerate. Vorsicht. Hieran drehen,
kann dazu führen, dass das Spiel einfriert!
//oCWorldTimer
Enthält die Weltzeit (0 = 0:00, 6000000 = 24:00) und den aktuellen Tag.
//oCSpawnManager
Enthält ein Array aller im Moment gespawnter Npcs. Das Spawnen kann
ausgeschaltet werden (spawningEnabled). Die eigentlich interessanten
Werte, die insert und remove Reichweite sind statisch, ich habe die
Adressen dieser Werte über der Klasse angegeben.
//oCPortalRoom und oCPortalRoomManager
Der einzige oCPortalRoomManager der Welt kennt alle oCPortalRooms. Zudem
wird festgehalten in welchem Raum der Spieler gerade ist (curPlayerRoom)
und wo er vorher war (oldPlayerRoom).
Jeder oCPortalRoom hat einen Besitzer, eine Besitzergilde und einen
Namen.
//zCVobLight
Ein Licht. Es ist zu erwarten, dass der Bsp-Tree wissen muss, welche
Lichter welches Weltsegment betreffen. Daher ist nicht ganz klar, in
welchen Grenzen man zum Beispiel Lichter verschieben oder den
Leuchtradius vergrößern kann. Die Farbe des Lichtes lässt sich aber zum
Beispiel problemlos verändern.
//oCMag_Book
Wird genutzt um den Kreis über dem Spieler bei der Zauberauswahl
anzuzeigen. Außerdem enthält diese Klasse Zuordnungen von Zaubern <->
Items <-> Tasten.
//zString
Ein String. Da diese Klasse ein Daedalus-Primitiv ist, ist es in aller
Regel nicht nötig, auf die einzelnen Eigenschaften zuzugreifen. Ich habe
diese Eigenschaften allerdings gebraucht um Speicherallokation zu
implementieren.
//######################################
// V. Die Funktionen
//######################################
Ikarusfunktionen beginnen mit dem Präfix "MEM_". Das soll eine Kurzform
von "Memory" sein und neben der Zugehörigkeit zu Ikarus auch andeuten,
dass Eingriffe in den Speicher von Gothic stattfinden (und evtl.
entsprechende Vorsicht geboten ist).
Funktionen mit dem Präfix "MEMINT_" sind interne ("private") Funktionen
von Ikarus die nach außen hin keine sinnvolle Anwendungen haben oder
zumindest undokumentiert sind. Es ist nicht garantiert, dass solche
Funktionen in späteren Ikarus Versionen in dieser Form enthalten sein
werden.
Eine Ausnahme bilden Stringbearbeitungsfunktionen, die ein eigenes
Präfix "STR_" besitzen.
//######################################
// 1.) Elementarer Speicherzugriff
Lesen und schreiben von strings und integern ist mit folgenden
Funktionen möglich:
func int MEM_ReadInt (var int address)
func void MEM_WriteInt (var int address, var int val)
func string MEM_ReadString (var int address)
func void MEM_WriteString (var int address, var string val)
Wenn address <= 0 ist, wird ein Fehler ausgegeben. Andernfalls wird
versucht an dieser Adresse zu lesen bzw. zu schreiben.
Liegt die Adresse in einem ungültigen Bereich, zum Beispiel in einem
Codesegment, gibt es eine Zugriffsverletzung (Gothic stürzt ab).
Bei Stringoperationen ist es zudem nötig, dass an der angegebene Stelle
bereits ein gültiger zString steht. Wenn dort Unsinn steht, kann lesen
und schreiben gleichmaßen Gothic zum Absturz bringen.
Ein Beispiel für die Benutzung von MEM_WriteInt ist zum Beispiel
folgende Ikarus Funktion, mit der Debugmeldungen an und ausgeschaltet
werden können:
//******************
func void MEM_SetShowDebug (var int on) {
MEM_WriteInt (showDebugAddress, on);
};
//******************
Zudem sind zwei Bequemlichkeitsfunktionen implementiert:
func int MEM_ReadIntArray (var int arrayAddress, var int offset)
func int MEM_WriteIntArray (var int arrayAddress, var int offset, var
int value)
Diese Funktionen lesen / schreiben den Wert an Stelle arrayAddress + 4 *
offset. Beispielsweise könnte man folgendermaßen den i-ten Eintrag in
der activeVoblist der Welt lesen:
//----------------------
func int GetActiveVob (var int i) {
MEM_InitGlobalInst(); //MEM_World muss initialisiert sein
if (i >= MEM_World.activeVobList_numInArray)
|| (i < 0) {
//jenseits der Array Grenze
MEM_Error ("GetActiveVob: Lesen jenseits der Array Grenze!");
return 0;
};
//Den i-ten Eintrag aus der activeVobList holen:
return MEM_ReadIntArray (MEM_World.activeVobList_array, i);
};
//----------------------
Um auf einzelne Bytes zuzugreifen gibt es außerdem noch:
func int MEM_ReadByte (var int adr)
func void MEM_WriteByte (var int adr, var int val)
Hierbei wird nur das Byte an Adresse adr verändert, nicht etwa ein
ganzes vier Byte Wort. Das heißt, die drei Folgebytes bleiben unberührt.
Falls in MEM_WriteByte nicht 0 <= val < 256 gilt wird eine Warnung
ausgegeben, und val entsprechend zugeschnitten. Insbesondere sollten
keine negativen Zahlen übergeben werden.
//######################################
// 2.) Parser Zeug
Mit der Adresse eines Objekts allein kann man nur sehr unbequem auf die
Objekteigenschaften zugreifen.
Besser ist es, wenn eine Instanz auf das Objekt zeigt, und dann mit
"instanz.eigenschaft" auf eine beliebige Eigenschaft zugegriffen werden
kann.
Dazu gibt es folgende Funktionen:
func instance MEM_PtrToInst (var int ptr)
func void MEM_AssignInst (var int inst, var int ptr)
Im Prinzip sind beide für den selben Zweck geschaffen.
MEM_PtrToInst nimmt einen Zeiger entgegen und gibt eine Instanz zurück,
die in einer Zuweisung genutzt werden kann.
MEM_AssignInst nimmt eine Instanz (eigentlich den Symbolindex) und eine
Adresse entgegen und sorgt dafür, dass die Instanz auf ptr zeigt.
Als Merkregel: Folgende Formulierungen ist äquivalent:
1.) inst = MEM_PtrToInst (ptr);
2.) MEM_AssignInst (inst, ptr);
Dabei kann inst von beliebigem Objekttyp sein. ptr ist ein Adresse (als
integer).
Beispiel zur Benutzung:
//----------------------
func void somefunc() {
//Hole Helden
var oCNpc her;
her = Hlp_GetNpc (PC_HERO);
//Hat der Held ein Vob im Fokus?
if (!her.focus_vob) { return; };
//Lasse meinFocusVob auf her.focus_vob zeigen
var zCVob meinFocusVob;
meinFocusVob = MEM_PtrToInst (her.focus_vob);
//Nutze meinFocusVob, z.B. um Vobnamen auszugeben
Print (meinFocusVob._zCObject_objectName);
};
//----------------------
Die umgekehrte Funktion zu MEM_PtrToInst ist MEM_InstToPtr. Diese
Funktion gibt die Adresse des Objekts zurück, auf das die übergebene
Instanz zeigt.
func int MEM_InstToPtr (var instance inst)
Zum Beispiel liefert MEM_InstToPtr (hero) die Adresse des Helden im
Speicher.
Eine Funktion um eine Instanz auf das selbe Ziel wie eine andere Instanz
zeigen zu lassen ist folgende:
func instance MEM_CpyInst (var int inst)
Folgender Code ist äquivalent:
1.) selfCopy = MEM_CpyInst (self);
2.) selfCopy = MEM_PtrToInst (MEM_InstToPtr (self));
Anmerkung: Es gibt ein alias zu MEM_InstToPtr unter dem Namen
MEM_InstGetOffset.
Anmerkung: Instanzen eines Typs und "Variablen" eines Typs sind
gleichwertig. Im obigen Beispiel wäre es möglich gewesen "meinFocusVob"
außerhalb der Funktion als "instance meinFocusVob (zCVob);" zu
deklarieren.
Anmerkung: MEM_AssignInst und MEM_PtrToInst geben eine Warnung aus,
falls ptr == 0, weil eine Zuweisung eines Nullzeigers in vielen Fällen
nicht absichtlich passieren wird. Um ganz bewusst 0 zuzuweisen gibt es
MEM_AssignInstNull bzw. MEM_NullToInst. Die Benutzung dieser Funktionen
ist analog, der ptr Parameter entfällt allerdings.
Anmerkung: MEM_AssignInst kann im Gegensatz zu MEM_PtrToInst genutzt
werden um Instanzen in anderen Parsern zu verändern. In aller Regel ist
dies aber nicht nötig.
//******************
Nicht immer weiß man zur Kompilierzeit, wann man welche Funktion
aufrufen will. Wenn man zum Beispiel die Condition-Funktion eines Mobs
aufrufen will, das der Spieler im Fokus hat, ist man zur Kompilierzeit
ratlos, weil man nicht ahnen kann, welches Mob sich der Spieler
aussuchen wird. Ikarus stellt eine Möglichkeit zur Verfügung mit deren
Hilfe Funktionen anhand ihres Namens oder ihres Symbolindexes aufgerufen
werden können. Im Beispiel des Mobs, kann der Name der
Condition-Funktion einfach im Mob nachgeschaut werden.
Die Funktionen sind leicht zu benutzen und leicht zu erklären:
func void MEM_CallByString (var string fnc)
func void MEM_CallByID (var int ID)
MEM_CallByString ruft die Funktion mit Namen fnc auf, hierbei muss der
Name GROSSGESCHRIEBEN sein. MEM_CallByID ruft die Funktion mit
Symbolindex ID auf. An den Symbolindex einer Funktion kommt man mit zum
Beispiel mit MEM_FindParserSymbol oder MEM_GetFuncID (siehe unten).
MEM_CallByID ist schneller als MEM_CallByString und sollte bevorzugt
werden, wenn die selbe Funktion sehr oft aufgerufen werden muss.
Falls die aufzurufende Funktion Parameter hat, müssen diese zuvor auf
den Datenstack gelegt werden. Das geht mit den Funktionen:
func void MEM_PushIntParam (var int param)
func void MEM_PushStringParam (var string strParam)
func void MEM_PushInstParam (var int instance)
Die Parameter müssen in der richtigen Reihenfolge gepusht werden, von
links nach rechts.
Hat eine Funktion einen Rückgabewert sollte dieser nach Aufruf vom
Datenstack heruntergeholt werden, sonst können unter ungünstigen
Umständen Stacküberläufe entstehen (abgesehen davon will man den
Rückgabewert vielleicht einfach haben, weil er wichtige Informationen
enthält).
Dies geht mit den Funktionen:
func int MEM_PopIntResult()
func string MEM_PopStringResult()
func instance MEM_PopInstResult()
Siehe dazu Beispiel 5.
Anmerkung: Die genannten Funktionen funktionieren ohne Einschränkung
auch für Externals.
//******************
Ergänzend zum letzten Abschnitt:
func int MEM_GetFuncID(var func function)
Gibt den Symbolindex einer Funktion zurück, der zum Beispiel in
MEM_CallByID verwendet werden kann. Eine Funktion muss (bzgl der Parsing
Reihenfolge) noch nicht deklariert sein um an MEM_GetFuncID übergeben
werden zu können.
func void MEM_Call(var func function)
Äquivalent zu MEM_CallByID(MEM_GetFuncID(function)). Dies ermöglicht
zweierlei interessante Dinge: Zum einen ist es möglich dass sich zwei
Funktionen gegenseitig aufrufen (was sonst problematisch ist, weil
normalerweise eine Funktion deklariert sein muss, bevor sie aufgerufen
werden kann), zum anderen ist es möglich var func parameter sinnvoll zu
verwenden und somit modulare Algorithmen zu gestalten. Hier ein Beispiel:
//----------------------
func void DoTwice(var func f) {
/* Wir könnten direkt MEM_Call(f) verwenden.
* zu Demonstrationszwecken hier aber nochmal
* eine Zuweisung von Funktionen: */
var func g; g = f; //(*)
MEM_Call(g);
MEM_Call(g);
};
func void bar() {
DoTwice(foo); //gibt zwei mal "Hello" aus.
};
func void foo() {
Print("Hello");
};
//----------------------
Beachte:
- Klassenvariablen machen erhebliche Probleme. MEM_Call erlaubt es
nicht, beispielsweise die on_equip Funktion eines Items aufzurufen. Nur
gewöhnliche "var func" außerhalb von Klassen funktionieren.
- Gothic legt ein recht unsinniges Verhalten bei der Zuweisung von
Funktionen an den Tag. An Stelle (*) des obigen Beispiels wird nicht
etwa der Inhalt von f in g übertragen. Stattdessen wird der Symbolindex
von f in g geschrieben, das heißt, g verweist nun sozusagen auf f. Mit
diesem Verhalten kommt MEM_Call klar, MEM_Call wird folgende "Kette" von
Referenzen vorfinden und zurückverfolgen: MEM_Call.fnc -> DoTwice.g ->
DoTwice.f -> foo und wird schließlich foo aufrufen. Würden wir an Stelle
(*) allerdings ein "f = g;" einfügen wäre diese Kette zerstört und f und
g würden zyklisch aufeinander verweisen. MEM_Call würde in einer
Endlosschleife gefangen sein. Ich habe das hier an Beispielen diskutiert:
http://forum.worldofplayers.de/forum/threads/
969446-Skriptpaket-Ikarus-3/page11?p=17243175&viewfull=0#post17243175
//******************
func int MEM_FindParserSymbol (var string inst)
Kleines Nebenprodukt: Liefert den Index des Parsersymbols mit Namen inst
zurück, falls ein solches Symbol existiert. Falls keines existiert wird
eine Warnung ausgegeben und -1 zurückgegeben. Einen Schritt weiter geht
die Funktion:
func int MEM_GetParserSymbol (var string inst)
Sie sucht ebenfalls das Parsersymbol mit Namen inst, gibt aber nicht den
Index zurück sondern direkt einen Zeiger auf das passende zCPar_Symbol.
Existiert kein solches Symbol wird eine Warnung ausgegeben und 0
zurückgegeben.
So kann man Variablen anhand ihres Namens finden und bearbeiten.
Beispiel:
//----------------------
func void SetVarTo (var string variableName, var int value) {
var int symPtr;
symPtr = MEM_GetParserSymbol (variableName);
if (symPtr) { //!= 0
var zCPar_Symbol sym;
sym = MEM_PtrToInst (symPtr);
if ((sym.bitfield & zCPar_Symbol_bitfield_type)
== zPAR_TYPE_INT) {
sym.content = value;
} else {
MEM_Error ("SetVarTo: Die Variable ist kein Integer!");
};
} else {
MEM_Error ("SetVarTo: Das Symbol existiert nicht!");
};
};
func void foo() {
var int myVar;
SetVarTo ("FOO.MYVAR", 42); //äquivalent zu myVar = 42;
};
//----------------------
//######################################
// 3.) Sprünge
Rücksprünge sind sehr elegant möglich. Mithilfe zweier einfacher Zeilen
kann die aktuelle Position im Parserstack (darunter versteht man einen
maschinennahen Code der beim Kompilieren der Skripte erzeugt wird)
abgefragt und gesetzt werden. Wird die Position im Parserstack
verändert, so wird die Ausführung an dieser neuen Stelle fortgesetzt.
Beispiel: Folgender Code gibt die Zahlen von 0 bis 42 aus:
//----------------------
func void foo() {
/* Initialisierung */
MEM_InitLabels();
var int count; count = 0;
/* In label die Ausführungsposition festhalten. */
var int label;
label = MEM_StackPos.position;
/* <---- label zeigt jetzt hierhin,
* also auf die Stelle NACH der Zuweisung von label. */
Print (ConcatStrings ("COUNT: ", IntToString (count)));
count += 1;
if (count <= 42) {
/* Die Ausführungsposition ersetzen,
* bei dem "<-----" wird dann weitergemacht */
MEM_StackPos.position = label;
};
/* Ist 43 erreicht, wird die "Schleife" verlassen. */
};
//----------------------
Wichtig: MEM_InitLabels() muss nach dem Laden eines Spielstandes einmal
ausgeführt werden. Am einfachsten ist es, diese Funktion aus INIT_GLOBAL
aufzurufen. Erst nachdem diese Funktion aufgerufen wurde, kann korrekt
auf MEM_StackPos.position zugegriffen werden!
Anmerkung: MEM_InitLabels wird auch von der Funktion MEM_InitAll
aufgerufen.
Wichtig: Eigentlich selbstverständlich: Ein Label muss initialisiert
sein, bevor dorthin gesprungen werden kann! Vorwärtssprünge sind daher
im Allgemeinen schwierig, weil die Sprungstelle passiert wird, bevor das
Sprungziel passiert wird.
Wichtig: Labels sind nach Speichern und Laden ungültig. Das heißt ein
Label muss "sofort" verwendet werden. Ich wüsste aber sowieso keinen
Grund, weshalb man sich Labels für längere Zeit aufheben sollte.
Wichtig: Wer zwischen verschiedenen Funktionen hin und herspringt und
nicht weiß, was er tut, wird auf die Nase fallen. Wer mit Labels rechnet
und nicht weiß was er tut ebenfalls. Allgemeiner: Wer etwas anderes
macht als Zuweisungen der obigen Art, könnte auf die Nase fallen.
//######################################
// 4.) String Funktionen
//******************
func int STR_GetCharAt (var string str, var int pos)
Liefert das Zeichen am Offset pos im String str zurück (das heißt den
Zahlwert dieses Zeichens, wie man ihn in der ASCII-Tabelle findet). Die
Zählung beginnt bei 0. Zum Beispiel ist STR_GetCharAt ("Hello", 1) ==
101, weil 'e' an Position 1 ist und an Stelle 101 in der ASCII-Tabelle
steht.
//******************
func int STR_Len (var string str)
Liefert die Länge des Strings in Zeichen.
//******************
const int STR_GREATER = 1;
const int STR_EQUAL = 0;
const int STR_SMALLER = -1;
func int STR_Compare (var string str1, var string str2) {
Liefert STR_GREATER, wenn str1 lexikographisch nach str2 kommt und
entsprechend STR_SMALLER oder STR_EQUAL in den anderen Fällen. Beispiele:
STR_Compare ("A", "B") -> STR_SMALLER
STR_Compare ("ABC", "ABC") -> STR_EQUAL
STR_Compare ("AA","A") -> STR_GREATER
STR_Compare ("BA", "BB") -> STR_SMALLER
STR_Compare ("B", "a") -> STR_SMALLER
STR_Compare ("A", "") -> STR_GREATER
(zum vorletzen Beispiel ist zu bemerken, dass Großbuchstaben
ironischerweise "kleiner" als Kleinbuchstaben sind, so ist nunmal die
Reihenfolge in der ASCII-Tabelle)
//******************
func int STR_ToInt (var string str)
Konvertiert die String-Repräsentation einer Ganzzahl in einen Integer.
Etwa wird "42" in den Integer 42 umgewandelt.
Beispiele für gültige Strings:
1.) 42
2.) +42
3.) -42
Beispiele für ungültige Strings:
1.) ++42
2.) 42+
3.) 4.2
4.) HelloWorld
Im Fehlerfall wird eine Warnung ausgegeben und 0 zurückgegeben.
//******************
func string STR_SubStr (var string str, var int start, var int count)
Gibt den Teilstring von str zurück, der an Index start beginnt und count
Zeichen lang ist.
Beispiele:
STR_SubStr ("Hello World!", 0, 5): "Hello"
STR_SubStr ("Hello World!", 6, 5): "World"
Als Spezialfall davon ist folgende Funktion implementiert:
func string STR_Prefix (var string str, var int count)
STR_Prefix gibt den String zurück, der aus den ersten count Zeichen von
str besteht.
Dies entspricht dem Verhalten von STR_SubStr, mit start == 0.
//******************
func string STR_Upper(var string str)
Gibt eine Kopie von str zurück, bei der alle Kleinbuchstaben in die
entsprechenden Großbuchstaben verwandelt wurden. Die Behandlung ist
mindestens bei Umlauten fehlerhaft, entspricht aber dem Engineverhalten
(verwendet wird zString::ToUpper). ASCII Zeichen werden korrekt
behandelt.
//*********************
func int STR_SplitCount(var string str,
var string Seperator)
func string STR_Split (var string str,
var string Separator, var int index)
STR_Split ist dazu da, einen String dort in mehrere Strings aufzuteilen
wo ein bestimmtes Zeichen (der Separator) vorkommt.
Der Parameter Index gibt an, der wievielte String nach dieser Aufteilung
zurückgegeben werden soll.
Zum Beispiel lässt sich ein deutscher Satz in Worte aufteilen, in dem
der String an Leerzeichen aufgetrennt wird:
//----------------------
func void foo() {
var string str; str = "Das ist ein Satz.";
var string tok1; tok1 = STR_Split(str, " ", 0);
var string tok2; tok2 = STR_Split(str, " ", 1);
var string tok3; tok3 = STR_Split(str, " ", 2);
var string tok4; tok4 = STR_Split(str, " ", 3);
};
//----------------------
Am Ende der Funktion ist tok1 == "Das", tok2 == "ist", tok3 == "ein" und
tok4 == "Satz.".
Die Funktion STR_SplitCount gibt an, in wieviele Teile der String
zerfällt. Im Kontext der Funktion foo wäre STR_SplitCount(str, " ") == 4.
Beachte: Bei der Aufteilung können auch leere Strings entstehen. Zum
Beispiel zerfällt der String "..abc" in drei Strings, wenn als Separator
"." gewählt wird, nämlich in "", "" und "abc". Analog zerfällt der leere
String "" über jedem Separator in einen String, nämlich den leeren
String.
//*********************
func int STR_IndexOf(var string str, var string tok)
STR_IndexOf sucht den String tok im String str und gibt, falls tok in
str enthalten ist, den Index zurück bei dem das erste Auftreten von tok
beginnt und -1, falls tok nicht in str auftaucht.
Groß- und Kleinschreibung wird beachtet.
Beispiele:
//----------
STR_IndexOf("Hello World!", "Hell") == 0
STR_IndexOf("Hello World!", "World") == 6
STR_IndexOf("Hello World!", "Cake") == -1
STR_IndexOf("Hello World!", "") == 0
STR_IndexOf("Hello", "Hello World!") == -1
STR_IndexOf("hello Hell!", "Hell") == 6
STR_IndexOf("", "") == 0
//----------
//######################################
// 5.) Menü-Funktionen
Diese Funktionen sollen den Zugriff auf Menüelemente (zum Beispiel im
Charaktermenü) vereinfachen. Leider werden manche Menüs jedesmal neu
erzeugt (vom Skript aus), andere dagegen werden einmal erzeugt und dann
behalten. Problem: Ein Charaktermenü gibt es zum Beispiel erst, nachdem
es das erste mal geöffnet wurde, danach liegt es im Speicher.
Abhängig davon und von dem, was man eigentlich tun will, kann es
sinnvoll sein in den Menüskripten Änderungen einzubringen oder sich das
Menü als Objekt zu holen und in dem fertigen Objekt selbst
herumzuschmieren. Für letzteres gibt es hier eine Hilfestellung:
func int MEM_GetMenuByString (var string menu)
func int MEM_GetMenuItemByString (var string menuItem)
Liefert die Adresse des Menüs bzw. des Menüitems falls ein Menü bzw.
Menüitem mit diesem Namen existiert, Null sonst.
//######################################
// 6.) Globale Instanzen initialisieren
Das Skriptpaket führt folgende Instanzen ein:
instance MEM_Game (oCGame);
instance MEM_World (oWorld);
instance MEM_Timer (zCTimer);
instance MEM_WorldTimer (oCWorldTimer);
instance MEM_Vobtree (zCTree);
instance MEM_InfoMan (oCInfoManager);
instance MEM_InformationMan (oCInformationManager);
instance MEM_Waynet (zCWaynet);
instance MEM_Camera (zCCamera);
instance MEM_SkyController (zCSkyController_Outdoor);
instance MEM_SpawnManager (oCSpawnManager);
Die hier benutzten Klassen haben alle eines gemeinsam: Es gibt stehts
maximal ein Objekt von ihnen zur gleichen Zeit (es gibt z.B. nicht
gleichzeitig zwei Welten oder zwei Himmel).
Ich stelle eine Funktion zur Verfügung, die die Offsets dieser Instanzen
auf das entsprechende eindeutige Objekt setzt.
func void MEM_InitGlobalInst()
Nachdem MEM_InitGlobalInst aufgerufen wurde, können alle oben genannten
Instanzen genutzt werden. Nach dem Laden eines neue Spielstandes muss
MEM_InitGlobalInst() erneut aufgerufen werden!
Anmerkung: MEM_InitGlobalInst wird auch von der Funktion MEM_InitAll
aufgerufen.
//######################################
// 7.) Ini Zugriff
Ini Dateien haben folgende Form:
//----------------------
[mySection1]
myOption1=myValue1
myOption2=myValue2
[mySection2]
myOption1=myValue1
myOption2=myValue2
//----------------------
Literale in eckigen Klammern identifizieren Sektionen eindeutig.
Innerhalb von Sektionen werden Optionen mit eindeutigen Namen
identifiziert. Jede Option nimmt einen Wert an, der nach dem "="-Zeichen
steht. Da .ini Dateien keine Binärdateien sind, sind Sektionsnamen,
Optionsnamen und Werte alle vom Typ string.
In diesem Skriptpaket gibt es Funktionen, um lesend und schreibend auf
die Gothic.ini zuzugreifen, sowie um lesend auf die .ini Datei der Mod
zuzugreifen. Zum Lesen gibt es:
func string MEM_GetGothOpt (var string sectionname,
var string optionname)
func string MEM_GetModOpt (var string sectionname,
var string optionname)
MEM_GetGothOpt durchsucht die Gothic.ini, MEM_GetModOpt die .ini Datei
der Mod. Gesucht wird nach der Option optionname in der Sektion
sectionname. Falls eine solche Sektion mit einer solchen Option
existiert, wird der Wert dieser Option zurückgegeben. Ein leerer String
sonst.
Zudem habe ich Funktionen geschrieben, die die Existenz von Sektionen
und Optionen prüfen. Sie sollten selbsterklärend sein:
func int MEM_GothOptSectionExists (var string sectionname)
func int MEM_GothOptExists (var string sectionname,
var string optionname)
func int MEM_ModOptSectionExists (var string sectionname)
func int MEM_ModOptExists (var string sectionname,
var string optionname)
Um schreibend auf die Gothic.ini zuzugreifen, gibt es folgende Funktion:
func void MEM_SetGothOpt (var string section,
var string option,
var string value)
Dabei wird die Option option in der Sektion section auf den Wert value
gesetzt. Falls die Sektion und/oder Option nicht existiert, werden beide
im Zweifelsfall angelegt.
Die .ini Datei der Mod kann leider nicht beschrieben werden, da Gothic
Änderungen daran niemals auf die Festplatte zurückschreibt.
//BEACHTE:
-Falls du neue Optionen einführst gebietet der gute Stil, dass du dies
in einer eigenen Sektion tust und die Optionen verständlich benennst!
Als Norm schlage ich vor, dass eine Mod mit Namen "myMod" nur in der
Sektion "myMod" oder "MOD_mymod" neue Eigenschaften einführt (und nicht
etwa in der Sektion "GAME" oder "PERFORMANCE").
-Die Gothic.ini wird erst beim Verlassen von Gothic physikalisch
beschrieben. Falls Gothic abstürzt, kann es also sein, dass Änderungen
verloren gehen.
-Manche Änderungen werden erst nach einem Neustart von Gothic oder dem
Betreten/Verlassen des Menüs Wirkung zeigen.
//Nutzungsmöglichkeiten:
-In der .ini Datei der Mod könnten dem Spieler zusätzliche
Konfigurationsmöglichkeiten gegeben werden, etwa könnte man dort ein
bestimmtes Features abschalten können, falls absehbar ist, dass nicht
jeder Spieler es mögen wird.
-In der Gothic.ini könnte zum Beispiel der Schwierigkeitsgrad der Mod
hinterlegt sein, der sich dadurch auf alle Savegames auswirkt, und nicht
für jedes Savegame neu festgelegt werden muss.
-In der Gothic.ini könnte gespeichert sein, ob die Mod bereits
mindestens einmal durchgespielt wurde. So könnte das zweite mal
Durchspielen verschieden gestaltet werden.
-In der Gothic.ini könnten Highscores (evtl. zusammen mit idComputerName
gehasht zur Verifikation) hinterlegt sein.
-In der Gothic.ini könnten statistische Informationen festgehalten
werden, etwa wie oft ein Spieler (insgesamt oder in der letzten Zeit)
geladen hat. Denkbar wäre ein System, dass den Schwierigkeitsgrad
drosselt, falls der Spieler sehr oft in kurzen Abständen stirbt.
-uvm.
//Anmerkung:
-Menüelemente bringen von Haus aus die Möglichkeit mit Änderungen an
Gothic.ini Eigenschaften vorzunehmen. Es ist daher leicht eine weitere
Einstellungsmöglichkeit ins Gothic Menü aufzunehmen und Änderungen
direkt aus der Gothic.ini (und nicht etwa aus dem Menüitem) auszulesen.
//********************************
// 7.1.) Tastenzuordnungen
In der Gothic.ini steht die Zuordnung von physikalischen Tasten (zum
Beispiel "W") zu logischen Tasten (zum Beispiel "keyUp", also nach vorne
laufen).
Es ist etwas trickreich die Information in der dortigen Formatierung zu
verstehen, daher gibt es folgende Funktionen:
func int MEM_GetKey (var string name)
func int MEM_GetSecondaryKey(var string name)
Beide erwarten den Namen einer logischen Taste (zum Beispiel "keyUp"
oder "keyInventory"). Zurückgegeben wird die Erst- bzw. Zweitbelegung
der Taste. Falls die logische Taste nicht bzw. nicht ein zweites mal
zugewiesen wurde, wird entsprechend 0 zurückgegeben, sonst der
entsprechende Tastencode, wie er in Ikarus_Const.d zu finden ist. Dieser
Tastencode kann dann zum Beispiel als Parameter für MEM_KeyPressed oder
MEM_KeyState dienen.
Beispiel: Um zu erkennen, dass der Spieler die Inventartaste drückt,
würde es genügen, sehr häufig (am besten jeden Frame) zu prüfen:
MEM_KeyPressed(MEM_GetKey ("keyInventory"))
|| MEM_KeyPressed(MEM_GetSecondaryKey("keyInventory"))
//######################################
// 8.) Tastendrücke erkennen
Eine einfache Funktion ist folgende:
func int MEM_KeyPressed(var int key)
Liefert 1, falls die Taste gedrückt ist, die zu dem virtuellen
Tastencode key gehört. Die Tastencodes sind in Ikarus_Const.d zu finden.
Mit MEM_KeyPressed(KEY_RETURN) kann man zum Beispiel abfragen ob die
ENTER Taste gedrückt ist.
//######################
Häufig wird man in einer Triggerschleife einem Tastendruck auflauern
wollen. Oft möchte man dabei nur einmal auf einen Tastendruck reagieren,
auch wenn der Spieler die Taste für eine bestimmt Zeitspanne festhält.
Dann ist es nötig zu unterscheiden, ob die Taste gerade neu gedrückt
wurde oder bloß noch gehalten wird. Dafür gibt es die Funktion:
func int MEM_KeyState(var int key)
Sie zieht neben der Tatsache, ob eine Taste tatsächlich gedrückt ist
oder nicht, auch noch in Betracht, was das letzte mal für diese Taste
zurückgegeben wurde. Es gibt die folgende Rückgabewerte:
KEY_UP: Die Taste ist nicht gedrückt und war auch vorher nicht gedrückt.
("nicht gedrückt")
KEY_PRESSED: Die Taste ist gedrückt und war vorher nicht gedrückt. ("neu
gedrückt")
KEY_HOLD: Die Taste ist gedrückt und war auch vorher gedrückt. ("immer
noch gedrückt")
KEY_RELEASED: Die Taste ist nicht gedrückt und war vorher gedrückt.
("losgelassen")
KEY_PRESSED oder KEY_RELEASED werden also zurückgeben, wenn sich der
Zustand der Taste seit der letzten Abfrage geändert hat.
KEY_UP oder KEY_HOLD werden zurückgegeben, wenn sich der Zustand nicht
geändert hat.
Beachte: Wenn sich der Tastenzustand zwischen zwei Abfragen zweimal
ändert (zum Beispiel die Taste ganz schnell gedrückt und wieder
losgelassen wird), dann wird MEM_KeyState das nicht bemerken. Die
Funktion kann nur zu den Zeitpunkten an denen sie aufgerufen wird den
Tastenzustand überprüfen.
Beachte auch: Die Funktion wird nie zweimal direkt hintereinander
KEY_PRESSED zurückgeben. Ein Aufruf von MEM_KeyState wird also die
Rückgabewerte von späteren Aufrufen verändern. Folgendes ist zum
Beispiel FALSCH FALSCH FALSCH:
//------ SO NICHT! -----
if (MEM_KeyState (KEY_RETURN) == KEY_UP) {
Print ("Die Taste ist oben!");
} else if (MEM_KeyState (KEY_RETURN) == KEY_PRESSED) {
Print ("Die Taste wurde gerade gedrückt!");
};
//----------------------
Der else if Block wird niemals betreten werden. Wenn die Taste gerade
gedrückt wird, wird KEY_PRESSED nur in der ersten if-Abfrage auftauchen
und ist dann "verbraucht". Die zweite if-Abfrage bekommt dann nur noch
KEY_HOLD ab.
So ist es besser:
//----------------------
var int returnState;
returnState = MEM_KeyState (KEY_RETURN);
if (returnState == KEY_UP) {
Print ("Die Taste ist oben!");
} else if (returnState == KEY_PRESSED) {
Print ("Die Taste wurde gerade gedrückt!");
};
//----------------------
Wenn mehrere Events auf die gleiche Taste hören, konkurrieren sie also
auch um die KEY_PRESSED Rückgabewerte!
//######################
Eine Funktion zum simulieren von Tastendrücken ist:
func void MEM_InsertKeyEvent(var int key)
In manchen Fällen wird die Engine (im nächsten Frame) so reagieren, als
wäre die Taste gedrückt, die mit dem virtuellen Tastencode key in
Verbindung steht. Zum Beispiel öffnet MEM_InsertKeyEvent(KEY_ESC) das
Hauptmenü oder schließt geöffnete Dokumente und
MEM_InsertKeyEvent(KEY_TAB) öffnet das Inventar, falls die Einstellungen
des Spielers TAB als Taste für das Inventar vorsieht.
In anderen Fällen funktioniert diese Funktion nicht, zum Beispiel ist es
nicht möglich das Inventar auf diese Weise zu schließen.
Das klingt nicht nur willkürlich sondern ist auch so. Das Problem ist,
dass die Engine auf verschiedene Arten und Weise abfragen kann ob eine
Taste gedrückt wurde und nur eine dieser Varianten auf
MEM_InsertKeyEvent "hereinfällt". Was zum Beispiel funktioniert hat:
-Inventar öffnen. (TAB)
-Charaktermenü öffnen (C)
-Pause togglen / Quickload (F9)
-Tagebuch-Öffnen (L)
-Hauptmenü öffnen / Dokument schließen (ESC)
Beachte: Verschiedene Spieler nutzen verschiedene Tasten für bestimmte
Aktionen! Es ist aber möglich mit MEM_GetGothOpt an die Einstellungen
(Gothic.ini) heranzukommen. Hier sind ein oder zwei Tasten als
Hexadezimalstring (Vorsicht: Little Endian!) für die einzelnen Aktionen
registriert.
//######################################
// 9.) Maschinencode ausführen
Unter Maschinencode versteht man ein Programm oder ein Programmstück,
dass in Maschinensprache vorliegt, das heißt ohne weiteren
Übersetzungsschritt direkt von einem Prozessor ausgeführt werden kann.
Die für uns relevante Maschinensprache ist die zur x86
Prozessorarchitektur gehörige. Alle Maschinenbefehle, was sie tun und
wie sie in Maschinensprache kodiert sind, kann man in den Intel
Handbüchern nachlesen.
http://www.intel.com/products/processor/manuals/index.htm
In der Praxis wird man mit sehr wenigen Befehlen auskommen und nur in
seltenen Fällen (abstrakte) Maschinenbefehle von Hand in (konkreten)
Maschinencode übersetzen wollen, weil das sehr mühseelig ist.
Um technische Dinge zu tun, die sich in Daedalus nicht hinschreiben
lassen, kann aber Maschinencode nützlich sein. Zum Beispiel nutzen die
CALL Funktionen (siehe unten) als Basis den ASM Funktionensatz.
Bemerkung: Die Funktionen tragen das Präfix "ASM_" für
Assembler(sprache). Assemblersprache ist eine menschenlesbare Sprache
mit eins-zu-eins Entsprechungen zur Maschinensprache. Strenggenommen ist
das "ASM_" Präfix daher fehlleitend, da es hier um Maschinencode und
nicht um Assemblersprache geht. Gedanklich ist beides aber nah verwandt.
Hinweis: Ich empfehle jedem, der nicht plant, die Funktionen aus diesem
Kapitel zu nutzen, dieses Kapitel zu überspringen. Die Funktionen in
diesem Kapitel sind sehr speziell und sehr technisch.
Wer nur Engine Funktionen aufrufen will, kann sich direkt den "CALL_"
Funktionen zuwenden. Die "ASM_" Funktionen sind sehr unhandlich, und nur
mit Intel Referenz oder einer anderen Wissensquelle über Maschinencode
sinnvoll benutzbar.
//Grundlegende Funktionsweise
Über die Funktion
func void ASM (var int data, var int length)
ist es möglich nach und nach Maschinencode zu diktieren. Die ersten
length Bytes von data (maximal aber 4!) werden an den bereits zuvor
diktierten Teil angehängt. So entsteht Stück für Stück ein vom Prozessor
ausführbares Programmstück.
Es stehen als kompaktere Schreibweise die Funktionen
func void ASM_1 (var int data) { ASM (data, 1); };
func void ASM_2 (var int data) { ASM (data, 2); };
func void ASM_3 (var int data) { ASM (data, 3); };
func void ASM_4 (var int data) { ASM (data, 4); };
zur Verfügung. Einzelne Maschinenbefehle können durchaus eine Kodierung
besitzen, die länger als 4 Byte ist, in diesen Fällen muss diese eben
Stück für Stück diktiert werden. In der Regel gibt es aber eine logische
Aufteilung in Blöcke die höchstens 4 Byte groß sind (und damit in einen
Integer hineinpassen).
Um ein fertig diktiertes Stück Maschinencode auszuführen gibt es die
Funktion
func void ASM_RunOnce()
Diese führt den bis zu diesem Zeitpunkt diktierten Code aus, ähnlich wie
eine externe Funktion ausgeführt wird. Der ausgeführte Code wird danach
freigegeben, und neuer Code kann diktiert werden.
Anmerkung: Der diktierte Code wird im Datensegment ausgeführt. Falls die
Datenausführungsverhinderung von Windows für Gothic aktiv ist (das wäre
äußerst ungewöhnlich) wird eine Schutzverletzung auftreten und Windows
wird Gothic beenden.
Anmerkung: Wie man sieht kann es zu jedem Zeitpunkt nur maximal ein
angefangenes Diktat von Maschinencode geben. Es ist nicht möglich zwei
verschiedene Sequenzen von Maschinencode gleichzeitig aufzubauen.
Anmerkung: Das System ist nicht robust gegenüber Lade und
Speicheroperationen. Es ist daher nicht nur unsinnig sondern auch
unzulässig ein angefangenes Diktat über einen oder mehrere Frames hinweg
liegen zu lassen. Ein Diktat ist abgeschlossen, wenn es durch einen
Aufruf von ASM_RunOnce oder ASM_Close beendet wurde.
//aktuelle Codeposition
Zum Beispiel bei Jumps und Calls kann es notwendig sein die Adresse des
gerade ausgeführten Codes zu kennen. Die Funktion
func int ASM_Here()
liefert sozusagen die Adresse des Cursors, das heißt die Adresse der
Stelle, die als nächtes durch einen Aufruf von ASM beschrieben werden
wird. Es ist garantiert, dass die Stelle an der der Code geschrieben
wird auch die Stelle ist, an der er ausgeführt wird.
//allozierter Speicher
Der Speicher in dem der Maschinencode steht, wird zu Beginn des Diktats
alloziert. Falls keine spezielle Größe spezifiziert wird, das heißt,
falls das Diktat direkt mit ASM oder ASM_Here beginnt, so werden 256
Bytes alloziert. Für einfache Anwendungen ist dies oft ausreichend.
Wird mehr Speicher benötigt, muss dies explizit zu Beginn des Diktats
angekündigt werden. Dazu wird das Diktat mit dem speziellen Befehl
func void ASM_Open(var int space)
eingeleitet. space soll hierbei die Größe des zu reservierenden
Speicherbereichs in Byte behinhalten.
//Performance
Falls eine Funktion mehrmals in kurzer zeitlicher Abfolge benötigt wird,
kann es sinnvoll sein, sie nicht für jeden Aufruf von neuem zu
diktieren. Es ist möglich ein Diktat von Maschinencode nicht mit
ASM_RunOnce sondern stattdessen mit
func int ASM_Close()
zu beenden. Diese Funktion beendet das Diktat (sodass ein neues beginnen
kann) und gibt einen Zeiger auf einen Speicherbereich zurück, der den
diktierten Maschinencode enthält. Dieser Zeiger kann nun jederzeit und
beliebig oft an
func void ASM_Run(var int ptr)
übergeben werden, damit der Maschinencode ausgeführt wird.
Doch Vorsicht: Der durch ASM_Close erhaltene Speicherbereich muss über
MEM_Free manuell freigegeben werden um Speicherlecks zu vermeiden.
Vermutlich ist es für fast alle praktischen Belange ausreichend
ASM_RunOnce zu verwenden und Code immer wieder von neuem zu diktieren,
sobald er benötigt wird.
Anmerkung: ASM_Run kann auch benutzt werden, um Engine Funktionen ohne
Parameter und ohne relevanten Rückgabewert aufzurufen. In diesem Fall
müsste ptr einfach auf die auszuführende Funktion im Codesegment zeigen.
//Beispiel:
Folgende Funktion setzt den als slf übergebenen Npc als den Spieler, so
als hätte man mit diesem Npc im Fokus im Marvin Modus "o" gedrückt.
Das ist deshalb so kurz, weil es genau zu diesem Zweck bereits eine
Funktion gibt, sie ist nur normalerweise aus den Skripten heraus nicht
erreichbar.
Es genügt daher Assemblercode zu schreiben, der den Parameter der
Funktion (den "this"-Pointer) in das entsprechende Register schiebt und
dann die Funktion aufruft.
func void SetAsPlayer (var C_NPC slf) {
/* Adresse der Funktion */
const int oCNpc__SetAsPlayer = 7612064; //0x7426A0 (Gothic2.exe)
var int slfPtr;
slfPtr = MEM_InstToPtr (slf);
//mov ecx slfPtr
ASM_1 (ASMINT_OP_movImToECX); /* move immediate value to ecx */
ASM_4 (slfPtr); /* eine Konstante (immediate) */
//call oCNpc__SetAsPlayer
ASM_1 (ASMINT_OP_call);
ASM_4 (oCNpc__SetAsPlayer - ASM_Here() - 4);
ASM_RunOnce(); /* retn wird automatisch hinzugefügt */
};
Bemerkung: Callziele werden relativ zu derjenigen Instruktion angegeben,
die nach der eigentlichen Call-Instruktion ausgeführt worden wäre. Daher
ist sowohl ASM_Here() als auch die Subtraktion von 4 im Parameter von
call nötig.
Bemerkung: Die Opcodes ASMINT_OP_movImToECX und ASMINT_OP_call sind in
Ikarus.d als Konstanten enthalten. Dort sind allerdings nur die Opcodes
verfügbar, die auch direkt von den Call-Skripten benötigt werden.
Opcodes herauszufinden ist mühseelig.
Bemerkung: Das folgende Unterkapitel beschreibt unter anderem
CALL__thiscall, eine Funktionen, mit deren Hilfe sich SetAsPlayer auch
so implementieren lässt:
func void SetAsPlayer (var C_NPC slf) {
const int oCNpc__SetAsPlayer = 7612064;
CALL__thiscall (MEM_InstToPtr (slf), oCNpc__SetAsPlayer);
};
//######################################
// 10. Enginefunktionen aufrufen
Um eine Funktion benutzen zu können, muss man ihre Schnittstelle kennen,
das heißt Anzahl und Art der Parameter (was will die Funktion wissen?)
und die Art des Rückgabewerts (was sagt mir die Funktion?). Das kennt
man ja.
Was in einer maschinennahen Situation hinzukommt, ist die
Aufrufkonvention (wie hätte die Funktion ihre Parameter gerne und wer
räumt auf?) und die Adresse der Funktion (wo steht sie überhaupt im
Speicher?).
An dieses Wissen über Engine Funktionen kann man zum Beispiel mit IDA
herankommen, einem Werkzeug, das die GothicMod.exe / Gothic2.exe
analysieren und in eine für Menschen besser (aber immer noch sehr
schwer) lesbare Ansicht überführen kann.
Wie man eine gute Ansicht der GothicMod.exe / Gothic2.exe bekommt, hat
Nico hier beschrieben:
http://forum.worldofplayers.de/forum/showpost.php?p=12395375
Mit diesem Wissen ausgestattet, kümmern sich die folgenden Funktionen um
den Rest der noch fehlt um Enginefunktionen aufzurufen.
Und so funktioniert's:
//Schritt 1: Parameter von rechts nach links
Zunächst müssen die Parameter, die die Funktion erwartet in umgekehrter
Reihenfolge, das heißt vom Parameter ganz rechts bis zum Parameter ganz
links auf den Maschinenstack.
Dazu gibt es folgende Funktionen:
func void CALL_IntParam (var int param) /* int32 */
func void CALL_FloatParam (var int param) /* single / zREAL */
func void CALL_PtrParam (var int param) /* void* */
func void CALL_zStringPtrParam (var string param) /* zString* */
func void CALL_cStringPtrParam (var string param) /* char ** */
func void CALL_StructParam (var int ptr, var int words) /* struct */
Die meisten Parameter sind Zahlen oder Zeiger.
Da es in Daedalus nicht ganz leicht ist, an den Zeiger auf einen String
zu kommen, sind die Spezialfälle "Zeiger auf zString" und "Zeiger auf
cString" implementiert. Dabei wird ein zString* bzw. ein char** erzeugt,
jeweils mit den Daten wie sie im übergebenen Daedalus String enthalten
waren. Der so gewonnene Wert wird dann als Parameter auf den Stack
gelegt.
Dass ein komplexer Parameter, also ein Objekt oder eine Struktur direkt
auf dem Stack liegt (kein Zeiger sondern alle Daten) ist selten. In
diesem Fall ist CALL_StructParam ein Zeiger auf das Objekt und die Größe
des Objekts in Worten (1 Wort = 32 bit) zu übergeben. CALL_StructParam
legt es dann in seiner Gesamtheit auf den Stack.
Anmerkung: CALL_IntParam, CALL_FloatParam und CALL_PtrParam sind
identisch. Die Unterscheidung soll lediglich helfen Code gut lesbar zu
halten.
Spitzfindigkeit: Diese Funktionen legen keine Parameter auf den
Maschinenstack. Genau müsste es heißen: Sie erzeugen den Maschinencode,
der Parameter auf den Maschinenstack legen wird, wenn er denn ausgeführt
wird. Und ausgeführt wird er erst im zweiten Schritt mit der Bekanntgabe
der Aufrufkonvention.
//Schritt 2: Der Aufruf
Es sind vier Aufrufkonventionen implementiert:
func void CALL__stdcall (var int adr )
func void CALL__thiscall (var int this, var int adr )
func void CALL__cdecl (var int adr )
func void CALL__fastcall (var int ecx, var int edx, var int adr)
__stdcall steht für "Standard Call" und hat sich neben __cdecl als eine
der wichtigsten Aufrufkonvention durchgesetzt. CALL__stdcall benötigt
als Parameter lediglich die Adresse der Funktion. Die Windows API
benutzt sehr konsequent __stdcall als Aufrufkonvention.
__thiscall ist eine Abwandlung von __stdcall für Klassenfunktionen.
Hierbei wird der this-Pointer, also der Zeiger auf das Objekt, auf dem
die Funktion aufgerufen werden soll als versteckter Parameter im
Register ecx übergeben. CALL__thiscall erwartet neben der Adresse daher
zusätzlich einen Objektzeiger. Da Gothic durchgängig objektorientiert
programmiert wurde, ist der __thiscall die häufigste anzutreffende
Aufrufkonvention.
Funktionen, die nicht aus der Windows API sind und keine
Klassenfunktionen sind, benutzen häufig __cdecl als Aufrufkonvention.
Benutzt wird CALL__cdecl genau wie CALL__stdcall. Der Unterschied liegt
intern in der Verantwortlichkeit für das anpassen des Stackpointers.
__fastcall ist nicht standardisiert. Manche Compiler, darunter auch der
Compiler des Microsoft Visual Studio mit dem Gothic compiliert wurde,
bieten eine solche Aufrufkonvention an, die potenziell etwas
performanter ist.
Im Falle von Microsoft Visual Studio werden die ersten zwei Parameter
auf dem Stack übergeben (in ecx und edx). __fastcall wird selten
verwendet.
Welche Aufrufkonvention eine konkrete Enginefunktion nutzt, lässt sich
mit IDA (oder einem anderen Disassembler) herausfinden.
Die Bekanntgabe der Aufrufkonvention, also der Aufruf einer der drei
oben genannten Funktionen) ist gleichzeitig der Zeitpunkt des Aufrufs
der Funktion. Zu diesem Zeitpunkt müssen insbesondere schon alle
Parameter spezifiziert sein.
//Schritt 3: Der Rückgabewert
Sobald der Funktionsaufruf stattgefunden hat, also nach Schritt 2, kann
der Rückgabewert abgefragt werden.
Die folgenden Funktionen interpretieren den Rückgabewert (in aller Regel
ist das der Inhalt von EAX unmittelbar nach dem Aufruf) in der im
Funktionsnamen suggerierten Art und Weise. Das Ergebnis wird dann in
einer in Daedalus brauchbaren Art und Weise zurückgeliefert.
func int CALL_RetValAsInt () /* Ganzzahl */
func int CALL_RetValAsPtr () /* Zeiger */
func instance CALL_RetValAsStructPtr () /* struct* */
func string CALL_RetValAszStringPtr() /* zString* */
CALL_RetValAsInt und CALL_RetValAsPtr liefern den Rückgabewert einfach
als Zahl zurück.
CALL_RetValAsStructPtr kann genutzt werden um eine Zuweisung an eine
Instanz zu machen, zum Beispiel eine Zuweisung an ein var zCVob, falls
der Rückgabewert ein Zeiger auf ein zCVob ist.
Ist der Rückgabewert ein zString* so kann CALL_RetValAszStringPtr
benutzt werden um den Rückgabewert in handlicher Form als Daedalusstring
zu erhalten.
Einen Spezialfall stellen Floats dar (sie werden nicht in EAX
zurückgegeben). Vor der Bekanntgabe der Aufrufkonvention (und damit der
Ausführung des Calls) muss daher die Funktion:
func void CALL_RetValIsFloat()
aufgerufen werden um diesen Umstand zu melden. Nach dem Call an den
Rückgabewert zu kommen ist dann nicht weiter problematisch.
func int CALL_RetValAsFloat () /* Gleitkommazahl */
Anmerkung: CALL_RetValAsInt, CALL_RetValAsPtr und CALL_RetValAsFloat
sind identisch und geben einfach eine interne Ergebnisvariable zurück.
Die Unterscheidung erfolgt hier abermals aus Lesbarkeitsgründen.
//Komplexe Rückgabewerte
In seltenen Fällen ist ein Rückgabewert ein großes Objekt (kein Zeiger,
sondern das gesamte Objekt), zum Beispiel ein zVEC3. Dies stellt einen
Sonderfall dar. Er muss mit
func void CALL_RetValIsStruct (var int words)
unmittelbar vor Bekanntgabe der Aufrufkonvention (und damit der
Ausführung des Calls) angekündigt werden. Die Größe der Struktur ist
hier in Worten (1 Wort = 32 bit) anzugeben. Ein zVEC3 hat zum Beispiel
eine Größe von drei Worten.
Intern wird dann Speicher für den Rückgabewert reserviert und ein Zeiger
auf den reservierten Speicherbereich als versteckter letzter Parameter
auf den Stack geschoben. Die aufgerufene Funktion befüllt dann diesen
Speicher und gibt (eigentlich überflüssigerweise, weil der Aufrufer sie
schon kennt) die Adresse des Rückgabewerts zurück.
Der Rückgabewert ist also über CALL_RetValAsPtr oder
CALL_RetValAsStructPtr zugänglich, als wäre der Rückgabewert kein
komplexes Objekt, sondern ein Zeiger auf ein komplexes Objekt.
Hinweis: Im Falle eines komplexen Rückgabewertes wurde das
zurückgegebene Objekt speziell für den Aufrufer konstruiert. Es muss
also auch von ihm freigegeben werden, wenn es nicht mehr benötigt wird.
Im Falle eines zVEC3 würde es genügen den Speicherbereich mit MEM_Free
freizugeben.
//Spezialfall: Rückgabewert zString
Ein Spezialfall eines komplexen Rückgabewerts ist ein zString. Da es
nicht ganz einfach ist, einen zString Unfall- und Speicherleckfrei in
einen Daedalusstring hinüberzuretten, gibt es hierfür spezielle
Funktionen:
func void CALL_RetValIszString()
func string CALL_RetValAszString()
Hierbei ersetzt CALL_RetValIszString den Aufruf von CALL_RetValIsStruct.
CALL_RetValAszString kopiert den zurückgegebenen String in einen
Daedalusstring und gibt anschließend den zurückgegebenen String frei.
Anmerkung: CALL_RetValAszStringPtr und CALL_RetValAszString sind
durchaus verschieden und sollten nicht verwechselt werden. Bei einer
Verwendung von CALL_RetValAszString anstelle von CALL_RetValAszStringPtr
wird Speicher freigegeben, der evtl noch benötigt wird. Bei einer
umgekehrten Verwechslung wird Speicher nicht freigegeben, der nicht mehr
benötigt wird (-> Speicherleck).
//Beispiel:
MessageBox ist eine Funktion aus der WinAPI, die in Gothic2 an Stelle
0x7B48E8 herumliegt. Wie sie funktioniert ist hier dokumentiert:
http://msdn.microsoft.com/en-us/library/ms645505%28v=vs.85%29.aspx
Um sie bequem aus Gothic heraus aufrufen zu können schreiben wir eine
Daedalusfunktion, die sich um Parameter und Aufrufkonvention kümmert.
In IDA (oder einem anderen Disassembler) finden wir folgende Zeile:
int __stdcall MessageBoxA (HWND hWnd, LPCSTR lpText,
LPCSTR lpCaption,UINT uType)
sie sagt uns, dass es sich um einen __stdcall handelt. Zudem ist Anzahl
und Art der Parameter, sowie die Art des Rückgabewerts ersichtlich,
(alles stimmt mit der Spezifikation auf der MSDN Seite überein). Ein
LPCSTR ist ein "Long Pointer to a c String", ein UINT ein "unsigned
Integer" und HWND ein Zeigertyp.
//----------------------
func int MEM_MessageBox (var string txt,
var string caption, var int type) {
/* Hier liegt die MessageBox Funktion */
const int WinAPI__MessageBox = 8079592; //0x7B48E8
/* Parameter in umgekehrter Reihenfolge */
CALL_IntParam (type); // int
CALL_cStringPtrParam (caption); // char **
CALL_cStringPtrParam (txt); // char **
CALL_PtrParam (0); // owner Window; darf Null sein
/* als __stdcall ausführen */
CALL__stdcall (WinAPI__MessageBox);
return CALL_RetValAsInt();
};
//----------------------
Anmerkung: Dies ist ein besonders einfacher Fall. Für Funktionen von
Gothic besitzt man keine Dokumentation. Die Bedeutung der Parameter ist
im Allgemeinen unklar, und nur zu erraten oder zu erforschen. Adresse
und Signatur der Funktion sind allerdings Problemlos mit IDA (oder einem
anderen Disassembler) in Erfahrung zu bringen.
//Weitere Beispiele:
Die folgenden Beispiele gehen davon aus, dass MEM_InitAll oder
MEM_InitGlobalInst aufgerufen wurde, das heißt dass bestimmte globale
Instanzen initialisiert sind.
1.) Erhalte den Spieler mithilfe von
.text:006C2C60:
class oCNpc * __thiscall oCGame::GetSelfPlayerVob(void)
//----------------------
{
const int oCGame__GetSelfPlayerVob = 7089248; //0x6C2C60
CALL__thiscall (MEM_InstToPtr (MEM_Game),
oCGame__GetSelfPlayerVob);
var oCNpc player;
player = CALL_RetValAsStructPtr();
PrintDebug (player.name);
}
//----------------------
2.) Gib dem Spieler eine Overlay-Animation mit Hilfe von
.text:0072D2C0:
int __thiscall oCNpc::ApplyOverlay(class zSTRING const &)
//----------------------
{
const int oCNpc__ApplyOverlay = 7525056; //0x72D2C0
CALL_zStringPtrParam ("HUMANS_MILITIA.MDS");
CALL__thiscall (MEM_InstToPtr (hero), oCNpc__ApplyOverlay);
//Rückgabewert interessiert uns hier nicht.
}
//----------------------
3.) Hole eine Stringrepräsentation der Zeit, das heißt zum Beispiel
"7:30" für halb acht Uhr morgens mit Hilfe von
.text:00780EC0:
class zSTRING __thiscall oCWorldTimer::GetTimeString(void)
//----------------------
{
const int oCWorldTimer__GetTimeString = 7868096; //780EC0
CALL_RetValIszString();
CALL__thiscall (MEM_InstToPtr (MEM_WorldTimer),
oCWorldTimer__GetTimeString );
PrintDebug (CALL_RetValAszString());
}
//----------------------
Beachte: Der Rückgabewert ist hier ein zString also ein 20 Byte großes
Objekt. Das muss mit CALL_RetValIszString angekündigt werden, damit der
Speicher für den Rückgabewert im Vorfeld angelegt werden kann.
CALL_RetValAszString sorgt dafür, dass der angelegte Speicher auch
wieder freigegeben wird. Bei anderen Strukturen als zString gibt es
diesen Automatismus nicht.
4.) Hole die "Himmelszeit", ein Gleitkommawert zwischen 0 und 1, der
Mittags um 12 von 1 auf 0 zurückspringt. Nutze dazu:
.text:00781240:
float __thiscall oCWorldTimer::GetSkyTime(void)
//----------------------
func int GetSkyTime() {
const int oCWorldTimer__GetSkyTime = 7868992; //0x781240
CALL_RetValIsFloat();
CALL__thiscall (MEM_InstToPtr (MEM_WorldTimer),
oCWorldTimer__GetSkyTime);
return CALL_RetValAsFloat();
};
//----------------------
Beachte: Da der Rückgabewert eine Gleitkommazahl ist, muss
CALL_RetValIsFloat aufgerufen werden.
//######################################
// 11.) Externe Bibliotheken
Zum Laden von DLLs bietet Windows die Funktion LoadLibrary an.
Zudem gibt es GetProcAddress zum Finden einer Funktion innerhalb einer
bereits geladenen DLL.
Die Dokumentation der beiden Funktion sind hier zu finden:
http://msdn.microsoft.com/en-us/library/ms684175%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/ms683212%28v=vs.85%29.aspx
Ikarus bietet die Funktionen genau wie in MSDN beschrieben an, also
folgendermaßen:
func int LoadLibrary (var string lpFileName)
func int GetProcAddress (var int hModule, var string lpProcName)
Die mit GetProcAddress erhaltenen Funktionsadressen können mit Hilfe der
CALL_ Funktionen verwendet werden um die Funktionen auch wirklich
aufzurufen. Beispielsweise könnte folgendermaßen die Sleep Funktion aus
der Kernel32.dll aufgerufen werden:
//----------------------
func void Sleep(var int ms) {
var int adr;
adr = GetProcAddress (LoadLibrary ("KERNEL32.DLL"), "Sleep");
CALL_IntParam(ms);
CALL__stdcall(adr); //0x007B47E6
};
//----------------------
Eine Dokumentation der Sleep Funktion findet sich wieder in MSDN, und
zwar hier:
http://msdn.microsoft.com/en-us/library/ms686298%28v=vs.85%29.aspx
Da die Kernel32.dll eine wichtige Bibliothek ist, stellt Ikarus
abkürzend folgende Funktion zur Verfügung:
func int FindKernelDllFunction (var string name)
FindKernelDllFunction ist äqivalent zu GetProcAddress mit der Adresse
von Kernel32.dll als fixem erstem Parameter.
//######################################
// 12.) Verschiedenes
func int MEM_SearchVobByName (var string str)
Liefert die Adresse eines zCVobs mit dem Namen str, falls ein solches
Vob existiert. Andernfalls wird 0 zurückgegeben.
Als Abwandlung davon gibt es
func int MEM_SearchAllVobsByName (var string str)
Diese Funktion erzeugt ein zCArray in dem alle Zeiger auf Vobs mit dem
Namen str stehen. Falls kein Vob mit dem Namen existiert wird ein leeres
zCArray erzeugt. Ein Zeiger auf das erzeugte zCArray wird dann
zurückgegeben. Dieses kann ausgewertet werden, sollte aber noch vor Ende
des Frames (bevor der Spieler Laden kann) wieder mit MEM_ArrayFree
freigegeben werden um Speicherlecks zu vermeiden.
Die Klasse zCArray ist in Misc.d zu finden.
//******************
func int MEM_InsertVob(var string vis, var string wp)
Fügt ein Vob mit dem Visual vis am Waypoint wp ein. Hierbei muss vis der
Name eines Visuals mit Dateierweiterung sein, zum Beispiel
"FAKESCROLL.3DS", "FIRE.PFX", "SNA_BODY.ASC",
"CHESTSMALL_NW_POOR_LOCKED.MDS", oder "ADD_PIRATEFLAG.MMS".
Zurückgegeben wird ein Pointer auf das erzeugte Objekt.
Falls das Visual oder der Waypoint nicht existiert ist das Verhalten
dieser Funktion undefiniert.
Anmerkung: Das eingefügt Vob ist sogar ein oCMob, kann also zum Beispiel
einen Fokusnamen bekommen. Man kann es aber wie ein zCVob behandeln,
wenn man die zusätzlichen Eigenschaften nicht benötigt.
//******************
func void MEM_TriggerVob (var int vobPtr)
func void MEM_UntriggerVob (var int vobPtr)
Diese beide Funktionen nehmen jeweils einen Pointer auf ein zCVob
entgegen und senden eine Triggernachricht beziehungsweise
Untriggernachricht an das Vob. Dafür wird das Vob temporär umbenannt.
Falls das Triggern des Vobs also unmittelbare Auswirkungen hat (noch
bevor MEM_TriggerVob verlassen wird) ist der Name des Vobs in dieser
Zeit verfälscht. Es ist nicht ratsam das Objekt in diesem Moment
umzubenennen, nochmal zu triggern oder zu zerstören, das Verhalten in
solchen Fällen ist ungetestet.
//******************
func void MEM_RenameVob (var int vobPtr, var string newName)
Nimmt einen Zeiger auf ein Vob entgegen und benennt das Vob in den
ebenfalls zu übergebenden Namen newName um. Das Objekt wird dazu
zunächst aus der Vobhashtabelle entfernt, dann unbenannt und dann wieder
unter neuem Namen in die Vobhashtabelle eingefügt.
//******************
func int Hlp_Is_oCMob(var int ptr)
func int Hlp_Is_oCMobInter(var int ptr)
func int Hlp_Is_oCMobLockable(var int ptr)
func int Hlp_Is_oCMobContainer(var int ptr)
func int Hlp_Is_oCMobDoor(var int ptr)
func int Hlp_Is_oCNpc(var int ptr)
func int Hlp_Is_oCItem(var int ptr)
func int Hlp_Is_zCMover(var int ptr)
func int Hlp_Is_oCMobFire(var int ptr)
Diese Funktionen können u.a. nützlich sein, wenn es darum geht den Fokus
des Helden auszuwerten. Die Funktionen geben 1 zurück, falls der
übergebene Zeiger auf ein Objekt der angegebenen Klasse oder eine
Unterklasse dieser Klasse zeigt.
Für einen Stuhl würden zum Beispiel Hlp_Is_oCMob und Hlp_Is_oCMobInter 1
zurückgeben, die anderen Funktionen 0.
Natürlich kann man diese Funktionen noch für andere Objekttypen als Mobs
schreiben, wenn das nötig ist.
//******************
func void MEM_SetShowDebug (var int on)
Setzt die Variable, die auch von "toggle debug" getoggelt wird. Dadurch
landen mit PrintDebug ausgegebenen Meldungen im Spy (wenn dort
Informationen geloggt werden). Es empfielt sich als Filter "Skript" im
Spy einzustellen, sonst gehen die Meldungen meist unter einem Haufen
nutzlosem Enginezeug unter.
//******************
func string MEM_GetCommandLine ()
Gibt den Inhalt der Kommandozeile zurück, die an Gothic Übergeben wurde.
Diese könnte zum Beispiel so aussehen:
"-TIME:7:35 -GAME:TEST_IKARUS.INI -ZREPARSE -ZWINDOW -ZLOG:5,S -DEVMODE
-ZMAXFRAMERATE:30"
//******************
func int MEM_MessageBox (var string txt,
var string caption,
var int type)
Erzeugt ein kleines Fenster mit Überschrift caption und Inhalt txt.
Die möglichen Werte für type sowie die Rückgabewerte entsprechen der
Beschreibung auf:
http://msdn.microsoft.com/en-us/library/ms645505%28v=vs.85%29.aspx
Alle sinnvoll anwendbaren Konstanten von dieser Seite stehen zur
Verfügung.
Beispiel:
//----------------------
func void panic() {
if (MEM_MessageBox (
"The Computer will Explode. Continue anyway?",
"Warning!",
MB_YESNO | MB_ICONWARNING)
== IDYES) {
Print ("BAM! You're dead!");
} else {
Print ("Wise decision.");
};
};
//----------------------
Als Spezialfall von MEM_MessageBox ist MEM_InfoBox verfügbar:
func void MEM_InfoBox (var string txt)
Auf einer Infobox gibt es nur einen OK-Knopf und ein Informationssymbol.
Message Boxen beenden den Vollbildmodus und sind daher wohl nur für
Debugzwecke sinnvoll zu gebrauchen.
//******************
func int MEM_GetSystemTime()
Gibt die seit dem Start von Gothic verstrichene Zeit in Millisekunden
zurück.
//******************
func int MEM_BenchmarkMS(var func f)
MEM_BenchmarkMS führt die übergebene parameterlose Funktion aus und gibt
zurück, wie lange die Ausführung gedauert hat und zwar in Millisekunden,
daher das MS.
Zeitmessung kann sinnvoll sein, um festzustellen ob und in welchem Maße
eine Funktion die Leistung beeinträchtigt.
Millisekunden ist allerdings oft eine zu grobe Einheit, mit anderen
Worten, eine Millisekunde ist für Prozessorverhältnisse eine sehr lange
Zeit.
Besser geeignet ist daher der sogenannte Performancecounter, der
allerdings je nach System verschieden schnell zählt.
Die Anzahl der Performancecounter Ticks, die eine Funktion braucht, kann
mit folgender Abwandlung der Benchmarkfunktion gemessen werden:
func int MEM_BenchmarkPC(var func f)
Der Performancecounter ist gut geeignet um die Geschwindigkeit
verschiedener Funktionen zu vergleichen.
Umrechnung in Millisekunden ist möglich, die Anzahl der
Performancecounter Ticks pro Millisekunde steht an der Addresse
PC_TicksPerMS_Address.
Auf meinem System sind es 2741 Ticks pro Millisekunde. Umrechnung in
Nanosekunden könnte schnell an die Grenzen von 32 bit Ganzzahlen kommen,
also vorsicht!
Um ein verlässliches Ergebnis zu erhalten ist es sehr zu empfehlen nicht
einen einzigen Durchlauf einer Funktion zu messen, sondern die
Gesamtdauer vieler Durchläufe (zum Beispiel 1000).
Besonders bei recht schnellen Funktionen wird sonst das Ergebnis durch
die Messung selbst zu stark verfälscht. Daher gibt es noch Abwandlungen
der Benchmark-Funktionen, die einen Parameter entgegennehmen, der
besagt, wieviele Durchläufe der Funktion f durchgeführt werden sollen.
Zurückgegeben wird dann die aufsummierte Dauer aller Durchläufe (kein
Mittelwert) in der entsprechenden Einheit:
func int MEM_BenchmarkMS_N(var func f, var int n)
func int MEM_BenchmarkPC_N(var func f, var int n)
Anmerkungen zur Konditionierung der Messung:
-Der Paramter n ist so zu wählen, dass das Ergebnis in einem geeigneten
Bereich zu erwarten ist. Wenn n Ausführungen der Funktion nicht einmal
eine Millisekunde dauern, ist natürlich ein Rückgabewert in
Millisekunden nicht aussagekräftig.
-Bei *sehr* schnellen Funktion f wird die Zeit, die in der
Benchmark-Funktion aufgewendet wird (und nicht in f) signifikant zur
Messung beitragen (was das Ergebnis verfälscht). Nur Funktionen, die
hinreichend langsam sind, können sinnvoll gemessen werden.
Zur Orientierung, hier eine Zeitmessung für einige Operationen (in
Nanosekunden, also milliardstel Sekunden):
- Funktionsaufruf (hin und zurückspringen) : 30ns
- Elementare Rechnung (z.B: i = i + 1) : 130ns
- Wld_IsTime : 200ns
- MEM_ReadInt, MEM_WriteInt : 350ns
- Hlp_StrCmp("Hello", "Hello") : 500ns
- MEM_InstToPtr : 1400ns
- (wenig) Speicher allozieren und freigeben : 9700ns
- CALL__stdcall (in leere Funktion) : 29000ns
- MEM_GetParserSymb : 280000ns
- Iteration der Benchmark-Funktion : 300ns
//******************
Der Zugriff auf statische Arrays ist in Daedalus sehr mühsam. Unter
einem statischen Array verstehe ich ein gewöhnliches Skriptarray, zum
Beispiel:
var int myStaticArray[42];
Es ist nicht möglich mit einem variablen Index i auf myStaticArray[i]
zuzugreifen, sondern stehts nur mit einer Konstanten. Das ändert sich
mit folgenden Funktionen:
func int MEM_ReadStatArr (var int array, var int offset)
func void MEM_WriteStatArr (var int array, var int offset, var int value)
Der Befehl:
MEM_WriteStatArr (myStaticArray, i, 23);
wird Beispielsweise an Position i der Wert 23 geschrieben. Hierbei
spielt es keine Rolle ob i eine Konstante oder eine Variable ist. Vor
der ersten Nutzung einer der obigen beiden Funktionen muss allerdings
die Funktion:
func void MEM_InitStatArrs()
aufgerufen werden. Nach jedem Laden eines Spielstands sollte
MEM_InitStatArrs() erneut aufgerufen werden.
Anmerkung: MEM_InitStatArrs wird auch von der Funktion MEM_InitAll
aufgerufen.
Vorsicht: Keine der beiden Funktionen führt irgendeine Art von
Gültigkeitsprüfung durch. Falls es sich beim übergebenen Wert nicht um
ein Array handelt oder offset jenseits der Grenzen des übergebenen
Arrays liegen ist das Verhalten undefiniert.
//******************
Manchmal ist es hilfreich, die Speicheradresse einer Variable zu
erfahren. Dies ist in Daedalus nicht vorgesehen. Folgende Funktionen
schaffen Abhilfe:
func int MEM_GetStringAddress(var string s)
func int MEM_GetFloatAddress (var float f)
func int MEM_GetIntAddress (var int i)
Der Rückgabewert ist jeweils die Addresse der übergebenen Variable. Wird
anstatt einer Variable, ein arithmetischer Ausdruck übergeben (zum
Beispiel MEM_GetIntAddress(x + 1)), wird kein sinnvolles Verhalten
garantiert.
Beispiel:
//----------------------
func void foo() {
MEM_GetAddress_Init();
//Beispiel für MEM_GetIntAddress
var int i; i = 0;
var int ptr; ptr = MEM_GetIntAddress(i);
MEM_WriteInt(ptr, 42);
Print(IntToString(i)); //gibt "42" aus.
//Beispiel für MEM_GetStringAddress
var string str; str = "Hello";
var zString zStr; zStr = MEM_PtrToInst(MEM_GetStringAddress(str));
MEM_WriteByte(zStr.ptr, 66); //66 = B im ASCII Zeichensatz
Print(str); //<-gibt Bello aus.
//Zwei Sonderfälle:
/* (1) */
ptr = MEM_GetStringAddress("Hello?");
/* (2) */
ptr = MEM_GetStringAddress(ConcatStrings("Hello", " World!"));
};
//----------------------
Zu den Sonderfällen im Beispiel:
Nach (1) steht in ptr die Adresse des Strings "Hello?", der in
irgendeiner Stringtabelle des Parsers liegt.
Nach (2) steht in ptr die Adresse eines statischen zStrings der von der
Enginefunktion ConcatStrings benutzt wird (und gerade "Hello World!"
enthält).
Wichtig: Diese Funktionen setzen voraus, dass MEM_InitAll oder
MEM_GetAddress_Init aufgerufen wurde.
//******************
func int MEM_ArrayCreate ()
func void MEM_ArrayFree (var int zCArray_ptr)
func void MEM_ArrayClear (var int zCArray_ptr)
func void MEM_ArrayInsert (var int zCArray_ptr, var int value)
func void MEM_ArrayRemoveIndex (var int zCArray_ptr, var int index)
func void MEM_ArrayRemoveValue (var int zCArray_ptr, var int value)
func void MEM_ArrayRemoveValueOnce (var int zCArray_ptr, var int value)
zCArrays sind eine sehr einfache Feld-Datenstruktur, die exzessiv von
der Engine verwedet wird.
Arrays dieser Art können aber auch Skriptintern sinnvoll zur Übergabe
von großen Datenmengen dienen. Zum Beispiel nutzt
MEM_SearchAllVobsByName Arrays um gleich eine große Menge von Vobs
zurückzugeben. Dabei wird verlangt, dass der Nutzer das Array noch im
selben Frame (bevor der Spieler Laden oder Speichern könnte) wieder
freigibt (mit MEM_ArrayFree).
Das Einfügen eines Elements in ein Array ist nicht einfach, da eventuell
der Platz im Array nicht ausreicht und das Array vergrößert werden muss.
Daher habe ich diese Funktion zur Verfügung gestellt. Die anderen
Funktionen sind sozusagen Beiwerk und leisten einfachere Dinge.
zCArray_ptr ist in allen Funktionen ein Zeiger auf ein zCArray (siehe
auch Misc.d).
MEM_ArrayCreate: Erzeuge ein leeres zCArray und gebe seine Adresse
zurück.
MEM_ArrayFree: Gebe sowohl das zCArray als auch seine Daten frei.
MEM_ArrayClear: Gibt die Daten des zCArray frei. Es wird zu einem
leeren Array.
MEM_ArrayInsert: Fügt value ans Ende des Arrays an. Das Array wird
automatisch vergrößert falls es zu klein ist.
Entfernen von Elementen passiert durch auffüllen der Lücke mit dem
letzten Element. Wird zum Beispiel aus einem Array (1,2,3,4,5) die 3
entfernt, wird das Ergebnis so aussehen: (1,2,5,4). Die 5 ist in die
entstehende Lücke gewandert.
MEM_ArrayRemoveIndex: Entfernt das Element an Position index.
MEM_ArrayRemoveValue: Sucht alle Vorkommen von value im Array und
entfernt diese.
MEM_ArrayRemoveValueOnce: Sucht das erste Vorkommen von value im Array
und entfernt dies. Wird value nicht gefunden wird eine Warnung
ausgegeben.
Hinweis: Diese Funktionen erwarten Pointer auf ein zCArray! Nicht
verwechseln mit der Adresse des ersten Datenelements oder dem
Symbolindex irgendeines "var zCArray"! Manchmal wird man sich die
Adresse eines zCArrays erst ausrechnen müssen und zwar aus der Adresse
des Objekts, das dieses zCArray beinhaltet und dem Offset des zCArrays
in der entsprechenden Klasse (Bytes zählen!).
Lesen und Schreiben auf Indizes ist selbst zu organisieren, zum Beispiel
mit MEM_ReadIntArray, MEM_WriteIntArray angewendet auf zCArray.array.
//******************
func void MEM_CopyBytes (var int src, var int dst, var int byteCount)
func void MEM_CopyWords (var int src, var int dst, var int wordcount)
func void MEM_SwapBytes (var int ptr1, var int ptr2, var int byteCount)
func void MEM_SwapWords (var int ptr1, var int ptr2, var int wordcount)
func int MEM_CompareBytes (var int ptr1, var int ptr2, var int byteCount)
func int MEM_CompareWords (var int ptr1, var int ptr2, var int wordcount)
Die hier aufgeführten Funktionen arbeiten jeweils auf zwei
Speicherbereichen gleicher Größe, wobei die ersten zwei Parameter
angeben wo die Speicherbereiche beginnen. Der dritte Parameter gibt die
Größe beider Speicherbereiche an. Es gibt jeweils eine Version, die die
Größe in Bytes entgegennimmt und eine Version, die die Größe in
Speicherworten entgegenimmt (1 Wort = 4 Byte, was der Größe vieler
primitiver Datentypen entspricht, zum Beispiel Integer).
/* Copy */
Die Varianten von MEM_Copy kopieren entsprechend viele Bytes bzw. Worte
von der Quelle (beginnend von Speicherstelle src) ans Ziel (beginnend an
Speicherstelle dst).
Beachte: Wenn sich die Speicherbereiche überlappen ist das Verhalten
unspezifiziert.
/* Swap */
"Swap" bedeutet so viel wie tauschen. Die Daten beginnend an der Adresse
ptr1 werden an die Adresse ptr2 verschoben und umgekehrt.
Beachte: Wenn sich die Speicherbereiche überlappen ist das Verhalten
unspezifiziert.
Anmerkung: Es wird nur konstant viel zusätzlicher Speicher benötigt.
/* Compare */
Die Varianten von MEM_Compare vergleichen die Daten in den
Speicherbereichen beginnend an ptr1 und ptr2. Bei Gleichheit wird 1
zurückgegeben, bei Ungleichheit 0.
//******************
func void MEM_InitAll()
Kann benutzt werden anstelle der Initialisierungsfunktionen von
einzelnen Features. Tut nichts anderes als MEM_InitGlobalInst,
MEM_InitLabels, MEM_InitStatArrs, STR_GetAddressInit und
MEM_ReinitParser aufzurufen.
Tipp: Ein Aufruf in INIT_GLOBAL ist empfehlenswert. Dann müssen bis nach
dem nächsten Laden keine weiteren Initialisierungen mehr vorgenommen
werden.
Vorsicht: Manche Funktionen werden noch vor INIT_GLOBAL aufgerufen. Zum
Beispiel werden Npcs vor INIT_GLOBAL erzeugt. Wird also zum Beispiel
während der Npc Erzeugung auf Ikarus Funktionalität zurückgegriffen der
eine Initialisierung mit einer der genannten Funktionen vorausgehen
muss, ist ein Aufruf von MEM_InitAll in INIT_GLOBAL nicht hinreichend.
Im Zweifelsfall ist es zu empfehlen, die passende
Initialisierungsfunktion noch einmal direkt bei der Verwendung
aufzurufen. Mehrfache Aufrufe schaden nicht und haben keine
nennenswerten Performancetechnischen Implikationen.
//######################################
// 13.) "Obskure" Funktionen
Ikarus bietet auch einige eher technische Funktionen an, deren Nutzen
nicht unbedingt unmittelbar greifbar ist. Die meisten, die diese Paket
benutzen, werden sie nicht brauchen, ich werde sie hier dennoch erklären.
//******************
func int MEM_GetFuncPtr(var func fnc)
Gibt die Adresse einer Daedalus Funktion zurück. Das ist der Ort im
Speicher, an der ihr Code anfängt, das heißt die Adresse des ersten
Tokens (z.B. zPAR_TOK_PUSHVAR), dass zur Funktion gehört.
func int MEM_GetFuncOffset(var func fnc)
Ähnlich wie MEM_GetFuncPtr, allerdings wird die Adresse nicht absolut,
sondern relativ zum Anfang des Codes angegeben. Jumps und Calls nutzen
solche relativen Adressen.
//******************
func int MEM_GetClassDef (var int objPtr)
Übergeben wird ein Zeiger objPtr auf ein zCObject O, also zum Beispiel
auf ein zCVob oder ein zCMaterial. Viele Objekte, die mehr als simple
Datenstrukturen sind, sind direkt oder indirekt von zCObject abgeleitet.
MEM_GetClassDef gibt einen Zeiger auf ein Objekt C vom Typ zCClassDef
zurück. C enthält Informationen über die Klasse, der O angehört. Zum
Beispiel würde MEM_GetClassDef (MEM_InstToPtr (hero)) einen Zeiger auf
das zCClassDef Objekt liefern, dass zur Klasse oCNpc gehört.
zCClassDef hat einige Interessante Eigenschaften (siehe Misc.d).
func string MEM_GetClassName (var int objPtr)
ist eine einfache Anwendung von MEM_GetClassDef und gibt den
Klassennamen der Klasse aus, der das Objekt angehört, auf das objPtr
zeigt. Zum Bespiel liefert MEM_GetClassName (MEM_InstToPtr (hero)) den
string "oCNpc".
Wenn diesen Funktionen ein Zeiger übergeben wird, der nicht auf ein
zCObject zeigt, wird das mit großer Wahrscheinlichkeit zu einem Absturz
führen.
//******************
func int MEM_GetBufferCRC32 (var int buf, var int buflen)
Berechnet einen Hashwert aus einem Bytearray, dass an buf beginnt und
Länge buflen hat. Es wird die selbe Hashfunktion verwendet wie in Gothic.
func int MEM_GetStringHash (var string str) {
Berechnet den Hashwert eines Strings. Es wird die selbe Hashfunktion
verwendet wie in Gothic.
Bemerkung: Diese Funktion wird von MEM_SearchVobByName benutzt.
//******************
func int MEM_Alloc (var int amount)
Mit MEM_Alloc werden amount Byte Speicher alloziert und ein Zeiger auf
den Speicherbereich zurückgegeben.
Gothic hält keine Referenz auf diesen Speicherbereich und kann ihn auch
nicht freigeben (auch nicht beim Zerstören der Session!).
Speicher sollte daher nur dann reserviert werden, wenn er garantiert vor
dem Laden eines Spielstands wieder mit MEM_Free freigegeben werden kann
oder garantiert ist, dass Gothic von diesem Speicherbereich weiß und ihn
selbstständig freigibt.
Vielleicht kann man mit dieser Funktion neue Objekte erzeugen und
dauerhaft in die Objektstruktur von Gothic einbauen. Das Bedarf aber
großer Vorsicht, da die Objektkonstrukturen nicht genutzt werden können.
Man müsste alles von Hand machen.
Sehr gut geeignet dürfte diese Funktion sein um Kleinigkeiten wie
Listenelemente zu bauen und in vorhandenen Listen zu integrieren. Der
neu allozierte Speicher ist stets genullt.
func int MEM_Realloc (var int oldptr, var int oldsize, var int newsize)
Alloziert einen Speicherbereich der größe newsize und gibt einen Zeiger
auf diesen Speicherbereich zurück.
Der Speicherbereich ab Stelle oldptr wird freigegeben.
Falls newsize >= oldsize werden die ersten oldsize Bytes aus dem alten
Speicherbereich in den neuen übernommen. Der zusätzliche Speicher ist
mit Null initialisiert.
Falls newsize <= oldsize werden alle Bytes des neuen Speicherbereichs
mit den entsprechenden Werten des alten Speicherbereichs initialisiert.
Diese Funktion ist dazu gedacht um einen allozierten Speicherbereich zu
vergrößern oder zu verkleinern. Vorhandene Daten bleiben auf natürliche
Art und Weise erhalten.
func void MEM_Free (var int ptr)
Gibt einen allozierten Speicherbereich wieder frei.
Vielleicht kann man so auch Engine-Objekte zerstören. Auch hier ist
große Vorsicht angesagt, da keine Destruktoren aufgerufen werden!
Kleinigkeiten wie Listenelemente können so aber problemlos freigegeben
werden.
//******************
func void MEM_SetParser(var int parserID)
Hiermit lässt sich der aktuelle Parser auf etwas anderes als den
Content-Parser umstellen. Dies ist nötig, wenn man zum Beispiel mit
Symbolen im Menü suchen und bearbeiten will. Kommunikation mit den
Menüskripten wird dadurch möglich. Aber leider ist das ganze nicht ohne
Tücken und vermutlich eher uninteressant, weil die Menüskripte selten
von Gothic aufgerufen werden. Bestimmte Menüobjekte bleiben über die
Session hinaus erhalten.
//******************
func void MemoryProtectionOverride (var int address, var int size)
Der Versuch das Codesegment oder schreibgeschützte Datensegmente zu
beschreiben wird eine Accessviolation verursachen.
MemoryProtectionOverride hebelt diesen Schreibschutz für den
Adressbereich aus, der bei address beginnt und size Bytes groß ist.
Anmerkung: MemoryProtectionOverride hebt den Schreibschutz für alle
Seite auf, die mindestens ein Byte im spezifizierten Adressbereich
beinhalten. Im Allgemeinen ist also ein größerer Speicherbereich
betroffen als angegeben.
MemoryProtectionOverride benutzt die Windows Funktion VirtualProtect.
//######################################
// VI. Gefahren
//######################################
Dieses Skriptpaket heißt nicht umsonst Ikarus:
Man kann die Grenzen von Daedalus hinter sich lassen, aber dabei auch
auf die Schnauze fallen. Wer etwa an ungültigen Adressen liest, bekommt
dabei keine zSpy-Warnung, sondern landet auf dem Desktop mit einer
Access Violations. Dies ist kein Grund zur Panik, setzt aber
Frusttolleranz vorraus (die man als Skripter aber auch sonst gut
gebrauchen kann).
Natürlich kann man auch solche spektakulär anmutenden Fehler beheben und
wenn man konzentriert und planvoll arbeitet, wird man schon was
vernünftiges zu Stande bringen.
Kurz gesagt: Besondere Sorgfalt ist geboten! Ein Bug der zum Absturz
führt ist nichts, was man in der Releaseversion haben will. Aber wenn
man sauber arbeitet und ausführlich testet ist das alles halb so wild.
Ein guter Freund beim beheben von Abstürzen ist zweifellos PrintDebug,
damit ist es möglich Meldungen an den zSpy zu schicken (zum Beispiel um
einzugrenzen wo der Absturz überhaupt stattfindet). Auf die Funktion
MEM_SetShowDebug und den Textfilter (Options -> Textfilter) im zSpy sei
in diesem Zusammenhang nochmal besonders hingewiesen.
//######################################
// VII. Beispiele
//######################################
//--------------------------------------
// 1.) Funktion zum öffnen der Truhe im Fokus:
func void OpenFocussedChestOrDoor() {
var oCNpc her;
her = Hlp_GetNpc (hero);
//Gar kein Fokusvob?
if (!her.focus_vob) {
Print ("Kein Fokus!");
return;
};
//Fokusvob kein verschließbares Vob?
if (!Hlp_Is_oCMobLockable(her.focus_vob)) {
Print ("Keine Truhe oder Tür im Fokus!");
return;
};
var oCMobLockable Lockable;
Lockable = MEM_PtrToInst (her.focus_vob);
if (Lockable.bitfield & oCMobLockable_bitfield_locked) {
Lockable.bitfield = Lockable.bitfield & ~
oCMobLockable_bitfield_locked;
Print (ConcatStrings (
"Folgendes Vob geöffnet: ",
Lockable._zCObject_objectName));
} else {
Print (ConcatStrings (
Lockable._zCObject_objectName,
" war gar nicht abgeschlossen!"));
};
};
//--------------------------------------
// 2.) Kameraposition ermitteln:
func void PrintCameraPos() {
/* Globale Instanzen (die es nur einmal gibt) initialisieren: */
/* Initialisiert MEM_World, MEM_Game, etc. u.a. auch MEM_Camera */
MEM_InitGlobalInst();
/* Das Kameraobjekt ist kein vob (sondern was abstraktes),
* weiß nicht wo und wie da Positionsdaten stehen.
Ich arbeite lieber auf dem Kameravob: */
var zCVob camVob;
camVob = MEM_PtrToInst (MEM_Camera.connectedVob);
/*Hier muss man wissen wie die Transformationsmatrix aufgebaut ist:
Sie besteht aus drei Vektoren, die x, y und z Richtung
des lokalen Koordinatensystem des Kameravobs
in Weltkoordinaten angeben (dabei müsste z die
Blickrichtung sein). Ich habe diese Vektoren hier
mit v1, v2, v3 Bezeichnet.
Zusätzlich gibt es in der 4. Spalte die Translation,
das heißt die Position der Kamera.
v1_x v2_x v3_x x
v1_y v2_y v3_y y
v1_z v3_z v3_z z
0 0 0 0
Die Matrix ist Zeilenweise im Speicher abgelegt.
Da wir uns für die letzte Spalte interessieren sind die Indizes
im trafoWorld Array 3, 7 und 11, die wir brauchen.
*/
Print (ConcatStrings ("x: ",
IntToString(roundf(camVob.trafoObjToWorld[ 3]))));
Print (ConcatStrings ("y: ",
IntToString(roundf(camVob.trafoObjToWorld[ 7]))));
Print (ConcatStrings ("z: ",
IntToString(roundf(camVob.trafoObjToWorld[11]))));
};
//--------------------------------------
// 3.) Regen starten
func void StartRain() {
/* Globale Instanzen initialisieren: */
MEM_InitGlobalInst(); /* Hierrunter fällt auch der Skycontroller */
/* man könnte sich jetzt hier was besseres überlegen,
* aber ich machs mal so: */
/* start am Anfang vom Tag (12:00 Uhr mittags) */
MEM_SkyController.rainFX_timeStartRain = 0; //FLOATNULL;
/* ende am Ende vom Tag (12:00 Uhr mittags des nächsten Tags) */
MEM_SkyController.rainFX_timeStopRain = 1065353216; //FLOATEINS;
/* Bemerkung dazu: Die Start und Endzeiten sind Gleitkommazahlen.
* 0 steht für den Anfang des Tages 1 für das Ende des Tages.
* Ein "Skytag" beginnt um 12:00 Uhr.
* Zum Aufbau des Gleitkommaformats google man nach IEEE 745.
* Ich habe mal floats in Daedalus implementiert:
* http://forum.worldofplayers.de/forum/showthread.php?t=500080
* Diese Implementierung kann man nutzen um sich
* floats aus Ganzzahlen bauen zu lassen. */
/* Ergebnis: Ganzer Tag regen! (es sei denn man ist in einer Zone
* in der es schneit, dann den ganzen Tag Schnee) */
};
//--------------------------------------
// 4.) Geschachtelte Schleife
/* Soll alle Paare (x,y) aufzählen mit
0 <= x < max_x,
0 <= j < max_y
*/
func void printpairs(var int max_x, var int max_y) {
/* Sprung-System initialisieren */
MEM_InitLabels();
/* PrintDebug soll benutzt werden, also Debugausgabe aktivieren */
MEM_SetShowDebug (1);
var int x; var int y;
x = 0;
/* while (x < max_x) */
var int x_loop; x_loop = MEM_StackPos.position;
if (x < max_x) {
y = 0;
/* while (y < max_y) */
var int y_loop; y_loop = MEM_StackPos.position;
if (y < max_y) {
var string out; out = "(";
out = ConcatStrings (out, IntToString (x));
out = ConcatStrings (out, ", ");
out = ConcatStrings (out, IntToString (y));
out = ConcatStrings (out, ")");
PrintDebug (out);
y += 1;
/* continue y_loop */
MEM_StackPos.position = y_loop;
};
x += 1;
/* continue x_loop */
MEM_StackPos.position = x_loop;
};
};
/* Ausgabe eines Aufrufs printpairs (4,2) wäre dann:
00:36 Info: 5 U: Skript: (0, 0) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (0, 1) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (1, 0) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (1, 1) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (2, 0) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (2, 1) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (3, 0) .... <zError.cpp,#465>
00:36 Info: 5 U: Skript: (3, 1) .... <zError.cpp,#465>
*/
//--------------------------------------
// 5.) Aufrufen einer Funktion
// anhand ihres Namens.
/* Dieses Beispiel zeigt nicht, weshalb MEM_CallByString
* praktisch ist, aber wie man die Funktion benutzt. */
var zCVob someObject;
func int MyFunction(var int param1, var string str1,
var int param2, var string str2) {
Print (ConcatStrings (str1, str2)); //(*)
return 100 * param1 + param2;
};
func void foo() {
var int result;
/* Der Code zwischen A und B ist in diesem Fall
* äquivalent zu:
* result = MyFunction (42, "Hello ", 23, "World!");
* */
/* A */
MEM_PushIntParam (42);
MEM_PushStringParam ("Hello ");
MEM_PushIntParam (23);
MEM_PushStringParam ("World!");
MEM_CallByString ("MYFUNCTION");
result = MEM_PopIntResult();
/* B */
Print (IntToString (result)); //(**)
};
/* Ausgegeben wird "Hello World" (das macht MyFunction bei (*))
* sowie "4223" (das macht foo bei (**)). */
/* Anmerkung: Da Symbolindizes fortlaufend sind
* und der Symbolindex von someObject einfach durch
* someObject selbst gegeben ist, könnte
* MEM_CallByString ("MYFUNCTION");
* hier auch ersetzt werden durch
* MEM_CallByID (someObject + 1); */
|
D
|
/Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Fluent.build/QueryBuilder/QueryBuilder+Run.swift.o : /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ID.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Deprecated.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/MigrateCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/RevertCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/SoftDeletable.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationConfig.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/JoinSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QuerySupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationLog.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/AnyModel.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/FluentProvider.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaUpdater.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/FluentError.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaCreator.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ModelEvent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Pivot.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/CacheEntry.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Fluent.build/QueryBuilder+Run~partial.swiftmodule : /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ID.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Deprecated.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/MigrateCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/RevertCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/SoftDeletable.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationConfig.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/JoinSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QuerySupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationLog.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/AnyModel.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/FluentProvider.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaUpdater.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/FluentError.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaCreator.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ModelEvent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Pivot.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/CacheEntry.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Fluent.build/QueryBuilder+Run~partial.swiftdoc : /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ID.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+CRUD.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Deprecated.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/MigrateCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/RevertCommand.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Decode.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Range.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/SoftDeletable.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Aggregate.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationConfig.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/JoinSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Transaction/TransactionSupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/QuerySupporting.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationLog.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Model.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/AnyModel.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Children.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Join/QueryBuilder+Join.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaSupporting+Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigration.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Run.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/FluentProvider.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaUpdater.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Filter.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/FluentError.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/SchemaCreator.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Schema/DatabasesConfig+References.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Siblings.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/AnyMigrations.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Operators.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Utilities/Exports.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Relations/Parent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Service/CommandConfig+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/KeyedCacheSupporting+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Database/DatabaseConnection+Fluent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/ModelEvent.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Model/Pivot.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/QueryBuilder/QueryBuilder+Sort.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Cache/CacheEntry.swift /Users/Khanh/vapor/TILApp/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Query/FluentProperty.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIO.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Async.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Command.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Service.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Console.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Logging.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOConcurrencyHelpers.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/Bits.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/DatabaseKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/cpp_magic.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIODarwin/include/c_nio_darwin.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOAtomics/include/c-atomics.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio.git-3108475404973543938/Sources/CNIOLinux/include/c_nio_linux.h /Users/Khanh/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--1071467962839356487/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOSHA1.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOOpenSSL.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOZlib.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIODarwin.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOHTTPParser.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOAtomics.build/module.modulemap /Users/Khanh/vapor/TILApp/.build/x86_64-apple-macosx10.10/debug/CNIOLinux.build/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
/Users/mu/Hello/.build/x86_64-apple-macosx/debug/TemplateKit.build/Tag/Uppercase.swift.o : /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateData.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateEmbed.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Deprecated.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSource.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataStorage.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/ASTCache.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataRepresentable.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/HTMLEscape.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntaxType.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Uppercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Lowercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Capitalize.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateTag.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConditional.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateCustom.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateExpression.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Var.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataEncoder.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIdentifier.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateByteScanner.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/PlaintextRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/ViewRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateParser.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateSerializer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/TemplateError.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIterator.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Contains.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/Exports.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/DateFormat.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConstant.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Comment.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Print.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Count.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateDataContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Raw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateRaw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/View.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntax.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mu/Hello/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/mu/Hello/.build/x86_64-apple-macosx/debug/TemplateKit.build/Tag/Uppercase~partial.swiftmodule : /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateData.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateEmbed.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Deprecated.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSource.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataStorage.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/ASTCache.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataRepresentable.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/HTMLEscape.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntaxType.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Uppercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Lowercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Capitalize.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateTag.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConditional.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateCustom.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateExpression.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Var.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataEncoder.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIdentifier.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateByteScanner.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/PlaintextRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/ViewRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateParser.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateSerializer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/TemplateError.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIterator.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Contains.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/Exports.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/DateFormat.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConstant.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Comment.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Print.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Count.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateDataContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Raw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateRaw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/View.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntax.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mu/Hello/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/mu/Hello/.build/x86_64-apple-macosx/debug/TemplateKit.build/Tag/Uppercase~partial.swiftdoc : /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateData.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateEmbed.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Deprecated.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSource.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataStorage.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/ASTCache.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataRepresentable.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/HTMLEscape.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntaxType.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Uppercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Lowercase.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Capitalize.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateTag.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConditional.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateCustom.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateExpression.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Var.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Data/TemplateDataEncoder.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIdentifier.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateByteScanner.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/PlaintextRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/ViewRenderer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateParser.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Pipeline/TemplateSerializer.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/TemplateError.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateIterator.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Contains.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Utilities/Exports.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/DateFormat.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateConstant.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Comment.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Print.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Count.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateDataContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/TagContext.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/Tag/Raw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateRaw.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/View.swift /Users/mu/Hello/.build/checkouts/template-kit/Sources/TemplateKit/AST/TemplateSyntax.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/mu/Hello/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /Users/mu/Hello/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/mu/Hello/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/mu/Hello/.build/checkouts/swift-nio-zlib-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
module libos.libconsole;
import user.syscall;
import user.console;
struct Console {
static:
enum Color : ubyte {
Black = 0x00,
Blue = 0x01,
Green = 0x02,
Cyan = 0x03,
Red = 0x04,
Magenta = 0x05,
Yellow = 0x06,
LightGray = 0x07,
Gray = 0x08,
LightBlue = 0x09,
LightGreen = 0x0A,
LightCyan = 0x0B,
LightRed = 0x0C,
LightMagenta = 0x0D,
LightYellow = 0x0E,
White = 0x0F
}
void initialize() {
requestConsole(&cinfo);
if (cinfo.buffer is null) {
// boo
}
_xpos = 0;
_ypos = 0;
}
void putChar(char c) {
if (c == '\t') {
_xpos += TABSTOP;
}
else if (c != '\n' && c != '\r') {
ubyte* ptr = cast(ubyte*)cinfo.buffer;
ptr += (_xpos + (_ypos * cinfo.width)) * 2;
// Set the current piece of video memory to the character
*(ptr) = c & 0xff;
*(ptr + 1) = _attr;
// Increment
_xpos++;
}
// check for end of line, or newline
if (c == '\n' || c == '\r' || _xpos >= cinfo.width) {
_xpos = 0;
_ypos++;
while (_ypos >= cinfo.height) {
scroll(1);
}
}
}
void putString(char[] string) {
foreach(c; string) {
putChar(c);
}
}
void clear() {
ubyte* ptr = cast(ubyte*)cinfo.buffer;
for (int i; i < cinfo.width * cinfo.height * 2; i += 2) {
*(ptr + i) = 0x00;
*(ptr + i + 1) = _attr;
}
_xpos = 0;
_ypos = 0;
}
void scroll(uint numLines) {
ubyte* ptr = cast(ubyte*)cinfo.buffer;
if (numLines >= cinfo.height) {
clear();
return;
}
int cury = 0;
int offset1 = 0;
int offset2 = numLines * cinfo.width;
// Go through and shift the correct amount
for ( ; cury <= cinfo.height - numLines; cury++) {
for (int curx = 0; curx < cinfo.height; curx++) {
*(ptr + (curx + offset1) * 2)
= *(ptr + (curx + offset1 + offset2) * 2);
*(ptr + (curx + offset1) * 2 + 1)
= *(ptr + (curx + offset1 + offset2) * 2 + 1);
}
offset1 += cinfo.width;
}
// clear remaining lines
for ( ; cury <= cinfo.height; cury++) {
for (int curx = 0; curx < cinfo.width; curx++) {
*(ptr + (curx + offset1) * 2) = 0x00;
*(ptr + (curx + offset1) * 2 + 1) = 0x00;
}
}
_ypos -= numLines;
if (_ypos < 0) {
_ypos = 0;
}
}
void position(uint x, uint y) {
_xpos = x;
_ypos = y;
if (_xpos >= cinfo.width) {
_xpos = cinfo.width - 1;
}
if (_ypos >= cinfo.height) {
_ypos = cinfo.height - 1;
}
}
void reset() {
_attr = DEFAULTCOLORS;
clear();
}
void resetColor() {
_attr = DEFAULTCOLORS;
}
void forecolor(Color clr) {
_attr = (_attr & 0xf0) | clr;
}
Color forecolor() {
ubyte clr = _attr & 0xf;
return cast(Color)clr;
}
void backcolor(Color clr) {
_attr = (_attr & 0x0f) | (clr << 4);
}
Color backcolor() {
ubyte clr = _attr & 0xf0;
clr >>= 4;
return cast(Color)clr;
}
uint width() {
return cinfo.width;
}
uint height() {
return cinfo.height;
}
private:
ConsoleInfo cinfo;
int _ypos;
int _xpos;
ubyte _attr = DEFAULTCOLORS;
const ubyte DEFAULTCOLORS = Color.LightGray;
const ubyte TABSTOP = 4;
}
|
D
|
// Copyright Ferdinand Majerech 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
///Allows an entity to damage other entities at collision.
module component.warheadcomponent;
import util.yaml;
///Allows an entity to damage other entities at collision.
struct WarheadComponent
{
private static bool DO_NOT_DESTROY_AT_ENTITY_DEATH;
///Damage caused (negative for a healing effect).
int damage;
///Does this warhead kill its entity when activated?
bool killsEntity = true;
///Load from a YAML node. Throws YAMLException on error.
this(ref YAMLNode yaml)
{
damage = yaml["damage"].as!int;
if(yaml.containsKey("killsEntity")){killsEntity = yaml["killsEntity"].as!bool;}
}
}
|
D
|
module ecs.exceptions.component.componentDoesNotExistException;
import ecs.exceptions.ecsException;
import std.conv : to;
class ComponentDoesNotExistException : ECS_Exception
{
public this(string message, string hint)
{
super(message ~ "\nThe component does not exist! Is it initialized?", hint);
}
}
|
D
|
module android.java.javax.microedition.khronos.opengles.GL10Ext_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import1 = android.java.java.lang.Class_d_interface;
import import0 = android.java.java.nio.IntBuffer_d_interface;
final class GL10Ext : IJavaObject {
static immutable string[] _d_canCastTo = [
"javax/microedition/khronos/opengles/GL",
];
@Import int glQueryMatrixxOES(int, int, int, int[][]);
@Import int glQueryMatrixxOES(import0.IntBuffer, import0.IntBuffer);
@Import import1.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import void notify();
@Import void notifyAll();
@Import void wait(long);
@Import void wait(long, int);
@Import void wait();
mixin IJavaObjectImplementation!(false);
public static immutable string _javaParameterString = "Ljavax/microedition/khronos/opengles/GL10Ext;";
}
|
D
|
/Users/GMoran/Desktop/ClassicPlayer/DerivedData/ClassicPlayer/Build/Intermediates/ClassicPlayer.build/Debug-iphonesimulator/ClassicPlayer.build/Objects-normal/i386/AppDelegate.o : /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/NowPlayingVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AboutScreenVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsVC.swift /Users/GMoran/Desktop/ClassicPlayer/AboutVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MusicMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MainMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AlbumsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/PlaylistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ArtistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SongListMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/Array+Shuffle.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AppDelegate.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/C2AClickWheel.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ImageTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MenuTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsScreenViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/StatusBarViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/MediaPlayer.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AudioToolbox.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/SwiftOnoneSupport.swiftmodule
/Users/GMoran/Desktop/ClassicPlayer/DerivedData/ClassicPlayer/Build/Intermediates/ClassicPlayer.build/Debug-iphonesimulator/ClassicPlayer.build/Objects-normal/i386/AppDelegate~partial.swiftmodule : /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/NowPlayingVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AboutScreenVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsVC.swift /Users/GMoran/Desktop/ClassicPlayer/AboutVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MusicMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MainMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AlbumsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/PlaylistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ArtistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SongListMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/Array+Shuffle.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AppDelegate.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/C2AClickWheel.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ImageTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MenuTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsScreenViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/StatusBarViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/MediaPlayer.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AudioToolbox.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/SwiftOnoneSupport.swiftmodule
/Users/GMoran/Desktop/ClassicPlayer/DerivedData/ClassicPlayer/Build/Intermediates/ClassicPlayer.build/Debug-iphonesimulator/ClassicPlayer.build/Objects-normal/i386/AppDelegate~partial.swiftdoc : /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/NowPlayingVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AboutScreenVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsVC.swift /Users/GMoran/Desktop/ClassicPlayer/AboutVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MusicMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MainMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AlbumsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/PlaylistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ArtistsMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SongListMenuVC.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/Array+Shuffle.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/AppDelegate.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/C2AClickWheel.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ImageTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/MenuTableCell.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/ViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/SettingsScreenViewController.swift /Users/GMoran/Desktop/ClassicPlayer/ClassicPlayer/StatusBarViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/MediaPlayer.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AudioToolbox.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/i386/SwiftOnoneSupport.swiftmodule
|
D
|
// Copyright 2019 Tero Hänninen. All rights reserved.
// SPDX-License-Identifier: BSD-2-Clause
module engine.thirdparty.imagefmt.jpeg;
import std.math : ceil;
import engine.thirdparty.imagefmt;
@nogc nothrow package:
struct JPEGDecoder {
Reader* rc;
ubyte[64][4] qtables;
HuffTab[2] ac_tables;
HuffTab[2] dc_tables;
int bits_left; // num of unused bits in cb
ubyte cb; // current byte (next bit always at MSB)
bool has_frame_header = false;
bool eoi_reached = false;
bool correct_comp_ids;
ubyte[] compsbuf;
Component[3] comps;
ubyte num_comps;
int tchans;
int width;
int height;
int hmax;
int vmax;
int num_mcu_x;
int num_mcu_y;
ushort restart_interval; // number of MCUs in restart interval
}
// image component
struct Component {
size_t x; // total num of samples, without fill samples
size_t y; // total num of samples, without fill samples
ubyte[] data; // reconstructed samples
int pred; // dc prediction
ubyte sfx; // sampling factor, aka. h
ubyte sfy; // sampling factor, aka. v
ubyte qtable;
ubyte ac_table;
ubyte dc_table;
}
struct HuffTab {
ubyte[256] values;
ubyte[257] sizes;
short[16] mincode;
short[16] maxcode;
short[16] valptr;
}
enum MARKER : ubyte {
SOI = 0xd8, // start of image
SOF0 = 0xc0, // start of frame / baseline DCT
//SOF1 = 0xc1, // start of frame / extended seq.
//SOF2 = 0xc2, // start of frame / progressive DCT
SOF3 = 0xc3, // start of frame / lossless
SOF9 = 0xc9, // start of frame / extended seq., arithmetic
SOF11 = 0xcb, // start of frame / lossless, arithmetic
DHT = 0xc4, // define huffman tables
DQT = 0xdb, // define quantization tables
DRI = 0xdd, // define restart interval
SOS = 0xda, // start of scan
DNL = 0xdc, // define number of lines
RST0 = 0xd0, // restart entropy coded data
// ...
RST7 = 0xd7, // restart entropy coded data
APP0 = 0xe0, // application 0 segment
// ...
APPf = 0xef, // application f segment
//DAC = 0xcc, // define arithmetic conditioning table
COM = 0xfe, // comment
EOI = 0xd9, // end of image
}
bool detect_jpeg(Reader* rc)
{
auto info = read_jpeg_info(rc);
reset2start(rc);
return info.e == 0;
}
IFInfo infoerror(ubyte e)
{
IFInfo info = { e: e };
return info;
}
IFInfo read_jpeg_info(Reader* rc)
{
if (read_u8(rc) != 0xff || read_u8(rc) != MARKER.SOI)
return infoerror(rc.fail ? ERROR.stream : ERROR.data);
while (true) {
if (read_u8(rc) != 0xff)
return infoerror(rc.fail ? ERROR.stream : ERROR.data);
ubyte marker = read_u8(rc);
while (marker == 0xff && !rc.fail)
marker = read_u8(rc);
if (rc.fail)
return infoerror(ERROR.stream);
switch (marker) with (MARKER) {
case SOF0: .. case SOF3:
case SOF9: .. case SOF11:
skip(rc, 3); // len + some byte
IFInfo info;
info.h = read_u16be(rc);
info.w = read_u16be(rc);
info.c = read_u8(rc);
info.e = rc.fail ? ERROR.stream : 0;
return info;
case SOS, EOI:
return infoerror(ERROR.data);
case DRI, DHT, DQT, COM:
case APP0: .. case APPf:
int len = read_u16be(rc) - 2;
skip(rc, len);
break;
default:
return infoerror(ERROR.unsupp);
}
}
assert(0);
}
ubyte read_jpeg(Reader* rc, out IFImage image, in int reqchans, in int reqbpc)
{
if (cast(uint) reqchans > 4)
return ERROR.arg;
const ubyte tbpc = cast(ubyte) (reqbpc ? reqbpc : 8);
if (tbpc != 8 && tbpc != 16)
return ERROR.unsupp;
if (read_u8(rc) != 0xff || read_u8(rc) != MARKER.SOI)
return rc.fail ? ERROR.stream : ERROR.data;
if (rc.fail)
return ERROR.stream;
JPEGDecoder dc = { rc: rc };
ubyte e = read_markers(dc); // reads until first scan header or eoi
if (e) return e;
if (dc.eoi_reached) return ERROR.data;
dc.tchans = reqchans == 0 ? dc.num_comps : reqchans;
if (cast(ulong) dc.width * dc.height * dc.tchans > MAXIMUM_IMAGE_SIZE)
return ERROR.bigimg;
{
size_t[3] csizes;
size_t acc;
foreach (i, ref comp; dc.comps[0..dc.num_comps]) {
csizes[i] = dc.num_mcu_x * comp.sfx*8 * dc.num_mcu_y * comp.sfy*8;
acc += csizes[i];
}
dc.compsbuf = new_buffer(acc, e);
if (e) return e;
acc = 0;
foreach (i, ref comp; dc.comps[0..dc.num_comps]) {
comp.data = dc.compsbuf[acc .. acc + csizes[i]];
acc += csizes[i];
}
}
scope(exit)
_free(dc.compsbuf.ptr);
// E.7 -- Multiple scans are for progressive images which are not supported
//while (!dc.eoi_reached) {
e = decode_scan(dc); // E.2.3
//read_markers(dc); // reads until next scan header or eoi
//}
if (e) return e;
// throw away fill samples and convert to target format
ubyte[] buf = dc.reconstruct(e);
if (e) return e;
if (VERTICAL_ORIENTATION_READ == -1)
e = flip_vertically(dc.width, dc.height, dc.tchans, buf);
image.w = dc.width;
image.h = dc.height;
image.c = cast(ubyte) dc.tchans;
image.cinfile = dc.num_comps;
image.bpc = tbpc;
if (tbpc == 8) {
image.buf8 = buf;
} else {
image.buf16 = bpc8to16(buf);
if (!image.buf16.ptr)
return ERROR.oom;
}
return 0;
}
ubyte read_markers(ref JPEGDecoder dc)
{
bool has_next_scan_header = false;
while (!has_next_scan_header && !dc.eoi_reached) {
if (read_u8(dc.rc) != 0xff)
return dc.rc.fail ? ERROR.stream : ERROR.data;
ubyte marker = read_u8(dc.rc);
while (marker == 0xff && !dc.rc.fail)
marker = read_u8(dc.rc);
if (dc.rc.fail)
return ERROR.stream;
ubyte e;
switch (marker) with (MARKER) {
case DHT:
e = read_huffman_tables(dc);
break;
case DQT:
e = read_quantization_tables(dc);
break;
case SOF0:
if (dc.has_frame_header)
return ERROR.data;
e = read_frame_header(dc);
dc.has_frame_header = true;
break;
case SOS:
if (!dc.has_frame_header)
return ERROR.data;
e = read_scan_header(dc);
has_next_scan_header = true;
break;
case DRI:
if (read_u16be(dc.rc) != 4) // len
return dc.rc.fail ? ERROR.stream : ERROR.unsupp;
dc.restart_interval = read_u16be(dc.rc);
break;
case EOI:
dc.eoi_reached = true;
break;
case APP0: .. case APPf:
case COM:
const int len = read_u16be(dc.rc) - 2;
skip(dc.rc, len);
break;
default:
return ERROR.unsupp;
}
if (e)
return dc.rc.fail ? ERROR.stream : e;
}
return 0;
}
// DHT -- define huffman tables
ubyte read_huffman_tables(ref JPEGDecoder dc)
{
ubyte[17] tmp;
int len = read_u16be(dc.rc) - 2;
if (dc.rc.fail) return ERROR.stream;
ubyte e;
while (len > 0) {
read_block(dc.rc, tmp[0..17]); // info byte & the BITS
if (dc.rc.fail) return ERROR.stream;
const ubyte tableslot = tmp[0] & 0x0f; // must be 0 or 1 for baseline
const ubyte tableclass = tmp[0] >> 4; // 0 = dc table, 1 = ac table
if (tableslot > 1 || tableclass > 1)
return ERROR.unsupp;
// compute total number of huffman codes
int mt = 0;
foreach (i; 1..17)
mt += tmp[i];
if (256 < mt)
return ERROR.data;
if (tableclass == 0) {
read_block(dc.rc, dc.dc_tables[tableslot].values[0..mt]);
derive_table(dc.dc_tables[tableslot], tmp[1..17], e);
} else {
read_block(dc.rc, dc.ac_tables[tableslot].values[0..mt]);
derive_table(dc.ac_tables[tableslot], tmp[1..17], e);
}
len -= 17 + mt;
}
if (dc.rc.fail) return ERROR.stream;
return e;
}
// num_values is the BITS
void derive_table(ref HuffTab table, in ref ubyte[16] num_values, ref ubyte e)
{
short[256] codes;
int k = 0;
foreach (i; 0..16) {
foreach (j; 0..num_values[i]) {
if (k > table.sizes.length) {
e = ERROR.data;
return;
}
table.sizes[k] = cast(ubyte) (i + 1);
++k;
}
}
table.sizes[k] = 0;
k = 0;
short code = 0;
ubyte si = table.sizes[k];
while (true) {
do {
codes[k] = code;
++code;
++k;
} while (si == table.sizes[k]);
if (table.sizes[k] == 0)
break;
assert(si < table.sizes[k]);
do {
code <<= 1;
++si;
} while (si != table.sizes[k]);
}
derive_mincode_maxcode_valptr(
table.mincode, table.maxcode, table.valptr,
codes, num_values
);
}
// F.15
void derive_mincode_maxcode_valptr(ref short[16] mincode, ref short[16] maxcode,
ref short[16] valptr, in ref short[256] codes, in ref ubyte[16] num_values)
{
mincode[] = -1;
maxcode[] = -1;
valptr[] = -1;
int j = 0;
foreach (i; 0..16) {
if (num_values[i] != 0) {
valptr[i] = cast(short) j;
mincode[i] = codes[j];
j += num_values[i] - 1;
maxcode[i] = codes[j];
j += 1;
}
}
}
// DQT -- define quantization tables
ubyte read_quantization_tables(ref JPEGDecoder dc)
{
int len = read_u16be(dc.rc);
if (len % 65 != 2)
return dc.rc.fail ? ERROR.stream : ERROR.data;
len -= 2;
while (len > 0) {
const ubyte info = read_u8(dc.rc);
const ubyte tableslot = info & 0x0f;
const ubyte precision = info >> 4; // 0 = 8 bit, 1 = 16 bit
if (tableslot > 3 || precision != 0) // only 8 bit for baseline
return dc.rc.fail ? ERROR.stream : ERROR.unsupp;
read_block(dc.rc, dc.qtables[tableslot][0..64]);
len -= 1 + 64;
}
return dc.rc.fail ? ERROR.stream : 0;
}
// SOF0 -- start of frame
ubyte read_frame_header(ref JPEGDecoder dc)
{
const int len = read_u16be(dc.rc); // 8 + num_comps*3
const ubyte precision = read_u8(dc.rc);
dc.height = read_u16be(dc.rc);
dc.width = read_u16be(dc.rc);
dc.num_comps = read_u8(dc.rc);
if ((dc.num_comps != 1 && dc.num_comps != 3)
|| precision != 8 || len != 8 + dc.num_comps*3)
return ERROR.unsupp;
dc.hmax = 0;
dc.vmax = 0;
int mcu_du = 0; // data units in one mcu
ubyte[9] tmp;
read_block(dc.rc, tmp[0..dc.num_comps*3]);
if (dc.rc.fail) return ERROR.stream;
foreach (i; 0..dc.num_comps) {
ubyte ci = tmp[i*3];
// JFIF says ci should be i+1, but there are images where ci is i. Normalize
// ids so that ci == i, always. So much for standards...
if (i == 0) { dc.correct_comp_ids = ci == i+1; }
if ((dc.correct_comp_ids && ci != i+1)
|| (!dc.correct_comp_ids && ci != i))
return ERROR.data;
Component* comp = &dc.comps[i];
const ubyte sampling_factors = tmp[i*3 + 1];
comp.sfx = sampling_factors >> 4;
comp.sfy = sampling_factors & 0xf;
comp.qtable = tmp[i*3 + 2];
if ( comp.sfy < 1 || 4 < comp.sfy ||
comp.sfx < 1 || 4 < comp.sfx ||
3 < comp.qtable )
return ERROR.unsupp;
if (dc.hmax < comp.sfx) dc.hmax = comp.sfx;
if (dc.vmax < comp.sfy) dc.vmax = comp.sfy;
mcu_du += comp.sfx * comp.sfy;
}
if (10 < mcu_du)
return ERROR.unsupp;
assert(dc.hmax * dc.vmax);
foreach (i; 0..dc.num_comps) {
dc.comps[i].x = cast(size_t) ceil(dc.width * (cast(double) dc.comps[i].sfx /
dc.hmax));
dc.comps[i].y = cast(size_t) ceil(dc.height * (cast(double) dc.comps[i].sfy /
dc.vmax));
}
size_t mcu_w = dc.hmax * 8;
size_t mcu_h = dc.vmax * 8;
dc.num_mcu_x = cast(int) ((dc.width + mcu_w-1) / mcu_w);
dc.num_mcu_y = cast(int) ((dc.height + mcu_h-1) / mcu_h);
return 0;
}
// SOS -- start of scan
ubyte read_scan_header(ref JPEGDecoder dc)
{
const ushort len = read_u16be(dc.rc);
const ubyte num_scan_comps = read_u8(dc.rc);
if ( num_scan_comps != dc.num_comps ||
len != (6+num_scan_comps*2) )
return dc.rc.fail ? ERROR.stream : ERROR.unsupp;
ubyte[16] buf;
read_block(dc.rc, buf[0..len-3]);
if (dc.rc.fail) return ERROR.stream;
foreach (i; 0..num_scan_comps) {
const uint ci = buf[i*2] - (dc.correct_comp_ids ? 1 : 0);
if (ci >= dc.num_comps)
return ERROR.data;
const ubyte tables = buf[i*2 + 1];
dc.comps[ci].dc_table = tables >> 4;
dc.comps[ci].ac_table = tables & 0x0f;
if (dc.comps[ci].dc_table > 1 || dc.comps[ci].ac_table > 1)
return ERROR.unsupp;
}
// ignore these
//ubyte spectral_start = buf[$-3];
//ubyte spectral_end = buf[$-2];
//ubyte approx = buf[$-1];
return 0;
}
// E.2.3 and E.8 and E.9
ubyte decode_scan(ref JPEGDecoder dc)
{
int intervals, mcus;
if (dc.restart_interval > 0) {
int total_mcus = dc.num_mcu_x * dc.num_mcu_y;
intervals = (total_mcus + dc.restart_interval-1) / dc.restart_interval;
mcus = dc.restart_interval;
} else {
intervals = 1;
mcus = dc.num_mcu_x * dc.num_mcu_y;
}
ubyte e;
foreach (mcu_j; 0 .. dc.num_mcu_y) {
foreach (mcu_i; 0 .. dc.num_mcu_x) {
// decode mcu
foreach (c; 0..dc.num_comps) {
auto comp = &dc.comps[c];
foreach (du_j; 0 .. comp.sfy) {
foreach (du_i; 0 .. comp.sfx) {
// decode entropy, dequantize & dezigzag
short[64] data;
e = decode_block(dc, *comp, dc.qtables[comp.qtable], data);
if (e) return e;
// idct & level-shift
int outx = (mcu_i * comp.sfx + du_i) * 8;
int outy = (mcu_j * comp.sfy + du_j) * 8;
int dst_stride = dc.num_mcu_x * comp.sfx*8;
ubyte* dst = comp.data.ptr + outy*dst_stride + outx;
stbi__idct_block(dst, dst_stride, data);
}
}
}
--mcus;
if (!mcus) {
--intervals;
if (!intervals)
return e;
e = read_restart(dc.rc); // RSTx marker
if (intervals == 1) {
// last interval, may have fewer MCUs than defined by DRI
mcus = (dc.num_mcu_y - mcu_j - 1)
* dc.num_mcu_x + dc.num_mcu_x - mcu_i - 1;
} else {
mcus = dc.restart_interval;
}
// reset decoder
dc.cb = 0;
dc.bits_left = 0;
foreach (k; 0..dc.num_comps)
dc.comps[k].pred = 0;
}
}
}
return e;
}
// RST0-RST7
ubyte read_restart(Reader* rc) {
ubyte a = read_u8(rc);
ubyte b = read_u8(rc);
if (rc.fail) return ERROR.stream;
if (a != 0xff || b < MARKER.RST0 || b > MARKER.RST7)
return ERROR.data;
return 0;
// the markers should cycle 0 through 7, could check that here...
}
immutable ubyte[64] dezigzag = [
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63,
];
// decode entropy, dequantize & dezigzag (see section F.2)
ubyte decode_block(ref JPEGDecoder dc, ref Component comp, in ref ubyte[64] qtable,
out short[64] result)
{
ubyte e;
const ubyte t = decode_huff(dc, dc.dc_tables[comp.dc_table], e);
if (e) return e;
const int diff = t ? dc.receive_and_extend(t, e) : 0;
comp.pred = comp.pred + diff;
result[0] = cast(short) (comp.pred * qtable[0]);
int k = 1;
do {
ubyte rs = decode_huff(dc, dc.ac_tables[comp.ac_table], e);
if (e) return e;
ubyte rrrr = rs >> 4;
ubyte ssss = rs & 0xf;
if (ssss == 0) {
if (rrrr != 0xf)
break; // end of block
k += 16; // run length is 16
continue;
}
k += rrrr;
if (63 < k)
return ERROR.data;
result[dezigzag[k]] = cast(short) (dc.receive_and_extend(ssss, e) * qtable[k]);
k += 1;
} while (k < 64);
return 0;
}
int receive_and_extend(ref JPEGDecoder dc, in ubyte s, ref ubyte e)
{
// receive
int symbol = 0;
foreach (_; 0..s)
symbol = (symbol << 1) + nextbit(dc, e);
// extend
int vt = 1 << (s-1);
if (symbol < vt)
return symbol + (-1 << s) + 1;
return symbol;
}
// F.16 -- the DECODE
ubyte decode_huff(ref JPEGDecoder dc, in ref HuffTab tab, ref ubyte e)
{
short code = nextbit(dc, e);
int i = 0;
while (tab.maxcode[i] < code) {
code = cast(short) ((code << 1) + nextbit(dc, e));
i += 1;
if (i >= tab.maxcode.length) {
e = ERROR.data;
return 0;
}
}
const uint j = cast(uint) (tab.valptr[i] + code - tab.mincode[i]);
if (j >= tab.values.length) {
e = ERROR.data;
return 0;
}
return tab.values[j];
}
// F.2.2.5 and F.18
ubyte nextbit(ref JPEGDecoder dc, ref ubyte e)
{
if (!dc.bits_left) {
dc.cb = read_u8(dc.rc);
dc.bits_left = 8;
if (dc.cb == 0xff) {
if (read_u8(dc.rc) != 0x0) {
e = dc.rc.fail ? ERROR.stream : ERROR.data; // unexpected marker
return 0;
}
}
if (dc.rc.fail) e = ERROR.stream;
}
ubyte r = dc.cb >> 7;
dc.cb <<= 1;
dc.bits_left -= 1;
return r;
}
ubyte[] reconstruct(in ref JPEGDecoder dc, ref ubyte e)
{
ubyte[] result = new_buffer(dc.width * dc.height * dc.tchans, e);
if (e) return null;
switch (dc.num_comps * 10 + dc.tchans) {
case 34, 33:
// Use specialized bilinear filtering functions for the frequent cases
// where Cb & Cr channels have half resolution.
if (dc.comps[0].sfx <= 2 && dc.comps[0].sfy <= 2 &&
dc.comps[0].sfx + dc.comps[0].sfy >= 3 &&
dc.comps[1].sfx == 1 && dc.comps[1].sfy == 1 &&
dc.comps[2].sfx == 1 && dc.comps[2].sfy == 1)
{
void function(in ubyte[], in ubyte[], ubyte[]) nothrow resample;
switch (dc.comps[0].sfx * 10 + dc.comps[0].sfy) {
case 22: resample = &upsample_h2_v2; break;
case 21: resample = &upsample_h2_v1; break;
case 12: resample = &upsample_h1_v2; break;
default: assert(0);
}
ubyte[] comps1n2 = new_buffer(dc.width * 2, e);
if (e) return null;
scope(exit) _free(comps1n2.ptr);
ubyte[] comp1 = comps1n2[0..dc.width];
ubyte[] comp2 = comps1n2[dc.width..$];
size_t s = 0;
size_t di = 0;
foreach (j; 0 .. dc.height) {
const size_t mi = j / dc.comps[0].sfy;
const size_t si = (mi == 0 || mi >= (dc.height-1)/dc.comps[0].sfy)
? mi : mi - 1 + s * 2;
s = s ^ 1;
const size_t cs = dc.num_mcu_x * dc.comps[1].sfx * 8;
const size_t cl0 = mi * cs;
const size_t cl1 = si * cs;
resample(dc.comps[1].data[cl0 .. cl0 + dc.comps[1].x],
dc.comps[1].data[cl1 .. cl1 + dc.comps[1].x],
comp1[]);
resample(dc.comps[2].data[cl0 .. cl0 + dc.comps[2].x],
dc.comps[2].data[cl1 .. cl1 + dc.comps[2].x],
comp2[]);
foreach (i; 0 .. dc.width) {
result[di .. di+3] = ycbcr_to_rgb(
dc.comps[0].data[j * dc.num_mcu_x * dc.comps[0].sfx * 8 + i],
comp1[i],
comp2[i],
);
if (dc.tchans == 4)
result[di+3] = 255;
di += dc.tchans;
}
}
return result;
}
foreach (const ref comp; dc.comps[0..dc.num_comps]) {
if (comp.sfx != dc.hmax || comp.sfy != dc.vmax)
return dc.upsample(result);
}
size_t si, di;
foreach (j; 0 .. dc.height) {
foreach (i; 0 .. dc.width) {
result[di .. di+3] = ycbcr_to_rgb(
dc.comps[0].data[si+i],
dc.comps[1].data[si+i],
dc.comps[2].data[si+i],
);
if (dc.tchans == 4)
result[di+3] = 255;
di += dc.tchans;
}
si += dc.num_mcu_x * dc.comps[0].sfx * 8;
}
return result;
case 32, 12, 31, 11:
const comp = &dc.comps[0];
if (comp.sfx == dc.hmax && comp.sfy == dc.vmax) {
size_t si, di;
if (dc.tchans == 2) {
foreach (j; 0 .. dc.height) {
foreach (i; 0 .. dc.width) {
result[di++] = comp.data[si+i];
result[di++] = 255;
}
si += dc.num_mcu_x * comp.sfx * 8;
}
} else {
foreach (j; 0 .. dc.height) {
result[di .. di+dc.width] = comp.data[si .. si+dc.width];
si += dc.num_mcu_x * comp.sfx * 8;
di += dc.width;
}
}
return result;
} else {
// need to resample (haven't tested this...)
return dc.upsample_luma(result);
}
case 14, 13:
const comp = &dc.comps[0];
size_t si, di;
foreach (j; 0 .. dc.height) {
foreach (i; 0 .. dc.width) {
result[di .. di+3] = comp.data[si+i];
if (dc.tchans == 4)
result[di+3] = 255;
di += dc.tchans;
}
si += dc.num_mcu_x * comp.sfx * 8;
}
return result;
default:
assert(0);
}
}
void upsample_h2_v2(in ubyte[] line0, in ubyte[] line1, ubyte[] result)
{
ubyte mix(ubyte mm, ubyte ms, ubyte sm, ubyte ss)
{
return cast(ubyte) (( cast(uint) mm * 3 * 3
+ cast(uint) ms * 3 * 1
+ cast(uint) sm * 1 * 3
+ cast(uint) ss * 1 * 1
+ 8) / 16);
}
result[0] = cast(ubyte) (( cast(uint) line0[0] * 3
+ cast(uint) line1[0] * 1
+ 2) / 4);
if (line0.length == 1)
return;
result[1] = mix(line0[0], line0[1], line1[0], line1[1]);
size_t di = 2;
foreach (i; 1 .. line0.length) {
result[di] = mix(line0[i], line0[i-1], line1[i], line1[i-1]);
di += 1;
if (i == line0.length-1) {
if (di < result.length) {
result[di] = cast(ubyte) (( cast(uint) line0[i] * 3
+ cast(uint) line1[i] * 1
+ 2) / 4);
}
return;
}
result[di] = mix(line0[i], line0[i+1], line1[i], line1[i+1]);
di += 1;
}
}
void upsample_h2_v1(in ubyte[] line0, in ubyte[] _line1, ubyte[] result)
{
result[0] = line0[0];
if (line0.length == 1)
return;
result[1] = cast(ubyte) (( cast(uint) line0[0] * 3
+ cast(uint) line0[1] * 1
+ 2) / 4);
size_t di = 2;
foreach (i; 1 .. line0.length) {
result[di] = cast(ubyte) (( cast(uint) line0[i-1] * 1
+ cast(uint) line0[i+0] * 3
+ 2) / 4);
di += 1;
if (i == line0.length-1) {
if (di < result.length) result[di] = line0[i];
return;
}
result[di] = cast(ubyte) (( cast(uint) line0[i+0] * 3
+ cast(uint) line0[i+1] * 1
+ 2) / 4);
di += 1;
}
}
void upsample_h1_v2(in ubyte[] line0, in ubyte[] line1, ubyte[] result)
{
foreach (i; 0 .. result.length) {
result[i] = cast(ubyte) (( cast(uint) line0[i] * 3
+ cast(uint) line1[i] * 1
+ 2) / 4);
}
}
// Nearest neighbor
ubyte[] upsample_luma(in ref JPEGDecoder dc, ubyte[] result)
{
const size_t stride0 = dc.num_mcu_x * dc.comps[0].sfx * 8;
const y_step0 = cast(float) dc.comps[0].sfy / cast(float) dc.vmax;
const x_step0 = cast(float) dc.comps[0].sfx / cast(float) dc.hmax;
float y0 = y_step0 * 0.5;
size_t y0i = 0;
size_t di;
foreach (j; 0 .. dc.height) {
float x0 = x_step0 * 0.5;
size_t x0i = 0;
foreach (i; 0 .. dc.width) {
result[di] = dc.comps[0].data[y0i + x0i];
if (dc.tchans == 2)
result[di+1] = 255;
di += dc.tchans;
x0 += x_step0;
if (x0 >= 1.0) {
x0 -= 1.0;
x0i += 1;
}
}
y0 += y_step0;
if (y0 >= 1.0) {
y0 -= 1.0;
y0i += stride0;
}
}
return result;
}
// Nearest neighbor
ubyte[] upsample(in ref JPEGDecoder dc, ubyte[] result)
{
const size_t stride0 = dc.num_mcu_x * dc.comps[0].sfx * 8;
const size_t stride1 = dc.num_mcu_x * dc.comps[1].sfx * 8;
const size_t stride2 = dc.num_mcu_x * dc.comps[2].sfx * 8;
const y_step0 = cast(float) dc.comps[0].sfy / cast(float) dc.vmax;
const y_step1 = cast(float) dc.comps[1].sfy / cast(float) dc.vmax;
const y_step2 = cast(float) dc.comps[2].sfy / cast(float) dc.vmax;
const x_step0 = cast(float) dc.comps[0].sfx / cast(float) dc.hmax;
const x_step1 = cast(float) dc.comps[1].sfx / cast(float) dc.hmax;
const x_step2 = cast(float) dc.comps[2].sfx / cast(float) dc.hmax;
float y0 = y_step0 * 0.5;
float y1 = y_step1 * 0.5;
float y2 = y_step2 * 0.5;
size_t y0i = 0;
size_t y1i = 0;
size_t y2i = 0;
size_t di;
foreach (_j; 0 .. dc.height) {
float x0 = x_step0 * 0.5;
float x1 = x_step1 * 0.5;
float x2 = x_step2 * 0.5;
size_t x0i = 0;
size_t x1i = 0;
size_t x2i = 0;
foreach (i; 0 .. dc.width) {
result[di .. di+3] = ycbcr_to_rgb(
dc.comps[0].data[y0i + x0i],
dc.comps[1].data[y1i + x1i],
dc.comps[2].data[y2i + x2i],
);
if (dc.tchans == 4)
result[di+3] = 255;
di += dc.tchans;
x0 += x_step0;
x1 += x_step1;
x2 += x_step2;
if (x0 >= 1.0) { x0 -= 1.0; x0i += 1; }
if (x1 >= 1.0) { x1 -= 1.0; x1i += 1; }
if (x2 >= 1.0) { x2 -= 1.0; x2i += 1; }
}
y0 += y_step0;
y1 += y_step1;
y2 += y_step2;
if (y0 >= 1.0) { y0 -= 1.0; y0i += stride0; }
if (y1 >= 1.0) { y1 -= 1.0; y1i += stride1; }
if (y2 >= 1.0) { y2 -= 1.0; y2i += stride2; }
}
return result;
}
ubyte[3] ycbcr_to_rgb(in ubyte y, in ubyte cb, in ubyte cr) pure {
ubyte[3] rgb = void;
rgb[0] = clamp(y + 1.402*(cr-128));
rgb[1] = clamp(y - 0.34414*(cb-128) - 0.71414*(cr-128));
rgb[2] = clamp(y + 1.772*(cb-128));
return rgb;
}
ubyte clamp(in float x) pure {
if (x < 0) return 0;
if (255 < x) return 255;
return cast(ubyte) x;
}
// ------------------------------------------------------------
// The IDCT stuff here (to the next dashed line) is copied and adapted from
// stb_image which is released under public domain. Many thanks to stb_image
// author, Sean Barrett.
// Link: https://github.com/nothings/stb/blob/master/stb_image.h
pure int f2f(float x) { return cast(int) (x * 4096 + 0.5); }
pure int fsh(int x) { return x << 12; }
// from stb_image, derived from jidctint -- DCT_ISLOW
pure void STBI__IDCT_1D(ref int t0, ref int t1, ref int t2, ref int t3,
ref int x0, ref int x1, ref int x2, ref int x3,
int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7)
{
int p1,p2,p3,p4,p5;
//int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3;
p2 = s2;
p3 = s6;
p1 = (p2+p3) * f2f(0.5411961f);
t2 = p1 + p3 * f2f(-1.847759065f);
t3 = p1 + p2 * f2f( 0.765366865f);
p2 = s0;
p3 = s4;
t0 = fsh(p2+p3);
t1 = fsh(p2-p3);
x0 = t0+t3;
x3 = t0-t3;
x1 = t1+t2;
x2 = t1-t2;
t0 = s7;
t1 = s5;
t2 = s3;
t3 = s1;
p3 = t0+t2;
p4 = t1+t3;
p1 = t0+t3;
p2 = t1+t2;
p5 = (p3+p4)*f2f( 1.175875602f);
t0 = t0*f2f( 0.298631336f);
t1 = t1*f2f( 2.053119869f);
t2 = t2*f2f( 3.072711026f);
t3 = t3*f2f( 1.501321110f);
p1 = p5 + p1*f2f(-0.899976223f);
p2 = p5 + p2*f2f(-2.562915447f);
p3 = p3*f2f(-1.961570560f);
p4 = p4*f2f(-0.390180644f);
t3 += p1+p4;
t2 += p2+p3;
t1 += p2+p4;
t0 += p1+p3;
}
// idct and level-shift
pure void stbi__idct_block(ubyte* dst, in int dst_stride, in ref short[64] data)
{
int i;
int[64] val;
int* v = val.ptr;
const(short)* d = data.ptr;
// columns
for (i=0; i < 8; ++i,++d, ++v) {
// if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
&& d[40]==0 && d[48]==0 && d[56]==0) {
// no shortcut 0 seconds
// (1|2|3|4|5|6|7)==0 0 seconds
// all separate -0.047 seconds
// 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
int dcterm = d[0] << 2;
v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
} else {
int t0,t1,t2,t3,x0,x1,x2,x3;
STBI__IDCT_1D(
t0, t1, t2, t3,
x0, x1, x2, x3,
d[ 0], d[ 8], d[16], d[24],
d[32], d[40], d[48], d[56]
);
// constants scaled things up by 1<<12; let's bring them back
// down, but keep 2 extra bits of precision
x0 += 512; x1 += 512; x2 += 512; x3 += 512;
v[ 0] = (x0+t3) >> 10;
v[56] = (x0-t3) >> 10;
v[ 8] = (x1+t2) >> 10;
v[48] = (x1-t2) >> 10;
v[16] = (x2+t1) >> 10;
v[40] = (x2-t1) >> 10;
v[24] = (x3+t0) >> 10;
v[32] = (x3-t0) >> 10;
}
}
ubyte* o = dst;
for (i=0, v=val.ptr; i < 8; ++i,v+=8,o+=dst_stride) {
// no fast case since the first 1D IDCT spread components out
int t0,t1,t2,t3,x0,x1,x2,x3;
STBI__IDCT_1D(
t0, t1, t2, t3,
x0, x1, x2, x3,
v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]
);
// constants scaled things up by 1<<12, plus we had 1<<2 from first
// loop, plus horizontal and vertical each scale by sqrt(8) so together
// we've got an extra 1<<3, so 1<<17 total we need to remove.
// so we want to round that, which means adding 0.5 * 1<<17,
// aka 65536. Also, we'll end up with -128 to 127 that we want
// to encode as 0-255 by adding 128, so we'll add that before the shift
x0 += 65536 + (128<<17);
x1 += 65536 + (128<<17);
x2 += 65536 + (128<<17);
x3 += 65536 + (128<<17);
// tried computing the shifts into temps, or'ing the temps to see
// if any were out of range, but that was slower
o[0] = stbi__clamp((x0+t3) >> 17);
o[7] = stbi__clamp((x0-t3) >> 17);
o[1] = stbi__clamp((x1+t2) >> 17);
o[6] = stbi__clamp((x1-t2) >> 17);
o[2] = stbi__clamp((x2+t1) >> 17);
o[5] = stbi__clamp((x2-t1) >> 17);
o[3] = stbi__clamp((x3+t0) >> 17);
o[4] = stbi__clamp((x3-t0) >> 17);
}
}
// clamp to 0-255
pure ubyte stbi__clamp(int x) {
if (cast(uint) x > 255) {
if (x < 0) return 0;
if (x > 255) return 255;
}
return cast(ubyte) x;
}
// ------------------------------------------------------------
|
D
|
/+
+ Copyright 2023 Aya Partridge
+ Copyright 2018 - 2022 Michael D. Parker
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+/
module bindbc.glfw.bindstatic;
import bindbc.glfw.types;
static if(staticBinding):
extern(C) @nogc nothrow {
int glfwInit();
void glfwTerminate();
void glfwGetVersion(int* major, int* minor, int* rev);
const(char)* glfwGetVersionString();
GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
GLFWmonitor** glfwGetMonitors(int* count);
GLFWmonitor* glfwGetPrimaryMonitor();
void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
const(char)* glfwGetMonitorName(GLFWmonitor* monitor);
GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
const(GLFWvidmode)* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
const(GLFWvidmode)* glfwGetVideoMode(GLFWmonitor* monitor);
void glfwSetGamma(GLFWmonitor* monitor, float gamma);
const(GLFWgammaramp*) glfwGetGammaRamp(GLFWmonitor* monitor);
void glfwSetGammaRamp(GLFWmonitor* monitor, const(GLFWgammaramp)* ramp);
void glfwDefaultWindowHints();
void glfwWindowHint(int hint, int value);
GLFWwindow* glfwCreateWindow(int width, int height, const(char)* title, GLFWmonitor* monitor, GLFWwindow* share);
void glfwDestroyWindow(GLFWwindow* window);
int glfwWindowShouldClose(GLFWwindow* window);
void glfwSetWindowShouldClose(GLFWwindow* window, int value);
void glfwSetWindowTitle(GLFWwindow* window, const(char)* title);
void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
void glfwSetWindowSize(GLFWwindow* window, int width, int height);
void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
void glfwIconifyWindow(GLFWwindow* window);
void glfwRestoreWindow(GLFWwindow* window);
void glfwShowWindow(GLFWwindow* window);
void glfwHideWindow(GLFWwindow* window);
GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
void* glfwGetWindowUserPointer(GLFWwindow* window);
GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);
GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);
GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);
GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);
GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback);
void glfwPollEvents();
void glfwWaitEvents();
int glfwGetInputMode(GLFWwindow* window, int mode);
void glfwSetInputMode(GLFWwindow* window, int mode, int value);
int glfwGetKey(GLFWwindow* window, int key);
int glfwGetMouseButton(GLFWwindow* window, int button);
void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);
GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);
GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);
GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
int glfwJoystickPresent(int jid);
float* glfwGetJoystickAxes(int jid, int* count);
ubyte* glfwGetJoystickButtons(int jid, int* count);
const(char)* glfwGetJoystickName(int jid);
void glfwSetClipboardString(GLFWwindow* window, const(char)* string_);
const(char)* glfwGetClipboardString(GLFWwindow* window);
double glfwGetTime();
void glfwSetTime(double time);
void glfwMakeContextCurrent(GLFWwindow* window);
GLFWwindow* glfwGetCurrentContext();
void glfwSwapBuffers(GLFWwindow* window);
void glfwSwapInterval(int interval);
int glfwExtensionSupported(const(char)* extension);
GLFWglproc glfwGetProcAddress(const(char)* procname);
static if(glfwSupport >= GLFWSupport.glfw31) {
void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
void glfwPostEmptyEvent();
GLFWcursor* glfwCreateCursor(const(GLFWimage)* image, int xhot, int yhot);
GLFWcursor* glfwCreateStandardCursor(int shape);
void glfwDestroyCursor(GLFWcursor* cursor);
void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback);
GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
}
static if(glfwSupport >= GLFWSupport.glfw32) {
void glfwSetWindowIcon(GLFWwindow* window, int count, const(GLFWimage)* images);
void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
void glfwMaximizeWindow(GLFWwindow* window);
void glfwFocusWindow(GLFWwindow* window);
void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
void glfwWaitEventsTimeout(double timeout);
const(char)* glfwGetKeyName(int key, int scancode);
long glfwGetTimerValue();
long glfwGetTimerFrequency();
int glfwVulkanSupported();
GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
}
static if(glfwSupport >= GLFWSupport.glfw33) {
void glfwInitHint(int,int);
int glfwGetError(const(char)** description);
void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
void glfwWindowHintString(int hint,const(char)* value);
void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
float glfwGetWindowOpacity(GLFWwindow* window);
void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
void glfwRequestWindowAttention(GLFWwindow* window);
void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);
GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);
int glfwGetKeyScancode(int key);
const(ubyte)* glfwGetJoystickHats(int jid, int* count);
const(char)* glfwGetJoystickGUID(int jid);
void glfwSetJoystickUserPointer(int jid, void* pointer);
void* glfwGetJoystickUserPointer(int jid);
int glfwJoystickIsGamepad(int jid);
int glfwUpdateGamepadMappings(const(char)* string_);
const(char)* glfwGetGamepadName(int jid);
int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
}
}
/*
The following allow binding to Vulkan and native system functions using
types declared in any Vulkan or system binding, e.g.:
```d
module myglfw;
public import bindbc.glfw;
mixin(bindGLFW_Vulkan);
```
*/
// Vulkan
static if(glfwSupport >= GLFWSupport.glfw32) {
enum bindGLFW_Vulkan = q{
extern(C) @nogc nothrow {
const(char)** glfwGetRequiredInstanceExtensions(uint* count);
GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const(char)* procname);
int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint queuefamily);
VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const(VkAllocationCallbacks)* allocator, VkSurfaceKHR* surface);
}
};
}
// EGL
enum bindGLFW_EGL = q{
extern(C) @nogc nothrow {
EGLDisplay glfwGetEGLDisplay();
EGLContext glfwGetEGLContext(GLFWwindow* window);
EGLSurface glfwGetEGLSurface(GLFWwindow* window);
}
};
version(Windows) {
enum bindGLFW_WGL = q{
extern(C) @nogc nothrow HGLRC glfwGetWGLContext(GLFWwindow* window);
};
static if(glfwSupport >= GLFWSupport.glfw31) {
enum bindGLFW_Windows = q{
extern(C) @nogc nothrow {
HWND glfwGetWin32Window(GLFWwindow* window);
const(char)* glfwGetWin32Adapter(GLFWmonitor* monitor);
const(char)* glfwGetWin32Monitor(GLFWmonitor* monitor);
}
};
}
else enum bindGLFW_Windows= q{
extern(C) @nogc nothrow HWND glfwGetWin32Window(GLFWwindow* window);
};
}
version(OSX) {
enum bindGLFW_NSGL = q{
extern(C) @nogc nothrow id glfwGetNSGLContext(GLFWwindow* window);
};
static if(glfwSupport >= GLFWSupport.glfw31) {
enum bindGLFW_Cocoa = q{
extern(C) @nogc nothrow {
CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
id glfwGetCocoaWindow(GLFWwindow* window);
}
};
}
else enum bindGLFW_Cocoa = q{
extern(C) @nogc nothrow id glfwGetCocoaWindow(GLFWwindow* window);
};
}
else version(Android) {}
else version(Posix) {
// X11
static if(glfwSupport >= GLFWSupport.glfw32) {
enum bindGLFW_GLX = q{
extern(C) @nogc nothrow {
GLXContext glfwGetGLXContext(GLFWwindow* window);
GLXwindow glfwGetGLXWindow(GLFWwindow* window);
}
};
}
else enum bindGLFW_GLX = q{
extern(C) @nogc nothrow GLXContext glfwGetGLXContext(GLFWwindow* window);
};
static if(glfwSupport >= GLFWSupport.glfw33) {
enum bindGLFW_X11 = q{
extern(C) @nogc nothrow {
Display* glfwGetX11Display();
Window glfwGetX11Window(GLFWwindow* window);
RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
void glfwSetX11SelectionString(const(char)* string_);
const(char)* glfwGetX11SelectionString();
}
};
}
else static if(glfwSupport >= GLFWSupport.glfw31) {
enum bindGLFW_X11 = q{
extern(C) @nogc nothrow {
Display* glfwGetX11Display();
Window glfwGetX11Window(GLFWwindow* window);
RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
}
};
}
else enum bindGLFW_X11 = q{
extern(C) @nogc nothrow {
Display* glfwGetX11Display();
Window glfwGetX11Window(GLFWwindow* window);
}
};
// Wayland
static if(glfwSupport >= GLFWSupport.glfw32) {
enum bindGLFW_Wayland = q{
extern(C) @nogc nothrow {
wl_display* glfwGetWaylandDisplay();
wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
}
};
}
// Mir
// Removed in GLFW 3.3
static if(glfwSupport == GLFWSupport.glfw32) {
enum bindGLFW_Mir = q{
extern(C) @nogc nothrow {
MirConnection* glfwGetMirDisplay();
int glfwGetMirMonitor(GLFWmonitor* monitor);
MirSurface* glfwGetMirWindow(GLFWwindow* window);
}
};
}
}
|
D
|
// PERMUTE_ARGS: -w
extern(C) int printf(const char*, ...);
int testswitch(string h)
{
int x;
switch (h)
{
case "abc":
printf("abc\n");
x = 4;
break;
case "foo":
printf("foo\n");
x = 1;
break;
case "bar":
printf("bar\n");
x = 2;
break;
default:
printf("default\n");
x = 3;
break;
}
return x;
}
void test1()
{
int i;
i = testswitch("foo");
printf("i = %d\n", i);
assert(i == 1);
assert(testswitch("abc") == 4);
assert(testswitch("bar") == 2);
assert(testswitch("hello") == 3);
printf("Success\n");
}
/*****************************************/
void test2()
{
int i;
switch (5)
{
case 3,4,5,6:
i = 20;
break;
case 7:
default:
assert(0);
}
assert(i == 20);
}
/*****************************************/
void test3()
{
int i;
switch (5)
{
case 7:
i = 6;
goto default;
default:
i = 8;
break;
case 3,4,5,6:
i = 20;
goto default;
}
assert(i == 8);
}
/*****************************************/
void test4()
{ int i;
switch (5)
{
case 3,4,5,6:
i = 20;
goto default;
case 7:
i = 6;
goto default;
default:
i = 8;
break;
}
assert(i == 8);
}
/*****************************************/
void test5()
{ int i;
switch (5)
{
case 7:
i = 6;
goto case;
default:
i = 8;
break;
case 3,4,5,6:
i = 20;
break;
}
assert(i == 20);
}
/*****************************************/
void test6()
{
int i;
switch (5)
{
case 7:
i = 6;
goto case 4;
default:
i = 8;
break;
case 3,4,5,6:
i = 20;
break;
}
assert(i == 20);
}
/*****************************************/
void test7()
{
int i;
switch (5)
{
case 3,4,5,6:
i = 20;
break;
case 7:
i = 6;
goto case 4;
default:
i = 8;
break;
}
assert(i == 20);
}
/*****************************************/
void test8()
{
dstring str = "xyz";
switch (str)
{
case "xyz":
printf("correct\n");
return;
case "abc":
break;
default:
assert(0);
}
assert(0);
}
/*****************************************/
void test9()
{
int i = 1;
switch(i)
{
case 2:
return;
case 1:
switch(i)
{
case 1:
goto case 2;
default:
assert(0);
}
default:
assert(0);
}
assert(0);
}
/*****************************************/
void test10()
{
int id1 = 0;
int id;
switch (id1)
{
case 0: ++id; goto case;
case 7: ++id; goto case;
case 6: ++id; goto case;
case 5: ++id; goto case;
case 4: ++id; goto case;
case 3: ++id; goto case;
case 2: ++id; goto case;
case 1: ++id; goto default;
default:
break;
}
assert(id == 8);
}
/*****************************************/
void test11()
{
long foo = 4;
switch (foo)
{
case 2: assert (false);
case 3: break;
case 4: break;
case 5: break;
default: assert(0);
}
}
/*****************************************/
void test12()
{
switch("#!")
{
case "#!": printf("----Found #!\n"); break;
case "\xFF\xFE"c: break;
default:
assert(0);
}
}
/*****************************************/
void test13()
{
switch("#!")
{
case "#!": printf("----Found #!\n"); break;
case "#\xFE"c: break;
default:
assert(0);
}
}
/*****************************************/
void foo14(A...)(int i)
{
switch (i)
{
foreach(a; A)
{
goto case;
case a:
printf("%d\n", a);
}
break;
default:
assert(0);
}
}
void bar14(A...)(int i)
{
switch (i)
{
foreach(j, a; A)
{
goto case;
case A[j]:
printf("a = %d, A[%zd] = %d\n", a, j, A[j]);
}
break;
default:
assert(0);
}
}
void test14()
{
foo14!(1,2,3,4,5)(1);
bar14!(1,2,3,4,5)(1);
}
/*****************************************/
const int X15;
immutable int Y15;
const int Z15;
int foo15(int i)
{
auto y = 1;
switch (i)
{
case X15:
y += 1;
goto case;
case 3:
y += 2;
break;
case Y15:
y += 20;
goto case;
case Z15:
y += 10;
break;
default:
y += 4;
break;
}
printf("y = %d\n", y);
return y;
}
static this()
{
X15 = 4;
Z15 = 5;
}
shared static this()
{
Y15 = 4;
}
void test15()
{
auto i = foo15(3);
assert(i == 3);
i = foo15(4);
assert(i == 4);
i = foo15(7);
assert(i == 5);
i = foo15(5);
assert(i == 11);
}
/*****************************************/
enum E16
{
A,B,C
}
void test16()
{
E16 e = E16.A;
final switch (e)
{
case E16.A:
case E16.B:
case E16.C:
{}
}
}
/*****************************************/
void test17()
{
int i = 2;
switch (i)
{
case 1: .. case 3:
i = 5;
break;
default:
assert(0);
}
if (i != 5)
assert(0);
switch (i)
{
case 1: .. case 3:
i = 4;
break;
case 5:
i = 6;
break;
default:
assert(0);
}
if (i != 6)
assert(0);
}
/*****************************************/
int test19()
{
enum foo{ bar }
foo x;
final switch(x){ case foo.bar: return 0; }
}
/*****************************************/
void test20()
{
switch(1)
{
mixin("case 0:{}");
case 1:
case 2:
default:
}
}
/*****************************************/
void hang3139(int x)
{
switch(x) {
case -9: .. case -1:
default:
}
}
int wrongcode3139(int x)
{
switch(x) {
case -9: .. case 2: return 3;
default:
return 4;
}
}
static assert(wrongcode3139(-5)==3);
// https://issues.dlang.org/show_bug.cgi?id=3139
static assert(!is(typeof(
(long x) { switch(x) { case long.max: .. case -long.max:
default:} return 4; }(3)
)));
/*****************************************/
void test7358()
{
static void test7358a()
{
enum X { A = 1, B = 2 }
auto x = X.A | X.B;
final switch(x)
{
case X.A:
case X.B:
break;
}
}
bool exception;
try
test7358a();
catch (Error)
exception = true;
assert(exception);
}
/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=9263
void test9263()
{
enum Foo { A }
Foo f;
final switch (f) with(Foo)
{
case A:
return;
}
}
/*****************************************/
int bar21(int i)
{
switch (i)
{
// case 1: return 11;
case 2: return 12;
case 3: return 13;
case 4: return 14;
case 5: return 15;
case 6: return 16;
case 7: return 17;
case 8: return 18;
case 9: return 19;
case 10: return 20;
default: break;
}
switch (i)
{
case 11: return 21;
case 12: return 22;
case 13: return 23;
case 14: return 24;
case 15: return 25;
case 16: return 26;
case 17: return 27;
case 18: return 28;
case 19: return 29;
case 20: return 30;
default: return 31;
}
}
void test21()
{
// int j = bar(12);
// printf("j = %d\n", j);
for (int i = 2; i < 21; i++)
{
int j = bar21(i);
//printf("j = %d\n", j);
assert(j == i + 10);
}
}
/*****************************************/
int bar22(int i)
{
switch (i)
{
case 1: return i + 1;
case 10: return i + 2;
case 20: return i + 3;
case 50: return i + 4;
case 1000: return i + 5;
default: return 28;
}
}
void test22()
{
assert(bar22(1) == 2);
assert(bar22(10) == 12);
assert(bar22(20) == 23);
assert(bar22(50) == 54);
assert(bar22(1000) == 1005);
assert(bar22(0) == 28);
assert(bar22(5) == 28);
assert(bar22(15) == 28);
assert(bar22(25) == 28);
assert(bar22(58) == 28);
assert(bar22(2000) == 28);
}
/*****************************************/
long bar23(long i)
{
switch (i)
{
case 1: return i + 1;
case 0x10_0000_0000L: return i + 2;
case 0x20_0070_0000L: return i + 3;
case 0x50_0000_0000L: return i + 4;
case 0x1000_0000_8000L: return i + 5;
default: return 28;
}
}
void test23()
{
assert(bar23(1) == 2);
assert(bar23(0x10_0000_0000L) == 0x10_0000_0000L + 2);
assert(bar23(0x20_0070_0000L) == 0x20_0070_0000L + 3);
assert(bar23(0x50_0000_0000L) == 0x50_0000_0000L + 4);
assert(bar23(0x1000_0000_8000L) == 0x1000_0000_8000L + 5);
assert(bar23(0) == 28);
assert(bar23(58) == 28);
assert(bar23(0x10_0000_0000L+1) == 28);
assert(bar23(0x20_0070_0000L+5) == 28);
assert(bar23(0x50_0000_0000L+25) == 28);
assert(bar23(0x1000_0000_8000L+1) == 28);
}
/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=14352
int transmogrify14352(int input)
{
int output = 0;
switch (input)
{
case 0, 1:
if (input == 0)
goto case;
else
output++;
goto case;
case 2:
output += 5;
goto case;
case 3:
output += 5;
break;
case 4, 5, 6:
goto default;
case 7:
case 8:
output += 20;
break;
default:
return -1;
}
return output;
}
void test14352()
{
assert(transmogrify14352(0) == 10);
}
/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=14587
// DMD 2.067.1 generating crashing binary on OSX
struct Card {
int value;
int suit;
}
void foo14587(Card card) {
switch(card.value) {
case 4: case 5: case 6: case 11:
break;
default:
}
}
void test14587() {
auto card = Card(11, 1);
foo14587(card);
}
/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=15396
// static immutable not recognized as constant within switch statement
void test15396()
{
static immutable Foo = "Foobar";
static const Bar = "BarFoo";
foreach (var; [ "Foobar", "BarFoo" ])
{
switch (var)
{
case Foo:
break;
case Bar:
break;
default:
assert(0, "test15396 failed");
}
}
}
/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=15538
struct S15538
{
int a = 0;
int b = 1;
}
int f15538(S15538 s)
{
switch (s.a)
{
case 0: return 10;
case 1: return 20;
case 2: return 30;
case 3: return 40;
default: return 99;
}
}
void test15538()
{
S15538 s;
assert(f15538(s) == 10); /* fails */
}
/*****************************************/
int main()
{
test1();
test2();
test3();
test4();
test5();
test6();
test7();
test8();
test9();
test10();
test11();
test12();
test13();
test14();
test15();
test16();
test17();
test19();
test20();
test7358();
test9263();
test21();
test22();
test23();
test14352();
test14587();
test15396();
test15538();
printf("Success\n");
return 0;
}
|
D
|
// @expect error
import smack;
int cap(int x) {
int y = x;
if (10 < x) {
y = 10;
}
return y;
}
void main() {
__VERIFIER_assert(cap(2) == 2);
__VERIFIER_assert(cap(15) == 10);
int x = __VERIFIER_nondet_int();
__VERIFIER_assert(cap(x) > 10);
}
|
D
|
func void B_GiveDeathInv(var C_Npc slf)
{
if(slf.aivar[AIV_DeathInvGiven] == TRUE)
{
return;
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_Teeth] == TRUE)
{
if((slf.aivar[AIV_MM_REAL_ID] == ID_WOLF) && (slf.protection[PROT_POINT] != IMMUNE))
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Icewolf)
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_WARG)
{
CreateInvItems(slf,ItAt_DS2P_Teeth_Warg,2); //NS - 26/06/2013
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SNAPPER)
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DRAGONSNAPPER)
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Razor)
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_KARAKUS)
{
CreateInvItems(slf,ItAt_Canine_Karakus,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Bloodhound)
{
CreateInvItems(slf,ItAt_Teeth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SWAMPSHARK)
{
CreateInvItems(slf,ItAt_SharkTeeth,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_TROLL)
{
CreateInvItems(slf,ItAt_TrollTooth,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_TROLL_BLACK)
{
CreateInvItems(slf,ItAt_TrollTooth,4);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_Claws] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_WARAN)
{
CreateInvItems(slf,ItAt_Claw,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_FIREWARAN)
{
CreateInvItems(slf,ItAt_Claw,4);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SNAPPER)
{
CreateInvItems(slf,ItAt_Claw,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Razor)
{
CreateInvItems(slf,ItAt_Claw,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DRAGONSNAPPER)
{
CreateInvItems(slf,ItAt_Claw,4);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SHADOWBEAST)
{
CreateInvItems(slf,ItAt_Claw,4);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Bloodhound)
{
CreateInvItems(slf,ItAt_Claw,4);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_LURKER)
{
CreateInvItems(slf,ItAt_LurkerClaw,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_Fur] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_SHEEP)
{
CreateInvItems(slf,ItAt_SheepFur,1);
};
if((slf.aivar[AIV_MM_REAL_ID] == ID_WOLF) && (slf.protection[PROT_POINT] != IMMUNE))
{
CreateInvItems(slf,ItAt_WolfFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Icewolf)
{
CreateInvItems(slf,ItAt_WolfFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_WARG)
{
CreateInvItems(slf,ItAt_WargFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SHADOWBEAST)
{
CreateInvItems(slf,ItAt_ShadowFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_TROLL)
{
CreateInvItems(slf,ItAt_TrollFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_TROLL_BLACK)
{
CreateInvItems(slf,ItAt_TrollBlackFur,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Keiler)
{
CreateInvItems(slf,ItAt_Addon_KeilerFur,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_ReptileSkin] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_LURKER)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SNAPPER)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Razor)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DRAGONSNAPPER)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_WARAN)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_FIREWARAN)
{
CreateInvItems(slf,itat_LurkerSkin,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SWAMPSHARK)
{
CreateInvItems(slf,ItAt_SharkSkin,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_Heart] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_STONEGOLEM)
{
CreateInvItems(slf,ItAt_StoneGolemHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_FIREGOLEM)
{
CreateInvItems(slf,ItAt_FireGolemHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_ICEGOLEM)
{
CreateInvItems(slf,ItAt_IceGolemHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_STORMGOLEM)
{
CreateInvItems(slf,ItAt_DS_StormGolemHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_Swampgolem)
{
CreateInvItems(slf,ItAt_DS2P_Heart_SwampGolem,1); //NS - 26/06/2013
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DEMON)
{
CreateInvItems(slf,ItAt_DemonHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DEMON_LORD)
{
CreateInvItems(slf,ItAt_DemonHeart,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_SLEEPKEEPER)
{
CreateInvItems(slf,ItAt_Heart_KeeperKrypt,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_ShadowHorn] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_SHADOWBEAST)
{
CreateInvItems(slf,ItAt_ShadowHorn,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_FireTongue] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_FIREWARAN)
{
CreateInvItems(slf,ItAt_WaranFiretongue,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_BFWing] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_BLOODFLY)
{
CreateInvItems(slf,ItAt_Wing,2);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_BFSting] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_BLOODFLY)
{
CreateInvItems(slf,ItAt_Sting,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_Mandibles] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_GIANT_BUG)
{
CreateInvItems(slf,ItAt_BugMandibles,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLER)
{
CreateInvItems(slf,ItAt_CrawlerMandibles,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLERWARRIOR)
{
CreateInvItems(slf,ItAt_CrawlerMandibles,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_GNORE)
{
CreateInvItems(slf,ItAt_Claw_Rudogriz,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_CrawlerPlate] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLER)
{
CreateInvItems(slf,ItAt_CrawlerPlate,1);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLERWARRIOR)
{
CreateInvItems(slf,ItAt_CrawlerPlate,2);
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_DRAKE)
{
CreateInvItems(slf,ItAt_Armour_Kraur,1);
};
};
if(PLAYER_TALENT_TAKEANIMALTROPHY[TROPHY_DrgSnapperHorn] == TRUE)
{
if(slf.aivar[AIV_MM_REAL_ID] == ID_DRAGONSNAPPER)
{
CreateInvItems(slf,ItAt_DrgSnapperHorn,2);
};
};
if(slf.aivar[AIV_MM_REAL_ID] == ID_MEATBUG)
{
CreateInvItems(slf,ItAt_Meatbugflesh,1);
}
else if( (slf.aivar[AIV_MM_REAL_ID] == ID_LURKER) || (slf.aivar[AIV_MM_REAL_ID] == ID_SNAPPER)
|| (slf.aivar[AIV_MM_REAL_ID] == ID_Razor) || (slf.aivar[AIV_MM_REAL_ID] == ID_DRAGONSNAPPER)
|| (slf.aivar[AIV_MM_REAL_ID] == ID_WARAN) || (slf.aivar[AIV_MM_REAL_ID] == ID_FIREWARAN))
{
CreateInvItems(slf,ItAt_VeinLizard,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLER) || (slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLERWARRIOR))
{
CreateInvItems(slf,ItAt_Spider_Crawler,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_SKELETON)
{
CreateInvItems(slf,ItAt_GoblinBone,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BERSERK)
{
CreateInvItems(slf,ItPl_Dex_Herb_01,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_SKELETON)
{
CreateInvItems(slf,ItAt_SkeletonBone,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_WOLF_UNDEAD)
{
CreateInvItems(slf,ItAt_Bone_WolfZombie,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_SKELETON_MAGE)
{
var int SKELETON_MAGE_Randomizer; SKELETON_MAGE_Randomizer = Hlp_Random(100);
if(SKELETON_MAGE_Randomizer <= 5) {CreateInvItems(slf,ItPo_Mana_03,1);}
else if(SKELETON_MAGE_Randomizer <= 15) {CreateInvItems(slf,ItPo_Mana_02,1);}
else {CreateInvItems(slf,ItPo_Mana_01,1);};
CreateInvItems(slf,ItMi_Sulfur,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_ZOMBIE)
{
CreateInvItems(slf,ItAt_Prah_Zombie,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_BLATTCRAWLER)
{
CreateInvItems(slf,ItAt_Addon_BCKopf,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_MINECRAWLER_QUEEN)
{
CreateInvItems(slf,ItAt_Egg_CrawlerQueen,1);
};
var int GoblinGreen_Randomizer; GoblinGreen_Randomizer = Hlp_Random(100);
if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_GREEN) && (GoblinGreen_Randomizer == 0))
{
CreateInvItems(slf,ItMi_SilverRing,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_GREEN) && (GoblinGreen_Randomizer <= 5))
{
CreateInvItems(slf,ItPl_Mushroom_01,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_GREEN) && (GoblinGreen_Randomizer <= 15))
{
CreateInvItems(slf,ItMi_Gold,5);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_GREEN) && (GoblinGreen_Randomizer <= 30))
{
CreateInvItems(slf,ItFo_Fish,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_GREEN) && (GoblinGreen_Randomizer <= 50))
{
CreateInvItems(slf,ItMi_Gold,2);
};
var int GoblinBlack_Randomizer; GoblinBlack_Randomizer = Hlp_Random(100);
if(((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BLACK) || (slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BERSERK))
&& (GoblinBlack_Randomizer == 0))
{
CreateInvItems(slf,ItMi_GoldRing,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BLACK) && (GoblinBlack_Randomizer <= 5))
{
CreateInvItems(slf,ItFo_Fish,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BLACK) && (GoblinBlack_Randomizer <= 15))
{
CreateInvItems(slf,ItMi_Gold,10);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BLACK) && (GoblinBlack_Randomizer <= 30))
{
CreateInvItems(slf,ItPl_Mushroom_02,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_GOBBO_BLACK) && (GoblinBlack_Randomizer <= 50))
{
CreateInvItems(slf,ItMi_Gold,5);
};
var int Orc_Randomizer; Orc_Randomizer = Hlp_Random(10);
if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer == 0))
{
CreateInvItems(slf,ItPo_Health_02,1);
CreateInvItems(slf,ItMi_Gold,2);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer == 1))
{
CreateInvItems(slf,ItPo_Health_01,1);
CreateInvItems(slf,ItFoMuttonRaw,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer == 2))
{
CreateInvItems(slf,ItPo_Health_01,2);
CreateInvItems(slf,ItMi_Gold,18);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer == 3))
{
CreateInvItems(slf,ItFo_Booze,1);
CreateInvItems(slf,ItMi_SilverRing,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer == 4))
{
CreateInvItems(slf,ItPl_Health_Herb_01,1);
CreateInvItems(slf,ItMi_Gold,4);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCWARRIOR) && (Orc_Randomizer <= 7))
{
CreateInvItems(slf,ItMi_Gold,9);
};
if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer == 0))
{
CreateInvItems(slf,ItPo_Mana_03,1);
CreateInvItems(slf,ItMi_Gold,5);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer == 1))
{
CreateInvItems(slf,ItPo_Mana_02,2);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer == 2))
{
CreateInvItems(slf,ItPo_Mana_02,1);
CreateInvItems(slf,ItMi_Coal,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer == 3))
{
CreateInvItems(slf,ItPo_Mana_01,2);
CreateInvItems(slf,ItMi_Gold,12);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer == 4))
{
CreateInvItems(slf,ItPo_Mana_01,1);
CreateInvItems(slf,ItMi_Sulfur,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCSHAMAN) && (Orc_Randomizer <= 8))
{
CreateInvItems(slf,ItPl_Mana_Herb_02,2);
CreateInvItems(slf,ItMi_Gold,8);
};
if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer == 0))
{
CreateInvItems(slf,ItAt_WolfFur,1);
CreateInvItems(slf,ItPo_Health_03,1);
CreateInvItems(slf,ItFoMutton,2);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer == 1))
{
CreateInvItems(slf,ItMi_GoldRing,1);
CreateInvItems(slf,ItPo_Health_01,1);
CreateInvItems(slf,ItMi_Gold,26);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer == 2))
{
CreateInvItems(slf,ItSc_LightHeal,1);
CreateInvItems(slf,ItLsTorch,2);
CreateInvItems(slf,ItAt_Teeth,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer <= 5))
{
CreateInvItems(slf,ItMi_Gold,19);
CreateInvItems(slf,ItPo_Health_02,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer == 6))
{
CreateInvItems(slf,ItAt_WargFur,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_ORCELITE) && (Orc_Randomizer <= 9))
{
CreateInvItems(slf,ItMi_Gold,22);
CreateInvItems(slf,ItPo_Health_01,1);
};
if((slf.aivar[AIV_MM_REAL_ID] == ID_DEMON) && (Orc_Randomizer == 0))
{
CreateInvItems(slf,ItPo_Mana_03,2);
CreateInvItems(slf,ItMi_GoldRing,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_DEMON) && (Orc_Randomizer <= 2))
{
CreateInvItems(slf,ItPo_Mana_03,1);
CreateInvItems(slf,ItPo_Health_02,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_DEMON) && (Orc_Randomizer <= 6))
{
CreateInvItems(slf,ItPo_Mana_02,2);
CreateInvItems(slf,ItMi_Pitch,1);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_DEMON)
{
CreateInvItems(slf,ItPo_Mana_02,1);
CreateInvItems(slf,ItPo_Health_02,1);
};
if((slf.aivar[AIV_MM_REAL_ID] == ID_DEMON_LORD) && (Orc_Randomizer <= 1))
{
CreateInvItems(slf,ItPo_Mana_03,2);
CreateInvItems(slf,ItPo_Health_03,2);
CreateInvItems(slf,ItSc_SumDemon,1);
}
else if((slf.aivar[AIV_MM_REAL_ID] == ID_DEMON_LORD) && (Orc_Randomizer <= 5))
{
CreateInvItems(slf,ItPo_Mana_03,2);
CreateInvItems(slf,ItPo_Health_03,2);
}
else if(slf.aivar[AIV_MM_REAL_ID] == ID_DEMON_LORD)
{
CreateInvItems(slf,ItPo_Mana_03,1);
CreateInvItems(slf,ItPo_Health_03,1);
};
slf.aivar[AIV_DeathInvGiven] = TRUE;
};
|
D
|
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;
void main()
{
auto nm = readln.split.to!(int[]);
auto N = nm[0];
long M = nm[1];
long[] PS = [0];
foreach (_; 0..N) PS ~= readln.chomp.to!long;
long[] QS;
foreach (i; 0..N+1) {
foreach (j; i..N+1) {
QS ~= PS[i] + PS[j];
}
}
sort(QS);
long res;
foreach (q; QS) {
if (q + QS[0] > M) {
continue;
} else if (q + QS[$-1] <= M) {
res = max(res, q + QS[$-1]);
continue;
}
size_t l, r = QS.length - 1;
while (l+1 < r) {
auto m = (l+r)/2;
if (q + QS[m] > M) {
r = m;
} else {
l = m;
}
}
res = max(res, q + QS[l]);
}
writeln(res);
}
|
D
|
struct A
{
int x;
}
struct B
{
A a, b;
}
static assert(B(A(1), A(1)) != B(A(1), A(2))); // Works
struct C
{
A a, b;
alias a this;
}
static assert(C(A(1), A(1)) != C(A(1), A(2))); // Fails!
|
D
|
func void zs_dead()
{
printdebugnpc(PD_ZS_FRAME,"ZS_Dead");
printglobals(PD_ZS_CHECK);
c_zsinit();
self.aivar[AIV_PLUNDERED] = FALSE;
if(self.id == 251 && PLAYERINARENA == TRUE)
{
PLAYERINARENA = FALSE;
Wld_SendTrigger("OC_ARENA_GATE");
b_exchangeroutine(tpl_1422_gorhanis,"START");
b_exchangeroutine(sld_729_kharim,"START");
};
if(self.id == 729 && PLAYERINARENA == TRUE)
{
PLAYERINARENA = FALSE;
Wld_SendTrigger("OC_ARENA_GATE");
b_exchangeroutine(tpl_1422_gorhanis,"START");
b_exchangeroutine(grd_251_kirgo,"START");
};
if(self.id == 1422 && PLAYERINARENA == TRUE)
{
PLAYERINARENA = FALSE;
Wld_SendTrigger("OC_ARENA_GATE");
b_exchangeroutine(grd_251_kirgo,"START");
b_exchangeroutine(sld_729_kharim,"START");
};
if(Npc_IsPlayer(self) && PLAYERINARENA == TRUE)
{
PLAYERINARENA = FALSE;
Wld_SendTrigger("OC_ARENA_GATE");
b_exchangeroutine(tpl_1422_gorhanis,"START");
b_exchangeroutine(grd_251_kirgo,"START");
b_exchangeroutine(sld_729_kharim,"START");
};
if(Npc_IsPlayer(other) || (c_npcishuman(other) && other.aivar[AIV_PARTYMEMBER]) || (c_npcismonster(other) && other.aivar[AIV_MOVINGMOB]))
{
b_deathxp();
};
if(c_npcismonster(self))
{
b_givedeathinv();
};
if(self.guild == GIL_ORCSHAMAN)
{
Npc_RemoveInvItem(self,itarrune_2_2_fireball);
};
b_checkdeadmissionnpcs();
b_respawn(self);
};
|
D
|
import std.stdio, std.concurrency;
//version = compileFail;
void fun(string str) {
writeln(str);
}
version( compileFail )
void fun2(char[] str) {
writeln(str);
}
void fun3(int i) {
writeln(i);
}
void main() {
string str1 = "foo"; // string is an alias for immutable(char)[].
version( compileFail )
char[] str2 = "foo".dup;
auto t1 = spawn(&fun, str1); // Works. Pointers to immutable data.
version( compileFail )
auto t2 = spawn(&fun2, str2); // Error: Pointers to mutable data.
auto t3 = spawn(&fun3, 1); // Works. No pointer indirection at all.
send(t1, str1); // Pass a message. Works. Pointers to immutable data.
version( compileFail )
send(t1, str2); // Error: Pointers to mutable data.
send(t1, 1); // Works. No pointer indirection at all.
}
|
D
|
module android.java.java.lang.Long;
public import android.java.java.lang.Long_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!Long;
import import0 = android.java.java.lang.Long;
import import1 = android.java.java.lang.Class;
|
D
|
instance Org_804_Organisator_Exit(C_Info)
{
npc = ORG_804_Organisator;
nr = 999;
condition = Org_804_Organisator_Exit_Condition;
information = Org_804_Organisator_Exit_Info;
permanent = 1;
description = DIALOG_ENDE;
};
func int Org_804_Organisator_Exit_Condition()
{
if(Npc_KnowsInfo(hero,Org_804_Organisator_ToLares))
{
return 1;
};
};
func void Org_804_Organisator_Exit_Info()
{
AI_StopProcessInfos(self);
};
instance Org_804_Organisator_Greet(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Org_804_Organisator_Greet_Condition;
information = Org_804_Organisator_Greet_Info;
permanent = 0;
important = 1;
};
func int Org_804_Organisator_Greet_Condition()
{
if(Npc_GetDistToNpc(self,hero) < ZivilAnquatschDist)
{
return 1;
};
};
func void Org_804_Organisator_Greet_Info()
{
AI_Output(self,other,"Org_804_Organisator_Greet_06_00"); //A dokąd to się wybieramy?
};
instance Org_804_Organisator_WayTo(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Org_804_Organisator_WayTo_Condition;
information = Org_804_Organisator_WayTo_Info;
permanent = 0;
description = "A gdzie MOGĘ pójść?";
};
func int Org_804_Organisator_WayTo_Condition()
{
return 1;
};
func void Org_804_Organisator_WayTo_Info()
{
var C_Npc Lares;
AI_Output(other,self,"Org_804_Organisator_WayTo_15_00"); //A gdzie MOGĘ pójść?
AI_Output(self,other,"Org_804_Organisator_WayTo_06_01"); //Do Laresa.
Lares = Hlp_GetNpc(Org_801_Lares);
Lares.aivar[AIV_FINDABLE] = TRUE;
};
instance Org_804_Organisator_ToLares(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Org_804_Organisator_ToLares_Condition;
information = Org_804_Organisator_ToLares_Info;
permanent = 0;
description = "Chcę porozmawiać z Laresem.";
};
func int Org_804_Organisator_ToLares_Condition()
{
if(Npc_KnowsInfo(hero,Org_804_Organisator_WayTo))
{
return 1;
};
};
func void Org_804_Organisator_ToLares_Info()
{
AI_Output(other,self,"Org_804_Organisator_ToLares_15_00"); //Chcę porozmawiać z Laresem.
AI_Output(self,other,"Org_804_Organisator_ToLares_06_01"); //Ale Lares raczej nie będzie chciał rozmawiać z tobą.
AI_Output(other,self,"Org_804_Organisator_ToLares_15_02"); //To już mój problem.
AI_Output(self,other,"Org_804_Organisator_ToLares_06_03"); //Jak sobie chcesz...
AI_StopProcessInfos(self);
};
instance Org_804_Organisator_PERM(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Org_804_Organisator_PERM_Condition;
information = Org_804_Organisator_PERM_Info;
permanent = 1;
description = "Mogę porozmawiać z Laresem?";
};
func int Org_804_Organisator_PERM_Condition()
{
if(Npc_KnowsInfo(hero,Org_804_Organisator_ToLares))
{
return 1;
};
};
func void Org_804_Organisator_PERM_Info()
{
AI_Output(other,self,"Org_804_Organisator_PERM_15_00"); //Mogę porozmawiać z Laresem?
AI_Output(self,other,"Org_804_Organisator_PERM_06_01"); //Pogadaj najpierw z Roscoe.
AI_StopProcessInfos(self);
};
const string Org_804_CHECKPOINT = "NC_HUT23_OUT";
instance Info_Org_804_FirstWarn(C_Info)
{
npc = ORG_804_Organisator;
nr = 2;
condition = Info_Org_804_FirstWarn_Condition;
information = Info_Org_804_FirstWarn_Info;
permanent = 1;
important = 1;
};
func int Info_Org_804_FirstWarn_Condition()
{
if(((other.guild == GIL_GRD) || (other.guild == GIL_STT)) && (hero.aivar[AIV_GUARDPASSAGE_STATUS] == AIV_GPS_BEGIN) && (Npc_GetAttitude(self,hero) != ATT_FRIENDLY) && Hlp_StrCmp(Npc_GetNearestWP(self),self.wp))
{
return TRUE;
};
};
func void Info_Org_804_FirstWarn_Info()
{
PrintGlobals(PD_MISSION);
AI_Output(self,hero,"Info_Org_804_FirstWarn_Info_06_00"); //Ludzie Gomeza nie mają tu wstępu! Spadaj!
hero.aivar[AIV_LASTDISTTOWP] = Npc_GetDistToWP(hero,Org_804_CHECKPOINT);
hero.aivar[AIV_GUARDPASSAGE_STATUS] = AIV_GPS_FIRSTWARN;
AI_StopProcessInfos(self);
};
instance Info_Org_804_LastWarn(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Info_Org_804_LastWarn_Condition;
information = Info_Org_804_LastWarn_Info;
permanent = 1;
important = 1;
};
func int Info_Org_804_LastWarn_Condition()
{
if((hero.aivar[AIV_GUARDPASSAGE_STATUS] == AIV_GPS_FIRSTWARN) && ((other.guild == GIL_GRD) || (other.guild == GIL_STT)) && (Npc_GetAttitude(self,hero) != ATT_FRIENDLY) && (Npc_GetDistToWP(hero,Org_804_CHECKPOINT) < (hero.aivar[AIV_LASTDISTTOWP] - 100)) && Hlp_StrCmp(Npc_GetNearestWP(self),self.wp))
{
return TRUE;
};
};
func int Info_Org_804_LastWarn_Info()
{
AI_Output(self,hero,"Info_Org_804_LastWarn_06_00"); //Idź stąd, póki jeszcze możesz!
hero.aivar[AIV_LASTDISTTOWP] = Npc_GetDistToWP(hero,Org_804_CHECKPOINT);
hero.aivar[AIV_GUARDPASSAGE_STATUS] = AIV_GPS_LASTWARN;
AI_StopProcessInfos(self);
};
instance Info_Org_804_Attack(C_Info)
{
npc = ORG_804_Organisator;
nr = 1;
condition = Info_Org_804_Attack_Condition;
information = Info_Org_804_Attack_Info;
permanent = 1;
important = 1;
};
func int Info_Org_804_Attack_Condition()
{
if((hero.aivar[AIV_GUARDPASSAGE_STATUS] == AIV_GPS_LASTWARN) && ((other.guild == GIL_GRD) || (other.guild == GIL_STT)) && (Npc_GetAttitude(self,hero) != ATT_FRIENDLY) && (Npc_GetDistToWP(hero,Org_804_CHECKPOINT) < (hero.aivar[AIV_LASTDISTTOWP] - 100)) && Hlp_StrCmp(Npc_GetNearestWP(self),self.wp))
{
return TRUE;
};
};
func int Info_Org_804_Attack_Info()
{
hero.aivar[AIV_LASTDISTTOWP] = 0;
hero.aivar[AIV_GUARDPASSAGE_STATUS] = AIV_GPS_PUNISH;
B_FullStop(self);
AI_StopProcessInfos(self);
B_IntruderAlert(self,other);
B_SetAttackReason(self,AIV_AR_INTRUDER);
Npc_SetTarget(self,hero);
AI_StartState(self,ZS_Attack,1,"");
};
|
D
|
// Copyright Ferdinand Majerech 2013-2014.
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt)
// (See accompanying file LICENSE_1_0.txt or copy at
module tharsis.entity.entitymanager;
import std.algorithm;
import std.array;
import std.conv;
import std.exception: assumeWontThrow;
import std.stdio;
import std.string;
import std.traits;
import std.typetuple;
import std.typecons;
import core.sync.mutex;
import tharsis.prof;
import tharsis.entity.componentbuffer;
import tharsis.entity.componenttypeinfo;
import tharsis.entity.componenttypemanager;
import tharsis.entity.entitypolicy;
import tharsis.entity.entity;
import tharsis.entity.entityid;
import tharsis.entity.entityprototype;
import tharsis.entity.entityrange;
import tharsis.entity.gamestate;
import tharsis.entity.processtypeinfo;
import tharsis.entity.processwrapper;
import tharsis.entity.resourcemanager;
import tharsis.entity.scheduler;
import tharsis.util.bitmanip;
import tharsis.util.mallocarray;
import tharsis.util.time;
/// A shortcut alias for EntityManager with the default entity policy.
alias DefaultEntityManager = EntityManager!DefaultEntityPolicy;
/** The central, "World" subsystem of Tharsis.
*
* EntityManager fullfills multiple roles:
*
* * Registers [Processes](../concepts/process.html) and resource managers.
* * Executes processes.
* * Manages game state (past and future entities and [components](../concepts/component.html)).
*
* Params: Policy = A struct with enum members specifying various compile-time
* parameters and hints. See tharsis.entity.entitypolicy for an example.
*/
class EntityManager(Policy)
{
mixin validateEntityPolicy!Policy;
/// Allows to access the EntityManager's Policy.
alias EntityPolicy = Policy;
import tharsis.entity.diagnostics;
/// Struct type to store diagnostics (profiling and debugging) info in.
alias Diagnostics = EntityManagerDiagnostics!Policy;
package:
// Type used to represent component counts in an entity.
alias ComponentCount = Policy.ComponentCount;
// Shortcut aliases.
alias GameStateT = GameState!Policy;
alias ComponentStateT = ComponentState!Policy;
alias ComponentTypeStateT = ComponentTypeState!Policy;
import core.thread;
/* A thread that runs processes each frame.
*
* The thread alternates between states:
*
* When a game update starts, EntityManager changes state to Executing (by a call to
* startUpdate()), which is detected by the ProcessThread which then begins executing
* Processes (as determined by the Scheduler) for the update. Once the ProcessThread
* is done running the Processes, it sets its state to Waiting. EntityManager waits
* until all ProcessThreads are Waiting to end the game update.
*
* On the next game update, this sequence repeats.
*
* EntityManager stops all ProcessThreads at its deinitialization by calling stop(),
* changing ProcessThread state to Stopping, which is detected by the ProcessThread
* which then stops.
*/
static class ProcessThread
{
/// Possible states of a ProcessThread.
enum State: ubyte
{
// Executing processes in a game update.
Executing,
// Waiting for the next game update after done executing the last one.
Waiting,
// Stopping the thread.
//
// Set by EntityManager to signify that the thread should stop.
Stopping,
// The thread is stopped, or never ran in the first place.
Stopped,
}
private:
// The thread itself.
Thread thread_;
// Using atomic *stores* to set state_ but don't use atomic loads to read it:
// The value won't get 'teared' since it's 1 byte.
// Current state of the thread. Use atomic stores to write, normal reads to read.
shared(State) state_ = State.Stopped;
// The entity manager (called self_ because this is essentially EntityManager code).
EntityManager self_;
// Index of this thread (main thread is 0, first external thread 1, next 2, etc.)
uint threadIdx_;
// Name of the thread (for profiling/debugging).
string threadName_;
// External profiler (if any) attached by the user to profile this thread.
//
// See_Also: EntityManager.attachPerThreadProfilers()
Profiler profiler_;
// package avoids invariants, which slow down state() to crawl in debug builds.
package:
/** Construct a ProcessThread.
*
* Params:
*
* self = The entity manager. The ProcessThread is essentially EntityManager
* code moved into a separate thread.
* threadIdx = Index of the thread. 0 is the main thread, 1 the first
* ProcessThread, etc.
*/
this(EntityManager self, uint threadIdx) @system nothrow
{
self_ = self;
threadIdx_ = threadIdx;
threadName_ = "Tharsis ExecuteThread %s".format(threadIdx_).assumeWontThrow;
}
/// Destroy the thread.
~this()
{
// .destroy(thread_);
assert(thread_ is null, "Thread must be stopped before being destroyed");
}
/// Attach an external profiler to profile this thread.
void profiler(Profiler rhs) @system nothrow
{
assert(!isRunning, "Trying to attach a profiler while the thread is running");
profiler_ = rhs;
}
/// Get the current state of the thread.
final State state() @system pure nothrow @nogc { return cast(State)state_; }
/// Call when waiting so the OS can use the CPU core for something else.
void yieldToOS() @system nothrow
{
assert(thread_ !is null, "yieldToOS called when thread stopped");
try
{
// thread_.yield();
thread_.sleep(dur!"msecs"(0));
}
// TODO: log this, eventually (despiker eventEvent?) 2014-09-17
catch(Exception e) { } // ignore, resulting in a hot loop replacing sleep
}
/// Is the thread running right now?
bool isRunning() @system nothrow
{
return !(thread_ is null) && thread_.isRunning;
}
/** Create and start the thread itself.
*
* Throws:
*
* core.thread.ThreadException on failure to start the thread.
*/
void start() @system
{
assert(state_ == State.Stopped, "Can't start a thread that is not stopped");
state_ = state_.Waiting;
thread_ = new Thread(&run);
thread_.start();
}
import core.atomic;
/** Stop the thread. Should be called only by EntityManager.
* Can only be called once execution of any game update is finished (i.e. when
*
* the thread is in Waiting state).
*/
final void stop() @system nothrow
{
assert(isRunning, "Trying to stop() a thread that is not running");
assert(state == State.Waiting, "Trying to stop a ProcessThread that is "
"either executing or is already stopping");
atomicStore(state_, State.Stopping);
try
{
scope(exit)
{
atomicStore(state_, State.Stopped);
.destroy(thread_);
}
thread_.join();
}
catch(Throwable e)
{
// TODO: Logging 2014-09-17
import std.stdio;
writeln("EntityManager thread terminated with an error:").assumeWontThrow;
writeln(e).assumeWontThrow;
}
thread_ = null;
}
/** Start executing processes in a game update. Should be called only by EntityManager.
*
* Can only be called when the thread is in Waiting state.
*/
final void startUpdate() @system nothrow
{
assert(thread_ !is null, "startUpdate called when thread stopped");
assert(isRunning, "Trying to startUpdate() in a thread that is not running");
assert(state == State.Waiting, "Trying to start an update on an ProcessThread "
"that is either executing or is stopping");
atomicStore(state_, State.Executing);
}
/// Code that runs in the ProcessThread.
void run() @system nothrow
{
assert(thread_ !is null, "startUpdate called when thread stopped");
ulong frameIdx = 0;
// Note:
// Can't have any profiler events while Waiting because user code may decide
// to read profiler data between frames.
for(;;) final switch(state)
{
case State.Waiting:
bool shouldSleep = true;
// Wait for the next game update.
// No profiling so the user can access the profiler between frames.
while(state == State.Waiting)
{
// We need to give the OS some time to do other work... if we hog
// all cores the OS will stop our threads at inconvenient times.
yieldToOS();
continue;
}
break;
case State.Executing:
{
// scope(exit) ensures the state is set even if we're crashing
// with a Throwable (to avoid EntityManager waiting forever).
scope(exit) { atomicStore(state_, State.Waiting); }
{
auto frameZone = Zone(profiler_, "frame");
self_.executeProcessesOneThread(threadIdx_, profiler_);
}
++frameIdx;
// Ensure any memory ops finish before finishing a game update.
atomicFence();
}
break;
case State.Stopping:
// return, finishing the thread.
return;
case State.Stopped:
assert(false, "run() still running when the thread is Stopped");
}
}
}
// Game state from the previous frame. Stores entities and their components,
// including dead entities and entities that were added during the last frame.
immutable(GameStateT)* past_;
// Game state in the current frame. Stores entities and their components, including
// entities hat were added during the last frame.
GameStateT* future_;
// Component type manager, including type info about registered component types.
AbstractComponentTypeManager componentTypeMgr_;
private:
// If writtenComponentTypes_[i] is true, there is a process that writes components
// of type with ComponentTypeID equal to i.
bool[maxComponentTypes!Policy] writtenComponentTypes_;
// Multiplier to apply when preallocating buffers.
double allocMult_ = 1.0;
/* Stores both past and future game states.
*
* The past_ and future_ pointers are exchanged every frame, replacing past with
* future and vice versa to reuse memory,
*/
GameStateT[2] stateStorage_;
// Wrappers that execute registered processes.
AbstractProcessWrapper!Policy[] processes_;
// Registered resource managers.
AbstractResourceManager[] resourceManagers_;
/* A simple class wrapper over entities to add when the next frame starts.
*
* A class is used to allow convenient use of synchronized and shared. A struct +
* mutex could be used if needed, but GC overhead of a single instance is very low.
*/
class EntitiesToAdd
{
/** ID of the next entity that will be created.
*
* 1 is used to ease detection of bugs with uninitialized data.
*/
uint nextEntityID = 1;
/// Stores pointers to prototypes and IDs of the entities to add when the next
/// frame starts.
MallocArray!(Tuple!(immutable(EntityPrototype)*, EntityID)) prototypes;
}
// Entities to add when the next frame starts.
shared(EntitiesToAdd) entitiesToAdd_;
// Determines which processes run in which threads.
Scheduler scheduler_;
// Process threads (all threads executing processes other than the main thread).
ProcessThread[] procThreads_;
// Have the process threads been started?
bool threadsStarted_ = false;
// Diagnostics data (how many components of which type, etc).
Diagnostics diagnostics_;
// Profiler (if any) attached to the main thread by attachPerThreadProfilers().
Profiler profilerMainThread_ = null;
public:
/** Construct an EntityManager using component types registered in a ComponentTypeManager.
*
* Note: startThreads() must be called before executing any game updates (frames).
*
* Params:
*
* componentTypeManager = Component type manager storing component type information.
*
* **Must be locked.**
* scheduler = Scheduler to schedule Processes with.
*/
this(AbstractComponentTypeManager componentTypeManager, Scheduler scheduler)
@trusted nothrow
{
scheduler_ = scheduler;
// Ensure diagnostics_.threadCount is valid even before the first frame.
diagnostics_.threadCount = scheduler_.threadCount;
// Construct process threads.
// 0 is the main thread, so we only need to add threads other than 0.
foreach(threadIdx; 1 .. scheduler_.threadCount)
{
procThreads_ ~= new ProcessThread(this, cast(uint)threadIdx);
}
componentTypeMgr_ = componentTypeManager;
// Explicit initialization is needed as of DMD 2.066, may be redundant later.
(stateStorage_[] = GameStateT.init).assumeWontThrow;
foreach(ref info; componentTypeInfo)
{
if(info.isNull) { continue; }
foreach(ref state; stateStorage_)
{
state.components[info.id].enable(info);
}
}
entitiesToAdd_ = cast(shared(EntitiesToAdd))new EntitiesToAdd();
auto entitiesToAdd = cast(EntitiesToAdd)entitiesToAdd_;
entitiesToAdd.prototypes.reserve(Policy.maxNewEntitiesPerFrame);
past_ = cast(immutable(GameStateT*))&(stateStorage_[0]);
future_ = &(stateStorage_[1]);
}
/** Start executing EntityManager (in number of threads determined by Scheduler).
*
* Note: Must be called before any calls to executeFrame()
*
* Throws:
*
* core.thread.ThreadException on failure to start the threads..
*/
void startThreads() @trusted
{
// Start the process threads. This is the place where the user can handle any
// failure to start the threads. updateThreads() assumes starting threads to be
// safe.
foreach(thread; procThreads_) { thread.start(); }
threadsStarted_ = true;
}
/** Destroy the EntityManager.
*
* Must be called when done using the EntityManager.
*
* Params: clearResources = Destroy all resources in registered resource managers? If
* `No`, the clear() method of each resource manager must be
* called manually to free the resources.
*/
void destroy(Flag!"ClearResources" clearResources = Yes.ClearResources)
@trusted
{
auto zoneDtor = Zone(profilerMainThread_, "EntityManager.destroy");
.destroy(cast(EntitiesToAdd)entitiesToAdd_);
if(clearResources) foreach(manager; resourceManagers_)
{
manager.clear();
}
// Tell all process threads to stop and then wait to join them.
foreach(thread; procThreads_) if(thread.state != ProcessThread.State.Stopped)
{
thread.stop();
}
.destroy(scheduler_);
foreach(wrapper; processes_) { .destroy(wrapper); }
}
/** Attach multiple [Profilers](http://defenestrate.eu/docs/tharsis.prof/tharsis.prof.profiler.html),
* each of which will profile a single thread.
*
* Allows to profile Tharsis execution as a part of a larger program. If there are not
* enough profilers for all threads, only profilers.length threads will be profiled.
* If there are more profilers than threads, the extra profilers will be unused.
*
* Note:
*
* * Must not be called before startThreads().
* * Attached profilers must not be modified until EntityManager.destroy() (which
* stops the threads) is called.
*
* Params:
*
* profilers = Profilers to attach. Profiler at `profilers[0]` will profile code
* running in the main thread.
*/
void attachPerThreadProfilers(Profiler[] profilers) @trusted nothrow
{
assert(!threadsStarted_, "Trying to attach profilers after starting threads");
if(profilers.empty) { return; }
profilerMainThread_ = profilers.front;
foreach(idx, prof; profilers[1 .. $]) { procThreads_[idx].profiler = prof; }
}
/** Get a copy of diagnostics from the last game update.
*
* Note: Calling this during executeFrame() will return incomplete data.
*/
Diagnostics diagnostics() @trusted pure nothrow const @nogc { return diagnostics_; }
/** Add a new entity, using components from specified prototype.
*
* The new entity will be added at the beginning of the next frame.
*
* Params:
*
* prototype = Prototype of the entity to add. Usually, the prototype will have to be
* cast to immutable before passed. Must exist without changes until the
* beginning of the next update. Can be safely deleted afterwards.
*
* Returns: ID of the new entity on success. A null ID if more than
* Policy.maxNewEntitiesPerFrame new entities were added during one frame.
*/
EntityID addEntity(ref immutable(EntityPrototype) prototype) @trusted nothrow
{
EntityID nothrowWrapper()
{
// Should be fast, assuming most of the time only 1 thread (SpawnerProcess)
// adds entities. If slow, allow bulk adding with a struct that locks at
// ctor/unlocks at dtor.
auto entitiesToAdd = cast(EntitiesToAdd)entitiesToAdd_;
synchronized(entitiesToAdd)
{
if(entitiesToAdd.prototypes.length == entitiesToAdd.prototypes.capacity)
{
return EntityID.init;
}
auto id = EntityID(entitiesToAdd.nextEntityID++);
entitiesToAdd.prototypes ~= tuple(&prototype, id);
return id;
}
}
return nothrowWrapper().assumeWontThrow();
}
/** Can be set to force more or less memory preallocation.
*
* Useful e.g. before loading a big map with many entities.
*
* Params: mult = Multiplier for size of preallocations. Must be greater than 0.
*/
void allocMult(const double mult) @safe pure nothrow
{
assert(mult > 0.0, "allocMult parameter set to 0 or less");
allocMult_ = mult;
}
/** Execute a single frame/tick/time step of the game/simulation.
*
* Does all management needed between frames, and runs all registered processes on
* matching entities once.
*
* This includes updating resource managers, swapping past/future state, forgetting
* dead entities, creating entities added by addEntity, preallocation, etc.
*/
void executeFrame() @trusted nothrow
{
assert(threadsStarted_, "startThreads() must be called before executeFrame()");
auto zoneExecuteFrame = Zone(profilerMainThread_, "EntityManager.executeFrame");
frameDebug();
updateResourceManagers();
// Past entities from the previous frame may be longer or equal, but not shorter
// than future entities.
assert(past_.entities.length >= future_.entities.length,
"Less past than future entities in previous frame. Past entities may be "
"longer or equal, never shorter than future entities: any dead entities "
"from past are not copied to future (newly added entities are copied to "
"both, so they don't affect relative lengths");
// Get the past & future component/entity buffers for the new frame.
GameStateT* newFuture = cast(GameStateT*)past_;
GameStateT* newPast = future_;
// Copy alive past entities to future.
{
auto zone = Zone(profilerMainThread_, "copy entities from the past update");
newPast.copyLiveEntitiesToFuture(*newFuture);
}
// Create space for the newly added entities.
{
auto zone = Zone(profilerMainThread_, "add new entities without initializing");
const addedEntityCount = (cast(EntitiesToAdd)entitiesToAdd_).prototypes.length;
newPast.addNewEntitiesNoInit(addedEntityCount, profilerMainThread_);
newFuture.addNewEntitiesNoInit(addedEntityCount, profilerMainThread_);
}
// Preallocate future component buffer if needed.
{
auto zone = Zone(profilerMainThread_, "preallocate components");
newFuture.preallocateComponents(allocMult_, componentTypeMgr_);
}
// Add the new entities into the reserved entity/component space.
{
auto zone = Zone(profilerMainThread_, "init new entities");
initNewEntities((cast(EntitiesToAdd)entitiesToAdd_).prototypes,
componentTypeMgr_, *newPast, *newFuture);
// Clear to reuse during the next frame.
(cast(EntitiesToAdd)entitiesToAdd_).prototypes.clear();
}
// Assign back to data members.
future_ = newFuture;
past_ = cast(immutable(GameStateT*))(newPast);
executeProcesses();
updateDiagnostics();
}
/** Type passed to [Processes](../concepts/process.html) to provide access to the
* current entity handle and components of all past entities.
*
* Can be used as an argument for a [process()](../concepts/process.html#process-method)
* method of a Process.
*
* See_Also: tharsis.entity.entityrange.EntityAccess
*/
alias Context = EntityAccess!(typeof(this));
package:
/* Get a resource handle without compile-time type information.
*
* Params:
*
* type = Type of the resource. There must be a resource manager managing
* resources of this type.
* descriptor = A void pointer to the descriptor of the resource. The actual type of
* the descriptor must be the Descriptor type of the resource type.
*
* Returns: A raw handle to the resource.
*/
RawResourceHandle rawResourceHandle(TypeInfo type, void* descriptor) nothrow
{
foreach(manager; resourceManagers_) if(manager.managedResourceType is type)
{
return manager.rawHandle(descriptor);
}
assert(false, "No resource manager for type " ~ to!string(type));
}
private:
/* Register a Process.
*
* At most Policy.maxProcesses Processes can be registered (256 by default). Override
* the Policy template parameter to increase this limit.
*
* Params: process = Process to register. There may be at most 1 process writing any
* single component type (specifying it as its FutureComponent).
* The FutureComponent of the process must be registered with the
* ComponentTypeManager passed to the EntityManager's constructor.
*
* TODO link to an process.rst once it exists
*/
void registerProcess(P)(P process) @trusted nothrow
{
mixin validateProcess!P;
assert(processes_.length < Policy.maxProcesses,
"Can't register more Processes than Policy.maxProcesses (256 by default). "
"To increase this limit, override the Policy template parameter of "
"ComponentTypeManager/EntityManager.");
auto registerZone = Zone(profilerMainThread_, "EntityManager.registerProcess");
// True if the Process does not write to any future component. Usually processes
// that only read past components and produce some kind of output.
enum noFuture = !hasFutureComponent!P;
// All overloads of the process() method in the process.
alias overloads = processOverloads!P;
static if(!noFuture)
{
assert(!writtenComponentTypes_[P.FutureComponent.ComponentTypeID],
"Can't register 2 processes with one future component type");
assert(componentTypeMgr_.areTypesRegistered!(P.FutureComponent),
"Registering a process with unregistered future component type " ~
P.FutureComponent.stringof);
// This future component is now taken; no other process can write to it.
writtenComponentTypes_[P.FutureComponent.ComponentTypeID] = true;
}
else
{
}
// A function executing the process during one frame.
//
// Iterate past entities. If an entity has all past components in a signature of
// any P.process() overload, call that overload, passing refs to those components
// and a ref/ptr to a future component of type P.FutureComponent.
//
// Specific overloads have precedence over more general. For example, if there are
// overloads process(A) and process(A, B), and an entity has components A and B,
// the latter overload is called.
//
// Params: self = The entity manager.
// process = The process being executed.
// threadProfiler = Profiler for this thread, if attached with
// attachPerThreadProfilers().
static ProcessDiagnostics runProcess
(EntityManager self, P process, Profiler threadProfiler) nothrow
{
ProcessDiagnostics processDiagnostics;
processDiagnostics.name = P.stringof;
processDiagnostics.componentTypesRead = AllPastComponentTypes!P.length;
// If the process has a 'preProcess' method, call it before processing any entities.
static if(hasMember!(P, "preProcess"))
{
alias params = ParameterTypeTuple!(process.preProcess);
static if(params.length == 0)
{
process.preProcess();
}
else
{
static assert(params.length == 1 && is(params[0] == Profiler),
"preProcess() method of a process must either have no "
"parameters, or exactly one Profiler parameter (for "
"one of the thread profilers attached by the "
"EntityManager.attachPerThreadProfilers())");
process.preProcess(threadProfiler);
}
}
// Iterate over all alive entities, executing the process on those that
// match the process() methods of the Process.
// Using a for instead of foreach because DMD insists on copying the range
// in foreach for some reason, breaking the code.
for(auto entityRange = EntityRange!(typeof(this), P)(self);
!entityRange.empty(); entityRange.popFront())
{
static if(!noFuture)
{
entityRange.setFutureComponentCount(0);
}
// Generates an if-else chain checking each overload, starting with the
// most specific one.
mixin(prioritizeProcessOverloads!P.map!(p => q{
if(entityRange.matchComponents!(%s))
{
++processDiagnostics.processCalls;
// In processwrapper.d
callProcessMethod!(overloads[%s])(process, entityRange);
}
}.format(p[0], p[1])).join("else ").outdent);
}
// If the process has a 'postProcess' method, call it after processing entities.
static if(hasMember!(P, "postProcess")) { process.postProcess(); }
return processDiagnostics;
}
// Add a wrapper for the process,
processes_ ~= new ProcessWrapper!(P, Policy)(process, &runProcess);
// Ensure diagnostics_.processCount is valid even before the first frame.
diagnostics_.processCount = processes_.length;
}
// TODO a "locked" EntityManager state when no new stuff can be registered.
/* Register specified resource manager.
*
* Once registered, components may refer to resources managed by this resource
* manager, and the EntityManager will update it between frames.
*/
void registerResourceManager(Manager)(Manager manager) @safe pure nothrow
if(is(Manager : AbstractResourceManager))
{
assert(!resourceManagers_.canFind!(m => m.managedResourceType is
manager.managedResourceType),
"Can't register resource manager %s: a different manager already "
"manages the same resource type");
resourceManagers_ ~= manager;
}
// A shortcut to access component type information.
const(ComponentTypeInfo[]) componentTypeInfo() @safe pure nothrow const
{
return componentTypeMgr_.componentTypeInfo;
}
//-------------------------------------//
// BEGIN CODE CALLED BY executeFrame() //
//-------------------------------------//
// Ensure only the threads with processes scheduled to them will run.
void updateThreads() @trusted nothrow
{
foreach(idx, thread; procThreads_) with(ProcessThread.State)
{
// If a thread is idle for this many frames, we can stop it.
enum idleFramesTillStop = 4;
// 0 is the main thread, which is always running
const threadIdx = idx + 1;
const state = thread.state;
if(state != Stopped && scheduler_.idleFrames(threadIdx) >= idleFramesTillStop)
{
thread.stop();
}
else if(state == Stopped && scheduler_.idleFrames(threadIdx) == 0)
{
thread.start().assumeWontThrow;
}
}
}
// Run all processes; called by executeFrame();
void executeProcesses() @system nothrow
{
auto totalProcZone = Zone(profilerMainThread_, "EntityManager.executeProcesses()");
{
auto schedulingZone = Zone(profilerMainThread_, "scheduling");
scheduler_.updateSchedule!Policy(processes_, diagnostics_, profilerMainThread_);
}
import core.atomic;
updateThreads();
// Ensure any memory ops finish before finishing the new game update.
atomicFence();
// Start running Processes in ProcessThreads.
foreach(thread; procThreads_) if(thread.state != ProcessThread.State.Stopped)
{
thread.startUpdate();
}
// The main thread (this thread) has index 0.
executeProcessesOneThread(0, profilerMainThread_);
// Wait till all threads finish executing.
{
auto waitingZone = Zone(profilerMainThread_, "waiting");
bool shouldSleep = true;
while(procThreads_.canFind!(e => e.state == ProcessThread.State.Executing))
{
try if(shouldSleep)
{
Thread.sleep(dur!"msecs"(0));
}
catch(Exception e)
{
// ignore, will wait in hot loop if we can't sleep
}
continue;
}
}
}
/* Run Processes assigned by the scheduler to the current thread.
*
* Called during executeProcesses(), from the main thread or a ProcessThread.
*
* Params:
*
* threadIdx = Index of the current thread (0 for the main thread, other for ProcessThreads)
* profiler = Profiler to profile this thread with, if any is attached.
*/
void executeProcessesOneThread(uint threadIdx, Profiler profiler)
@system nothrow
{
auto processesZoneExternal = Zone(profiler, allProcessesZoneName);
// Find all processes assigned to this thread (threadIdx).
foreach(i, proc; processes_) if(scheduler_.processToThread(i) == threadIdx)
{
const name = proc.name;
const nameCut = name[0 .. min(Policy.profilerNameCutoff, name.length)];
auto procZoneExternal = Zone(profiler, nameCut);
proc.run(this, profiler);
}
}
// Name used for the profiler Zone measuring time spent by all processes in a thread.
//
// Using __underscores__ to ensure it doesn't collide with zone name of any actual
// process type.
enum allProcessesZoneName = "__processes__";
// Update EntityManager diagnostics (after processes are run).
void updateDiagnostics() @safe nothrow
{
auto diagZone = Zone(profilerMainThread_, "updateDiagnostics()");
diagnostics_ = Diagnostics.init;
{
auto procDiagZone = Zone(profilerMainThread_, "process diagnostics");
diagnostics_.processCount = processes_.length;
diagnostics_.threadCount = scheduler_.threadCount;
// Get process diagnostics.
foreach(idx, process; processes_)
{
diagnostics_.processes[idx] = process.diagnostics;
}
// Get process execution durations from the processes' internal profilers.
foreach(idx, process; processes_)
{
auto zones = process.profiler.profileData.zoneRange;
import std.range;
assert(zones.walkLength == 1,
"A process profiler must have exactly 1 zone - process execution time");
const duration = zones.front.duration;
diagnostics_.processes[idx].duration = duration;
const threadIdx = scheduler_.processToThread(idx);
diagnostics_.threads[threadIdx].processesDuration += duration;
}
}
{
auto stateDiagZone = Zone(profilerMainThread_, "GameState.updateDiagnostics()");
past_.updateDiagnostics(diagnostics_, componentTypeMgr_);
}
diagnostics_.scheduler = scheduler_.diagnostics;
}
// Show any useful debugging info (warnings) before an update, and check update invariants.
void frameDebug() @trusted nothrow
{
auto debugZone = Zone(profilerMainThread_, "frameDebug");
foreach(id; 0 .. maxBuiltinComponentTypes)
{
const(ComponentTypeInfo)* info = &componentTypeInfo[id];
// If no such builtin component type exists, ignore.
if(info.isNull) { continue; }
assert(writtenComponentTypes_[id],
"No process writing builtin component type %s: register a process "
"writing this component type (see tharsis.defaults.copyprocess for "
"a placeholder).".format(info.name).assumeWontThrow);
}
// If no process writes a component type, print a warning.
foreach(ref info; componentTypeInfo)
{
if(writtenComponentTypes_[info.id] || info.id == nullComponentTypeID)
{
continue;
}
writefln("WARNING: No process writing component type %s: components of this "
" type will disappear after the first update.", info.name)
.assumeWontThrow;
}
}
/* Update every resource manager, allowing them to load resources.
*
* Part of the code executed between frames in executeFrame().
*/
void updateResourceManagers() @safe nothrow
{
auto resourceZone = Zone(profilerMainThread_, "updateResourceManagers");
foreach(resManager; resourceManagers_) { resManager.update(); }
}
//-----------------------------------//
// END CODE CALLED BY executeFrame() //
//-----------------------------------//
}
|
D
|
/Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/Objects-normal/x86_64/ES.o : /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ES.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshProtocol.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh+Manager.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshHeaderAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshFooterAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshComponent.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/Target\ Support\ Files/ESPullToRefresh/ESPullToRefresh-umbrella.h /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/Objects-normal/x86_64/ES~partial.swiftmodule : /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ES.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshProtocol.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh+Manager.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshHeaderAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshFooterAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshComponent.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/Target\ Support\ Files/ESPullToRefresh/ESPullToRefresh-umbrella.h /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
/Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/Objects-normal/x86_64/ES~partial.swiftdoc : /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ES.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshProtocol.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESPullToRefresh+Manager.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshHeaderAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/Animator/ESRefreshFooterAnimator.swift /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/ESPullToRefresh/Sources/ESRefreshComponent.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Pods/Target\ Support\ Files/ESPullToRefresh/ESPullToRefresh-umbrella.h /Users/nikhilsridhar/Desktop/Dyce/DyceAppIOS/Build/Intermediates/Pods.build/Debug-iphonesimulator/ESPullToRefresh.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes
|
D
|
/**
* Open-Addressed Hash Set
* Copyright: © 2015 Economic Modeling Specialists, Intl.
* Authors: Brian Schott
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
*/
module containers.openhashset;
private import containers.internal.hash : generateHash;
private import containers.internal.node : shouldAddGCRange;
private import stdx.allocator.mallocator : Mallocator;
private import stdx.allocator.common : stateSize;
/**
* Simple open-addressed hash set. Use this instead of HashSet when the size and
* quantity of the data to be inserted is small.
*
* Params:
* T = the element type of the hash set
* Allocator = the allocator to use. Defaults to `Mallocator`.
* hashFunction = the hash function to use
* supportGC = if true, calls to GC.addRange and GC.removeRange will be used
* to ensure that the GC does not accidentally free memory owned by this
* container.
*/
struct OpenHashSet(T, Allocator = Mallocator,
alias hashFunction = generateHash!T, bool supportGC = shouldAddGCRange!T)
{
/**
* Disallow copy construction
*/
this(this) @disable;
static if (stateSize!Allocator != 0)
{
this() @disable;
/**
* Use the given `allocator` for allocations.
*/
this(Allocator allocator)
in
{
assert(allocator !is null, "Allocator must not be null");
}
body
{
this.allocator = allocator;
}
/**
* Initializes the hash set with the given initial capacity.
*
* Params:
* initialCapacity = the initial capacity for the hash set
*/
this(size_t initialCapacity, Allocator allocator)
in
{
assert(allocator !is null, "Allocator must not be null");
assert ((initialCapacity & initialCapacity - 1) == 0, "initialCapacity must be a power of 2");
}
body
{
this.allocator = allocator;
initialize(initialCapacity);
}
}
else
{
/**
* Initializes the hash set with the given initial capacity.
*
* Params:
* initialCapacity = the initial capacity for the hash set
*/
this(size_t initialCapacity)
in
{
assert ((initialCapacity & initialCapacity - 1) == 0, "initialCapacity must be a power of 2");
}
body
{
initialize(initialCapacity);
}
}
~this() nothrow
{
static if (useGC)
GC.removeRange(nodes.ptr);
allocator.deallocate(nodes);
}
/**
* Removes all items from the hash set.
*/
void clear()
{
if (empty)
return;
foreach (ref node; nodes)
{
typeid(typeof(node)).destroy(&node);
node.used = false;
}
_length = 0;
}
///
bool empty() const pure nothrow @nogc @safe @property
{
return _length == 0;
}
///
size_t length() const pure nothrow @nogc @safe @property
{
return _length;
}
/**
* Returns:
* $(B true) if the hash set contains the given item, false otherwise.
*/
bool contains(T item) const
{
if (empty)
return false;
immutable size_t hash = hashFunction(item);
size_t index = toIndex(nodes, item, hash);
if (index == size_t.max)
return false;
return nodes[index].hash == hash && nodes[index].data == item;
}
/// ditto
bool opBinaryRight(string op)(T item) inout if (op == "in")
{
return contains(item);
}
/**
* Inserts the given item into the set.
*
* Returns:
* $(B true) if the item was inserted, false if it was already present.
*/
bool insert(T item)
{
if (nodes.length == 0)
initialize(DEFAULT_INITIAL_CAPACITY);
immutable size_t hash = hashFunction(item);
size_t index = toIndex(nodes, item, hash);
if (index == size_t.max)
{
grow();
index = toIndex(nodes, item, hash);
}
else if (nodes[index].used && nodes[index].hash == hash && nodes[index].data == item)
return false;
nodes[index].used = true;
nodes[index].hash = hash;
nodes[index].data = item;
_length++;
return true;
}
/// ditto
alias put = insert;
/// ditto
alias insertAnywhere = insert;
/// ditto
bool opOpAssign(string op)(T item) if (op == "~")
{
return insert(item);
}
/**
* Params:
* item = the item to remove
* Returns:
* $(B true) if the item was removed, $(B false) if it was not present
*/
bool remove(T item)
{
if (empty)
return false;
immutable size_t hash = hashFunction(item);
size_t index = toIndex(nodes, item, hash);
if (index == size_t.max)
return false;
nodes[index].used = false;
destroy(nodes[index].data);
_length--;
return true;
}
/**
* Returns:
* A range over the set.
*/
auto opSlice(this This)() nothrow pure @nogc @safe
{
return Range!(This)(nodes);
}
mixin AllocatorState!Allocator;
private:
import containers.internal.storage_type : ContainerStorageType;
import containers.internal.element_type : ContainerElementType;
import containers.internal.mixins : AllocatorState;
import core.memory : GC;
enum DEFAULT_INITIAL_CAPACITY = 8;
enum bool useGC = supportGC && shouldAddGCRange!T;
static struct Range(ThisT)
{
ET front()
{
return cast(typeof(return)) nodes[index].data;
}
bool empty() const pure nothrow @safe @nogc @property
{
return index >= nodes.length;
}
void popFront() pure nothrow @safe @nogc
{
index++;
while (index < nodes.length && !nodes[index].used)
index++;
}
private:
alias ET = ContainerElementType!(ThisT, T);
this(const Node[] nodes)
{
this.nodes = nodes;
while (true)
{
if (index >= nodes.length || nodes[index].used)
break;
index++;
}
}
size_t index;
const Node[] nodes;
}
void grow()
{
immutable size_t newCapacity = nodes.length << 1;
Node[] newNodes = (cast (Node*) allocator.allocate(newCapacity * Node.sizeof))
[0 .. newCapacity];
newNodes[] = Node.init;
static if (useGC)
GC.addRange(newNodes.ptr, newNodes.length, typeid(typeof(nodes)));
foreach (ref node; nodes)
{
immutable size_t newIndex = toIndex(newNodes, node.data, node.hash);
newNodes[newIndex] = node;
}
static if (useGC)
GC.removeRange(nodes.ptr);
allocator.deallocate(nodes);
nodes = newNodes;
}
void initialize(size_t nodeCount)
{
nodes = (cast (Node*) allocator.allocate(nodeCount * Node.sizeof))[0 .. nodeCount];
nodes[] = Node.init;
_length = 0;
}
// Returns: size_t.max if the item was not found
static size_t toIndex(const Node[] n, T item, size_t hash)
{
immutable size_t bucketMask = (n.length - 1);
immutable size_t index = hash & bucketMask;
size_t i = index;
while (n[i].used && n[i].data != item)
{
i = (i + 1) & bucketMask;
if (i == index)
return size_t.max;
}
return i;
}
Node[] nodes;
size_t _length;
static struct Node
{
ContainerStorageType!T data;
bool used;
size_t hash;
}
}
version(emsi_containers_unittest) unittest
{
import std.string : format;
import std.algorithm : equal, sort;
import std.range : iota;
import std.array : array;
OpenHashSet!int ints;
assert (ints.empty);
assert (equal(ints[], cast(int[]) []));
ints.clear();
ints.insert(10);
assert (!ints.empty);
assert (ints.length == 1);
assert (equal(ints[], [10]));
assert (ints.contains(10));
ints.clear();
assert (ints.length == 0);
assert (ints.empty);
ints ~= 0;
assert (!ints.empty);
assert (ints.length == 1);
assert (equal(ints[], [0]));
ints.clear();
assert (ints.length == 0);
assert (ints.empty);
foreach (i; 0 .. 100)
ints ~= i;
assert (ints.length == 100, "%d".format(ints.length));
assert (!ints.empty);
foreach (i; 0 .. 100)
assert (i in ints);
assert (equal(ints[].array().sort(), iota(0, 100)));
assert (ints.insert(10) == false);
auto ohs = OpenHashSet!int(8);
assert (!ohs.remove(1000));
assert (ohs.contains(99) == false);
assert (ohs.insert(10) == true);
assert (ohs.insert(10) == false);
foreach (i; 0 .. 7)
ohs.insert(i);
assert (ohs.contains(6));
assert (!ohs.contains(100));
assert (!ohs.remove(9999));
assert (ohs.remove(0));
assert (ohs.remove(1));
}
version(emsi_containers_unittest) unittest
{
static class Foo
{
string name;
override bool opEquals(Object other) const @safe pure nothrow @nogc
{
Foo f = cast(Foo)other;
return f !is null && f.name == this.name;
}
}
hash_t stringToHash(string str) @safe pure nothrow @nogc
{
hash_t hash = 5381;
return hash;
}
hash_t FooToHash(Foo e) pure @safe nothrow @nogc
{
return stringToHash(e.name);
}
OpenHashSet!(Foo, Mallocator, FooToHash) hs;
auto f = new Foo;
hs.insert(f);
assert(f in hs);
auto r = hs[];
}
|
D
|
ZHBTRD (F08HSF) Example Program Data
4 2 :Values of N and KD
'L' :Value of UPLO
(-3.13, 0.00) ( 1.94,-2.10) (-3.40, 0.25)
( 1.94, 2.10) (-1.91, 0.00) (-0.82,-0.89) (-0.67, 0.34)
(-3.40,-0.25) (-0.82, 0.89) (-2.87, 0.00) (-2.10,-0.16)
(-0.67,-0.34) (-2.10, 0.16) ( 0.50, 0.00) :End of matrix A
|
D
|
module android.java.android.gesture.GesturePoint_d_interface;
import arsd.jni : IJavaObjectImplementation, JavaPackageId, JavaName, IJavaObject, ImportExportImpl, JavaInterfaceMembers;
static import arsd.jni;
import import0 = android.java.java.lang.Class_d_interface;
final class GesturePoint : IJavaObject {
static immutable string[] _d_canCastTo = [
];
@Import this(float, float, long);
@Import IJavaObject clone();
@Import import0.Class getClass();
@Import int hashCode();
@Import bool equals(IJavaObject);
@Import @JavaName("toString") string toString_();
override string toString() { return arsd.jni.javaObjectToString(this); }
@Import void notify();
@Import void notifyAll();
@Import void wait(long);
@Import void wait(long, int);
@Import void wait();
mixin IJavaObjectImplementation!(false);
public static immutable string _javaParameterString = "Landroid/gesture/GesturePoint;";
}
|
D
|
import connection;
import message.constants;
import builder;
import std.signals;
import std.stdio;
class Emitter {
mixin Signal!(string);
}
class Observer {
// our slot
void watch(string msg)
{
writeln("Received event " ~ msg);
}
}
class EventHandler {
private Emitter emitter;
private Connection connection;
this( Connection connection ) {
Observer o = new Observer;
this.emitter = new Emitter;
this.emitter.connect(&o.watch);
this.connection = connection;
}
void emit( string eventName ) {
this.connection.send( MessageBuilder.getMsg( Topic.EVENT, Actions.EVENT, eventName ) );
this.emitter.emit( eventName );
}
}
|
D
|
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module dwtx.jface.bindings.keys.formatting.AbstractKeyFormatter;
import dwtx.jface.bindings.keys.formatting.IKeyFormatter;
import dwtx.jface.bindings.keys.IKeyLookup;
import dwtx.jface.bindings.keys.KeyLookupFactory;
import dwtx.jface.bindings.keys.KeySequence;
import dwtx.jface.bindings.keys.KeyStroke;
import dwtx.jface.util.Util;
import dwt.dwthelper.utils;
import dwtx.dwtxhelper.Collection;
import dwt.dwthelper.ResourceBundle;
/**
* <p>
* An abstract implementation of a key formatter that provides a lot of common
* key formatting functionality. It is recommended that implementations of
* <code>IKeyFormatter</code> subclass from here, rather than implementing
* <code>IKeyFormatter</code> directly.
* </p>
*
* @since 3.1
*/
public abstract class AbstractKeyFormatter : IKeyFormatter {
/**
* The key for the delimiter between keys. This is used in the
* internationalization bundles.
*/
protected static const String KEY_DELIMITER_KEY = "KEY_DELIMITER"; //$NON-NLS-1$
/**
* The key for the delimiter between key strokes. This is used in the
* internationalization bundles.
*/
protected static const String KEY_STROKE_DELIMITER_KEY = "KEY_STROKE_DELIMITER"; //$NON-NLS-1$
/**
* An empty integer array that can be used in
* <code>sortModifierKeys(int)</code>.
*/
protected static const int[] NO_MODIFIER_KEYS = null;
/**
* The bundle in which to look up the internationalized text for all of the
* individual keys in the system. This is the platform-agnostic version of
* the internationalized strings. Some platforms (namely Carbon) provide
* special Unicode characters and glyphs for some keys.
*/
private static const ResourceBundle RESOURCE_BUNDLE;
/**
* The keys in the resource bundle. This is used to avoid missing resource
* exceptions when they aren't necessary.
*/
private static const Set resourceBundleKeys;
static this() {
RESOURCE_BUNDLE = ResourceBundle.getBundle(
getImportData!("dwtx.jface.bindings.keys.formatting.AbstractKeyFormatter.properties"));
resourceBundleKeys = new HashSet();
foreach( element; RESOURCE_BUNDLE.getKeys()){
resourceBundleKeys.add(stringcast(element));
}
}
/*
* (non-Javadoc)
*
* @see dwtx.jface.bindings.keysKeyFormatter#format(dwtx.jface.bindings.keys.KeySequence)
*/
public String format(int key) {
IKeyLookup lookup = KeyLookupFactory.getDefault();
String name = lookup.formalNameLookup(key);
if (resourceBundleKeys.contains(name)) {
return Util.translateString(RESOURCE_BUNDLE, name, name);
}
return name;
}
/*
* (non-Javadoc)
*
* @see dwtx.jface.bindings.keys.KeyFormatter#format(dwtx.jface.bindings.keys.KeySequence)
*/
public String format(KeySequence keySequence) {
StringBuffer stringBuffer = new StringBuffer();
KeyStroke[] keyStrokes = keySequence.getKeyStrokes();
int keyStrokesLength = keyStrokes.length;
for (int i = 0; i < keyStrokesLength; i++) {
stringBuffer.append(format(keyStrokes[i]));
if (i + 1 < keyStrokesLength) {
stringBuffer.append(getKeyStrokeDelimiter());
}
}
return stringBuffer.toString();
}
/*
* (non-Javadoc)
*
* @see dwtx.jface.bindings.keys.KeyFormatter#formatKeyStroke(dwtx.jface.bindings.keys.KeyStroke)
*/
public String format(KeyStroke keyStroke) {
String keyDelimiter = getKeyDelimiter();
// Format the modifier keys, in sorted order.
int modifierKeys = keyStroke.getModifierKeys();
int[] sortedModifierKeys = sortModifierKeys(modifierKeys);
StringBuffer stringBuffer = new StringBuffer();
if (sortedModifierKeys !is null) {
for (int i = 0; i < sortedModifierKeys.length; i++) {
int modifierKey = sortedModifierKeys[i];
if (modifierKey !is KeyStroke.NO_KEY) {
stringBuffer.append(format(modifierKey));
stringBuffer.append(keyDelimiter);
}
}
}
// Format the natural key, if any.
int naturalKey = keyStroke.getNaturalKey();
if (naturalKey !is 0) {
stringBuffer.append(format(naturalKey));
}
return stringBuffer.toString();
}
/**
* An accessor for the delimiter you wish to use between keys. This is used
* by the default format implementations to determine the key delimiter.
*
* @return The delimiter to use between keys; should not be
* <code>null</code>.
*/
protected abstract String getKeyDelimiter();
/**
* An accessor for the delimiter you wish to use between key strokes. This
* used by the default format implementations to determine the key stroke
* delimiter.
*
* @return The delimiter to use between key strokes; should not be
* <code>null</code>.
*/
protected abstract String getKeyStrokeDelimiter();
/**
* Separates the modifier keys from each other, and then places them in an
* array in some sorted order. The sort order is dependent on the type of
* formatter.
*
* @param modifierKeys
* The modifier keys from the key stroke.
* @return An array of modifier key values -- separated and sorted in some
* order. Any values in this array that are
* <code>KeyStroke.NO_KEY</code> should be ignored.
*/
protected abstract int[] sortModifierKeys(int modifierKeys);
}
|
D
|
/Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/Objects-normal/x86_64/GBHAlbumTableViewCell.o : /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHAssetImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHNotificationName.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePickerDelegate.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerConfig.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHImageViewAsynchLoading.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHAlbumTableViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHPhotoCollectionViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookAlbum.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAppearanceManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHImageCacheManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHFacebookManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAssetManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookAlbumPicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookNavigationController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHPhotoPickerViewController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerCustomError.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHSelectedView.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFURL.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/GBHFacebookImagePicker/GBHFacebookImagePicker-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/Bolts/Bolts-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTaskCompletionSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfile.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkResolving.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMutableCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLink.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAccessToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKTestUsersManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFExecutor.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKSettings.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMacros.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/Bolts.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppEvents.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkTarget.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManagerLoginResult.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestDataAttachment.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFMeasurementEvent.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequest.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfilePictureView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKUtility.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/unextended-module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/Bolts.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKCoreKit.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/module.modulemap
/Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/Objects-normal/x86_64/GBHAlbumTableViewCell~partial.swiftmodule : /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHAssetImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHNotificationName.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePickerDelegate.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerConfig.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHImageViewAsynchLoading.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHAlbumTableViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHPhotoCollectionViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookAlbum.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAppearanceManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHImageCacheManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHFacebookManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAssetManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookAlbumPicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookNavigationController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHPhotoPickerViewController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerCustomError.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHSelectedView.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFURL.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/GBHFacebookImagePicker/GBHFacebookImagePicker-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/Bolts/Bolts-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTaskCompletionSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfile.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkResolving.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMutableCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLink.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAccessToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKTestUsersManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFExecutor.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKSettings.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMacros.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/Bolts.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppEvents.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkTarget.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManagerLoginResult.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestDataAttachment.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFMeasurementEvent.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequest.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfilePictureView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKUtility.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/unextended-module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/Bolts.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKCoreKit.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/module.modulemap
/Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/Objects-normal/x86_64/GBHAlbumTableViewCell~partial.swiftdoc : /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHAssetImage.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHNotificationName.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePickerDelegate.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerConfig.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHImageViewAsynchLoading.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHAlbumTableViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHPhotoCollectionViewCell.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookAlbum.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAppearanceManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHImageCacheManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHFacebookManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Manager/GBHAssetManager.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookImagePicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookAlbumPicker.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHFacebookNavigationController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Controller/GBHPhotoPickerViewController.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/Model/GBHFacebookPickerCustomError.swift /Users/nabil/Downloads/AlbumsMnager/Pods/GBHFacebookImagePicker/GBHFacebookImagePicker/Classes/View/GBHSelectedView.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFURL.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/GBHFacebookImagePicker/GBHFacebookImagePicker-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/Bolts/Bolts-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKCoreKit/FBSDKCoreKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Target\ Support\ Files/FBSDKLoginKit/FBSDKLoginKit-umbrella.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTaskCompletionSource.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfile.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKApplicationDelegate.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkResolving.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMutableCopying.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLink.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAccessToken.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkNavigation.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestConnection.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginButton.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKTestUsersManager.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererController.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFWebViewAppLinkResolver.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphErrorRecoveryProcessor.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFExecutor.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKSettings.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/BFTask+Exceptions.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKMacros.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/Common/Bolts.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginConstants.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppEvents.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkTarget.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManagerLoginResult.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequestDataAttachment.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFMeasurementEvent.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKGraphRequest.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKProfilePictureView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginTooltipView.h /Users/nabil/Downloads/AlbumsMnager/Pods/Bolts/Bolts/iOS/BFAppLinkReturnToRefererView.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKUtility.h /Users/nabil/Downloads/AlbumsMnager/Pods/FBSDKCoreKit/FBSDKCoreKit/FBSDKCoreKit/FBSDKAppLinkUtility.h /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/GBHFacebookImagePicker.build/unextended-module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/Bolts.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKCoreKit.build/module.modulemap /Users/nabil/Downloads/AlbumsMnager/Build/Intermediates/Pods.build/Debug-iphonesimulator/FBSDKLoginKit.build/module.modulemap
|
D
|
module android.java.android.provider.CalendarContract;
public import android.java.android.provider.CalendarContract_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!CalendarContract;
import import1 = android.java.java.lang.Class;
|
D
|
/*
Copyright (C) 2002 Paul Davis
Copyright (C) 2003 Jack O'Quin
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
module jack.c.transport;
public import jack.c.types;
extern (C) {
/**
* @defgroup TransportControl Transport and Timebase control
* @{
*/
/**
* Called by the timebase master to release itself from that
* responsibility.
*
* If the timebase master releases the timebase or leaves the JACK
* graph for any reason, the JACK engine takes over at the start of
* the next process cycle. The transport state does not change. If
* rolling, it continues to play, with frame numbers as the only
* available position information.
*
* @see jack_set_timebase_callback
*
* @param client the JACK client structure.
*
* @return 0 on success, otherwise a non-zero error code.
*/
int jack_release_timebase (jack_client_t *client) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Register (or unregister) as a slow-sync client, one that cannot
* respond immediately to transport position changes.
*
* The @a sync_callback will be invoked at the first available
* opportunity after its registration is complete. If the client is
* currently active this will be the following process cycle,
* otherwise it will be the first cycle after calling jack_activate().
* After that, it runs according to the ::JackSyncCallback rules.
* Clients that don't set a @a sync_callback are assumed to be ready
* immediately any time the transport wants to start.
*
* @param client the JACK client structure.
* @param sync_callback is a realtime function that returns TRUE when
* the client is ready. Setting @a sync_callback to NULL declares that
* this client no longer requires slow-sync processing.
* @param arg an argument for the @a sync_callback function.
*
* @return 0 on success, otherwise a non-zero error code.
*/
int jack_set_sync_callback (jack_client_t *client,
JackSyncCallback sync_callback,
void *arg) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Set the timeout value for slow-sync clients.
*
* This timeout prevents unresponsive slow-sync clients from
* completely halting the transport mechanism. The default is two
* seconds. When the timeout expires, the transport starts rolling,
* even if some slow-sync clients are still unready. The @a
* sync_callbacks of these clients continue being invoked, giving them
* a chance to catch up.
*
* @see jack_set_sync_callback
*
* @param client the JACK client structure.
* @param timeout is delay (in microseconds) before the timeout expires.
*
* @return 0 on success, otherwise a non-zero error code.
*/
int jack_set_sync_timeout (jack_client_t *client,
jack_time_t timeout) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Register as timebase master for the JACK subsystem.
*
* The timebase master registers a callback that updates extended
* position information such as beats or timecode whenever necessary.
* Without this extended information, there is no need for this
* function.
*
* There is never more than one master at a time. When a new client
* takes over, the former @a timebase_callback is no longer called.
* Taking over the timebase may be done conditionally, so it fails if
* there was a master already.
*
* @param client the JACK client structure.
* @param conditional non-zero for a conditional request.
* @param timebase_callback is a realtime function that returns
* position information.
* @param arg an argument for the @a timebase_callback function.
*
* @return
* - 0 on success;
* - EBUSY if a conditional request fails because there was already a
* timebase master;
* - other non-zero error code.
*/
int jack_set_timebase_callback (jack_client_t *client,
int conditional,
JackTimebaseCallback timebase_callback,
void *arg) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Reposition the transport to a new frame number.
*
* May be called at any time by any client. The new position takes
* effect in two process cycles. If there are slow-sync clients and
* the transport is already rolling, it will enter the
* ::JackTransportStarting state and begin invoking their @a
* sync_callbacks until ready. This function is realtime-safe.
*
* @see jack_transport_reposition, jack_set_sync_callback
*
* @param client the JACK client structure.
* @param frame frame number of new transport position.
*
* @return 0 if valid request, non-zero otherwise.
*/
int jack_transport_locate (jack_client_t *client,
jack_nframes_t frame) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Query the current transport state and position.
*
* This function is realtime-safe, and can be called from any thread.
* If called from the process thread, @a pos corresponds to the first
* frame of the current cycle and the state returned is valid for the
* entire cycle.
*
* @param client the JACK client structure.
* @param pos pointer to structure for returning current transport
* position; @a pos->valid will show which fields contain valid data.
* If @a pos is NULL, do not return position information.
*
* @return Current transport state.
*/
jack_transport_state_t jack_transport_query (const(jack_client_t) *client,
jack_position_t *pos) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Return an estimate of the current transport frame,
* including any time elapsed since the last transport
* positional update.
*
* @param client the JACK client structure
*/
jack_nframes_t jack_get_current_transport_frame (const(jack_client_t) *client) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Request a new transport position.
*
* May be called at any time by any client. The new position takes
* effect in two process cycles. If there are slow-sync clients and
* the transport is already rolling, it will enter the
* ::JackTransportStarting state and begin invoking their @a
* sync_callbacks until ready. This function is realtime-safe.
*
* @see jack_transport_locate, jack_set_sync_callback
*
* @param client the JACK client structure.
* @param pos requested new transport position.
*
* @return 0 if valid request, EINVAL if position structure rejected.
*/
int jack_transport_reposition (jack_client_t *client,
const(jack_position_t) *pos) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Start the JACK transport rolling.
*
* Any client can make this request at any time. It takes effect no
* sooner than the next process cycle, perhaps later if there are
* slow-sync clients. This function is realtime-safe.
*
* @see jack_set_sync_callback
*
* @param client the JACK client structure.
*/
void jack_transport_start (jack_client_t *client) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Stop the JACK transport.
*
* Any client can make this request at any time. It takes effect on
* the next process cycle. This function is realtime-safe.
*
* @param client the JACK client structure.
*/
void jack_transport_stop (jack_client_t *client) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Gets the current transport info structure (deprecated).
*
* @param client the JACK client structure.
* @param tinfo current transport info structure. The "valid" field
* describes which fields contain valid data.
*
* @deprecated This is for compatibility with the earlier transport
* interface. Use jack_transport_query(), instead.
*
* @pre Must be called from the process thread.
*/
void jack_get_transport_info (jack_client_t *client,
jack_transport_info_t *tinfo) /* JACK_OPTIONAL_WEAK_EXPORT */;
/**
* Set the transport info structure (deprecated).
*
* @deprecated This function still exists for compatibility with the
* earlier transport interface, but it does nothing. Instead, define
* a ::JackTimebaseCallback.
*/
void jack_set_transport_info (jack_client_t *client,
jack_transport_info_t *tinfo) /* JACK_OPTIONAL_WEAK_EXPORT */;
/*@}*/
}
|
D
|
# FIXED
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/common/cc26xx/onboard.c
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/inc/bcomdef.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/comdef.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdint.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_stdint40.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/stdint.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/cdefs.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_types.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_types.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_stdint.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_stdint.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdbool.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_defs.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/common/cc26xx/onboard.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/sys_ctrl.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_types.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/../inc/hw_chip_def.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_memmap.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ints.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_sysctl.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_prcm.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_nvic.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_wuc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aux_wuc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_ioc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ddi_0_osc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_rfc_pwr.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi_3_refsys.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_sysctl.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_rtc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_fcfg1.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/interrupt.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/debug.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/cpu.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/pwr_ctrl.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi_2_refsys.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/osc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ddi.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ddi.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aux_smph.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/prcm.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aon_ioc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/adi.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_uart.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aux_wuc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aon_wuc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/vims.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_vims.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_mcu.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_gpio.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/systick.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/uart.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/gpio.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/flash.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_flash.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ioc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdlib.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_ti_config.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/linkage.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_assert.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_sleep.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h
TOOLS/onboard.obj: C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/limits.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_memory.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_timers.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_board_cfg.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_key.h
TOOLS/onboard.obj: C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_board.h
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/common/cc26xx/onboard.c:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/inc/bcomdef.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/comdef.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/../_common/cc26xx/_hal_types.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdint.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_stdint40.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/stdint.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/cdefs.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_types.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_types.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/machine/_stdint.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/sys/_stdint.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdbool.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_defs.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/common/cc26xx/onboard.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/sys_ctrl.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/../inc/hw_chip_def.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_memmap.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ints.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_sysctl.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_prcm.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_nvic.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_wuc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aux_wuc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_ioc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ddi_0_osc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_rfc_pwr.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi_3_refsys.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_sysctl.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aon_rtc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_fcfg1.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/interrupt.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/debug.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/cpu.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_cpu_scs.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../driverlib/rom.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/pwr_ctrl.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi_2_refsys.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/osc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ddi.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ddi.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_aux_smph.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/prcm.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aon_ioc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/adi.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_uart.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_adi.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aux_wuc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/aon_wuc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/vims.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_vims.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_mcu.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/inc/hw_gpio.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/systick.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/uart.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/gpio.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/flash.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_flash.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/ioc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/devices/cc26x0r2/driverlib/../inc/hw_ioc.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/icall/src/inc/icall.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/stdlib.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/_ti_config.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/linkage.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_assert.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_sleep.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal.h:
C:/ti/ccs930/ccs/tools/compiler/ti-cgt-arm_18.12.4.LTS/include/limits.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_memory.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/osal/src/inc/osal_timers.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_board_cfg.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/target/_common/hal_types.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_key.h:
C:/ti/simplelink_cc2640r2_sdk_1_50_00_58/source/ti/blestack/hal/src/inc/hal_board.h:
|
D
|
<?xml version="1.0" encoding="UTF-8"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmi:id="_m7U-QTqWEeWV7JtbNtoLYQ">
<pageList xmi:id="_m7U-QjqWEeWV7JtbNtoLYQ">
<availablePage>
<emfPageIdentifier href="CalculateTrainPosition.notation#_VnXGoDqXEeWV7JtbNtoLYQ"/>
</availablePage>
</pageList>
<sashModel xmi:id="_m7U-QzqWEeWV7JtbNtoLYQ" currentSelection="_m7U-RDqWEeWV7JtbNtoLYQ">
<windows xmi:id="_m7U-RTqWEeWV7JtbNtoLYQ">
<children xsi:type="di:TabFolder" xmi:id="_m7U-RDqWEeWV7JtbNtoLYQ"/>
</windows>
</sashModel>
</di:SashWindowsMngr>
|
D
|
/*#D*/
// Copyright © 2015-2017, Bernard Helyer.
// Copyright © 2016-2017, Jakob Bornecrantz.
// See copyright notice in src/volt/license.d (BOOST ver. 1.0).
/*!
* Module containing the @ref ScopeReplacer class.
*
* @ingroup passPost
*/
module volta.postparse.scopereplacer;
import watt.text.format : format;
import ir = volta.ir;
import volta.util.util;
import volta.util.sinks;
import volta.errors;
import volta.interfaces;
import volta.visitor.visitor;
import volta.visitor.scopemanager;
/*!
* Module containing the @ref ScopeReplacer class.
*
* @ingroup passes passLang passPost
*/
class ScopeReplacer : NullVisitor, Pass
{
public:
ErrorSink errSink;
protected:
FunctionSink mFuncStack;
public:
this(ErrorSink errSink)
{
this.errSink = errSink;
}
public:
override void transform(ir.Module m)
{
accept(m, this);
}
void transform(ir.Module m, ir.Function func, ir.BlockStatement bs)
{
enter(func);
accept(bs, this);
leave(func);
}
override void close()
{
}
override Status enter(ir.Function func)
{
funcPush(func);
return Continue;
}
override Status leave(ir.Function func)
{
funcPop(func);
return Continue;
}
override Status enter(ir.BlockStatement bs)
{
foreach (i, node; bs.statements) {
switch (node.nodeType) with (ir.NodeType) {
case TryStatement:
auto t = cast(ir.TryStatement) node;
bs.statements[i] = handleTry(t);
break;
case ScopeStatement:
auto ss = cast(ir.ScopeStatement) node;
bs.statements[i] = handleScope(ss);
break;
default:
}
}
return Continue;
}
override Status visit(ir.TemplateDefinition td)
{
if (td._struct !is null) {
return accept(td._struct, this);
}
if (td._union !is null) {
return accept(td._union, this);
}
if (td._interface !is null) {
return accept(td._interface, this);
}
if (td._class !is null) {
return accept(td._class, this);
}
if (td._function !is null) {
return accept(td._function, this);
}
panic(errSink, td, "Invalid TemplateDefinition");
return Continue;
}
protected:
/*
*
* Stack code
*
*/
final @property ir.Function funcTop()
{
return mFuncStack.getLast();
}
final void funcPush(ir.Function func)
{
mFuncStack.sink(func);
}
final void funcPop(ir.Function func)
{
assert(mFuncStack.length > 0 && func is funcTop);
mFuncStack.popLast();
}
/*
*
* Converting code.
*
*/
final ir.Node handleTry(ir.TryStatement t)
{
if (t.finallyBlock is null) {
return t;
}
if (!passert(errSink, t, mFuncStack.length > 0)) {
return null;
}
auto f = t.finallyBlock;
t.finallyBlock = null;
auto func = convertToFunction(
ir.ScopeKind.Exit, f, funcTop);
auto b = new ir.BlockStatement();
b.loc = t.loc;
b.statements = [func, t];
return b;
}
final ir.Function handleScope(ir.ScopeStatement ss)
{
if (mFuncStack.length == 0) {
errorMsg(errSink, ss, scopeOutsideFunctionMsg());
return null;
}
return convertToFunction(ss.kind, ss.block, funcTop);
}
final ir.Function convertToFunction(ir.ScopeKind kind, ir.BlockStatement block, ir.Function parent)
{
auto func = new ir.Function();
func.loc = block.loc;
func.kind = ir.Function.Kind.Nested;
func.type = new ir.FunctionType();
func.type.loc = block.loc;
func.type.ret = buildVoid(/*#ref*/block.loc);
func.parsedBody = block;
final switch (kind) with (ir.ScopeKind) {
case Exit:
func.isLoweredScopeExit = true;
func.name = format("__v_scope_exit%s", parent.scopeExits.length);
parent.scopeExits ~= func;
break;
case Success:
func.isLoweredScopeSuccess = true;
func.name = format("__v_scope_success%s", parent.scopeSuccesses.length);
parent.scopeSuccesses ~= func;
break;
case Failure:
func.isLoweredScopeFailure = true;
func.name = format("__v_scope_failure%s", parent.scopeFailures.length);
parent.scopeFailures ~= func;
break;
}
return func;
}
}
|
D
|
/home/javed/Documents/Projects/RustRepo/ultimate_rust_crash_course/exercise/z_final_project/target/rls/debug/build/rayon-core-1ddbc500769b7e57/build_script_build-1ddbc500769b7e57: /home/javed/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.0/build.rs
/home/javed/Documents/Projects/RustRepo/ultimate_rust_crash_course/exercise/z_final_project/target/rls/debug/build/rayon-core-1ddbc500769b7e57/build_script_build-1ddbc500769b7e57.d: /home/javed/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.0/build.rs
/home/javed/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-core-1.9.0/build.rs:
|
D
|
// Copyright Ahmet Sait Koçak 2020.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
module bindbc.hb.bind.font;
import bindbc.hb.config;
import bindbc.hb.bind.common;
import bindbc.hb.bind.face;
extern(C) @nogc nothrow:
struct hb_font_t;
/*
* hb_font_funcs_t
*/
struct hb_font_funcs_t;
version(BindHB_Static)
hb_font_funcs_t* hb_font_funcs_create ();
else
{
private alias fp_hb_font_funcs_create = hb_font_funcs_t* function ();
__gshared fp_hb_font_funcs_create hb_font_funcs_create;
}
version(BindHB_Static)
hb_font_funcs_t* hb_font_funcs_get_empty ();
else
{
private alias fp_hb_font_funcs_get_empty = hb_font_funcs_t* function ();
__gshared fp_hb_font_funcs_get_empty hb_font_funcs_get_empty;
}
version(BindHB_Static)
hb_font_funcs_t* hb_font_funcs_reference (hb_font_funcs_t* ffuncs);
else
{
private alias fp_hb_font_funcs_reference = hb_font_funcs_t* function (hb_font_funcs_t* ffuncs);
__gshared fp_hb_font_funcs_reference hb_font_funcs_reference;
}
version(BindHB_Static)
void hb_font_funcs_destroy (hb_font_funcs_t* ffuncs);
else
{
private alias fp_hb_font_funcs_destroy = void function (hb_font_funcs_t* ffuncs);
__gshared fp_hb_font_funcs_destroy hb_font_funcs_destroy;
}
version(BindHB_Static)
hb_bool_t hb_font_funcs_set_user_data (
hb_font_funcs_t* ffuncs,
hb_user_data_key_t* key,
void* data,
hb_destroy_func_t destroy,
hb_bool_t replace);
else
{
private alias fp_hb_font_funcs_set_user_data = hb_bool_t function (
hb_font_funcs_t* ffuncs,
hb_user_data_key_t* key,
void* data,
hb_destroy_func_t destroy,
hb_bool_t replace);
__gshared fp_hb_font_funcs_set_user_data hb_font_funcs_set_user_data;
}
version(BindHB_Static)
void* hb_font_funcs_get_user_data (
hb_font_funcs_t* ffuncs,
hb_user_data_key_t* key);
else
{
private alias fp_hb_font_funcs_get_user_data = void* function (
hb_font_funcs_t* ffuncs,
hb_user_data_key_t* key);
__gshared fp_hb_font_funcs_get_user_data hb_font_funcs_get_user_data;
}
version(BindHB_Static)
void hb_font_funcs_make_immutable (hb_font_funcs_t* ffuncs);
else
{
private alias fp_hb_font_funcs_make_immutable = void function (hb_font_funcs_t* ffuncs);
__gshared fp_hb_font_funcs_make_immutable hb_font_funcs_make_immutable;
}
version(BindHB_Static)
hb_bool_t hb_font_funcs_is_immutable (hb_font_funcs_t* ffuncs);
else
{
private alias fp_hb_font_funcs_is_immutable = hb_bool_t function (hb_font_funcs_t* ffuncs);
__gshared fp_hb_font_funcs_is_immutable hb_font_funcs_is_immutable;
}
/* font and glyph extents */
/* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
struct hb_font_extents_t
{
hb_position_t ascender; /* typographic ascender. */
hb_position_t descender; /* typographic descender. */
hb_position_t line_gap; /* suggested line spacing gap. */
/*< private >*/
hb_position_t reserved9;
hb_position_t reserved8;
hb_position_t reserved7;
hb_position_t reserved6;
hb_position_t reserved5;
hb_position_t reserved4;
hb_position_t reserved3;
hb_position_t reserved2;
hb_position_t reserved1;
}
/* Note that height is negative in coordinate systems that grow up. */
struct hb_glyph_extents_t
{
hb_position_t x_bearing; /* left side of glyph from origin. */
hb_position_t y_bearing; /* top side of glyph from origin. */
hb_position_t width; /* distance from left to right side. */
hb_position_t height; /* distance from top to bottom side. */
}
/* func types */
alias hb_font_get_font_extents_func_t = int function (
hb_font_t* font,
void* font_data,
hb_font_extents_t* extents,
void* user_data);
alias hb_font_get_font_h_extents_func_t = int function ();
alias hb_font_get_font_v_extents_func_t = int function ();
alias hb_font_get_nominal_glyph_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t unicode,
hb_codepoint_t* glyph,
void* user_data);
alias hb_font_get_variation_glyph_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t* glyph,
void* user_data);
alias hb_font_get_nominal_glyphs_func_t = uint function (
hb_font_t* font,
void* font_data,
uint count,
const(hb_codepoint_t)* first_unicode,
uint unicode_stride,
hb_codepoint_t* first_glyph,
uint glyph_stride,
void* user_data);
alias hb_font_get_glyph_advance_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t glyph,
void* user_data);
alias hb_font_get_glyph_h_advance_func_t = int function ();
alias hb_font_get_glyph_v_advance_func_t = int function ();
alias hb_font_get_glyph_advances_func_t = void function (
hb_font_t* font,
void* font_data,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride,
void* user_data);
alias hb_font_get_glyph_h_advances_func_t = void function ();
alias hb_font_get_glyph_v_advances_func_t = void function ();
alias hb_font_get_glyph_origin_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t glyph,
hb_position_t* x,
hb_position_t* y,
void* user_data);
alias hb_font_get_glyph_h_origin_func_t = int function ();
alias hb_font_get_glyph_v_origin_func_t = int function ();
alias hb_font_get_glyph_kerning_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t first_glyph,
hb_codepoint_t second_glyph,
void* user_data);
alias hb_font_get_glyph_h_kerning_func_t = int function ();
alias hb_font_get_glyph_extents_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t glyph,
hb_glyph_extents_t* extents,
void* user_data);
alias hb_font_get_glyph_contour_point_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t glyph,
uint point_index,
hb_position_t* x,
hb_position_t* y,
void* user_data);
alias hb_font_get_glyph_name_func_t = int function (
hb_font_t* font,
void* font_data,
hb_codepoint_t glyph,
char* name,
uint size,
void* user_data);
/* -1 means nul-terminated */
alias hb_font_get_glyph_from_name_func_t = int function (
hb_font_t* font,
void* font_data,
const(char)* name,
int len,
hb_codepoint_t* glyph,
void* user_data);
/* func setters */
/**
* hb_font_funcs_set_font_h_extents_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.1.2
**/
version(BindHB_Static)
void hb_font_funcs_set_font_h_extents_func (
hb_font_funcs_t* ffuncs,
hb_font_get_font_h_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_font_h_extents_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_font_h_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_font_h_extents_func hb_font_funcs_set_font_h_extents_func;
}
/**
* hb_font_funcs_set_font_v_extents_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.1.2
**/
version(BindHB_Static)
void hb_font_funcs_set_font_v_extents_func (
hb_font_funcs_t* ffuncs,
hb_font_get_font_v_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_font_v_extents_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_font_v_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_font_v_extents_func hb_font_funcs_set_font_v_extents_func;
}
/**
* hb_font_funcs_set_nominal_glyph_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.2.3
**/
version(BindHB_Static)
void hb_font_funcs_set_nominal_glyph_func (
hb_font_funcs_t* ffuncs,
hb_font_get_nominal_glyph_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_nominal_glyph_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_nominal_glyph_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_nominal_glyph_func hb_font_funcs_set_nominal_glyph_func;
}
static if (hbSupport >= 20000)
{
/**
* hb_font_funcs_set_nominal_glyphs_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 2.0.0
**/
version(BindHB_Static)
void hb_font_funcs_set_nominal_glyphs_func (
hb_font_funcs_t* ffuncs,
hb_font_get_nominal_glyphs_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_nominal_glyphs_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_nominal_glyphs_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_nominal_glyphs_func hb_font_funcs_set_nominal_glyphs_func;
}
}
/**
* hb_font_funcs_set_variation_glyph_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.2.3
**/
version(BindHB_Static)
void hb_font_funcs_set_variation_glyph_func (
hb_font_funcs_t* ffuncs,
hb_font_get_variation_glyph_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_variation_glyph_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_variation_glyph_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_variation_glyph_func hb_font_funcs_set_variation_glyph_func;
}
/**
* hb_font_funcs_set_glyph_h_advance_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_h_advance_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_advance_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_h_advance_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_advance_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_h_advance_func hb_font_funcs_set_glyph_h_advance_func;
}
/**
* hb_font_funcs_set_glyph_v_advance_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_v_advance_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_advance_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_v_advance_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_advance_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_v_advance_func hb_font_funcs_set_glyph_v_advance_func;
}
static if (hbSupport >= 10806)
{
/**
* hb_font_funcs_set_glyph_h_advances_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.8.6
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_h_advances_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_advances_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_h_advances_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_advances_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_h_advances_func hb_font_funcs_set_glyph_h_advances_func;
}
/**
* hb_font_funcs_set_glyph_v_advances_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 1.8.6
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_v_advances_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_advances_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_v_advances_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_advances_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_v_advances_func hb_font_funcs_set_glyph_v_advances_func;
}
}
/**
* hb_font_funcs_set_glyph_h_origin_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_h_origin_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_origin_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_h_origin_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_origin_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_h_origin_func hb_font_funcs_set_glyph_h_origin_func;
}
/**
* hb_font_funcs_set_glyph_v_origin_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_v_origin_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_origin_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_v_origin_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_v_origin_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_v_origin_func hb_font_funcs_set_glyph_v_origin_func;
}
/**
* hb_font_funcs_set_glyph_h_kerning_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_h_kerning_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_kerning_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_h_kerning_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_h_kerning_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_h_kerning_func hb_font_funcs_set_glyph_h_kerning_func;
}
/**
* hb_font_funcs_set_glyph_extents_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_extents_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_extents_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_extents_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_extents_func hb_font_funcs_set_glyph_extents_func;
}
/**
* hb_font_funcs_set_glyph_contour_point_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_contour_point_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_contour_point_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_contour_point_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_contour_point_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_contour_point_func hb_font_funcs_set_glyph_contour_point_func;
}
/**
* hb_font_funcs_set_glyph_name_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_name_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_name_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_name_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_name_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_name_func hb_font_funcs_set_glyph_name_func;
}
/**
* hb_font_funcs_set_glyph_from_name_func:
* @ffuncs: font functions.
* @func: (closure user_data) (destroy destroy) (scope notified):
* @user_data:
* @destroy:
*
*
*
* Since: 0.9.2
**/
version(BindHB_Static)
void hb_font_funcs_set_glyph_from_name_func (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_from_name_func_t func,
void* user_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_funcs_set_glyph_from_name_func = void function (
hb_font_funcs_t* ffuncs,
hb_font_get_glyph_from_name_func_t func,
void* user_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_funcs_set_glyph_from_name_func hb_font_funcs_set_glyph_from_name_func;
}
/* func dispatch */
version(BindHB_Static)
hb_bool_t hb_font_get_h_extents (hb_font_t* font, hb_font_extents_t* extents);
else
{
private alias fp_hb_font_get_h_extents = hb_bool_t function (hb_font_t* font, hb_font_extents_t* extents);
__gshared fp_hb_font_get_h_extents hb_font_get_h_extents;
}
version(BindHB_Static)
hb_bool_t hb_font_get_v_extents (hb_font_t* font, hb_font_extents_t* extents);
else
{
private alias fp_hb_font_get_v_extents = hb_bool_t function (hb_font_t* font, hb_font_extents_t* extents);
__gshared fp_hb_font_get_v_extents hb_font_get_v_extents;
}
version(BindHB_Static)
hb_bool_t hb_font_get_nominal_glyph (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t* glyph);
else
{
private alias fp_hb_font_get_nominal_glyph = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t* glyph);
__gshared fp_hb_font_get_nominal_glyph hb_font_get_nominal_glyph;
}
version(BindHB_Static)
hb_bool_t hb_font_get_variation_glyph (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t* glyph);
else
{
private alias fp_hb_font_get_variation_glyph = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t* glyph);
__gshared fp_hb_font_get_variation_glyph hb_font_get_variation_glyph;
}
static if (hbSupport >= HBSupport.v2_6_3)
{
version(BindHB_Static)
uint hb_font_get_nominal_glyphs (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_unicode,
uint unicode_stride,
hb_codepoint_t* first_glyph,
uint glyph_stride);
else
{
private alias fp_hb_font_get_nominal_glyphs = uint function (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_unicode,
uint unicode_stride,
hb_codepoint_t* first_glyph,
uint glyph_stride);
__gshared fp_hb_font_get_nominal_glyphs hb_font_get_nominal_glyphs;
}
}
version(BindHB_Static)
hb_position_t hb_font_get_glyph_h_advance (
hb_font_t* font,
hb_codepoint_t glyph);
else
{
private alias fp_hb_font_get_glyph_h_advance = hb_position_t function (
hb_font_t* font,
hb_codepoint_t glyph);
__gshared fp_hb_font_get_glyph_h_advance hb_font_get_glyph_h_advance;
}
version(BindHB_Static)
hb_position_t hb_font_get_glyph_v_advance (
hb_font_t* font,
hb_codepoint_t glyph);
else
{
private alias fp_hb_font_get_glyph_v_advance = hb_position_t function (
hb_font_t* font,
hb_codepoint_t glyph);
__gshared fp_hb_font_get_glyph_v_advance hb_font_get_glyph_v_advance;
}
static if (hbSupport >= HBSupport.v2_6_3)
{
version(BindHB_Static)
void hb_font_get_glyph_h_advances (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
else
{
private alias fp_hb_font_get_glyph_h_advances = void function (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
__gshared fp_hb_font_get_glyph_h_advances hb_font_get_glyph_h_advances;
}
version(BindHB_Static)
void hb_font_get_glyph_v_advances (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
else
{
private alias fp_hb_font_get_glyph_v_advances = void function (
hb_font_t* font,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
__gshared fp_hb_font_get_glyph_v_advances hb_font_get_glyph_v_advances;
}
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_h_origin (
hb_font_t* font,
hb_codepoint_t glyph,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_h_origin = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_h_origin hb_font_get_glyph_h_origin;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_v_origin (
hb_font_t* font,
hb_codepoint_t glyph,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_v_origin = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_v_origin hb_font_get_glyph_v_origin;
}
version(BindHB_Static)
hb_position_t hb_font_get_glyph_h_kerning (
hb_font_t* font,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph);
else
{
private alias fp_hb_font_get_glyph_h_kerning = hb_position_t function (
hb_font_t* font,
hb_codepoint_t left_glyph,
hb_codepoint_t right_glyph);
__gshared fp_hb_font_get_glyph_h_kerning hb_font_get_glyph_h_kerning;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_extents (
hb_font_t* font,
hb_codepoint_t glyph,
hb_glyph_extents_t* extents);
else
{
private alias fp_hb_font_get_glyph_extents = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_glyph_extents_t* extents);
__gshared fp_hb_font_get_glyph_extents hb_font_get_glyph_extents;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_contour_point (
hb_font_t* font,
hb_codepoint_t glyph,
uint point_index,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_contour_point = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
uint point_index,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_contour_point hb_font_get_glyph_contour_point;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_name (
hb_font_t* font,
hb_codepoint_t glyph,
char* name,
uint size);
else
{
private alias fp_hb_font_get_glyph_name = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
char* name,
uint size);
__gshared fp_hb_font_get_glyph_name hb_font_get_glyph_name;
}
/* -1 means nul-terminated */
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_from_name (
hb_font_t* font,
const(char)* name,
int len,
hb_codepoint_t* glyph);
else
{
private alias fp_hb_font_get_glyph_from_name = hb_bool_t function (
hb_font_t* font,
const(char)* name,
int len,
hb_codepoint_t* glyph);
__gshared fp_hb_font_get_glyph_from_name hb_font_get_glyph_from_name;
}
/* high-level funcs, with fallback */
/* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
* otherwise calls hb_font_get_variation_glyph(). */
version(BindHB_Static)
hb_bool_t hb_font_get_glyph (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t* glyph);
else
{
private alias fp_hb_font_get_glyph = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t unicode,
hb_codepoint_t variation_selector,
hb_codepoint_t* glyph);
__gshared fp_hb_font_get_glyph hb_font_get_glyph;
}
version(BindHB_Static)
void hb_font_get_extents_for_direction (
hb_font_t* font,
hb_direction_t direction,
hb_font_extents_t* extents);
else
{
private alias fp_hb_font_get_extents_for_direction = void function (
hb_font_t* font,
hb_direction_t direction,
hb_font_extents_t* extents);
__gshared fp_hb_font_get_extents_for_direction hb_font_get_extents_for_direction;
}
version(BindHB_Static)
void hb_font_get_glyph_advance_for_direction (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_advance_for_direction = void function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_advance_for_direction hb_font_get_glyph_advance_for_direction;
}
static if (hbSupport >= HBSupport.v2_6_3)
{
version(BindHB_Static)
void hb_font_get_glyph_advances_for_direction (
hb_font_t* font,
hb_direction_t direction,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
else
{
private alias fp_hb_font_get_glyph_advances_for_direction = void function (
hb_font_t* font,
hb_direction_t direction,
uint count,
const(hb_codepoint_t)* first_glyph,
uint glyph_stride,
hb_position_t* first_advance,
uint advance_stride);
__gshared fp_hb_font_get_glyph_advances_for_direction hb_font_get_glyph_advances_for_direction;
}
}
version(BindHB_Static)
void hb_font_get_glyph_origin_for_direction (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_origin_for_direction = void function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_origin_for_direction hb_font_get_glyph_origin_for_direction;
}
version(BindHB_Static)
void hb_font_add_glyph_origin_for_direction (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_add_glyph_origin_for_direction = void function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_add_glyph_origin_for_direction hb_font_add_glyph_origin_for_direction;
}
version(BindHB_Static)
void hb_font_subtract_glyph_origin_for_direction (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_subtract_glyph_origin_for_direction = void function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_subtract_glyph_origin_for_direction hb_font_subtract_glyph_origin_for_direction;
}
version(BindHB_Static)
void hb_font_get_glyph_kerning_for_direction (
hb_font_t* font,
hb_codepoint_t first_glyph,
hb_codepoint_t second_glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_kerning_for_direction = void function (
hb_font_t* font,
hb_codepoint_t first_glyph,
hb_codepoint_t second_glyph,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_kerning_for_direction hb_font_get_glyph_kerning_for_direction;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_extents_for_origin (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t* extents);
else
{
private alias fp_hb_font_get_glyph_extents_for_origin = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
hb_direction_t direction,
hb_glyph_extents_t* extents);
__gshared fp_hb_font_get_glyph_extents_for_origin hb_font_get_glyph_extents_for_origin;
}
version(BindHB_Static)
hb_bool_t hb_font_get_glyph_contour_point_for_origin (
hb_font_t* font,
hb_codepoint_t glyph,
uint point_index,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
else
{
private alias fp_hb_font_get_glyph_contour_point_for_origin = hb_bool_t function (
hb_font_t* font,
hb_codepoint_t glyph,
uint point_index,
hb_direction_t direction,
hb_position_t* x,
hb_position_t* y);
__gshared fp_hb_font_get_glyph_contour_point_for_origin hb_font_get_glyph_contour_point_for_origin;
}
/* Generates gidDDD if glyph has no name. */
version(BindHB_Static)
void hb_font_glyph_to_string (
hb_font_t* font,
hb_codepoint_t glyph,
char* s,
uint size);
else
{
private alias fp_hb_font_glyph_to_string = void function (
hb_font_t* font,
hb_codepoint_t glyph,
char* s,
uint size);
__gshared fp_hb_font_glyph_to_string hb_font_glyph_to_string;
}
/* Parses gidDDD and uniUUUU strings automatically. */
/* -1 means nul-terminated */
version(BindHB_Static)
hb_bool_t hb_font_glyph_from_string (
hb_font_t* font,
const(char)* s,
int len,
hb_codepoint_t* glyph);
else
{
private alias fp_hb_font_glyph_from_string = hb_bool_t function (
hb_font_t* font,
const(char)* s,
int len,
hb_codepoint_t* glyph);
__gshared fp_hb_font_glyph_from_string hb_font_glyph_from_string;
}
/*
* hb_font_t
*/
/* Fonts are very light-weight objects */
version(BindHB_Static)
hb_font_t* hb_font_create (hb_face_t* face);
else
{
private alias fp_hb_font_create = hb_font_t* function (hb_face_t* face);
__gshared fp_hb_font_create hb_font_create;
}
version(BindHB_Static)
hb_font_t* hb_font_create_sub_font (hb_font_t* parent);
else
{
private alias fp_hb_font_create_sub_font = hb_font_t* function (hb_font_t* parent);
__gshared fp_hb_font_create_sub_font hb_font_create_sub_font;
}
version(BindHB_Static)
hb_font_t* hb_font_get_empty ();
else
{
private alias fp_hb_font_get_empty = hb_font_t* function ();
__gshared fp_hb_font_get_empty hb_font_get_empty;
}
version(BindHB_Static)
hb_font_t* hb_font_reference (hb_font_t* font);
else
{
private alias fp_hb_font_reference = hb_font_t* function (hb_font_t* font);
__gshared fp_hb_font_reference hb_font_reference;
}
version(BindHB_Static)
void hb_font_destroy (hb_font_t* font);
else
{
private alias fp_hb_font_destroy = void function (hb_font_t* font);
__gshared fp_hb_font_destroy hb_font_destroy;
}
version(BindHB_Static)
hb_bool_t hb_font_set_user_data (
hb_font_t* font,
hb_user_data_key_t* key,
void* data,
hb_destroy_func_t destroy,
hb_bool_t replace);
else
{
private alias fp_hb_font_set_user_data = hb_bool_t function (
hb_font_t* font,
hb_user_data_key_t* key,
void* data,
hb_destroy_func_t destroy,
hb_bool_t replace);
__gshared fp_hb_font_set_user_data hb_font_set_user_data;
}
version(BindHB_Static)
void* hb_font_get_user_data (hb_font_t* font, hb_user_data_key_t* key);
else
{
private alias fp_hb_font_get_user_data = void* function (hb_font_t* font, hb_user_data_key_t* key);
__gshared fp_hb_font_get_user_data hb_font_get_user_data;
}
version(BindHB_Static)
void hb_font_make_immutable (hb_font_t* font);
else
{
private alias fp_hb_font_make_immutable = void function (hb_font_t* font);
__gshared fp_hb_font_make_immutable hb_font_make_immutable;
}
version(BindHB_Static)
hb_bool_t hb_font_is_immutable (hb_font_t* font);
else
{
private alias fp_hb_font_is_immutable = hb_bool_t function (hb_font_t* font);
__gshared fp_hb_font_is_immutable hb_font_is_immutable;
}
version(BindHB_Static)
void hb_font_set_parent (hb_font_t* font, hb_font_t* parent);
else
{
private alias fp_hb_font_set_parent = void function (hb_font_t* font, hb_font_t* parent);
__gshared fp_hb_font_set_parent hb_font_set_parent;
}
version(BindHB_Static)
hb_font_t* hb_font_get_parent (hb_font_t* font);
else
{
private alias fp_hb_font_get_parent = hb_font_t* function (hb_font_t* font);
__gshared fp_hb_font_get_parent hb_font_get_parent;
}
version(BindHB_Static)
void hb_font_set_face (hb_font_t* font, hb_face_t* face);
else
{
private alias fp_hb_font_set_face = void function (hb_font_t* font, hb_face_t* face);
__gshared fp_hb_font_set_face hb_font_set_face;
}
version(BindHB_Static)
hb_face_t* hb_font_get_face (hb_font_t* font);
else
{
private alias fp_hb_font_get_face = hb_face_t* function (hb_font_t* font);
__gshared fp_hb_font_get_face hb_font_get_face;
}
version(BindHB_Static)
void hb_font_set_funcs (
hb_font_t* font,
hb_font_funcs_t* klass,
void* font_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_set_funcs = void function (
hb_font_t* font,
hb_font_funcs_t* klass,
void* font_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_set_funcs hb_font_set_funcs;
}
/* Be *very* careful with this function! */
version(BindHB_Static)
void hb_font_set_funcs_data (
hb_font_t* font,
void* font_data,
hb_destroy_func_t destroy);
else
{
private alias fp_hb_font_set_funcs_data = void function (
hb_font_t* font,
void* font_data,
hb_destroy_func_t destroy);
__gshared fp_hb_font_set_funcs_data hb_font_set_funcs_data;
}
version(BindHB_Static)
void hb_font_set_scale (hb_font_t* font, int x_scale, int y_scale);
else
{
private alias fp_hb_font_set_scale = void function (hb_font_t* font, int x_scale, int y_scale);
__gshared fp_hb_font_set_scale hb_font_set_scale;
}
version(BindHB_Static)
void hb_font_get_scale (hb_font_t* font, int* x_scale, int* y_scale);
else
{
private alias fp_hb_font_get_scale = void function (hb_font_t* font, int* x_scale, int* y_scale);
__gshared fp_hb_font_get_scale hb_font_get_scale;
}
/*
* A zero value means "no hinting in that direction"
*/
version(BindHB_Static)
void hb_font_set_ppem (hb_font_t* font, uint x_ppem, uint y_ppem);
else
{
private alias fp_hb_font_set_ppem = void function (hb_font_t* font, uint x_ppem, uint y_ppem);
__gshared fp_hb_font_set_ppem hb_font_set_ppem;
}
version(BindHB_Static)
void hb_font_get_ppem (hb_font_t* font, uint* x_ppem, uint* y_ppem);
else
{
private alias fp_hb_font_get_ppem = void function (hb_font_t* font, uint* x_ppem, uint* y_ppem);
__gshared fp_hb_font_get_ppem hb_font_get_ppem;
}
/*
* Point size per EM. Used for optical-sizing in CoreText.
* A value of zero means "not set".
*/
version(BindHB_Static)
void hb_font_set_ptem (hb_font_t* font, float ptem);
else
{
private alias fp_hb_font_set_ptem = void function (hb_font_t* font, float ptem);
__gshared fp_hb_font_set_ptem hb_font_set_ptem;
}
version(BindHB_Static)
float hb_font_get_ptem (hb_font_t* font);
else
{
private alias fp_hb_font_get_ptem = float function (hb_font_t* font);
__gshared fp_hb_font_get_ptem hb_font_get_ptem;
}
version(BindHB_Static)
void hb_font_set_variations (
hb_font_t* font,
const(hb_variation_t)* variations,
uint variations_length);
else
{
private alias fp_hb_font_set_variations = void function (
hb_font_t* font,
const(hb_variation_t)* variations,
uint variations_length);
__gshared fp_hb_font_set_variations hb_font_set_variations;
}
version(BindHB_Static)
void hb_font_set_var_coords_design (
hb_font_t* font,
const(float)* coords,
uint coords_length);
else
{
private alias fp_hb_font_set_var_coords_design = void function (
hb_font_t* font,
const(float)* coords,
uint coords_length);
__gshared fp_hb_font_set_var_coords_design hb_font_set_var_coords_design;
}
/* 2.14 normalized */
version(BindHB_Static)
void hb_font_set_var_coords_normalized (
hb_font_t* font,
const(int)* coords,
uint coords_length);
else
{
private alias fp_hb_font_set_var_coords_normalized = void function (
hb_font_t* font,
const(int)* coords,
uint coords_length);
__gshared fp_hb_font_set_var_coords_normalized hb_font_set_var_coords_normalized;
}
version(BindHB_Static)
const(int)* hb_font_get_var_coords_normalized (hb_font_t* font, uint* length);
else
{
private alias fp_hb_font_get_var_coords_normalized = const(int)* function (hb_font_t* font, uint* length);
__gshared fp_hb_font_get_var_coords_normalized hb_font_get_var_coords_normalized;
}
static if (hbSupport >= HBSupport.v2_6_3)
{
version(BindHB_Static)
void hb_font_set_var_named_instance (hb_font_t* font, uint instance_index);
else
{
private alias fp_hb_font_set_var_named_instance = void function (hb_font_t* font, uint instance_index);
__gshared fp_hb_font_set_var_named_instance hb_font_set_var_named_instance;
}
}
|
D
|
import std.stdio;
import std.typetuple;
/// Native and external functions with the same signature.
/// ...except they don't, because "extern (C)" is apparently enough to make it
/// its own type!
extern (C) float doThing(int x);
extern (C) void glClear(uint mask);
extern (C) void noArgs();
float doThingNative(int x) {
return 1.2;
}
/// Non-templated example
alias doThing_t = extern(C) float function(int);
float delegate(int) callFn (doThing_t glFunction) {
return (int x) {
return glFunction(x);
};
}
/// Templated attempt
alias glFunction_t(R, Args) = extern(C) R function(Args);
alias glFunction_t(R, Args : TypeTuple!()) = extern(C) R function();
R delegate(Args) callGl(R, Args...)(glFunction_t!(R, Args) glFunction) {
return (Args args) {
return glFunction(args);
};
}
/*R delegate() callGl(R)(glFunction_t!(R) glFunction) {
return () {
return glFunction();
};
}*/
template callGl2 (alias fn) {
typeof(&fn) callGl2 (typeof(&fn) glFunction) {
return glFunction;
}
}
typeof(&fn) callGl3 (alias fn) (typeof(&fn) glFunction) {
return glFunction;
}
mixin template SafeGl (alias glFunctionName, R, Args...) {
R longandunlikelyfunctionname (Args args) {
static if (is(R == void)) {
mixin(glFunctionName ~ "(args);");
writeln("glGetError() would be called");
} else {
mixin("R ret = " ~ glFunctionName ~ "(args);");
writeln("glGetError() would be called");
return ret;
}
}
mixin("auto " ~ glFunctionName ~ "_s = &longandunlikelyfunctionname;");
}
mixin SafeGl!("glClear", void, TypeTuple!uint);
mixin SafeGl!("noArgs", void);
void print(T, Args...)(T first, Args args) {
writeln(first);
static if (args.length)
print(args);
}
void print_thru(Args...)(Args args) {
static if (args.length)
print(args);
}
/// Driver function
void main() {
pragma(msg, typeof(&doThing));
//pragma(msg, typeof(&doThingNative));
//auto doThing_wrapped = callFn(&doThing);
//auto doThing_wrapped = callFn(&doThingNative);
// This works:
/*
auto doThing2_wrapped = callGl!(float, int)(&doThing);
writeln(doThing2_wrapped(7));
// */
//writeln(callGl!(float, int)(&doThing)(7));
// This works:
callGl!(void, uint)(&glClear)(18);
// This doesn't:
//callGl(&glClear)(18);
/*callGl!(void)(&noArgs)();*/
/*print_thru(1, "asdf", 'z');
print_thru("qwer");
print_thru();*/
callGl2!(glClear)(&glClear)(2);
callGl3!(glClear)(&glClear)(3);
noArgs_s();
glClear_s(4);
}
|
D
|
import std;
///
struct PackageInfo
{
///
string name;
///
string[] exceptArch;
}
///
struct Defines
{
static:
/// ドキュメントジェネレータを指定します。
/// gendocのバージョンが更新されたら変更してください。
immutable documentGenerator = "gendoc@0.0.6";
/// テスト対象にするサブパッケージを指定します。
/// サブパッケージが追加されたらここにも追加してください。
immutable subPkgs = [
PackageInfo("windows"),
PackageInfo("libdparse_usage"),
PackageInfo("vibe-d_usage", ["windows-x86_omf-", "linux-x86-", "osx-x86-"])
];
}
///
struct Config
{
///
string os;
///
string arch;
///
string compiler;
///
string archiveSuffix;
///
string scriptDir = __FILE__.dirName();
///
string projectName;
///
string refName;
}
///
__gshared Config config;
///
int main(string[] args)
{
string mode;
version (Windows) {config.os = "windows";}
else version (linux) {config.os = "linux";}
else version (OSX) {config.os = "osx";}
else static assert(0, "Unsupported OS");
version (Windows) {config.archiveSuffix = ".zip";}
else version (linux) {config.archiveSuffix = ".tar.gz";}
else version (OSX) {config.archiveSuffix = ".tar.gz";}
else static assert(0, "Unsupported OS");
version (D_LP64) {config.arch = "x86_64";}
else {config.arch = "x86";}
version (DigitalMars) {config.compiler = "dmd";}
else version (LDC) {config.compiler = "ldc2";}
else version (GNU) {config.compiler = "gdc";}
else static assert(0, "Unsupported Compiler");
config.projectName = environment.get("GITHUB_REPOSITORY").chompPrefix(environment.get("GITHUB_ACTOR") ~ "/");
config.refName = getRefName();
string[] exDubOpts;
args.getopt(
"a|arch", &config.arch,
"os", &config.os,
"c|compiler", &config.compiler,
"archive-suffix", &config.archiveSuffix,
"m|mode", &mode,
"exdubopts", &exDubOpts);
switch (mode.toLower)
{
case "unit-test":
case "unittest":
case "ut":
unitTest(exDubOpts);
break;
case "integration-test":
case "integrationtest":
case "tt":
integrationTest(exDubOpts);
break;
case "create-release-build":
case "createreleasebuild":
case "release-build":
case "releasebuild":
case "build":
createReleaseBuild(exDubOpts);
break;
case "create-archive":
case "createarchive":
createArchive();
break;
case "create-document":
case "createdocument":
case "create-document-test":
case "createdocumenttest":
case "generate-document":
case "generatedocument":
case "generate-document-test":
case "generatedocumenttest":
case "gendoc":
case "docs":
case "doc":
generateDocument();
break;
case "all":
unitTest(exDubOpts);
integrationTest(exDubOpts);
createReleaseBuild(exDubOpts);
createArchive();
generateDocument();
break;
default:
enforce(0, "Unknown mode: " ~ mode);
break;
}
return 0;
}
///
void unitTest(string[] exDubOpts = null)
{
if (!".cov".exists)
mkdir(".cov");
auto opt = ["-a", config.arch, "--compiler", config.compiler, "--coverage", "--main-file", ".github/ut.d"]
~ exDubOpts;
string[string] env;
env.addCurlPath();
exec(["dub", "test"] ~ opt, null, env);
foreach (pkg; Defines.subPkgs)
{
if (!matchArch(pkg.exceptArch))
exec(["dub", "test", ":" ~ pkg.name] ~ opt, null, env);
}
}
///
void generateDocument()
{
import std.file;
string[string] env;
env.addCurlPath();
exec(["dub", "run", Defines.documentGenerator, "-y", "-a", config.arch,
"--", "-a", config.arch, "-b=release", "--compiler", config.compiler], null, env);
// CircleCIでgh-pagesへのデプロイがビルドエラーになる件を回避
auto circleCiConfigDir = config.scriptDir.buildPath("../docs/.circleci");
if (!circleCiConfigDir.exists || !circleCiConfigDir.isDir)
mkdirRecurse(circleCiConfigDir);
std.file.write(circleCiConfigDir.buildPath("config.yml"),`
version: 2
jobs:
build:
branches:
ignore:
- gh-pages
`.chompPrefix("\n").outdent);
}
///
void createReleaseBuild(string[] exDubOpts = null)
{
string[string] env;
env.addCurlPath();
exec(["dub", "build", "-a", config.arch, "-b=unittest-cov", "--compiler", config.compiler]
~ exDubOpts, null, env);
}
///
void integrationTest(string[] exDubOpts = null)
{
string[string] env;
env.addCurlPath();
auto covdir = config.scriptDir.buildNormalizedPath("../.cov").absolutePath();
if (!covdir.exists)
mkdirRecurse(covdir);
// build
exec(["dub", "build", "-a", config.arch, "-b=cov", "--compiler", config.compiler]
~ exDubOpts, null, env);
// do-nothiong
}
///
void createArchive()
{
import std.file;
auto archiveName = format!"%s-%s-%s-%s%s"(
config.projectName, config.refName, config.os, config.arch, config.archiveSuffix);
scope (success)
writeln("::set-output name=ARCNAME::", archiveName);
version (Windows)
{
auto zip = new ZipArchive;
foreach (de; dirEntries("build", SpanMode.depth))
{
if (de.isDir)
continue;
auto m = new ArchiveMember;
m.expandedData = cast(ubyte[])std.file.read(de.name);
m.name = de.name.absolutePath.relativePath(absolutePath("build"));
m.time = de.name.timeLastModified();
m.fileAttributes = de.name.getAttributes();
m.compressionMethod = CompressionMethod.deflate;
zip.addMember(m);
}
std.file.write(archiveName, zip.build());
}
else
{
string abs(string file, string base)
{
return file.absolutePath.relativePath(absolutePath(base));
}
void mv(string from, string to)
{
if (from.isDir)
return;
if (!to.dirName.exists)
mkdirRecurse(to.dirName);
std.file.rename(from, to);
}
mv("build/gendoc", "archive-tmp/bin/gendoc");
foreach (de; dirEntries("build/ddoc", SpanMode.depth))
mv(de.name, buildPath("archive-tmp/etc/.gendoc/ddoc", abs(de.name, "build/ddoc")));
foreach (de; dirEntries("build/source_docs", SpanMode.depth))
mv(de.name, buildPath("archive-tmp/etc/.gendoc/docs", abs(de.name, "build/source_docs")));
exec(["tar", "cvfz", buildPath("..", archiveName), "-C", "."]
~ dirEntries("archive-tmp", "*", SpanMode.shallow)
.map!(de => abs(de.name, "archive-tmp")).array, "archive-tmp");
}
}
///
void exec(string[] args, string workDir = null, string[string] env = null)
{
import std.process, std.stdio;
writefln!"> %-(%-s %)"(args);
auto pid = spawnProcess(args, env, std.process.Config.none, workDir ? workDir : ".");
auto res = pid.wait();
enforce(res == 0, format!"Execution was failed[code=%d]."(res));
}
///
string cmd(string[] args, string workDir = null, string[string] env = null)
{
import std.process;
auto res = execute(args, env, std.process.Config.none, size_t.max, workDir);
enforce(res.status == 0, format!"Execution was failed[code=%d]."(res.status));
return res.output;
}
///
string getRefName()
{
auto ghref = environment.get("GITHUB_REF");
enum keyBranche = "refs/heads/";
enum keyTag = "refs/heads/";
enum keyPull = "refs/heads/";
if (ghref.startsWith(keyBranche))
return ghref[keyBranche.length..$];
if (ghref.startsWith(keyTag))
return ghref[keyTag.length..$];
if (ghref.startsWith(keyPull))
return "pr" ~ ghref[keyPull.length..$];
return cmd(["git", "describe", "--tags", "--always"]).chomp;
}
///
string searchPath(string name, string[] dirs = null)
{
if (name.length == 0)
return name;
if (name.isAbsolute())
return name;
version (Windows)
{
foreach (dir; dirs.chain(environment.get("Path").split(";")))
{
auto bin = dir.buildPath(name).setExtension(".exe");
if (bin.exists)
return bin;
}
}
else
{
foreach (dir; dirs.chain(environment.get("PATH").split(":")))
{
auto bin = dir.buildPath(name);
if (bin.exists)
return bin;
}
}
return name;
}
///
void addCurlPath(ref string[string] env)
{
if (config.os == "windows" && config.arch == "x86_64")
{
auto bin64dir = searchDCompiler().dirName.buildNormalizedPath("../bin64");
if (bin64dir.exists && bin64dir.isDir)
env["Path"] = bin64dir ~ ";" ~ environment.get("Path").chomp(";");
}
else if (config.os == "windows" && config.arch == "x86")
{
auto bin32dir = searchDCompiler().dirName.buildNormalizedPath("../bin");
if (bin32dir.exists && bin32dir.isDir)
env["Path"] = bin32dir ~ ";" ~ environment.get("Path").chomp(";");
}
}
///
string searchDCompiler()
{
auto compiler = config.compiler;
if (compiler.absolutePath.exists)
return compiler.absolutePath;
compiler = compiler.searchPath();
if (compiler.exists)
return compiler;
auto dc = searchPath(environment.get("DC"));
if (dc.exists)
return dc;
auto dmd = searchPath(environment.get("DMD"));
if (dmd.exists)
return dmd;
return "dmd";
}
///
string[] getArch()
{
switch (config.os)
{
case "windows":
switch (config.arch)
{
case "x86":
switch (config.compiler)
{
case "dmd": return ["windows-x86-dmd", "windows-x86_omf-dmd"];
case "gdc": return ["windows-x86-gdc"];
case "ldc": return ["windows-x86-ldc", "windows-x86-ldc2", "windows-x86_mscoff-ldc", "windows-x86_mscoff-ldc2"];
case "ldc2": return ["windows-x86-ldc", "windows-x86-ldc2", "windows-x86_mscoff-ldc", "windows-x86_mscoff-ldc2"];
default: assert(0);
}
break;
case "x86_omf":
switch (config.compiler)
{
case "dmd": return ["windows-x86-dmd", "windows-x86_omf-dmd"];
default: assert(0);
}
break;
case "x86_mscoff":
switch (config.compiler)
{
case "dmd": return ["windows-x86-dmd", "windows-x86_mscoff-dmd"];
case "ldc": return ["windows-x86-ldc", "windows-x86-ldc2", "windows-x86_mscoff-ldc", "windows-x86_mscoff-ldc2"];
case "ldc2": return ["windows-x86-ldc", "windows-x86-ldc2", "windows-x86_mscoff-ldc", "windows-x86_mscoff-ldc2"];
default: assert(0);
}
break;
case "x86_64":
switch (config.compiler)
{
case "dmd": return ["windows-x86_64-dmd"];
case "gdc": return ["windows-x86_64-gdc"];
case "ldc": return ["windows-x86_64-ldc", "windows-x86_64-ldc2"];
case "ldc2": return ["windows-x86_64-ldc", "windows-x86_64-ldc2"];
default: assert(0);
}
break;
default: assert(0);
}
break;
case "linux":
switch (config.arch)
{
case "x86":
switch (config.compiler)
{
case "dmd": return ["linux-x86-dmd"];
case "gdc": return ["linux-x86-gdc"];
case "ldc": return ["linux-x86-ldc", "linux-x86-ldc2"];
case "ldc2": return ["linux-x86-ldc", "linux-x86-ldc2"];
default: assert(0);
}
break;
case "x86_64":
switch (config.compiler)
{
case "dmd": return ["linux-x86_64-dmd"];
case "gdc": return ["linux-x86_64-gdc"];
case "ldc": return ["linux-x86_64-ldc", "linux-x86_64-ldc2"];
case "ldc2": return ["linux-x86_64-ldc", "linux-x86_64-ldc2"];
default: assert(0);
}
break;
default: assert(0);
}
break;
case "osx":
switch (config.arch)
{
case "x86":
switch (config.compiler)
{
case "dmd": return ["osx-x86-dmd"];
case "gdc": return ["osx-x86-gdc"];
case "ldc": return ["osx-x86-ldc", "osx-x86-ldc2"];
case "ldc2": return ["osx-x86-ldc", "osx-x86-ldc2"];
default: assert(0);
}
break;
case "x86_64":
switch (config.compiler)
{
case "dmd": return ["osx-x86_64-dmd"];
case "gdc": return ["osx-x86_64-gdc"];
case "ldc": return ["osx-x86_64-ldc", "osx-x86_64-ldc2"];
case "ldc2": return ["osx-x86_64-ldc", "osx-x86_64-ldc2"];
default: assert(0);
}
break;
default: assert(0);
}
break;
default: assert(0);
}
assert(0);
}
///
bool matchArch(in string[] exceptArchs)
{
auto targetArchs = getArch();
foreach (ea; exceptArchs)
{
foreach (a; targetArchs)
{
if (a.canFind(ea))
return true;
}
}
return false;
}
|
D
|
/*
* Copyright 2015-2018 HuntLabs.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module hunt.sql.ast.statement.SQLForeignKeyConstraint;
import hunt.collection;
import hunt.sql.ast.SQLName;
import hunt.sql.ast.statement.SQLConstraint;
import hunt.sql.ast.statement.SQLTableElement;
import hunt.sql.ast.statement.SQLTableConstraint;
import hunt.sql.ast.statement.SQLExprTableSource;
public interface SQLForeignKeyConstraint : SQLConstraint, SQLTableElement, SQLTableConstraint {
List!SQLName getReferencingColumns();
SQLExprTableSource getReferencedTable();
SQLName getReferencedTableName();
void setReferencedTableName(SQLName value);
List!SQLName getReferencedColumns();
}
|
D
|
/Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/Objects-normal/x86_64/Spring.o : /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AutoTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/BlurView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTabBarController.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/ImageLoader.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/KeyboardLayoutConstraint.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/LoadingView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Misc.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SoundPlayer.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Spring.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringAnimation.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionManager.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionZoom.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/UnwindSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Target\ Support\ Files/Spring/Spring-umbrella.h /Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/Objects-normal/x86_64/Spring~partial.swiftmodule : /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AutoTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/BlurView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTabBarController.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/ImageLoader.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/KeyboardLayoutConstraint.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/LoadingView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Misc.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SoundPlayer.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Spring.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringAnimation.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionManager.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionZoom.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/UnwindSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Target\ Support\ Files/Spring/Spring-umbrella.h /Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/Objects-normal/x86_64/Spring~partial.swiftdoc : /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AsyncImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/AutoTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/BlurView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTabBarController.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/DesignableView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/ImageLoader.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/KeyboardLayoutConstraint.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/LoadingView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Misc.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SoundPlayer.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/Spring.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringAnimation.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringButton.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringImageView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringLabel.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextField.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringTextView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/SpringView.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionManager.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/TransitionZoom.swift /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Spring/Spring/UnwindSegue.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/parkingsq1/Documents/PushPill/PushPillClient/Pods/Target\ Support\ Files/Spring/Spring-umbrella.h /Users/parkingsq1/Documents/PushPill/PushPillClient/DerivedData/PushPill/Build/Intermediates/IBDesignables/Intermediates/Pods.build/Debug-iphonesimulator/Spring.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
|
D
|
/*
* Copyright Andrej Mitrovic 2013.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module dtk.tests.text;
version(unittest):
version(DTK_UNITTEST):
import dtk;
import dtk.imports;
import dtk.tests.globals;
unittest
{
auto testWindow = new Window(app.mainWindow, 200, 200);
testWindow.position = Point(500, 500);
auto text = new Text(testWindow);
text.pack();
text.textSize = Size(50, 10);
assert(text.textSize == Size(50, 10));
text.wrapMode = WrapMode.none;
assert(text.wrapMode == WrapMode.none);
text.wrapMode = WrapMode.word;
assert(text.wrapMode == WrapMode.word);
text.value = "asdf";
assert(text.value == "asdf");
text.value = "a b c d e f g h foo bar doo";
assert(text.value == "a b c d e f g h foo bar doo");
app.testRun();
}
|
D
|
/home/gui/Projects/rustLearning/target/rls/debug/deps/matches-b54f6ec777068fbe.rmeta: /home/gui/.asdf/installs/rust/1.48.0/registry/src/github.com-1ecc6299db9ec823/matches-0.1.8/lib.rs
/home/gui/Projects/rustLearning/target/rls/debug/deps/matches-b54f6ec777068fbe.d: /home/gui/.asdf/installs/rust/1.48.0/registry/src/github.com-1ecc6299db9ec823/matches-0.1.8/lib.rs
/home/gui/.asdf/installs/rust/1.48.0/registry/src/github.com-1ecc6299db9ec823/matches-0.1.8/lib.rs:
|
D
|
/**
* Defines declarations of various attributes.
*
* The term 'attribute' refers to things that can apply to a larger scope than a single declaration.
* Among them are:
* - Alignment (`align(8)`)
* - User defined attributes (`@UDA`)
* - Function Attributes (`@safe`)
* - Storage classes (`static`, `__gshared`)
* - Mixin declarations (`mixin("int x;")`)
* - Conditional compilation (`static if`, `static foreach`)
* - Linkage (`extern(C)`)
* - Anonymous structs / unions
* - Protection (`private`, `public`)
* - Deprecated declarations (`@deprecated`)
*
* Copyright: Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/attrib.d, _attrib.d)
* Documentation: https://dlang.org/phobos/dmd_attrib.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/attrib.d
*/
module dmd.attrib;
import dmd.aggregate;
import dmd.arraytypes;
import dmd.cond;
import dmd.declaration;
import dmd.dmodule;
import dmd.dscope;
import dmd.dsymbol;
import dmd.dsymbolsem : dsymbolSemantic;
import dmd.expression;
import dmd.expressionsem;
import dmd.func;
import dmd.globals;
import dmd.hdrgen : visibilityToBuffer;
import dmd.id;
import dmd.identifier;
import dmd.mtype;
import dmd.objc; // for objc.addSymbols
import dmd.root.outbuffer;
import dmd.target; // for target.systemLinkage
import dmd.tokens;
import dmd.visitor;
/***********************************************************
* Abstract attribute applied to Dsymbol's used as a common
* ancestor for storage classes (StorageClassDeclaration),
* linkage (LinkageDeclaration) and others.
*/
extern (C++) abstract class AttribDeclaration : Dsymbol
{
Dsymbols* decl; /// Dsymbol's affected by this AttribDeclaration
extern (D) this(Dsymbols* decl)
{
this.decl = decl;
}
extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl)
{
super(loc, ident);
this.decl = decl;
}
Dsymbols* include(Scope* sc)
{
if (errors)
return null;
return decl;
}
/****************************************
* Create a new scope if one or more given attributes
* are different from the sc's.
* If the returned scope != sc, the caller should pop
* the scope after it used.
*/
extern (D) static Scope* createNewScope(Scope* sc, StorageClass stc, LINK linkage,
CPPMANGLE cppmangle, Visibility visibility, int explicitVisibility,
AlignDeclaration aligndecl, PragmaDeclaration inlining)
{
Scope* sc2 = sc;
if (stc != sc.stc ||
linkage != sc.linkage ||
cppmangle != sc.cppmangle ||
!visibility.isSubsetOf(sc.visibility) ||
explicitVisibility != sc.explicitVisibility ||
aligndecl !is sc.aligndecl ||
inlining != sc.inlining)
{
// create new one for changes
sc2 = sc.copy();
sc2.stc = stc;
sc2.linkage = linkage;
sc2.cppmangle = cppmangle;
sc2.visibility = visibility;
sc2.explicitVisibility = explicitVisibility;
sc2.aligndecl = aligndecl;
sc2.inlining = inlining;
}
return sc2;
}
/****************************************
* A hook point to supply scope for members.
* addMember, setScope, importAll, semantic, semantic2 and semantic3 will use this.
*/
Scope* newScope(Scope* sc)
{
return sc;
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
Dsymbols* d = include(sc);
if (d)
{
Scope* sc2 = newScope(sc);
d.foreachDsymbol( s => s.addMember(sc2, sds) );
if (sc2 != sc)
sc2.pop();
}
}
override void setScope(Scope* sc)
{
Dsymbols* d = include(sc);
//printf("\tAttribDeclaration::setScope '%s', d = %p\n",toChars(), d);
if (d)
{
Scope* sc2 = newScope(sc);
d.foreachDsymbol( s => s.setScope(sc2) );
if (sc2 != sc)
sc2.pop();
}
}
override void importAll(Scope* sc)
{
Dsymbols* d = include(sc);
//printf("\tAttribDeclaration::importAll '%s', d = %p\n", toChars(), d);
if (d)
{
Scope* sc2 = newScope(sc);
d.foreachDsymbol( s => s.importAll(sc2) );
if (sc2 != sc)
sc2.pop();
}
}
override void addComment(const(char)* comment)
{
//printf("AttribDeclaration::addComment %s\n", comment);
if (comment)
{
include(null).foreachDsymbol( s => s.addComment(comment) );
}
}
override const(char)* kind() const
{
return "attribute";
}
override bool oneMember(Dsymbol* ps, Identifier ident)
{
Dsymbols* d = include(null);
return Dsymbol.oneMembers(d, ps, ident);
}
override void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion)
{
include(null).foreachDsymbol( s => s.setFieldOffset(ad, poffset, isunion) );
}
override final bool hasPointers()
{
return include(null).foreachDsymbol( (s) { return s.hasPointers(); } ) != 0;
}
override final bool hasStaticCtorOrDtor()
{
return include(null).foreachDsymbol( (s) { return s.hasStaticCtorOrDtor(); } ) != 0;
}
override final void checkCtorConstInit()
{
include(null).foreachDsymbol( s => s.checkCtorConstInit() );
}
/****************************************
*/
override final void addLocalClass(ClassDeclarations* aclasses)
{
include(null).foreachDsymbol( s => s.addLocalClass(aclasses) );
}
override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories)
{
objc.addSymbols(this, classes, categories);
}
override final inout(AttribDeclaration) isAttribDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Storage classes applied to Dsymbols, e.g. `const int i;`
*
* <stc> <decl...>
*/
extern (C++) class StorageClassDeclaration : AttribDeclaration
{
StorageClass stc;
extern (D) this(StorageClass stc, Dsymbols* decl)
{
super(decl);
this.stc = stc;
}
override StorageClassDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new StorageClassDeclaration(stc, Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
StorageClass scstc = sc.stc;
/* These sets of storage classes are mutually exclusive,
* so choose the innermost or most recent one.
*/
if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest))
scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | STC.manifest);
if (stc & (STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared))
scstc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.tls | STC.manifest | STC.gshared);
if (stc & (STC.const_ | STC.immutable_ | STC.manifest))
scstc &= ~(STC.const_ | STC.immutable_ | STC.manifest);
if (stc & (STC.gshared | STC.shared_ | STC.tls))
scstc &= ~(STC.gshared | STC.shared_ | STC.tls);
if (stc & (STC.safe | STC.trusted | STC.system))
scstc &= ~(STC.safe | STC.trusted | STC.system);
scstc |= stc;
//printf("scstc = x%llx\n", scstc);
return createNewScope(sc, scstc, sc.linkage, sc.cppmangle,
sc.visibility, sc.explicitVisibility, sc.aligndecl, sc.inlining);
}
override final bool oneMember(Dsymbol* ps, Identifier ident)
{
bool t = Dsymbol.oneMembers(decl, ps, ident);
if (t && *ps)
{
/* This is to deal with the following case:
* struct Tick {
* template to(T) { const T to() { ... } }
* }
* For eponymous function templates, the 'const' needs to get attached to 'to'
* before the semantic analysis of 'to', so that template overloading based on the
* 'this' pointer can be successful.
*/
FuncDeclaration fd = (*ps).isFuncDeclaration();
if (fd)
{
/* Use storage_class2 instead of storage_class otherwise when we do .di generation
* we'll wind up with 'const const' rather than 'const'.
*/
/* Don't think we need to worry about mutually exclusive storage classes here
*/
fd.storage_class2 |= stc;
}
}
return t;
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
Dsymbols* d = include(sc);
if (d)
{
Scope* sc2 = newScope(sc);
d.foreachDsymbol( (s)
{
//printf("\taddMember %s to %s\n", s.toChars(), sds.toChars());
// STC.local needs to be attached before the member is added to the scope (because it influences the parent symbol)
if (auto decl = s.isDeclaration())
{
decl.storage_class |= stc & STC.local;
if (auto sdecl = s.isStorageClassDeclaration()) // TODO: why is this not enough to deal with the nested case?
{
sdecl.stc |= stc & STC.local;
}
}
s.addMember(sc2, sds);
});
if (sc2 != sc)
sc2.pop();
}
}
override inout(StorageClassDeclaration) isStorageClassDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Deprecation with an additional message applied to Dsymbols,
* e.g. `deprecated("Superseeded by foo") int bar;`.
* (Note that `deprecated int bar;` is currently represented as a
* StorageClassDeclaration with STC.deprecated_)
*
* `deprecated(<msg>) <decl...>`
*/
extern (C++) final class DeprecatedDeclaration : StorageClassDeclaration
{
Expression msg; /// deprecation message
const(char)* msgstr; /// cached string representation of msg
extern (D) this(Expression msg, Dsymbols* decl)
{
super(STC.deprecated_, decl);
this.msg = msg;
}
override DeprecatedDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new DeprecatedDeclaration(msg.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl));
}
/**
* Provides a new scope with `STC.deprecated_` and `Scope.depdecl` set
*
* Calls `StorageClassDeclaration.newScope` (as it must be called or copied
* in any function overriding `newScope`), then set the `Scope`'s depdecl.
*
* Returns:
* Always a new scope, to use for this `DeprecatedDeclaration`'s members.
*/
override Scope* newScope(Scope* sc)
{
auto scx = super.newScope(sc);
// The enclosing scope is deprecated as well
if (scx == sc)
scx = sc.push();
scx.depdecl = this;
return scx;
}
override void setScope(Scope* sc)
{
//printf("DeprecatedDeclaration::setScope() %p\n", this);
if (decl)
Dsymbol.setScope(sc); // for forward reference
return AttribDeclaration.setScope(sc);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Linkage attribute applied to Dsymbols, e.g.
* `extern(C) void foo()`.
*
* `extern(<linkage>) <decl...>`
*/
extern (C++) final class LinkDeclaration : AttribDeclaration
{
LINK linkage; /// either explicitly set or `default_`
extern (D) this(const ref Loc loc, LINK linkage, Dsymbols* decl)
{
super(loc, null, decl);
//printf("LinkDeclaration(linkage = %d, decl = %p)\n", linkage, decl);
this.linkage = (linkage == LINK.system) ? target.systemLinkage() : linkage;
}
static LinkDeclaration create(const ref Loc loc, LINK p, Dsymbols* decl)
{
return new LinkDeclaration(loc, p, decl);
}
override LinkDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new LinkDeclaration(loc, linkage, Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
return createNewScope(sc, sc.stc, this.linkage, sc.cppmangle, sc.visibility, sc.explicitVisibility,
sc.aligndecl, sc.inlining);
}
override const(char)* toChars() const
{
return toString().ptr;
}
extern(D) override const(char)[] toString() const
{
return "extern ()";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Attribute declaring whether an external aggregate should be mangled as
* a struct or class in C++, e.g. `extern(C++, struct) class C { ... }`.
* This is required for correct name mangling on MSVC targets,
* see cppmanglewin.d for details.
*
* `extern(C++, <cppmangle>) <decl...>`
*/
extern (C++) final class CPPMangleDeclaration : AttribDeclaration
{
CPPMANGLE cppmangle;
extern (D) this(const ref Loc loc, CPPMANGLE cppmangle, Dsymbols* decl)
{
super(loc, null, decl);
//printf("CPPMangleDeclaration(cppmangle = %d, decl = %p)\n", cppmangle, decl);
this.cppmangle = cppmangle;
}
override CPPMangleDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new CPPMangleDeclaration(loc, cppmangle, Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
return createNewScope(sc, sc.stc, LINK.cpp, cppmangle, sc.visibility, sc.explicitVisibility,
sc.aligndecl, sc.inlining);
}
override void setScope(Scope* sc)
{
if (decl)
Dsymbol.setScope(sc); // for forward reference
return AttribDeclaration.setScope(sc);
}
override const(char)* toChars() const
{
return toString().ptr;
}
extern(D) override const(char)[] toString() const
{
return "extern ()";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/**
* A node to represent an `extern(C++)` namespace attribute
*
* There are two ways to declarate a symbol as member of a namespace:
* `Nspace` and `CPPNamespaceDeclaration`.
* The former creates a scope for the symbol, and inject them in the
* parent scope at the same time.
* The later, this class, has no semantic implications and is only
* used for mangling.
* Additionally, this class allows one to use reserved identifiers
* (D keywords) in the namespace.
*
* A `CPPNamespaceDeclaration` can be created from an `Identifier`
* (already resolved) or from an `Expression`, which is CTFE-ed
* and can be either a `TupleExp`, in which can additional
* `CPPNamespaceDeclaration` nodes are created, or a `StringExp`.
*
* Note that this class, like `Nspace`, matches only one identifier
* part of a namespace. For the namespace `"foo::bar"`,
* the will be a `CPPNamespaceDeclaration` with its `ident`
* set to `"bar"`, and its `namespace` field pointing to another
* `CPPNamespaceDeclaration` with its `ident` set to `"foo"`.
*/
extern (C++) final class CPPNamespaceDeclaration : AttribDeclaration
{
/// CTFE-able expression, resolving to `TupleExp` or `StringExp`
Expression exp;
extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl)
{
super(loc, ident, decl);
}
extern (D) this(const ref Loc loc, Expression exp, Dsymbols* decl)
{
super(loc, null, decl);
this.exp = exp;
}
extern (D) this(const ref Loc loc, Identifier ident, Expression exp, Dsymbols* decl,
CPPNamespaceDeclaration parent)
{
super(loc, ident, decl);
this.exp = exp;
this.cppnamespace = parent;
}
override CPPNamespaceDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new CPPNamespaceDeclaration(
this.loc, this.ident, this.exp, Dsymbol.arraySyntaxCopy(this.decl), this.cppnamespace);
}
/**
* Returns:
* A copy of the parent scope, with `this` as `namespace` and C++ linkage
*/
override Scope* newScope(Scope* sc)
{
auto scx = sc.copy();
scx.linkage = LINK.cpp;
scx.namespace = this;
return scx;
}
override const(char)* toChars() const
{
return toString().ptr;
}
extern(D) override const(char)[] toString() const
{
return "extern (C++, `namespace`)";
}
override void accept(Visitor v)
{
v.visit(this);
}
override inout(CPPNamespaceDeclaration) isCPPNamespaceDeclaration() inout { return this; }
}
/***********************************************************
* Visibility declaration for Dsymbols, e.g. `public int i;`
*
* `<visibility> <decl...>` or
* `package(<pkg_identifiers>) <decl...>` if `pkg_identifiers !is null`
*/
extern (C++) final class VisibilityDeclaration : AttribDeclaration
{
Visibility visibility; /// the visibility
Identifier[] pkg_identifiers; /// identifiers for `package(foo.bar)` or null
/**
* Params:
* loc = source location of attribute token
* visibility = visibility attribute data
* decl = declarations which are affected by this visibility attribute
*/
extern (D) this(const ref Loc loc, Visibility visibility, Dsymbols* decl)
{
super(loc, null, decl);
this.visibility = visibility;
//printf("decl = %p\n", decl);
}
/**
* Params:
* loc = source location of attribute token
* pkg_identifiers = list of identifiers for a qualified package name
* decl = declarations which are affected by this visibility attribute
*/
extern (D) this(const ref Loc loc, Identifier[] pkg_identifiers, Dsymbols* decl)
{
super(loc, null, decl);
this.visibility.kind = Visibility.Kind.package_;
this.pkg_identifiers = pkg_identifiers;
if (pkg_identifiers.length > 0)
{
Dsymbol tmp;
Package.resolve(pkg_identifiers, &tmp, null);
visibility.pkg = tmp ? tmp.isPackage() : null;
}
}
override VisibilityDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
if (visibility.kind == Visibility.Kind.package_)
return new VisibilityDeclaration(this.loc, pkg_identifiers, Dsymbol.arraySyntaxCopy(decl));
else
return new VisibilityDeclaration(this.loc, visibility, Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
if (pkg_identifiers)
dsymbolSemantic(this, sc);
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, this.visibility, 1, sc.aligndecl, sc.inlining);
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
if (pkg_identifiers)
{
Dsymbol tmp;
Package.resolve(pkg_identifiers, &tmp, null);
visibility.pkg = tmp ? tmp.isPackage() : null;
pkg_identifiers = null;
}
if (visibility.kind == Visibility.Kind.package_ && visibility.pkg && sc._module)
{
Module m = sc._module;
// While isAncestorPackageOf does an equality check, the fix for issue 17441 adds a check to see if
// each package's .isModule() properites are equal.
//
// Properties generated from `package(foo)` i.e. visibility.pkg have .isModule() == null.
// This breaks package declarations of the package in question if they are declared in
// the same package.d file, which _do_ have a module associated with them, and hence a non-null
// isModule()
if (!m.isPackage() || !visibility.pkg.ident.equals(m.isPackage().ident))
{
Package pkg = m.parent ? m.parent.isPackage() : null;
if (!pkg || !visibility.pkg.isAncestorPackageOf(pkg))
error("does not bind to one of ancestor packages of module `%s`", m.toPrettyChars(true));
}
}
return AttribDeclaration.addMember(sc, sds);
}
override const(char)* kind() const
{
return "visibility attribute";
}
override const(char)* toPrettyChars(bool)
{
assert(visibility.kind > Visibility.Kind.undefined);
OutBuffer buf;
visibilityToBuffer(&buf, visibility);
return buf.extractChars();
}
override inout(VisibilityDeclaration) isVisibilityDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Alignment attribute for aggregates, members and variables.
*
* `align(<ealign>) <decl...>` or
* `align <decl...>` if `ealign` is null
*/
extern (C++) final class AlignDeclaration : AttribDeclaration
{
Expression ealign; /// expression yielding the actual alignment
enum structalign_t UNKNOWN = 0; /// alignment not yet computed
static assert(STRUCTALIGN_DEFAULT != UNKNOWN);
/// the actual alignment, `UNKNOWN` until it's either set to the value of `ealign`
/// or `STRUCTALIGN_DEFAULT` if `ealign` is null ( / an error ocurred)
structalign_t salign = UNKNOWN;
extern (D) this(const ref Loc loc, Expression ealign, Dsymbols* decl)
{
super(loc, null, decl);
this.ealign = ealign;
}
override AlignDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new AlignDeclaration(loc,
ealign ? ealign.syntaxCopy() : null,
Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.visibility, sc.explicitVisibility, this, sc.inlining);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* An anonymous struct/union (defined by `isunion`).
*/
extern (C++) final class AnonDeclaration : AttribDeclaration
{
bool isunion; /// whether it's a union
int sem; /// 1 if successful semantic()
uint anonoffset; /// offset of anonymous struct
uint anonstructsize; /// size of anonymous struct
uint anonalignsize; /// size of anonymous struct for alignment purposes
extern (D) this(const ref Loc loc, bool isunion, Dsymbols* decl)
{
super(loc, null, decl);
this.isunion = isunion;
}
override AnonDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new AnonDeclaration(loc, isunion, Dsymbol.arraySyntaxCopy(decl));
}
override void setScope(Scope* sc)
{
if (decl)
Dsymbol.setScope(sc);
return AttribDeclaration.setScope(sc);
}
override void setFieldOffset(AggregateDeclaration ad, uint* poffset, bool isunion)
{
//printf("\tAnonDeclaration::setFieldOffset %s %p\n", isunion ? "union" : "struct", this);
if (decl)
{
/* This works by treating an AnonDeclaration as an aggregate 'member',
* so in order to place that member we need to compute the member's
* size and alignment.
*/
size_t fieldstart = ad.fields.dim;
/* Hackishly hijack ad's structsize and alignsize fields
* for use in our fake anon aggregate member.
*/
uint savestructsize = ad.structsize;
uint savealignsize = ad.alignsize;
ad.structsize = 0;
ad.alignsize = 0;
uint offset = 0;
decl.foreachDsymbol( (s)
{
s.setFieldOffset(ad, &offset, this.isunion);
if (this.isunion)
offset = 0;
});
/* https://issues.dlang.org/show_bug.cgi?id=13613
* If the fields in this.members had been already
* added in ad.fields, just update *poffset for the subsequent
* field offset calculation.
*/
if (fieldstart == ad.fields.dim)
{
ad.structsize = savestructsize;
ad.alignsize = savealignsize;
*poffset = ad.structsize;
return;
}
anonstructsize = ad.structsize;
anonalignsize = ad.alignsize;
ad.structsize = savestructsize;
ad.alignsize = savealignsize;
// 0 sized structs are set to 1 byte
if (anonstructsize == 0)
{
anonstructsize = 1;
anonalignsize = 1;
}
assert(_scope);
auto alignment = _scope.alignment();
/* Given the anon 'member's size and alignment,
* go ahead and place it.
*/
anonoffset = AggregateDeclaration.placeField(
poffset,
anonstructsize, anonalignsize, alignment,
&ad.structsize, &ad.alignsize,
isunion);
// Add to the anon fields the base offset of this anonymous aggregate
//printf("anon fields, anonoffset = %d\n", anonoffset);
foreach (const i; fieldstart .. ad.fields.dim)
{
VarDeclaration v = ad.fields[i];
//printf("\t[%d] %s %d\n", i, v.toChars(), v.offset);
v.offset += anonoffset;
}
}
}
override const(char)* kind() const
{
return (isunion ? "anonymous union" : "anonymous struct");
}
override inout(AnonDeclaration) isAnonDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Pragma applied to Dsymbols, e.g. `pragma(inline, true) void foo`,
* but not PragmaStatement's like `pragma(msg, "hello");`.
*
* pragma(<ident>, <args>)
*/
extern (C++) final class PragmaDeclaration : AttribDeclaration
{
Expressions* args; /// parameters of this pragma
extern (D) this(const ref Loc loc, Identifier ident, Expressions* args, Dsymbols* decl)
{
super(loc, ident, decl);
this.args = args;
}
override PragmaDeclaration syntaxCopy(Dsymbol s)
{
//printf("PragmaDeclaration::syntaxCopy(%s)\n", toChars());
assert(!s);
return new PragmaDeclaration(loc, ident, Expression.arraySyntaxCopy(args), Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
if (ident == Id.Pinline)
{
// We keep track of this pragma inside scopes,
// then it's evaluated on demand in function semantic
return createNewScope(sc, sc.stc, sc.linkage, sc.cppmangle, sc.visibility, sc.explicitVisibility, sc.aligndecl, this);
}
if (ident == Id.printf || ident == Id.scanf)
{
auto sc2 = sc.push();
if (ident == Id.printf)
// Override previous setting, never let both be set
sc2.flags = (sc2.flags & ~SCOPE.scanf) | SCOPE.printf;
else
sc2.flags = (sc2.flags & ~SCOPE.printf) | SCOPE.scanf;
return sc2;
}
return sc;
}
PINLINE evalPragmaInline(Scope* sc)
{
if (!args || args.dim == 0)
return PINLINE.default_;
Expression e = (*args)[0];
if (!e.type)
{
sc = sc.startCTFE();
e = e.expressionSemantic(sc);
e = resolveProperties(sc, e);
sc = sc.endCTFE();
e = e.ctfeInterpret();
e = e.toBoolean(sc);
if (e.isErrorExp())
error("pragma(`inline`, `true` or `false`) expected, not `%s`", (*args)[0].toChars());
(*args)[0] = e;
}
if (e.isBool(true))
return PINLINE.always;
else if (e.isBool(false))
return PINLINE.never;
else
return PINLINE.default_;
}
override const(char)* kind() const
{
return "pragma";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* A conditional compilation declaration, used for `version`
* / `debug` and specialized for `static if`.
*
* <condition> { <decl...> } else { <elsedecl> }
*/
extern (C++) class ConditionalDeclaration : AttribDeclaration
{
Condition condition; /// condition deciding whether decl or elsedecl applies
Dsymbols* elsedecl; /// array of Dsymbol's for else block
extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
{
super(loc, null, decl);
//printf("ConditionalDeclaration::ConditionalDeclaration()\n");
this.condition = condition;
this.elsedecl = elsedecl;
}
override ConditionalDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
}
override final bool oneMember(Dsymbol* ps, Identifier ident)
{
//printf("ConditionalDeclaration::oneMember(), inc = %d\n", condition.inc);
if (condition.inc != Include.notComputed)
{
Dsymbols* d = condition.include(null) ? decl : elsedecl;
return Dsymbol.oneMembers(d, ps, ident);
}
else
{
bool res = (Dsymbol.oneMembers(decl, ps, ident) && *ps is null && Dsymbol.oneMembers(elsedecl, ps, ident) && *ps is null);
*ps = null;
return res;
}
}
// Decide if 'then' or 'else' code should be included
override Dsymbols* include(Scope* sc)
{
//printf("ConditionalDeclaration::include(sc = %p) scope = %p\n", sc, scope);
if (errors)
return null;
assert(condition);
return condition.include(_scope ? _scope : sc) ? decl : elsedecl;
}
override final void addComment(const(char)* comment)
{
/* Because addComment is called by the parser, if we called
* include() it would define a version before it was used.
* But it's no problem to drill down to both decl and elsedecl,
* so that's the workaround.
*/
if (comment)
{
decl .foreachDsymbol( s => s.addComment(comment) );
elsedecl.foreachDsymbol( s => s.addComment(comment) );
}
}
override void setScope(Scope* sc)
{
include(sc).foreachDsymbol( s => s.setScope(sc) );
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* `<scopesym> {
* static if (<condition>) { <decl> } else { <elsedecl> }
* }`
*/
extern (C++) final class StaticIfDeclaration : ConditionalDeclaration
{
ScopeDsymbol scopesym; /// enclosing symbol (e.g. module) where symbols will be inserted
private bool addisdone = false; /// true if members have been added to scope
private bool onStack = false; /// true if a call to `include` is currently active
extern (D) this(const ref Loc loc, Condition condition, Dsymbols* decl, Dsymbols* elsedecl)
{
super(loc, condition, decl, elsedecl);
//printf("StaticIfDeclaration::StaticIfDeclaration()\n");
}
override StaticIfDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new StaticIfDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
}
/****************************************
* Different from other AttribDeclaration subclasses, include() call requires
* the completion of addMember and setScope phases.
*/
override Dsymbols* include(Scope* sc)
{
//printf("StaticIfDeclaration::include(sc = %p) scope = %p\n", sc, scope);
if (errors || onStack)
return null;
onStack = true;
scope(exit) onStack = false;
if (sc && condition.inc == Include.notComputed)
{
assert(scopesym); // addMember is already done
assert(_scope); // setScope is already done
Dsymbols* d = ConditionalDeclaration.include(_scope);
if (d && !addisdone)
{
// Add members lazily.
d.foreachDsymbol( s => s.addMember(_scope, scopesym) );
// Set the member scopes lazily.
d.foreachDsymbol( s => s.setScope(_scope) );
addisdone = true;
}
return d;
}
else
{
return ConditionalDeclaration.include(sc);
}
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
//printf("StaticIfDeclaration::addMember() '%s'\n", toChars());
/* This is deferred until the condition evaluated later (by the include() call),
* so that expressions in the condition can refer to declarations
* in the same scope, such as:
*
* template Foo(int i)
* {
* const int j = i + 1;
* static if (j == 3)
* const int k;
* }
*/
this.scopesym = sds;
}
override void setScope(Scope* sc)
{
// do not evaluate condition before semantic pass
// But do set the scope, in case we need it for forward referencing
Dsymbol.setScope(sc);
}
override void importAll(Scope* sc)
{
// do not evaluate condition before semantic pass
}
override const(char)* kind() const
{
return "static if";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Static foreach at declaration scope, like:
* static foreach (i; [0, 1, 2]){ }
*/
extern (C++) final class StaticForeachDeclaration : AttribDeclaration
{
StaticForeach sfe; /// contains `static foreach` expansion logic
ScopeDsymbol scopesym; /// cached enclosing scope (mimics `static if` declaration)
/++
`include` can be called multiple times, but a `static foreach`
should be expanded at most once. Achieved by caching the result
of the first call. We need both `cached` and `cache`, because
`null` is a valid value for `cache`.
+/
bool onStack = false;
bool cached = false;
Dsymbols* cache = null;
extern (D) this(StaticForeach sfe, Dsymbols* decl)
{
super(sfe.loc, null, decl);
this.sfe = sfe;
}
override StaticForeachDeclaration syntaxCopy(Dsymbol s)
{
assert(!s);
return new StaticForeachDeclaration(
sfe.syntaxCopy(),
Dsymbol.arraySyntaxCopy(decl));
}
override bool oneMember(Dsymbol* ps, Identifier ident)
{
// Required to support IFTI on a template that contains a
// `static foreach` declaration. `super.oneMember` calls
// include with a `null` scope. As `static foreach` requires
// the scope for expansion, `oneMember` can only return a
// precise result once `static foreach` has been expanded.
if (cached)
{
return super.oneMember(ps, ident);
}
*ps = null; // a `static foreach` declaration may in general expand to multiple symbols
return false;
}
override Dsymbols* include(Scope* sc)
{
if (errors || onStack)
return null;
if (cached)
{
assert(!onStack);
return cache;
}
onStack = true;
scope(exit) onStack = false;
if (_scope)
{
sfe.prepare(_scope); // lower static foreach aggregate
}
if (!sfe.ready())
{
return null; // TODO: ok?
}
// expand static foreach
import dmd.statementsem: makeTupleForeach;
Dsymbols* d = makeTupleForeach!(true,true)(_scope, sfe.aggrfe, decl, sfe.needExpansion);
if (d) // process generated declarations
{
// Add members lazily.
d.foreachDsymbol( s => s.addMember(_scope, scopesym) );
// Set the member scopes lazily.
d.foreachDsymbol( s => s.setScope(_scope) );
}
cached = true;
cache = d;
return d;
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
// used only for caching the enclosing symbol
this.scopesym = sds;
}
override void addComment(const(char)* comment)
{
// do nothing
// change this to give semantics to documentation comments on static foreach declarations
}
override void setScope(Scope* sc)
{
// do not evaluate condition before semantic pass
// But do set the scope, in case we need it for forward referencing
Dsymbol.setScope(sc);
}
override void importAll(Scope* sc)
{
// do not evaluate aggregate before semantic pass
}
override const(char)* kind() const
{
return "static foreach";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Collection of declarations that stores foreach index variables in a
* local symbol table. Other symbols declared within are forwarded to
* another scope, like:
*
* static foreach (i; 0 .. 10) // loop variables for different indices do not conflict.
* { // this body is expanded into 10 ForwardingAttribDeclarations, where `i` has storage class STC.local
* mixin("enum x" ~ to!string(i) ~ " = i"); // ok, can access current loop variable
* }
*
* static foreach (i; 0.. 10)
* {
* pragma(msg, mixin("x" ~ to!string(i))); // ok, all 10 symbols are visible as they were forwarded to the global scope
* }
*
* static assert (!is(typeof(i))); // loop index variable is not visible outside of the static foreach loop
*
* A StaticForeachDeclaration generates one
* ForwardingAttribDeclaration for each expansion of its body. The
* AST of the ForwardingAttribDeclaration contains both the `static
* foreach` variables and the respective copy of the `static foreach`
* body. The functionality is achieved by using a
* ForwardingScopeDsymbol as the parent symbol for the generated
* declarations.
*/
extern(C++) final class ForwardingAttribDeclaration: AttribDeclaration
{
ForwardingScopeDsymbol sym = null;
this(Dsymbols* decl)
{
super(decl);
sym = new ForwardingScopeDsymbol(null);
sym.symtab = new DsymbolTable();
}
/**************************************
* Use the ForwardingScopeDsymbol as the parent symbol for members.
*/
override Scope* newScope(Scope* sc)
{
return sc.push(sym);
}
/***************************************
* Lazily initializes the scope to forward to.
*/
override void addMember(Scope* sc, ScopeDsymbol sds)
{
parent = sym.parent = sym.forward = sds;
return super.addMember(sc, sym);
}
override inout(ForwardingAttribDeclaration) isForwardingAttribDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Mixin declarations, like:
* mixin("int x");
* https://dlang.org/spec/module.html#mixin-declaration
*/
extern (C++) final class CompileDeclaration : AttribDeclaration
{
Expressions* exps;
ScopeDsymbol scopesym;
bool compiled;
extern (D) this(const ref Loc loc, Expressions* exps)
{
super(loc, null, null);
//printf("CompileDeclaration(loc = %d)\n", loc.linnum);
this.exps = exps;
}
override CompileDeclaration syntaxCopy(Dsymbol s)
{
//printf("CompileDeclaration::syntaxCopy('%s')\n", toChars());
return new CompileDeclaration(loc, Expression.arraySyntaxCopy(exps));
}
override void addMember(Scope* sc, ScopeDsymbol sds)
{
//printf("CompileDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum);
this.scopesym = sds;
}
override void setScope(Scope* sc)
{
Dsymbol.setScope(sc);
}
override const(char)* kind() const
{
return "mixin";
}
override inout(CompileDeclaration) isCompileDeclaration() inout
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* User defined attributes look like:
* @foo(args, ...)
* @(args, ...)
*/
extern (C++) final class UserAttributeDeclaration : AttribDeclaration
{
Expressions* atts;
extern (D) this(Expressions* atts, Dsymbols* decl)
{
super(decl);
this.atts = atts;
}
override UserAttributeDeclaration syntaxCopy(Dsymbol s)
{
//printf("UserAttributeDeclaration::syntaxCopy('%s')\n", toChars());
assert(!s);
return new UserAttributeDeclaration(Expression.arraySyntaxCopy(this.atts), Dsymbol.arraySyntaxCopy(decl));
}
override Scope* newScope(Scope* sc)
{
Scope* sc2 = sc;
if (atts && atts.dim)
{
// create new one for changes
sc2 = sc.copy();
sc2.userAttribDecl = this;
}
return sc2;
}
override void setScope(Scope* sc)
{
//printf("UserAttributeDeclaration::setScope() %p\n", this);
if (decl)
Dsymbol.setScope(sc); // for forward reference of UDAs
return AttribDeclaration.setScope(sc);
}
extern (D) static Expressions* concat(Expressions* udas1, Expressions* udas2)
{
Expressions* udas;
if (!udas1 || udas1.dim == 0)
udas = udas2;
else if (!udas2 || udas2.dim == 0)
udas = udas1;
else
{
/* Create a new tuple that combines them
* (do not append to left operand, as this is a copy-on-write operation)
*/
udas = new Expressions(2);
(*udas)[0] = new TupleExp(Loc.initial, udas1);
(*udas)[1] = new TupleExp(Loc.initial, udas2);
}
return udas;
}
Expressions* getAttributes()
{
if (auto sc = _scope)
{
_scope = null;
arrayExpressionSemantic(atts, sc);
}
auto exps = new Expressions();
if (userAttribDecl && userAttribDecl !is this)
exps.push(new TupleExp(Loc.initial, userAttribDecl.getAttributes()));
if (atts && atts.dim)
exps.push(new TupleExp(Loc.initial, atts));
return exps;
}
override const(char)* kind() const
{
return "UserAttribute";
}
override void accept(Visitor v)
{
v.visit(this);
}
/**
* Check if the provided expression references `core.attribute.gnuAbiTag`
*
* This should be called after semantic has been run on the expression.
* Semantic on UDA happens in semantic2 (see `dmd.semantic2`).
*
* Params:
* e = Expression to check (usually from `UserAttributeDeclaration.atts`)
*
* Returns:
* `true` if the expression references the compiler-recognized `gnuAbiTag`
*/
static bool isGNUABITag(Expression e)
{
if (global.params.cplusplus < CppStdRevision.cpp11)
return false;
auto ts = e.type ? e.type.isTypeStruct() : null;
if (!ts)
return false;
if (ts.sym.ident != Id.udaGNUAbiTag || !ts.sym.parent)
return false;
// Can only be defined in druntime
Module m = ts.sym.parent.isModule();
if (!m || !m.isCoreModule(Id.attribute))
return false;
return true;
}
/**
* Called from a symbol's semantic to check if `gnuAbiTag` UDA
* can be applied to them
*
* Directly emits an error if the UDA doesn't work with this symbol
*
* Params:
* sym = symbol to check for `gnuAbiTag`
* linkage = Linkage of the symbol (Declaration.link or sc.link)
*/
static void checkGNUABITag(Dsymbol sym, LINK linkage)
{
if (global.params.cplusplus < CppStdRevision.cpp11)
return;
// Avoid `if` at the call site
if (sym.userAttribDecl is null || sym.userAttribDecl.atts is null)
return;
foreach (exp; *sym.userAttribDecl.atts)
{
if (isGNUABITag(exp))
{
if (sym.isCPPNamespaceDeclaration() || sym.isNspace())
{
exp.error("`@%s` cannot be applied to namespaces", Id.udaGNUAbiTag.toChars());
sym.errors = true;
}
else if (linkage != LINK.cpp)
{
exp.error("`@%s` can only apply to C++ symbols", Id.udaGNUAbiTag.toChars());
sym.errors = true;
}
// Only one `@gnuAbiTag` is allowed by semantic2
return;
}
}
}
}
|
D
|
# Disease-Identification
#Unzip the file
#install prolog
#compile the code
#consult the code
#write yes if true
#write no if false
|
D
|
module UnrealScript.Engine.LandscapeHeightfieldCollisionComponent;
import ScriptClasses;
import UnrealScript.Helpers;
import UnrealScript.Core.UObject;
import UnrealScript.Engine.PrimitiveComponent;
import UnrealScript.Engine.PhysicalMaterial;
extern(C++) interface LandscapeHeightfieldCollisionComponent : PrimitiveComponent
{
public extern(D):
private static __gshared ScriptClass mStaticClass;
@property final static ScriptClass StaticClass() { mixin(MGSCC("Class Engine.LandscapeHeightfieldCollisionComponent")); }
private static __gshared LandscapeHeightfieldCollisionComponent mDefaultProperties;
@property final static LandscapeHeightfieldCollisionComponent DefaultProperties() { mixin(MGDPC("LandscapeHeightfieldCollisionComponent", "LandscapeHeightfieldCollisionComponent Engine.Default__LandscapeHeightfieldCollisionComponent")); }
@property final auto ref
{
ScriptArray!(ubyte) CollisionQuadFlags() { mixin(MGPC("ScriptArray!(ubyte)", 556)); }
ScriptArray!(PhysicalMaterial) PhysicalMaterials() { mixin(MGPC("ScriptArray!(PhysicalMaterial)", 568)); }
UObject.BoxSphereBounds CachedBoxSphereBounds() { mixin(MGPC("UObject.BoxSphereBounds", 584)); }
Pointer RBHeightfield() { mixin(MGPC("Pointer", 580)); }
float CollisionScale() { mixin(MGPC("float", 552)); }
int CollisionSizeQuads() { mixin(MGPC("int", 548)); }
int SectionBaseY() { mixin(MGPC("int", 544)); }
int SectionBaseX() { mixin(MGPC("int", 540)); }
UObject.UntypedBulkData_Mirror CollisionHeightData() { mixin(MGPC("UObject.UntypedBulkData_Mirror", 488)); }
}
}
|
D
|
someone who walks at a leisurely pace
|
D
|
module asn1.parser;
public import asn1.parser.defs;
public import asn1.parser.handler;
|
D
|
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2017 by Digital Mars, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DMDSRC _sideeffect.d)
*/
module ddmd.sideeffect;
import ddmd.apply;
import ddmd.declaration;
import ddmd.dscope;
import ddmd.expression;
import ddmd.expressionsem;
import ddmd.func;
import ddmd.globals;
import ddmd.identifier;
import ddmd.init;
import ddmd.mtype;
import ddmd.tokens;
import ddmd.visitor;
/**************************************************
* Front-end expression rewriting should create temporary variables for
* non trivial sub-expressions in order to:
* 1. save evaluation order
* 2. prevent sharing of sub-expression in AST
*/
extern (C++) bool isTrivialExp(Expression e)
{
extern (C++) final class IsTrivialExp : StoppableVisitor
{
alias visit = super.visit;
public:
extern (D) this()
{
}
override void visit(Expression e)
{
/* https://issues.dlang.org/show_bug.cgi?id=11201
* CallExp is always non trivial expression,
* especially for inlining.
*/
if (e.op == TOKcall)
{
stop = true;
return;
}
// stop walking if we determine this expression has side effects
stop = lambdaHasSideEffect(e);
}
}
scope IsTrivialExp v = new IsTrivialExp();
return walkPostorder(e, v) == false;
}
/********************************************
* Determine if Expression has any side effects.
*/
extern (C++) bool hasSideEffect(Expression e)
{
extern (C++) final class LambdaHasSideEffect : StoppableVisitor
{
alias visit = super.visit;
public:
extern (D) this()
{
}
override void visit(Expression e)
{
// stop walking if we determine this expression has side effects
stop = lambdaHasSideEffect(e);
}
}
scope LambdaHasSideEffect v = new LambdaHasSideEffect();
return walkPostorder(e, v);
}
/********************************************
* Determine if the call of f, or function type or delegate type t1, has any side effects.
* Returns:
* 0 has any side effects
* 1 nothrow + constant purity
* 2 nothrow + strong purity
*/
extern (C++) int callSideEffectLevel(FuncDeclaration f)
{
/* https://issues.dlang.org/show_bug.cgi?id=12760
* ctor call always has side effects.
*/
if (f.isCtorDeclaration())
return 0;
assert(f.type.ty == Tfunction);
TypeFunction tf = cast(TypeFunction)f.type;
if (tf.isnothrow)
{
PURE purity = f.isPure();
if (purity == PUREstrong)
return 2;
if (purity == PUREconst)
return 1;
}
return 0;
}
extern (C++) int callSideEffectLevel(Type t)
{
t = t.toBasetype();
TypeFunction tf;
if (t.ty == Tdelegate)
tf = cast(TypeFunction)(cast(TypeDelegate)t).next;
else
{
assert(t.ty == Tfunction);
tf = cast(TypeFunction)t;
}
tf.purityLevel();
PURE purity = tf.purity;
if (t.ty == Tdelegate && purity > PUREweak)
{
if (tf.isMutable())
purity = PUREweak;
else if (!tf.isImmutable())
purity = PUREconst;
}
if (tf.isnothrow)
{
if (purity == PUREstrong)
return 2;
if (purity == PUREconst)
return 1;
}
return 0;
}
extern (C++) bool lambdaHasSideEffect(Expression e)
{
switch (e.op)
{
// Sort the cases by most frequently used first
case TOKassign:
case TOKplusplus:
case TOKminusminus:
case TOKdeclaration:
case TOKconstruct:
case TOKblit:
case TOKaddass:
case TOKminass:
case TOKcatass:
case TOKmulass:
case TOKdivass:
case TOKmodass:
case TOKshlass:
case TOKshrass:
case TOKushrass:
case TOKandass:
case TOKorass:
case TOKxorass:
case TOKpowass:
case TOKin:
case TOKremove:
case TOKassert:
case TOKhalt:
case TOKdelete:
case TOKnew:
case TOKnewanonclass:
return true;
case TOKcall:
{
CallExp ce = cast(CallExp)e;
/* Calling a function or delegate that is pure nothrow
* has no side effects.
*/
if (ce.e1.type)
{
Type t = ce.e1.type.toBasetype();
if (t.ty == Tdelegate)
t = (cast(TypeDelegate)t).next;
if (t.ty == Tfunction && (ce.f ? callSideEffectLevel(ce.f) : callSideEffectLevel(ce.e1.type)) > 0)
{
}
else
return true;
}
break;
}
case TOKcast:
{
CastExp ce = cast(CastExp)e;
/* if:
* cast(classtype)func() // because it may throw
*/
if (ce.to.ty == Tclass && ce.e1.op == TOKcall && ce.e1.type.ty == Tclass)
return true;
break;
}
default:
break;
}
return false;
}
/***********************************
* The result of this expression will be discarded.
* Print error messages if the operation has no side effects (and hence is meaningless).
* Returns:
* true if expression has no side effects
*/
extern (C++) bool discardValue(Expression e)
{
if (lambdaHasSideEffect(e)) // check side-effect shallowly
return false;
switch (e.op)
{
case TOKcast:
{
CastExp ce = cast(CastExp)e;
if (ce.to.equals(Type.tvoid))
{
/*
* Don't complain about an expression with no effect if it was cast to void
*/
return false;
}
break; // complain
}
case TOKerror:
return false;
case TOKvar:
{
VarDeclaration v = (cast(VarExp)e).var.isVarDeclaration();
if (v && (v.storage_class & STCtemp))
{
// https://issues.dlang.org/show_bug.cgi?id=5810
// Don't complain about an internal generated variable.
return false;
}
break;
}
case TOKcall:
/* Issue 3882: */
if (global.params.warnings && !global.gag)
{
CallExp ce = cast(CallExp)e;
if (e.type.ty == Tvoid)
{
/* Don't complain about calling void-returning functions with no side-effect,
* because purity and nothrow are inferred, and because some of the
* runtime library depends on it. Needs more investigation.
*
* One possible solution is to restrict this message to only be called in hierarchies that
* never call assert (and or not called from inside unittest blocks)
*/
}
else if (ce.e1.type)
{
Type t = ce.e1.type.toBasetype();
if (t.ty == Tdelegate)
t = (cast(TypeDelegate)t).next;
if (t.ty == Tfunction && (ce.f ? callSideEffectLevel(ce.f) : callSideEffectLevel(ce.e1.type)) > 0)
{
const(char)* s;
if (ce.f)
s = ce.f.toPrettyChars();
else if (ce.e1.op == TOKstar)
{
// print 'fp' if ce.e1 is (*fp)
s = (cast(PtrExp)ce.e1).e1.toChars();
}
else
s = ce.e1.toChars();
e.warning("calling %s without side effects discards return value of type %s, prepend a cast(void) if intentional", s, e.type.toChars());
}
}
}
return false;
case TOKscope:
e.error("`%s` has no effect", e.toChars());
return true;
case TOKandand:
{
AndAndExp aae = cast(AndAndExp)e;
return discardValue(aae.e2);
}
case TOKoror:
{
OrOrExp ooe = cast(OrOrExp)e;
return discardValue(ooe.e2);
}
case TOKquestion:
{
CondExp ce = cast(CondExp)e;
/* https://issues.dlang.org/show_bug.cgi?id=6178
* https://issues.dlang.org/show_bug.cgi?id=14089
* Either CondExp::e1 or e2 may have
* redundant expression to make those types common. For example:
*
* struct S { this(int n); int v; alias v this; }
* S[int] aa;
* aa[1] = 0;
*
* The last assignment statement will be rewitten to:
*
* 1 in aa ? aa[1].value = 0 : (aa[1] = 0, aa[1].this(0)).value;
*
* The last DotVarExp is necessary to take assigned value.
*
* int value = (aa[1] = 0); // value = aa[1].value
*
* To avoid false error, discardValue() should be called only when
* the both tops of e1 and e2 have actually no side effects.
*/
if (!lambdaHasSideEffect(ce.e1) && !lambdaHasSideEffect(ce.e2))
{
return discardValue(ce.e1) |
discardValue(ce.e2);
}
return false;
}
case TOKcomma:
{
CommaExp ce = cast(CommaExp)e;
/* Check for compiler-generated code of the form auto __tmp, e, __tmp;
* In such cases, only check e for side effect (it's OK for __tmp to have
* no side effect).
* See https://issues.dlang.org/show_bug.cgi?id=4231 for discussion
*/
CommaExp firstComma = ce;
while (firstComma.e1.op == TOKcomma)
firstComma = cast(CommaExp)firstComma.e1;
if (firstComma.e1.op == TOKdeclaration && ce.e2.op == TOKvar && (cast(DeclarationExp)firstComma.e1).declaration == (cast(VarExp)ce.e2).var)
{
return false;
}
// Don't check e1 until we cast(void) the a,b code generation
//discardValue(ce.e1);
return discardValue(ce.e2);
}
case TOKtuple:
/* Pass without complaint if any of the tuple elements have side effects.
* Ideally any tuple elements with no side effects should raise an error,
* this needs more investigation as to what is the right thing to do.
*/
if (!hasSideEffect(e))
break;
return false;
default:
break;
}
e.error("`%s` has no effect in expression `%s`", Token.toChars(e.op), e.toChars());
return true;
}
/**************************************************
* Build a temporary variable to copy the value of e into.
* Params:
* stc = storage classes will be added to the made temporary variable
* name = name for temporary variable
* e = original expression
* Returns:
* Newly created temporary variable.
*/
VarDeclaration copyToTemp(StorageClass stc, const char* name, Expression e)
{
assert(name && name[0] == '_' && name[1] == '_');
auto id = Identifier.generateId(name);
auto ez = new ExpInitializer(e.loc, e);
auto vd = new VarDeclaration(e.loc, e.type, id, ez);
vd.storage_class = stc;
vd.storage_class |= STCtemp;
vd.storage_class |= STCctfe; // temporary is always CTFEable
return vd;
}
/**************************************************
* Build a temporary variable to extract e's evaluation, if e is not trivial.
* Params:
* sc = scope
* name = name for temporary variable
* e0 = a new side effect part will be appended to it.
* e = original expression
* alwaysCopy = if true, build new temporary variable even if e is trivial.
* Returns:
* When e is trivial and alwaysCopy == false, e itself is returned.
* Otherwise, a new VarExp is returned.
* Note:
* e's lvalue-ness will be handled well by STCref or STCrvalue.
*/
Expression extractSideEffect(Scope* sc, const char* name,
ref Expression e0, Expression e, bool alwaysCopy = false)
{
if (!alwaysCopy && isTrivialExp(e))
return e;
auto vd = copyToTemp(0, name, e);
if (e.isLvalue())
vd.storage_class |= STCref;
else
vd.storage_class |= STCrvalue;
Expression de = new DeclarationExp(vd.loc, vd);
Expression ve = new VarExp(vd.loc, vd);
de = de.semantic(sc);
ve = ve.semantic(sc);
e0 = Expression.combine(e0, de);
return ve;
}
|
D
|
/*
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
module engine.thirdparty.derelict.opengl.extensions.arb_m;
import engine.thirdparty.derelict.opengl.types : usingContexts;
import engine.thirdparty.derelict.opengl.extensions.internal;
// ARB_map_buffer_alignment <-- Core in GL 4.2
enum ARB_map_buffer_alignment = "GL_ARB_map_buffer_alignment";
enum arbMapBufferAlignmentDecls = `enum uint GL_MIN_MAP_BUFFER_ALIGNMENT = 0x90BC;`;
enum arbMapBufferAlignmentLoader = makeLoader(ARB_map_buffer_alignment, "", "gl42");
static if(!usingContexts) enum arbMapBufferAlignment = arbMapBufferAlignmentDecls ~ arbMapBufferAlignmentLoader;
// ARB_map_buffer_range <-- Core in GL 3.0
enum ARB_map_buffer_range = "GL_ARB_map_buffer_range";
enum arbMapBufferRangeDecls =
q{
enum : uint
{
GL_MAP_READ_BIT = 0x0001,
GL_MAP_WRITE_BIT = 0x0002,
GL_MAP_INVALIDATE_RANGE_BIT = 0x0004,
GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008,
GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010,
GL_MAP_UNSYNCHRONIZED_BIT = 0x0020,
}
extern(System) @nogc nothrow {
alias da_glMapBufferRange = GLvoid* function(GLenum, GLintptr, GLsizeiptr, GLbitfield);
alias da_glFlushMappedBufferRange = void function(GLenum, GLintptr, GLsizeiptr);
}};
enum arbMapBufferRangeFuncs =
q{
da_glMapBufferRange glMapBufferRange;
da_glFlushMappedBufferRange glFlushMappedBufferRange;
};
enum arbMapBufferRangeLoaderImpl =
q{
bindGLFunc(cast(void**)&glMapBufferRange, "glMapBufferRange");
bindGLFunc(cast(void**)&glFlushMappedBufferRange, "glFlushMappedBufferRange");
};
enum arbMapBufferRangeLoader = makeLoader(ARB_map_buffer_range, arbMapBufferRangeLoaderImpl, "gl30");
static if(!usingContexts) enum arbMapBufferRange = arbMapBufferRangeDecls ~ arbMapBufferRangeFuncs.makeGShared() ~ arbMapBufferRangeLoader;
// ARB_multi_bind <-- Core in GL 4.4
enum ARB_multi_bind = "GL_ARB_multi_bind";
enum arbMultBindDecls =
q{
extern(System) @nogc nothrow {
alias da_glBindBuffersBase = void function(GLenum,GLuint,GLsizei,const(GLuint)*);
alias da_glBindBuffersRange = void function(GLenum,GLuint,GLsizei,const(GLuint)*,const(GLintptr)*,const(GLsizeiptr)*);
alias da_glBindTextures = void function(GLuint,GLsizei,const(GLuint)*);
alias da_glBindSamplers = void function(GLuint,GLsizei,const(GLuint)*);
alias da_glBindImageTextures = void function(GLuint,GLsizei,const(GLuint)*);
alias da_glBindVertexBuffers = void function(GLuint,GLsizei,const(GLuint)*,const(GLintptr)*,const(GLsizei)*);
}};
enum arbMultBindFuncs =
q{
da_glBindBuffersBase glBindBuffersBase;
da_glBindBuffersRange glBindBuffersRange;
da_glBindTextures glBindTextures;
da_glBindSamplers glBindSamplers;
da_glBindImageTextures glBindImageTextures;
da_glBindVertexBuffers glBindVertexBuffers;
};
enum arbMultBindLoaderImpl =
q{
bindGLFunc(cast(void**)&glBindBuffersBase, "glBindBuffersBase");
bindGLFunc(cast(void**)&glBindBuffersRange, "glBindBuffersRange");
bindGLFunc(cast(void**)&glBindTextures, "glBindTextures");
bindGLFunc(cast(void**)&glBindSamplers, "glBindSamplers");
bindGLFunc(cast(void**)&glBindImageTextures, "glBindImageTextures");
bindGLFunc(cast(void**)&glBindVertexBuffers, "glBindVertexBuffers");
};
enum arbMultBindLoader = makeLoader(ARB_multi_bind, arbMultBindLoaderImpl, "gl44");
static if(!usingContexts) enum arbMultBind = arbMultBindDecls ~ arbMultBindFuncs.makeGShared() ~ arbMultBindLoader;
// ARB_multi_draw_indirect <-- Core in GL 4.3
enum ARB_multi_draw_indirect = "GL_ARB_multi_draw_indirect";
enum arbMultiDrawIndirectDecls =
q{
extern(System) @nogc nothrow {
alias da_glMultiDrawArraysIndirect = void function(GLenum,const(void)*,GLsizei,GLsizei);
alias da_glMultiDrawElementsIndirect = void function(GLenum,GLenum,const(void)*,GLsizei,GLsizei);
}};
enum arbMultiDrawIndirectFuncs =
q{
da_glMultiDrawArraysIndirect glMultiDrawArraysIndirect;
da_glMultiDrawElementsIndirect glMultiDrawElementsIndirect;
};
enum arbMultiDrawIndirectLoaderImpl =
q{
bindGLFunc(cast(void**)&glMultiDrawArraysIndirect, "glMultiDrawArraysIndirect");
bindGLFunc(cast(void**)&glMultiDrawElementsIndirect, "glMultiDrawElementsIndirect");
};
enum arbMultiDrawIndirectLoader = makeLoader(ARB_multi_draw_indirect, arbMultiDrawIndirectLoaderImpl, "gl43");
static if(!usingContexts) enum arbMultiDrawIndirect = arbMultiDrawIndirectDecls ~ arbMultiDrawIndirectFuncs.makeGShared() ~ arbMultiDrawIndirectLoader;
|
D
|
/home/naufil/Desktop/rust/3june/todocopy/target/rls/debug/deps/write_task-425b80134787bc86.rmeta: src/bin/write_task.rs
/home/naufil/Desktop/rust/3june/todocopy/target/rls/debug/deps/write_task-425b80134787bc86.d: src/bin/write_task.rs
src/bin/write_task.rs:
|
D
|
/*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Port to the D programming language:
* Frank Benoit <benoit@tionex.de>
*******************************************************************************/
module org.eclipse.swt.program.Program;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.internal.Compatibility;
import org.eclipse.swt.internal.Converter;
import org.eclipse.swt.internal.Library;
import org.eclipse.swt.internal.gtk.OS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import java.lang.all;
import java.nonstandard.SharedLib;
version(Tango){
static import tango.core.Array;
static import tango.io.device.File;
static import tango.io.stream.Lines;
} else { // Phobos
static import std.string;
static import std.file;
static import std.algorithm;
}
private extern(C) {
alias int GnomeIconLookupResultFlags;
alias int GnomeIconLookupFlags;
GnomeIconTheme *gnome_icon_theme_new ();
char *gnome_icon_lookup (
GtkIconTheme *icon_theme,
void *thumbnail_factory,
char *file_uri,
char *custom_icon,
void *file_info,
char *mime_type,
GnomeIconLookupFlags flags,
GnomeIconLookupResultFlags *result);
int gnome_vfs_init();
char* gnome_icon_theme_lookup_icon(GnomeIconTheme *theme,char *icon_name,int size, GnomeIconData **icon_data, int *base_size) ;
alias void GnomeIconTheme;
alias void GnomeIconData;
struct GnomeVFSMimeApplication{
/*< public > */
char *id;
char *name;
/*< private > */
char *command;
int can_open_multiple_files;
int expects_uris;
GList *supported_uri_schemes;
int requires_terminal;
/* Padded to avoid future breaks in ABI compatibility */
void * reserved1;
void * priv;
}
}
struct GNOME {
private static extern(C){
enum {
GNOME_ICON_LOOKUP_FLAGS_NONE = 0,
GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0,
GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES = 1<<1,
GNOME_ICON_LOOKUP_FLAGS_ALLOW_SVG_AS_THEMSELVES = 1<<2
}
enum {
GNOME_VFS_MAKE_URI_DIR_NONE = 0,
GNOME_VFS_MAKE_URI_DIR_HOMEDIR = 1 << 0,
GNOME_VFS_MAKE_URI_DIR_CURRENT = 1 << 1
}
alias int GnomeVFSMakeURIDirs;
enum {
GNOME_VFS_OK,
GNOME_VFS_ERROR_NOT_FOUND,
GNOME_VFS_ERROR_GENERIC,
GNOME_VFS_ERROR_INTERNAL,
GNOME_VFS_ERROR_BAD_PARAMETERS,
GNOME_VFS_ERROR_NOT_SUPPORTED,
GNOME_VFS_ERROR_IO,
GNOME_VFS_ERROR_CORRUPTED_DATA,
GNOME_VFS_ERROR_WRONG_FORMAT,
GNOME_VFS_ERROR_BAD_FILE,
GNOME_VFS_ERROR_TOO_BIG,
GNOME_VFS_ERROR_NO_SPACE,
GNOME_VFS_ERROR_READ_ONLY,
GNOME_VFS_ERROR_INVALID_URI,
GNOME_VFS_ERROR_NOT_OPEN,
GNOME_VFS_ERROR_INVALID_OPEN_MODE,
GNOME_VFS_ERROR_ACCESS_DENIED,
GNOME_VFS_ERROR_TOO_MANY_OPEN_FILES,
GNOME_VFS_ERROR_EOF,
GNOME_VFS_ERROR_NOT_A_DIRECTORY,
GNOME_VFS_ERROR_IN_PROGRESS,
GNOME_VFS_ERROR_INTERRUPTED,
GNOME_VFS_ERROR_FILE_EXISTS,
GNOME_VFS_ERROR_LOOP,
GNOME_VFS_ERROR_NOT_PERMITTED,
GNOME_VFS_ERROR_IS_DIRECTORY,
GNOME_VFS_ERROR_NO_MEMORY,
GNOME_VFS_ERROR_HOST_NOT_FOUND,
GNOME_VFS_ERROR_INVALID_HOST_NAME,
GNOME_VFS_ERROR_HOST_HAS_NO_ADDRESS,
GNOME_VFS_ERROR_LOGIN_FAILED,
GNOME_VFS_ERROR_CANCELLED,
GNOME_VFS_ERROR_DIRECTORY_BUSY,
GNOME_VFS_ERROR_DIRECTORY_NOT_EMPTY,
GNOME_VFS_ERROR_TOO_MANY_LINKS,
GNOME_VFS_ERROR_READ_ONLY_FILE_SYSTEM,
GNOME_VFS_ERROR_NOT_SAME_FILE_SYSTEM,
GNOME_VFS_ERROR_NAME_TOO_LONG,
GNOME_VFS_ERROR_SERVICE_NOT_AVAILABLE,
GNOME_VFS_ERROR_SERVICE_OBSOLETE,
GNOME_VFS_ERROR_PROTOCOL_ERROR,
GNOME_VFS_ERROR_NO_MASTER_BROWSER,
GNOME_VFS_ERROR_NO_DEFAULT,
GNOME_VFS_ERROR_NO_HANDLER,
GNOME_VFS_ERROR_PARSE,
GNOME_VFS_ERROR_LAUNCH,
GNOME_VFS_ERROR_TIMEOUT,
GNOME_VFS_ERROR_NAMESERVER,
GNOME_VFS_ERROR_LOCKED,
GNOME_VFS_ERROR_DEPRECATED_FUNCTION,
GNOME_VFS_ERROR_INVALID_FILENAME,
GNOME_VFS_ERROR_NOT_A_SYMBOLIC_LINK,
GNOME_VFS_NUM_ERRORS
}
alias int GnomeVFSResult;
enum {
GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS,
GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS,
GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES
}
alias GtkIconTheme GnomeIconTheme;
alias .gnome_icon_theme_lookup_icon gnome_icon_theme_lookup_icon;
alias .gnome_vfs_init gnome_vfs_init;
alias .gnome_icon_lookup gnome_icon_lookup;
alias .gnome_icon_theme_new gnome_icon_theme_new;
GnomeVFSMimeApplication * function ( char *mime_type ) gnome_vfs_mime_get_default_application;
char* function(char*, int ) gnome_vfs_make_uri_from_input_with_dirs;
GnomeVFSResult function( GnomeVFSMimeApplication*, GList*) gnome_vfs_mime_application_launch;
void function(GnomeVFSMimeApplication*) gnome_vfs_mime_application_free;
GList* function(char*) gnome_vfs_mime_get_extensions_list;
void function(GList*) gnome_vfs_mime_extensions_list_free;
void function(GList*) gnome_vfs_mime_registered_mime_type_list_free;
GnomeVFSResult function(char*) gnome_vfs_url_show;
char* function(char*) gnome_vfs_make_uri_from_input;
GList* function() gnome_vfs_get_registered_mime_types;
char* function(char*) gnome_vfs_mime_type_from_name;
}
static Symbol[] symbols;
static this () {
symbols = [
Symbol("gnome_vfs_mime_get_default_application", cast(void**)&gnome_vfs_mime_get_default_application ),
Symbol("gnome_vfs_make_uri_from_input_with_dirs", cast(void**)&gnome_vfs_make_uri_from_input_with_dirs ),
Symbol("gnome_vfs_mime_application_launch", cast(void**)&gnome_vfs_mime_application_launch ),
Symbol("gnome_vfs_mime_application_free", cast(void**)&gnome_vfs_mime_application_free ),
Symbol("gnome_vfs_url_show", cast(void**)&gnome_vfs_url_show ),
Symbol("gnome_vfs_make_uri_from_input", cast(void**)&gnome_vfs_make_uri_from_input ),
Symbol("gnome_vfs_get_registered_mime_types", cast(void**)&gnome_vfs_get_registered_mime_types ),
Symbol("gnome_vfs_mime_get_extensions_list", cast(void**)&gnome_vfs_mime_get_extensions_list ),
Symbol("gnome_vfs_mime_extensions_list_free", cast(void**)&gnome_vfs_mime_extensions_list_free ),
Symbol("gnome_vfs_mime_registered_mime_type_list_free", cast(void**)&gnome_vfs_mime_registered_mime_type_list_free ),
Symbol("gnome_vfs_mime_type_from_name", cast(void**)&gnome_vfs_mime_type_from_name )
];
}
}
/**
* Instances of this class represent programs and
* their associated file extensions in the operating
* system.
*
* @see <a href="http://www.eclipse.org/swt/snippets/#program">Program snippets</a>
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
*/
public final class Program {
String name;
String command;
String iconPath;
Display display;
/* Gnome specific
* true if command expects a URI
* false if expects a path
*/
bool gnomeExpectUri;
static ptrdiff_t cdeShell;
static const String[] CDE_ICON_EXT = [ ".m.pm"[], ".l.pm", ".s.pm", ".t.pm" ];
static const String[] CDE_MASK_EXT = [ ".m_m.bm"[], ".l_m.bm", ".s_m.bm", ".t_m.bm" ];
static const String DESKTOP_DATA = "Program_DESKTOP";
static const String ICON_THEME_DATA = "Program_GNOME_ICON_THEME";
static const String PREFIX_HTTP = "http://"; //$NON-NLS-1$
static const String PREFIX_HTTPS = "https://"; //$NON-NLS-1$
static const int DESKTOP_UNKNOWN = 0;
static const int DESKTOP_GNOME = 1;
static const int DESKTOP_GNOME_24 = 2;
static const int DESKTOP_CDE = 3;
static const int PREFERRED_ICON_SIZE = 16;
/**
* Prevents uninitialized instances from being created outside the package.
*/
this() {
}
/* Determine the desktop for the given display. */
static int getDesktop(Display display) {
if (display is null) return DESKTOP_UNKNOWN;
Integer desktopValue = cast(Integer)display.getData(DESKTOP_DATA);
if (desktopValue !is null) return desktopValue.intValue;
int desktop = DESKTOP_UNKNOWN;
/* Get the list of properties on the root window. */
void* xDisplay = OS.GDK_DISPLAY();
size_t rootWindow = OS.XDefaultRootWindow(xDisplay);
int numProp;
size_t* propList = OS.XListProperties(xDisplay, rootWindow, &numProp);
size_t[] property = new size_t[numProp];
if (propList !is null) {
property[ 0 .. numProp ] = propList[ 0 .. numProp ];
OS.XFree(propList);
}
/*
* Feature in Linux Desktop. There is currently no official way to
* determine whether the Gnome window manager or gnome-vfs is
* available. Earlier versions including Red Hat 9 and Suse 9 provide
* a documented Gnome specific property on the root window
* WIN_SUPPORTING_WM_CHECK. This property is no longer supported in newer
* versions such as Fedora Core 2.
* The workaround is to simply check that the window manager is a
* compliant one (property _NET_SUPPORTING_WM_CHECK) and to attempt to load
* our native library that depends on gnome-vfs.
*/
if (desktop is DESKTOP_UNKNOWN) {
String gnomeName = "_NET_SUPPORTING_WM_CHECK";
ptrdiff_t gnome = OS.XInternAtom(xDisplay, gnomeName.ptr, true);
if (gnome !is OS.None && (OS.GTK_VERSION >= OS.buildVERSION (2, 2, 0)) && gnome_init()) {
desktop = DESKTOP_GNOME;
int icon_theme = cast(int)GNOME.gnome_icon_theme_new();
display.setData(ICON_THEME_DATA, new Integer(icon_theme));
display.addListener(SWT.Dispose, new class(display) Listener {
Display display;
this( Display display ){ this.display = display; }
public void handleEvent(Event event) {
Integer gnomeIconTheme = cast(Integer)display.getData(ICON_THEME_DATA);
if (gnomeIconTheme is null) return;
display.setData(ICON_THEME_DATA, null);
/*
* Note. gnome_icon_theme_new uses g_object_new to allocate the
* data it returns. Use g_object_unref to free the pointer it returns.
*/
if (gnomeIconTheme.intValue !is 0) OS.g_object_unref( cast(void*)gnomeIconTheme.intValue);
}
});
/* Check for libgnomevfs-2 version 2.4 */
String buffer = "libgnomevfs-2.so.0";
void delegate (void*) dg = (void*){ desktop = DESKTOP_GNOME_24; };
SharedLib.tryUseSymbol( "gnome_vfs_url_show", buffer, dg);
if( desktop is DESKTOP_GNOME_24 ){
SharedLib.loadLibSymbols( GNOME.symbols, buffer );
}
}
}
// PORTING CDE not supported
/+
/*
* On CDE, the atom below may exist without DTWM running. If the atom
* below is defined, the CDE database exists and the available
* applications can be queried.
*/
if (desktop is DESKTOP_UNKNOWN) {
String cdeName = "_DT_SM_PREFERENCES";
ptrdiff_t cde = OS.XInternAtom(xDisplay, cdeName.ptr, true);
for (int index = 0; desktop is DESKTOP_UNKNOWN && index < property.length; index++) {
if (property[index] is OS.None) continue; /* do not match atoms that do not exist */
if (property[index] is cde && cde_init(display)) desktop = DESKTOP_CDE;
}
}
+/
display.setData(DESKTOP_DATA, new Integer(desktop));
return desktop;
}
// PORTING CDE not supported
/+
bool cde_execute(String fileName) {
/* Use the character encoding for the default locale */
char* action = toStringz(command);
char* ptr = cast(char*)OS.g_malloc(fileName.length+1);
ptr[ 0 .. fileName.length ] = fileName;
ptr[ fileName.length ] = 0;
DtActionArg args = new DtActionArg();
args.argClass = CDE.DtACTION_FILE;
args.name = ptr;
long actionID = CDE.DtActionInvoke(cdeShell, action, args, 1, null, null, null, 1, 0, 0);
OS.g_free(ptr);
return actionID !is 0;
}
static String cde_getAction(String dataType) {
String action = null;
String actions = cde_getAttribute(dataType, CDE.DtDTS_DA_ACTION_LIST);
if (actions !is null) {
int index = actions.indexOf("Open");
if (index !is -1) {
action = actions.substring(index, index + 4);
} else {
index = actions.indexOf(",");
action = index !is -1 ? actions.substring(0, index) : actions;
}
}
return action;
}
static String cde_getAttribute(String dataType, String attrName) {
/* Use the character encoding for the default locale */
byte[] dataTypeBuf = Converter.wcsToMbcs(null, dataType, true);
byte[] attrNameBuf = Converter.wcsToMbcs(null, attrName, true);
byte[] optNameBuf = null;
ptrdiff_t attrValue = CDE.DtDtsDataTypeToAttributeValue(dataTypeBuf, attrNameBuf, optNameBuf);
if (attrValue is 0) return null;
int length = OS.strlen(attrValue);
byte[] attrValueBuf = new byte[length];
OS.memmove(attrValueBuf, attrValue, length);
CDE.DtDtsFreeAttributeValue(attrValue);
/* Use the character encoding for the default locale */
return new String(Converter.mbcsToWcs(null, attrValueBuf));
}
static String[][ String ] cde_getDataTypeInfo() {
String[][ String ] dataTypeInfo;
int index;
ptrdiff_t dataTypeList = CDE.DtDtsDataTypeNames();
if (dataTypeList !is 0) {
/* For each data type name in the list */
index = 0;
ptrdiff_t [] dataType = new ptrdiff_t [1];
OS.memmove(dataType, dataTypeList + (index++ * 4), 4);
while (dataType[0] !is 0) {
int length = OS.strlen(dataType[0]);
byte[] dataTypeBuf = new byte[length];
OS.memmove(dataTypeBuf, dataType[0], length);
/* Use the character encoding for the default locale */
String dataTypeName = new String(Converter.mbcsToWcs(null, dataTypeBuf));
/* The data type is valid if it is not an action, and it has an extension and an action. */
String extension = cde_getExtension(dataTypeName);
if (!CDE.DtDtsDataTypeIsAction(dataTypeBuf) &&
extension !is null && cde_getAction(dataTypeName) !is null) {
String[] exts;
exts ~= extension;
dataTypeInfo[ dataTypeName ] = exts;
}
OS.memmove(dataType, dataTypeList + (index++ * 4), 4);
}
CDE.DtDtsFreeDataTypeNames(dataTypeList);
}
return dataTypeInfo;
}
static String cde_getExtension(String dataType) {
String fileExt = cde_getAttribute(dataType, CDE.DtDTS_DA_NAME_TEMPLATE);
if (fileExt is null || fileExt.indexOf("%s.") is -1) return null;
int dot = fileExt.indexOf(".");
return fileExt.substring(dot);
}
/**
* CDE - Get Image Data
*
* This method returns the image data of the icon associated with
* the data type. Since CDE supports multiple sizes of icons, several
* attempts are made to locate an icon of the desired size and format.
* CDE supports the sizes: tiny, small, medium and large. The best
* search order is medium, large, small and then tiny. Althoug CDE supports
* colour and monochrome bitmaps, only colour icons are tried. (The order is
* defined by the cdeIconExt and cdeMaskExt arrays above.)
*/
ImageData cde_getImageData() {
// TODO
return null;
}
static String cde_getMimeType(String extension) {
String mimeType = null;
String[][ String ] mimeInfo = cde_getDataTypeInfo();
if (mimeInfo is null) return null;
String[] keys = mimeInfo.keys();
int keyIdx = 0;
while (mimeType is null && keyIdx < keys.length ) {
String type = keys[ keyIdx ];
String[] mimeExts = mimeInfo[type];
for (int index = 0; index < mimeExts.length; index++){
if (extension.equals(mimeExts[index])) {
mimeType = type;
break;
}
}
keyIdx++;
}
return mimeType;
}
static Program cde_getProgram(Display display, String mimeType) {
Program program = new Program();
program.display = display;
program.name = mimeType;
program.command = cde_getAction(mimeType);
program.iconPath = cde_getAttribute(program.name, CDE.DtDTS_DA_ICON);
return program;
}
static bool cde_init(Display display) {
try {
Library.loadLibrary("swt-cde");
} catch (Throwable e) {
return false;
}
/* Use the character encoding for the default locale */
CDE.XtToolkitInitialize();
ptrdiff_t xtContext = CDE.XtCreateApplicationContext ();
ptrdiff_t xDisplay = OS.GDK_DISPLAY();
byte[] appName = Converter.wcsToMbcs(null, "CDE", true);
byte[] appClass = Converter.wcsToMbcs(null, "CDE", true);
ptrdiff_t [] argc = [0];
CDE.XtDisplayInitialize(xtContext, xDisplay, appName, appClass, 0, 0, argc, 0);
ptrdiff_t widgetClass = CDE.topLevelShellWidgetClass ();
cdeShell = CDE.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0);
CDE.XtSetMappedWhenManaged (cdeShell, false);
CDE.XtResizeWidget (cdeShell, 10, 10, 0);
CDE.XtRealizeWidget (cdeShell);
bool initOK = CDE.DtAppInitialize(xtContext, xDisplay, cdeShell, appName, appName);
if (initOK) CDE.DtDbLoad();
return initOK;
}
+/
static String[] parseCommand(String cmd) {
String[] args;
int sIndex = 0;
int eIndex;
while (sIndex < cmd.length) {
/* Trim initial white space of argument. */
while (sIndex < cmd.length && Compatibility.isWhitespace(cmd.charAt(sIndex))) {
sIndex++;
}
if (sIndex < cmd.length) {
/* If the command is a quoted string */
if (cmd.charAt(sIndex) is '"' || cmd.charAt(sIndex) is '\'') {
/* Find the terminating quote (or end of line).
* This code currently does not handle escaped characters (e.g., " a\"b").
*/
eIndex = sIndex + 1;
while (eIndex < cmd.length && cmd.charAt(eIndex) !is cmd.charAt(sIndex)) eIndex++;
if (eIndex >= cmd.length) {
/* The terminating quote was not found
* Add the argument as is with only one initial quote.
*/
args ~= cmd.substring(sIndex, eIndex);
} else {
/* Add the argument, trimming off the quotes. */
args ~= cmd.substring(sIndex + 1, eIndex);
}
sIndex = eIndex + 1;
}
else {
/* Use white space for the delimiters. */
eIndex = sIndex;
while (eIndex < cmd.length && !Compatibility.isWhitespace(cmd.charAt(eIndex))) eIndex++;
args ~= cmd.substring(sIndex, eIndex);
sIndex = eIndex + 1;
}
}
}
String[] strings = new String[args.length];
for (int index =0; index < args.length; index++) {
strings[index] = args[index];
}
return strings;
}
/**
* GNOME 2.4 - Execute the program for the given file.
*/
bool gnome_24_execute(String fileName) {
char* mimeTypeBuffer = toStringz(name);
auto ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer);
char* fileNameBuffer = toStringz(fileName);
char* uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT);
GList* list = OS.g_list_append( null, uri);
int result = GNOME.gnome_vfs_mime_application_launch(ptr, list);
GNOME.gnome_vfs_mime_application_free(ptr);
OS.g_free(uri);
OS.g_list_free(list);
return result is GNOME.GNOME_VFS_OK;
}
/**
* GNOME 2.4 - Launch the default program for the given file.
*/
static bool gnome_24_launch(String fileName) {
char* fileNameBuffer = toStringz(fileName);
char* uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT);
int result = GNOME.gnome_vfs_url_show(uri);
OS.g_free(uri);
return (result is GNOME.GNOME_VFS_OK);
}
/**
* GNOME 2.2 - Execute the program for the given file.
*/
bool gnome_execute(String fileName) {
if (gnomeExpectUri) {
/* Convert the given path into a URL */
char* fileNameBuffer = toStringz(fileName);
char* uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer);
if (uri !is null) {
fileName = fromStringz( uri )._idup();
OS.g_free(uri);
}
}
/* Parse the command into its individual arguments. */
String[] args = parseCommand(command);
int fileArg = -1;
int index;
for (index = 0; index < args.length; index++) {
int j = args[index].indexOf("%f");
if (j !is -1) {
String value = args[index];
fileArg = index;
args[index] = value.substring(0, j) ~ fileName ~ value.substring(j + 2);
}
}
/* If a file name was given but the command did not have "%f" */
if ((fileName.length > 0) && (fileArg < 0)) {
String[] newArgs = new String[args.length + 1];
for (index = 0; index < args.length; index++) newArgs[index] = args[index];
newArgs[args.length] = fileName;
args = newArgs;
}
/* Execute the command. */
try {
Compatibility.exec(args);
} catch (IOException e) {
return false;
}
return true;
}
/**
* GNOME - Get Image Data
*
*/
ImageData gnome_getImageData() {
if (iconPath is null) return null;
try {
return new ImageData(iconPath);
} catch (Exception e) {}
return null;
}
/++
+ SWT Extension
+ This is a temporary workaround until SWT will get the real implementation.
+/
static String[][ String ] gnome24_getMimeInfo() {
version(Tango){
scope file = new tango.io.device.File.File("/usr/share/mime/globs");
scope it = new tango.io.stream.Lines.Lines!(char)( file );
} else { // Phobos
scope it = std.string.splitLines( cast(String)std.file.read("/usr/share/mime/globs"));
}
// process file one line at a time
String[][ String ] mimeInfo;
foreach (line; it ){
int colon = line.indexOf(':');
if( colon is line.length ){
continue;
}
if( line.length < colon+3 || line[colon+1 .. colon+3 ] != "*." ){
continue;
}
String mimeType = line[0..colon]._idup();
String ext = line[colon+3 .. $]._idup();
if( auto exts = mimeType in mimeInfo ){
mimeInfo[ mimeType ] = *exts ~ ext;
}
else{
mimeInfo[ mimeType ] = [ ext ];
}
}
return mimeInfo;
}
/**
* GNOME - Get mime types
*
* Obtain the registered mime type information and
* return it in a map. The key of each entry
* in the map is the mime type name. The value is
* a vector of the associated file extensions.
*/
static String[][ String ] gnome_getMimeInfo() {
String[][ String ] mimeInfo;
GList* mimeList = GNOME.gnome_vfs_get_registered_mime_types();
GList* mimeElement = mimeList;
while (mimeElement !is null) {
auto mimePtr = cast(char*) OS.g_list_data(mimeElement);
String mimeTypeBuffer = fromStringz(mimePtr)._idup();
String mimeType = mimeTypeBuffer;//new String(Converter.mbcsToWcs(null, mimeTypeBuffer));
GList* extensionList = GNOME.gnome_vfs_mime_get_extensions_list(mimePtr);
if (extensionList !is null) {
String[] extensions;
GList* extensionElement = extensionList;
while (extensionElement !is null) {
char* extensionPtr = cast(char*) OS.g_list_data(extensionElement);
String extensionBuffer = fromStringz(extensionPtr)._idup();
String extension = extensionBuffer;
extension = '.' ~ extension;
extensions ~= extension;
extensionElement = OS.g_list_next(extensionElement);
}
GNOME.gnome_vfs_mime_extensions_list_free(extensionList);
if (extensions.length > 0) mimeInfo[ mimeType ] = extensions;
}
mimeElement = OS.g_list_next(mimeElement);
}
if (mimeList !is null) GNOME.gnome_vfs_mime_registered_mime_type_list_free(mimeList);
return mimeInfo;
}
static String gnome_getMimeType(String extension) {
String mimeType = null;
String fileName = "swt" ~ extension;
char* extensionBuffer = toStringz(fileName);
char* typeName = GNOME.gnome_vfs_mime_type_from_name(extensionBuffer);
if (typeName !is null) {
mimeType = fromStringz(typeName)._idup();
}
return mimeType;
}
static Program gnome_getProgram(Display display, String mimeType) {
Program program = null;
char* mimeTypeBuffer = toStringz(mimeType);
GnomeVFSMimeApplication* ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer);
if (ptr !is null) {
program = new Program();
program.display = display;
program.name = mimeType;
GnomeVFSMimeApplication* application = ptr;
String buffer = fromStringz(application.command)._idup();
program.command = buffer;
program.gnomeExpectUri = application.expects_uris is GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS;
buffer = (fromStringz( application.id) ~ '\0')._idup();
Integer gnomeIconTheme = cast(Integer)display.getData(ICON_THEME_DATA);
char* icon_name = GNOME.gnome_icon_lookup( cast(GtkIconTheme*) gnomeIconTheme.intValue, null, null, cast(char*)buffer.ptr, null, mimeTypeBuffer,
GNOME.GNOME_ICON_LOOKUP_FLAGS_NONE, null);
char* path = null;
if (icon_name !is null) path = GNOME.gnome_icon_theme_lookup_icon(cast(GtkIconTheme*)gnomeIconTheme.intValue, icon_name, PREFERRED_ICON_SIZE, null, null);
if (path !is null) {
program.iconPath = fromStringz( path)._idup();
OS.g_free(path);
}
if (icon_name !is null) OS.g_free(icon_name);
GNOME.gnome_vfs_mime_application_free(ptr);
}
return program;
}
static bool gnome_init() {
return cast(bool) GNOME.gnome_vfs_init();
}
/**
* Finds the program that is associated with an extension.
* The extension may or may not begin with a '.'. Note that
* a <code>Display</code> must already exist to guarantee that
* this method returns an appropriate result.
*
* @param extension the program extension
* @return the program or <code>null</code>
*
*/
public static Program findProgram(String extension) {
return findProgram(Display.getCurrent(), extension);
}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
static Program findProgram(Display display, String extension) {
// SWT extension: allow null for zero length string
//if (extension is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
if (extension.length is 0) return null;
if (extension.charAt(0) !is '.') extension = "." ~ extension;
int desktop = getDesktop(display);
String mimeType = null;
switch (desktop) {
case DESKTOP_GNOME_24:
case DESKTOP_GNOME: mimeType = gnome_getMimeType(extension); break;
//case DESKTOP_CDE: mimeType = cde_getMimeType(extension); break;
default:
}
if (mimeType is null) return null;
Program program = null;
switch (desktop) {
case DESKTOP_GNOME_24:
case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break;
//case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break;
default:
}
return program;
}
/**
* Answer all program extensions in the operating system. Note
* that a <code>Display</code> must already exist to guarantee
* that this method returns an appropriate result.
*
* @return an array of extensions
*/
public static String[] getExtensions() {
return getExtensions(Display.getCurrent());
}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
static String[] getExtensions(Display display) {
int desktop = getDesktop(display);
String[][ String ] mimeInfo = null;
switch (desktop) {
case DESKTOP_GNOME_24: mimeInfo = gnome24_getMimeInfo(); break;
case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break;
//case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break;
default:
}
if (mimeInfo is null) return null;
/* Create a unique set of the file extensions. */
String[] extensions;
String[] keys = mimeInfo.keys;
int keyIdx = 0;
while ( keyIdx < keys.length ) {
String mimeType = keys[ keyIdx ];
String[] mimeExts = mimeInfo[mimeType];
for (int index = 0; index < mimeExts.length; index++){
version(Tango){
bool contains = cast(bool)tango.core.Array.contains(extensions, mimeExts[index]);
} else { // Phobos
bool contains = std.algorithm.canFind(extensions, mimeExts[index]);
}
if (!contains) {
extensions ~= mimeExts[index];
}
}
keyIdx++;
}
/* Return the list of extensions. */
String[] extStrings = new String[]( extensions.length );
for (int index = 0; index < extensions.length; index++) {
extStrings[index] = extensions[index];
}
return extStrings;
}
/**
* Answers all available programs in the operating system. Note
* that a <code>Display</code> must already exist to guarantee
* that this method returns an appropriate result.
*
* @return an array of programs
*/
public static Program[] getPrograms() {
return getPrograms(Display.getCurrent());
}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
static Program[] getPrograms(Display display) {
int desktop = getDesktop(display);
String[][ String ] mimeInfo = null;
switch (desktop) {
case DESKTOP_GNOME_24: break;
case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break;
//case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break;
default:
}
if (mimeInfo is null) return new Program[0];
Program[] programs;
String[] keys = mimeInfo.keys;
int keyIdx = 0;
while ( keyIdx < keys.length ) {
String mimeType = keys[ keyIdx ];
Program program = null;
switch (desktop) {
case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break;
//case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break;
default:
}
if (program !is null) programs ~= program;
keyIdx++;
}
Program[] programList = new Program[programs.length];
for (int index = 0; index < programList.length; index++) {
programList[index] = programs[index];
}
return programList;
}
/**
* Launches the operating system executable associated with the file or
* URL (http:// or https://). If the file is an executable then the
* executable is launched. Note that a <code>Display</code> must already
* exist to guarantee that this method returns an appropriate result.
*
* @param fileName the file or program name or URL (http:// or https://)
* @return <code>true</code> if the file is launched, otherwise <code>false</code>
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT when fileName is null</li>
* </ul>
*/
public static bool launch(String fileName) {
return launch(Display.getCurrent(), fileName);
}
/*
* API: When support for multiple displays is added, this method will
* become public and the original method above can be deprecated.
*/
static bool launch (Display display, String fileName) {
if (fileName is null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
switch (getDesktop (display)) {
case DESKTOP_GNOME_24:
if (gnome_24_launch (fileName)) return true;
goto default;
default:
int index = fileName.lastIndexOf ('.');
if (index !is -1) {
String extension = fileName.substring (index);
Program program = Program.findProgram (display, extension);
if (program !is null && program.execute (fileName)) return true;
}
String lowercaseName = fileName.toLowerCase ();
if (lowercaseName.startsWith (PREFIX_HTTP) || lowercaseName.startsWith (PREFIX_HTTPS)) {
Program program = Program.findProgram (display, ".html"); //$NON-NLS-1$
if (program is null) {
program = Program.findProgram (display, ".htm"); //$NON-NLS-1$
}
if (program !is null && program.execute (fileName)) return true;
}
break;
}
try {
Compatibility.exec (fileName);
return true;
} catch (IOException e) {
return false;
}
}
/**
* Compares the argument to the receiver, and returns true
* if they represent the <em>same</em> object using a class
* specific comparison.
*
* @param other the object to compare with this object
* @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise
*
* @see #hashCode()
*/
public override equals_t opEquals(Object other) {
if (this is other) return true;
if (!(cast(Program)other)) return false;
Program program = cast(Program)other;
return display is program.display && name.equals(program.name) && command.equals(program.command);
}
/**
* Executes the program with the file as the single argument
* in the operating system. It is the responsibility of the
* programmer to ensure that the file contains valid data for
* this program.
*
* @param fileName the file or program name
* @return <code>true</code> if the file is launched, otherwise <code>false</code>
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT when fileName is null</li>
* </ul>
*/
public bool execute(String fileName) {
if (fileName is null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
int desktop = getDesktop(display);
switch (desktop) {
case DESKTOP_GNOME_24: return gnome_24_execute(fileName);
case DESKTOP_GNOME: return gnome_execute(fileName);
//case DESKTOP_CDE: return cde_execute(fileName);
default:
}
return false;
}
/**
* Returns the receiver's image data. This is the icon
* that is associated with the receiver in the operating
* system.
*
* @return the image data for the program, may be null
*/
public ImageData getImageData() {
switch (getDesktop(display)) {
case DESKTOP_GNOME_24:
case DESKTOP_GNOME: return gnome_getImageData();
//case DESKTOP_CDE: return cde_getImageData();
default:
}
return null;
}
/**
* Returns the receiver's name. This is as short and
* descriptive a name as possible for the program. If
* the program has no descriptive name, this string may
* be the executable name, path or empty.
*
* @return the name of the program
*/
public String getName() {
return name;
}
/**
* Returns an integer hash code for the receiver. Any two
* objects that return <code>true</code> when passed to
* <code>equals</code> must return the same value for this
* method.
*
* @return the receiver's hash
*
* @see #equals(Object)
*/
public override hash_t toHash() {
return .toHash(name) ^ .toHash(command) ^ display.toHash();
}
/**
* Returns a string containing a concise, human-readable
* description of the receiver.
*
* @return a string representation of the program
*/
override
public String toString() {
return Format( "Program {{{}}", name );
}
}
|
D
|
/**
* Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved.
* Authors: Jacob Carlborg
* Version: Initial created: Jan 9, 2011
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
*/
module dvm.dvm.ShellScript;
import std.conv : text;
import std.exception : assumeUnique;
import std.format : format;
import tango.io.device.File;
class ShellScript
{
string path;
private string content_;
string content ()
{
return content_;
}
private string content (string content)
{
return content_ = content;
}
this (string path = "")
{
this.path = path;
}
ShellScript allArgs (bool quote = true)
{
append(Sh.allArgs);
return this;
}
ShellScript comment (string c)
{
append(Sh.comment(c));
return this;
}
ShellScript declareVariable (string name, string value = "", bool local = false)
{
append(Sh.declareVariable(name, value, local)).nl;
return this;
}
ShellScript echoOff ()
{
version (Windows)
append(Sh.echoOff).nl;
return this;
}
ShellScript exec (string name, string args = "")
{
append(Sh.exec(name, args));
return this;
}
ShellScript export_ (string name, string content, bool quote = true)
{
append(Sh.export_(name, content, quote));
return this;
}
ShellScript exportPath (string name, string[] args ...)
{
string content ;
foreach (i, arg ; args)
{
if (i != args.length - 1)
content ~= arg ~ Sh.separator;
else
content ~= arg;
}
return export_(name, content);
}
ShellScript ifFileIsNotEmpty (string path, void delegate () ifBlock, void delegate () elseBlock = null)
{
version (Posix)
ifStatement("-s " ~ path, ifBlock, elseBlock);
else
ifStatement("exist " ~ path, ifBlock, elseBlock);
return this;
}
ShellScript ifStatement (string condition, void delegate () ifBlock, void delegate () elseBlock = null)
{
version (Posix)
{
append(format("if [ %s ] ; then", condition)).nl.indent;
ifBlock();
nl;
if (elseBlock)
{
append("else").nl.indent;
elseBlock();
nl;
}
append("fi");
}
else
{
append(format("if %s (", condition)).nl.indent;
ifBlock();
nl;
append(")");
if (elseBlock)
{
append(" else (").nl.indent;
elseBlock();
nl;
append(")");
}
}
return this;
}
ShellScript printError (string message, bool singleQuote = false)
{
version (Posix)
{
auto quote = singleQuote ? "'" : `"`;
append(format(`echo %sError: %s%s >&2`, quote, message, quote));
}
else
append(format(`echo Error: %s >&2`, message));
return this;
}
ShellScript shebang ()
{
version (Posix)
{
if (Sh.shebang != "")
append(Sh.shebang).nl;
}
return this;
}
ShellScript source (string path)
{
append(Sh.source(path));
return this;
}
ShellScript variable (string name, bool quote = true)
{
append(Sh.variable(name, quote));
return this;
}
ShellScript write ()
{
File.set(path, content);
return this;
}
ShellScript append(T)(T value)
{
content_ ~= value.text;
return this;
}
ShellScript nl ()
{
version (Posix)
append('\n');
else
append("\r\n");
return this;
}
ShellScript indent ()
{
append('\t');
return this;
}
}
struct Sh
{
static:
string quote (string str)
{
return format(`"%s"`, str);
}
version (Posix)
{
enum shebang = "#!/bin/sh";
enum separator = ":";
string allArgs (bool quote = true)
{
return quote ? `"$@"` : "$@";
}
string comment (string c)
{
return "# " ~ c;
}
string declareVariable (string name, string value = "", bool local = false)
{
string loc = local ? "local " : "";
if (value == "")
return loc ~ name;
return format("%s%s=%s", loc, name, value);
}
string exec (string name, string args = "")
{
args = args == "" ? "" : ' ' ~ args;
return format("exec %s%s", name, args);
}
string export_ (string name, string value, bool quote = true)
{
return format("%s=\"%s\"\nexport %s", name, value, name);
}
string source (string path, bool quote = true)
{
return format(". %s", path);
}
string exec (string command)
{
return format("exec %s", command);
}
string variable (string name, bool quote = true)
{
return quote ? format(`"$%s"`, name) : '$' ~ name;
}
}
else version (Windows)
{
// DMD 1.068 and up optimizes this out causing a linker error
//enum shebang = "";
enum echoOff = "@echo off";
enum separator = ";";
string allArgs (bool quote = true)
{
return "%*";
}
string comment (string c)
{
return "rem " ~ c;
}
string declareVariable (string name, string value = "", bool local = false)
{
return format("set %s=%s", name, value);
}
string export_ (string name, string content, bool quote = true)
{
return format("set %s=%s", name, content);
}
string source (string path)
{
return format("call %s", path);
}
string exec (string name, string args = "")
{
return format("%s %s", name, args);
}
string variable (string name, bool quote = true)
{
return quote ? format(`"%%s%"`, name) : '%' ~ name ~ '%';
}
}
}
string slashSafeSubstitute (string haystack, string needle, string replacement)
{
import tango.text.Util;
version (Windows)
{
needle = needle.substitute("/", "\\").assumeUnique;
replacement = replacement.substitute("/", "\\").assumeUnique;
}
return haystack.substitute(needle, replacement).assumeUnique;
}
|
D
|
module dcltk.initialize;
import derelict.opencl.cl;
import dcltk.error : OpenClException;
import dcltk.platform : getPlatformIds, getPlatformCLVersion;
import std.algorithm : map, maxElement;
/**
* load highest OpenCL libraries.
*
* Returns:
* loaded platform ID.
*/
cl_platform_id loadOpenCl() {
DerelictCL.load();
struct PlatformVersion {
cl_platform_id id;
CLVersion clVersion;
}
auto versions = getPlatformIds()
.map!((id) => PlatformVersion(id, getPlatformCLVersion(id)));
if(versions.empty) {
throw new OpenClException("nothing platform.");
}
auto highestVersion = versions.maxElement!"a.clVersion";
DerelictCL.reload(highestVersion.clVersion);
DerelictCL.loadEXT(highestVersion.id);
return highestVersion.id;
}
/**
* initialize OpenCL libraries.
*/
void initializeOpenCL() {
DerelictCL.load();
}
/**
* reload OpenCL libraries.
*
* Params:
* platformId = target platform ID.
* clVersion = target version.
*/
void reloadOpenCL(cl_platform_id platformId, CLVersion clVersion) {
DerelictCL.reload(clVersion);
DerelictCL.loadEXT(platformId);
}
|
D
|
module ppl2.resolve.resolve_is;
import ppl2.internal;
final class IsResolver {
private:
Module module_;
ModuleResolver resolver;
public:
this(ModuleResolver resolver, Module module_) {
this.resolver = resolver;
this.module_ = module_;
}
void resolve(Is n) {
auto leftType = n.leftType();
auto rightType = n.rightType();
/// Both sides must be resolved
if(leftType.isUnknown || rightType.isUnknown) return;
if(!n.left().isTypeExpr && !n.right().isTypeExpr) {
/// Identifier IS Identifier
if(leftType.isValue && rightType.isValue) {
/// value IS value
/// If the sizes are different then the result must be false
if(leftType.size != rightType.size) {
rewriteToConstBool(n, false);
return;
}
/// If one side is a struct then the other must be too
if(leftType.isStruct != rightType.isStruct) {
rewriteToConstBool(n, false);
return;
}
/// If one side is a tuple then the other side must be too
if(leftType.isTuple != rightType.isTuple) {
rewriteToConstBool(n, false);
return;
}
/// If one side is an array then the other must be too
if(leftType.isArray != rightType.isArray) {
rewriteToConstBool(n, false);
return;
}
/// If one side is a function then the other side must be too
if(leftType.isFunction != rightType.isFunction) {
rewriteToConstBool(n, false);
return;
}
/// If one side is an enum then the other side must be too
if(leftType.isEnum != rightType.isEnum) {
rewriteToConstBool(n, false);
return;
}
/// Two structs
if(leftType.isStruct) {
/// Must be the same type
if(leftType.getStruct != rightType.getStruct) {
rewriteToConstBool(n, false);
return;
}
rewriteToMemcmp(n);
return;
}
/// Two tuples
if(leftType.isTuple) {
rewriteToMemcmp(n);
return;
}
/// Two enums
if(leftType.isEnum) {
auto leftEnum = leftType.getEnum;
auto rightEnum = rightType.getEnum;
/// Must be the same enum type
if(!leftEnum.exactlyMatches(rightEnum)) {
rewriteToConstBool(n, false);
return;
}
rewriteToEnumMemberValues(n, leftEnum);
return;
}
/// Two arrays
if(leftType.isArray) {
/// Must be the same subtype
if(!leftType.getArrayType.subtype.exactlyMatches(rightType.getArrayType.subtype)) {
rewriteToConstBool(n, false);
return;
}
rewriteToMemcmp(n);
return;
}
/// Two functions
if(leftType.isFunction) {
assert(false, "implement me");
}
assert(leftType.isBasicType);
assert(rightType.isBasicType);
rewriteToBoolEquals(n);
return;
} else if(leftType.isPtr != rightType.isPtr) {
module_.addError(n, "Both sides if 'is' expression should be pointer types", true);
return;
}
/// ptr is ptr
/// This is the only one that stays as an Is
assert(leftType.isPtr && rightType.isPtr);
return;
} else {
/// Type is Type
/// Type is Expression
/// Expression is Type
rewriteToConstBool(n, leftType.exactlyMatches(rightType));
return;
}
}
private:
void rewriteToConstBool(Is n, bool result) {
result ^= n.negate;
auto lit = LiteralNumber.makeConst(result ? TRUE : FALSE, TYPE_BOOL);
resolver.fold(n, lit);
}
///
/// Binary (EQ)
/// call memcmp
/// Addressof
/// left
/// Addressof
/// right
/// long numBytes
/// 0
void rewriteToMemcmp(Is n) {
assert(n.leftType.isValue);
assert(n.rightType.isValue);
auto builder = module_.builder(n);
auto call = builder.call("memcmp", null);
call.add(builder.addressOf(n.left()));
call.add(builder.addressOf(n.right()));
call.add(LiteralNumber.makeConst(n.leftType.size, TYPE_INT));
auto op = n.negate ? Operator.BOOL_NE : Operator.BOOL_EQ;
auto ne = builder.binary(op, call, LiteralNumber.makeConst(0, TYPE_INT));
resolver.fold(n, ne);
}
void rewriteToBoolEquals(Is n) {
auto builder = module_.builder(n);
auto op = n.negate ? Operator.BOOL_NE : Operator.BOOL_EQ;
auto binary = builder.binary(op, n.left, n.right, TYPE_BOOL);
resolver.fold(n, binary);
}
void rewriteToEnumMemberValues(Is n, Enum enum_) {
auto builder = module_.builder(n);
auto lemv = builder.enumMemberValue(enum_, n.left());
auto remv = builder.enumMemberValue(enum_, n.right());
n.add(lemv);
n.add(remv);
resolver.setModified();
}
}
|
D
|
module scone.frame;
import scone.core;
import scone.window;
import scone.utility;
import scone.color;
import std.algorithm;
import std.array;
import std.conv;
import std.format;
import std.stdio;
import std.string;
import std.traits;
import std.uni;
/**
* Writable area
*/
class Frame
{
alias width = w;
alias height = h;
//@nogc: //In the future, make entire Frame @nogc
/**
* Main frame constructor.
* Params:
* width = Width of the main frame. If less than 1, get set to the consoles width (in slots)
* height = Height of the main frame. If less than 1, get set to the consoles height (in slots)
*
* Examples:
* --------------------
* //Creates a dynamically sized main frame, where the size is determined by the window width and height
* auto window = new Frame(); //The main frame
*
* //The width is less than one, meaning it get dynamically set to the consoles
* auto window = new Frame(0, 20); //Main frame, with the width of the width, and the height of 20
* --------------------
*
* Standards: width = 80, height = 24
*
* If the width or height exceeds the consoles width or height, the program errors.
*/
this(in int width = 0, in int height = 0)
in
{
auto size = windowSize;
sconeAssert(width <= size[0] && height <= size[1], "Frame is too small. Minimum size needs to be %sx%s slots, but frame size is %sx%s", width, height, size[0], size[1]);
}
body
{
auto size = windowSize;
if(width < 1){ _w = size[0]; } else { _w = width; }
if(height < 1){ _h = size[1]; } else { _h = height;}
_slots = new Slot[][](_h, _w);
_backbuffer = new Slot[][](_h, _w);
foreach(n, ref row; _slots)
{
row = _slots[n][] = Slot(' ');
}
}
/**
* Writes whatever is thrown into the parameters onto the frame
* Examples:
* --------------------
* window.write(10,15, fg(Color.red), bg(Color.green), 'D'); //Writes a 'D' colored RED with a GREEN background.
* window.write(10,16, fg(Color.red), bg(Color.white), "scon", fg(Color.blue), 'e'); //Writes "scone" where "scon" is YELLOW with WHITE background and "e" is RED with WHITE background.
* window.write(10,17, bg(Color.red), fg(Color.blue));
* window.write(10,17, bg(Color.white), fg(Color.green)); //Changes the slots' color to RED and the background to WHITE.
*
* window.write(10,18, 'D', bg(Color.red)); //Watch out: This will print "D" with the default color and the default background-color.
* --------------------
* Note: Using Unicode character may not work as expected, due to different operating systems may not handle Unicode correctly.
*/
auto write(Args...)(in int col, in int row, Args args)
{
//Check if writing outside border
if(col < 0 || row < 0 || col > w || row > h)
{
sconeLog.logf("Warning: Cannot write at (%s, %s). x must be between 0 <-> %s, y must be between 0 <-> %s", col, row, w, h);
return;
}
Slot[] slots;
fg foreground = fg.white_dark;
bg background = bg.black_dark;
bool unsetColors;
foreach(ref arg; args)
{
static if(is(typeof(arg) == fg))
{
foreground = arg;
unsetColors = true;
}
else static if(is(typeof(arg) == bg))
{
background = arg;
unsetColors = true;
}
else static if(is(typeof(arg) == Slot))
{
slots ~= arg;
unsetColors = false;
}
else
{
foreach(c; to!string(arg))
{
slots ~= Slot(c, foreground, background);
}
unsetColors = false;
}
}
//If the last argument is a color, warn
if(slots.length && unsetColors)
{
sconeLog.logf("Warning: The last argument in %s is a color, which will not be set!", args);
}
if(!slots.length)
{
_slots[row][col].foreground = foreground;
_slots[row][col].background = background;
}
else
{
int wx, wy;
foreach(ref slot; slots)
{
if(col + wx >= w || slot.character == '\n')
{
wx = 0;
++wy;
continue;
}
else
{
_slots[row + wy][col + wx] = slot;
++wx;
}
}
}
}
/** Prints the current frame to the console */
auto print()
{
foreach(sy, ref row; _slots)
{
foreach(sx, ref slot; row)
{
if(slot != _backbuffer[sy][sx])
{
writeSlot(sx,sy, slot);
_backbuffer[sy][sx] = slot;
}
}
}
}
///Sets all tiles to blank
auto clear()
{
foreach(ref row; _slots)
{
row[] = Slot(' ');
}
}
///Causes next `print()` to write out all tiles.
auto flush()
{
foreach(ref row; _backbuffer)
{
row[] = Slot(' ');
}
}
const
{
/** Get the width of the frame */
auto w() @property
{
return _w;
}
/** Get the height of the frame */
auto h() @property
{
return _h;
}
/** Returns: Slot at the specific x and y coordinates */
auto getSlot(in int x, in int y)
{
return _slots[y][x];
}
}
private:
//Forgive me for using C++ naming style
int _w, _h;
Slot[][] _slots, _backbuffer;
}
/**
* Slot structure
*
* Examples:
* --------------------
* Slot slot1 = Slot('d', fg(Color.red), bg(Color.white)); //'d' character with RED foreground color and WHITE background color
* Slot slot2 = Slot('g');
*
* auto window = new Frame();
* window.write(0,0, slot1);
* window.write(0,1, slot2);
* --------------------
*
*/
struct Slot
{
char character;
fg foreground = fg(Color.white_dark);
bg background = bg(Color.black_dark);
}
//Do not delete:
//hello there kott and blubeeries, wat are yoy doing this beautyiur beuirituyr nightrevening?? i am stiitngi ghere hanad dtyryugin to progrmamam this game enrgniergn that is for the solnosle
|
D
|
module android.java.java.nio.file.ClosedWatchServiceException;
public import android.java.java.nio.file.ClosedWatchServiceException_d_interface;
import arsd.jni : ImportExportImpl;
mixin ImportExportImpl!ClosedWatchServiceException;
import import4 = android.java.java.lang.Class;
import import3 = android.java.java.lang.StackTraceElement;
import import0 = android.java.java.lang.JavaThrowable;
|
D
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.