code
stringlengths 3
10M
| language
stringclasses 31
values |
|---|---|
#Power[MW] Current[A] Safety Ratio[] T_ref[°C] SymetryFlag
12.5 31000 0.8 20 Sym
#Helices N_Elem
14 56
#N R1[m] R2[m] HalfL[m] Rho[Ohm.m] Alpha[1/K] E_Max[Pa] K[W/(m.K)] h[W/(m^2.K)] <T_W>[°C] T_Max[°C]
#N T_o=20°C T_o=20°C T_o=10O°C
4 1.930e-02 2.420e-02 7.7050e-02 1.992e-08 0.00e+00 3.600e+08 3.800000e+02 8.500000e+04 3.000e+01 1.00e+02
...
4 1.703e-01 1.860e-01 1.6415e-01 2.087e-08 0.00e+00 3.740e+08 3.800000e+02 8.500000e+04 3.000e+01 1.00e+02
0.
#External_Magnets
0
|
D
|
instance Mod_7802_TPL_Templer_OM (Npc_Default)
{
//-------- primary data --------
name = Name_Templer;
Npctype = NpcType_mt_templer;
guild = GIL_out;
level = 17;
flags = 0;
voice = 0;
id = 7802;
//-------- abilities --------
attribute[ATR_STRENGTH] = 130;
attribute[ATR_DEXTERITY] = 65;
attribute[ATR_MANA_MAX] = 0;
attribute[ATR_MANA] = 0;
attribute[ATR_HITPOINTS_MAX] = 244;
attribute[ATR_HITPOINTS] = 244;
//-------- visuals --------
// animations
Mdl_SetVisual (self,"HUMANS.MDS");
Mdl_ApplyOverlayMds (self,"Humans_Mage.mds");
// body mesh ,bdytex,skin,head mesh ,headtex,teethtex,ruestung
Mdl_SetVisualBody (self,"hum_body_Naked0", 1, 1 ,"Hum_Head_Psionic", 65 , 0, TPL_ARMOR_M);
Mdl_SetModelFatness(self,0);
fight_tactic = FAI_HUMAN_STRONG;
//-------- Talente --------
Npc_SetTalentSkill (self, NPC_TALENT_2H,1);
//-------- inventory --------
EquipItem (self, ItMw_Zweihaender1);
B_CreateAmbientInv (self);
CreateInvItems (self, ItAt_CrawlerMandibles, 8);
//-------------Daily Routine-------------
daily_routine = Rtn_start_7802;
};
FUNC VOID Rtn_start_7802 ()
{
TA_Stand_Guarding (00,00,22,00,"OM_033");
TA_Stand_Guarding (22,00,24,00,"OM_033");
};
|
D
|
import entity_animal;
import enums;
import game;
import quest;
import item_seaweed;
import item_seasalad;
import item_sweetsalad;
import item_axe;
class EntityTurtle : EntityAnimal
{
this(int x, int y)
{
super("Ol' Man Bent", x, y, '@', Color.green, new Quest
(
[
//Talk messages
"Back in my days, we did have not internet. But I will never forget the moonlight shining on my head.",
"They call me old fashioned, but I simply do what I do best.",
"Why run when you can walk?",
"Slow is not necessarily bad.",
],
this,
[
QuestPart
(
[
//Initial phrase
"Back in my day we knew how to make really good salad, the best! Now that I talk about it I remember that I need some more seaweed, could you get me some young one?",
//Repeated, more descriptive phrase
"My Seaweed storage is still empty.",
//Finished phrase
"Thank you, young one, I needed that for my storage.",
],
{
//Check
return Game.player.hasItem(typeid(ItemSeaWeed));
},
{
//Action
Game.player.removeItem(typeid(ItemSeaWeed));
}
),
QuestPart
(
[
//Initial phrase
"MY GOD WHY CAN NOBODY MAKE GOOD SALAD ANYMORE? What did you say young one? Can you make salad? If you could make some for me I would be so happy.",
//Repeated, more descriptive phrase
"Do you have the Sea Salad, whippersnapper?",
//Finished phrase
"It was a long time since I had a good Sea Salad.",
],
{
//Check
return Game.player.hasItem(typeid(ItemSeaSalad));
},
{
//Action
Game.player.removeItem(typeid(ItemSeaSalad));
}
),
QuestPart
(
[
//Initial phrase
"I heard of some sort of new sort of Salad, Salad with Berry in it. Can you believe what youngsters come up with these days. To be honest I once tried it when I was young but I don't remember the taste, could you get me some so I can taste it again?",
//Repeated, more descriptive phrase
"Have you made the Berry Salad for me?",
//Finished phrase
"Thank you, this really tastes different from normal salad.",
],
{
//Check
return Game.player.hasItem(typeid(ItemSweetSalad));
},
{
//Action
Game.player.removeItem(typeid(ItemSweetSalad));
}
),
QuestPart
(
[
//Initial phrase
"I could really use a tool to take care of all the bushes in my garden. Could you make me an Axe so I can chop down some of them?",
//Repeated, more descriptive phrase
"Have you come to give me the Axe?",
//Finished phrase
"I will finally be able to get rid of those weeds.",
],
{
//Check
return Game.player.hasItem(typeid(ItemAxe));
},
{
//Action
Game.player.removeItem(typeid(ItemAxe));
}
),
QuestPart
(
[
//Initial phrase
"I am a lonely, old Turtle. I have lived here for so long I think it would do me good with a change of scenery. Could you make a house for me to live in?",
//Repeated, more descriptive phrase
"Have you finished the House, child?",
//Finished phrase
"Thank you, you truly have made this old turtle happy.",
],
{
//Check
return houseNear();
},
{
//Action
}
),
],
"Thank you, this reminds me of when I was young."
));
}
}
|
D
|
/**
* Top level code for the code generator.
*
* Copyright: Copyright (C) 1985-1998 by Symantec
* Copyright (C) 2000-2023 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/cgcod.d, backend/cgcod.d)
* Documentation: https://dlang.org/phobos/dmd_backend_cgcod.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/cgcod.d
*/
module dmd.backend.cgcod;
version = FRAMEPTR;
import core.bitop;
import core.stdc.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import dmd.backend.backend;
import dmd.backend.cc;
import dmd.backend.cdef;
import dmd.backend.code;
import dmd.backend.cgcse;
import dmd.backend.code_x86;
import dmd.backend.codebuilder;
import dmd.backend.disasm86;
import dmd.backend.dlist;
import dmd.backend.dvec;
import dmd.backend.melf;
import dmd.backend.mem;
import dmd.backend.el;
import dmd.backend.global;
import dmd.backend.obj;
import dmd.backend.oper;
import dmd.backend.pdata : win64_pdata;
import dmd.backend.rtlsym;
import dmd.backend.symtab;
import dmd.backend.ty;
import dmd.backend.type;
import dmd.backend.xmm;
import dmd.backend.barray;
extern (C++):
nothrow:
@safe:
alias _compare_fp_t = extern(C) nothrow int function(const void*, const void*);
extern(C) void qsort(void* base, size_t nmemb, size_t size, _compare_fp_t compar);
enum MARS = true;
import dmd.backend.dwarfdbginf : dwarf_except_gentables;
private extern (D) uint mask(uint m) { return 1 << m; }
__gshared
{
bool floatreg; // !=0 if floating register is required
int hasframe; // !=0 if this function has a stack frame
bool enforcealign; // enforced stack alignment
targ_size_t spoff;
targ_size_t Foff; // BP offset of floating register
targ_size_t CSoff; // offset of common sub expressions
targ_size_t NDPoff; // offset of saved 8087 registers
targ_size_t pushoff; // offset of saved registers
bool pushoffuse; // using pushoff
int BPoff; // offset from BP
int EBPtoESP; // add to EBP offset to get ESP offset
LocalSection Para; // section of function parameters
LocalSection Auto; // section of automatics and registers
LocalSection Fast; // section of fastpar
LocalSection EEStack; // offset of SCstack variables from ESP
LocalSection Alloca; // data for alloca() temporary
REGSAVE regsave;
CGstate cgstate; // state of code generator
regm_t BYTEREGS = BYTEREGS_INIT;
regm_t ALLREGS = ALLREGS_INIT;
/************************************
* # of bytes that SP is beyond BP.
*/
uint stackpush;
int stackchanged; /* set to !=0 if any use of the stack
other than accessing parameters. Used
to see if we can address parameters
with ESP rather than EBP.
*/
int refparam; // !=0 if we referenced any parameters
int reflocal; // !=0 if we referenced any locals
bool anyiasm; // !=0 if any inline assembler
char calledafunc; // !=0 if we called a function
char needframe; // if true, then we will need the frame
// pointer (BP for the 8088)
char gotref; // !=0 if the GOTsym was referenced
uint usednteh; // if !=0, then used NT exception handling
bool calledFinally; // true if called a BC_finally block
/* Register contents */
con_t regcon;
BackendPass pass;
private Symbol *retsym; // set to symbol that should be placed in
// register AX
/****************************
* Register masks.
*/
regm_t msavereg; // Mask of registers that we would like to save.
// they are temporaries (set by scodelem())
regm_t mfuncreg; // Mask of registers preserved by a function
regm_t allregs; // ALLREGS optionally including mBP
int dfoidx; /* which block we are in */
targ_size_t funcoffset; // offset of start of function
targ_size_t prolog_allocoffset; // offset past adj of stack allocation
targ_size_t startoffset; // size of function entry code
targ_size_t retoffset; /* offset from start of func to ret code */
targ_size_t retsize; /* size of function return */
private regm_t lastretregs,last2retregs,last3retregs,last4retregs,last5retregs;
}
/*********************************
* Generate code for a function.
* Note at the end of this routine mfuncreg will contain the mask
* of registers not affected by the function. Some minor optimization
* possibilities are here.
* Params:
* sfunc = function to generate code for
*/
@trusted
void codgen(Symbol *sfunc)
{
//printf("codgen('%s')\n",funcsym_p.Sident.ptr);
assert(sfunc == funcsym_p);
assert(cseg == funcsym_p.Sseg);
cgreg_init();
CSE.initialize();
cod3_initregs();
allregs = ALLREGS;
pass = BackendPass.initial;
Alloca.initialize();
anyiasm = 0;
if (config.ehmethod == EHmethod.EH_DWARF)
{
/* The dwarf unwinder relies on the function epilog to exist
*/
for (block* b = startblock; b; b = b.Bnext)
{
if (b.BC == BCexit)
b.BC = BCret;
}
}
tryagain:
debug
if (debugr)
printf("------------------ PASS%s -----------------\n",
(pass == BackendPass.initial) ? "init".ptr : ((pass == BackendPass.reg) ? "reg".ptr : "final".ptr));
lastretregs = last2retregs = last3retregs = last4retregs = last5retregs = 0;
// if no parameters, assume we don't need a stack frame
needframe = 0;
enforcealign = false;
gotref = 0;
stackchanged = 0;
stackpush = 0;
refparam = 0;
calledafunc = 0;
retsym = null;
cgstate.stackclean = 1;
cgstate.funcarg.initialize();
cgstate.funcargtos = ~0;
cgstate.accessedTLS = false;
STACKALIGN = TARGET_STACKALIGN;
regsave.reset();
memset(global87.stack.ptr,0,global87.stack.sizeof);
calledFinally = false;
usednteh = 0;
if (sfunc.Sfunc.Fflags3 & Fjmonitor &&
config.exe & EX_windos)
usednteh |= NTEHjmonitor;
// Set on a trial basis, turning it off if anything might throw
sfunc.Sfunc.Fflags3 |= Fnothrow;
floatreg = false;
assert(global87.stackused == 0); /* nobody in 8087 stack */
CSE.start();
memset(®con,0,regcon.sizeof);
regcon.cse.mval = regcon.cse.mops = 0; // no common subs yet
msavereg = 0;
uint nretblocks = 0;
mfuncreg = fregsaved; // so we can see which are used
// (bit is cleared each time
// we use one)
assert(!(needframe && mfuncreg & mBP)); // needframe needs mBP
for (block* b = startblock; b; b = b.Bnext)
{
memset(&b.Bregcon,0,b.Bregcon.sizeof); // Clear out values in registers
if (b.Belem)
resetEcomsub(b.Belem); // reset all the Ecomsubs
if (b.BC == BCasm)
anyiasm = 1; // we have inline assembler
if (b.BC == BCret || b.BC == BCretexp)
nretblocks++;
}
if (!config.fulltypes || (config.flags4 & CFG4optimized))
{
regm_t noparams = 0;
foreach (s; globsym[])
{
s.Sflags &= ~SFLread;
switch (s.Sclass)
{
case SC.fastpar:
case SC.shadowreg:
regcon.params |= s.Spregm();
goto case SC.parameter;
case SC.parameter:
if (s.Sfl == FLreg)
noparams |= s.Sregm;
break;
default:
break;
}
}
regcon.params &= ~noparams;
}
if (config.flags4 & CFG4optimized)
{
if (nretblocks == 0 && // if no return blocks in function
!(sfunc.ty() & mTYnaked)) // naked functions may have hidden veys of returning
sfunc.Sflags |= SFLexit; // mark function as never returning
assert(dfo);
cgreg_reset();
foreach (i, b; dfo[])
{
dfoidx = cast(int)i;
regcon.used = msavereg | regcon.cse.mval; // registers already in use
blcodgen(b); // gen code in depth-first order
//printf("b.Bregcon.used = %s\n", regm_str(b.Bregcon.used));
cgreg_used(dfoidx, b.Bregcon.used); // gather register used information
}
}
else
{
pass = BackendPass.final_;
for (block* b = startblock; b; b = b.Bnext)
blcodgen(b); // generate the code for each block
}
regcon.immed.mval = 0;
assert(!regcon.cse.mops); // should have all been used
// See which variables we can put into registers
if (pass != BackendPass.final_ &&
!anyiasm) // possible LEA or LES opcodes
{
allregs |= cod3_useBP(); // see if we can use EBP
// If pic code, but EBX was never needed
if (!(allregs & mask(PICREG)) && !gotref)
{
allregs |= mask(PICREG); // EBX can now be used
cgreg_assign(retsym);
pass = BackendPass.reg;
}
else if (cgreg_assign(retsym)) // if we found some registers
pass = BackendPass.reg;
else
pass = BackendPass.final_;
for (block* b = startblock; b; b = b.Bnext)
{
code_free(b.Bcode);
b.Bcode = null;
}
goto tryagain;
}
cgreg_term();
// See if we need to enforce a particular stack alignment
foreach (s; globsym[])
{
if (Symbol_Sisdead(*s, anyiasm))
continue;
switch (s.Sclass)
{
case SC.register:
case SC.auto_:
case SC.fastpar:
if (s.Sfl == FLreg)
break;
const sz = type_alignsize(s.Stype);
if (sz > STACKALIGN && (I64 || config.exe == EX_OSX))
{
STACKALIGN = sz;
enforcealign = true;
}
break;
default:
break;
}
}
stackoffsets(globsym, false); // compute final offsets of stack variables
cod5_prol_epi(); // see where to place prolog/epilog
CSE.finish(); // compute addresses and sizes of CSE saves
if (configv.addlinenumbers)
objmod.linnum(sfunc.Sfunc.Fstartline,sfunc.Sseg,Offset(sfunc.Sseg));
// Otherwise, jmp's to startblock will execute the prolog again
assert(!startblock.Bpred);
CodeBuilder cdbprolog; cdbprolog.ctor();
prolog(cdbprolog); // gen function start code
code *cprolog = cdbprolog.finish();
if (cprolog)
pinholeopt(cprolog,null); // optimize
funcoffset = Offset(sfunc.Sseg);
targ_size_t coffset = Offset(sfunc.Sseg);
if (eecontext.EEelem)
genEEcode();
for (block* b = startblock; b; b = b.Bnext)
{
// We couldn't do this before because localsize was unknown
switch (b.BC)
{
case BCret:
if (configv.addlinenumbers && b.Bsrcpos.Slinnum && !(sfunc.ty() & mTYnaked))
{
CodeBuilder cdb; cdb.ctor();
cdb.append(b.Bcode);
cdb.genlinnum(b.Bsrcpos);
b.Bcode = cdb.finish();
}
goto case BCretexp;
case BCretexp:
epilog(b);
break;
default:
if (b.Bflags & BFLepilog)
epilog(b);
break;
}
assignaddr(b); // assign addresses
pinholeopt(b.Bcode,b); // do pinhole optimization
if (b.Bflags & BFLprolog) // do function prolog
{
startoffset = coffset + calcblksize(cprolog) - funcoffset;
b.Bcode = cat(cprolog,b.Bcode);
}
cgsched_block(b);
b.Bsize = calcblksize(b.Bcode); // calculate block size
if (b.Balign)
{
targ_size_t u = b.Balign - 1;
coffset = (coffset + u) & ~u;
}
b.Boffset = coffset; /* offset of this block */
coffset += b.Bsize; /* offset of following block */
}
debug
debugw && printf("code addr complete\n");
// Do jump optimization
bool flag;
do
{
flag = false;
for (block* b = startblock; b; b = b.Bnext)
{
if (b.Bflags & BFLjmpoptdone) /* if no more jmp opts for this blk */
continue;
int i = branch(b,0); // see if jmp => jmp short
if (i) // if any bytes saved
{
b.Bsize -= i;
auto offset = b.Boffset + b.Bsize;
for (block* bn = b.Bnext; bn; bn = bn.Bnext)
{
if (bn.Balign)
{
targ_size_t u = bn.Balign - 1;
offset = (offset + u) & ~u;
}
bn.Boffset = offset;
offset += bn.Bsize;
}
coffset = offset;
flag = true;
}
}
if (!I16 && !(config.flags4 & CFG4optimized))
break; // use the long conditional jmps
} while (flag); // loop till no more bytes saved
debug
debugw && printf("code jump optimization complete\n");
if (usednteh & NTEH_try)
{
// Do this before code is emitted because we patch some instructions
nteh_filltables();
}
// Compute starting offset for switch tables
targ_size_t swoffset;
int jmpseg = -1;
if (config.flags & CFGromable)
{
jmpseg = 0;
swoffset = coffset;
}
// Emit the generated code
if (eecontext.EEcompile == 1)
{
codout(sfunc.Sseg,eecontext.EEcode,null);
code_free(eecontext.EEcode);
}
else
{
__gshared Barray!ubyte disasmBuf;
disasmBuf.reset();
for (block* b = startblock; b; b = b.Bnext)
{
if (b.BC == BCjmptab || b.BC == BCswitch)
{
if (jmpseg == -1)
{
jmpseg = objmod.jmpTableSegment(sfunc);
swoffset = Offset(jmpseg);
}
swoffset = _align(0,swoffset);
b.Btableoffset = swoffset; /* offset of sw tab */
swoffset += b.Btablesize;
}
jmpaddr(b.Bcode); /* assign jump addresses */
debug
if (debugc)
{
printf("Boffset = x%x, Bsize = x%x, Coffset = x%x\n",
cast(int)b.Boffset,cast(int)b.Bsize,cast(int)Offset(sfunc.Sseg));
if (b.Bcode)
printf( "First opcode of block is: %0x\n", b.Bcode.Iop );
}
if (b.Balign)
{ uint u = b.Balign;
uint nalign = (u - cast(uint)Offset(sfunc.Sseg)) & (u - 1);
cod3_align_bytes(sfunc.Sseg, nalign);
}
assert(b.Boffset == Offset(sfunc.Sseg));
codout(sfunc.Sseg,b.Bcode,configv.vasm ? &disasmBuf : null); // output code
}
if (coffset != Offset(sfunc.Sseg))
{
debug
printf("coffset = %d, Offset(sfunc.Sseg) = %d\n",cast(int)coffset,cast(int)Offset(sfunc.Sseg));
assert(0);
}
sfunc.Ssize = Offset(sfunc.Sseg) - funcoffset; // size of function
if (configv.vasm)
disassemble(disasmBuf[]); // disassemble the code
const nteh = usednteh & NTEH_try;
if (nteh)
{
assert(!(config.flags & CFGromable));
//printf("framehandleroffset = x%x, coffset = x%x\n",framehandleroffset,coffset);
objmod.reftocodeseg(sfunc.Sseg,framehandleroffset,coffset);
}
// Write out switch tables
for (block* b = startblock; b; b = b.Bnext)
{
switch (b.BC)
{
case BCjmptab: /* if jump table */
outjmptab(b); /* write out jump table */
goto default;
case BCswitch:
outswitab(b); /* write out switch table */
goto default;
case BCret:
case BCretexp:
/* Compute offset to return code from start of function */
retoffset = b.Boffset + b.Bsize - retsize - funcoffset;
/* Add 3 bytes to retoffset in case we have an exception
* handler. THIS PROBABLY NEEDS TO BE IN ANOTHER SPOT BUT
* IT FIXES THE PROBLEM HERE AS WELL.
*/
if (usednteh & NTEH_try)
retoffset += 3;
break;
default:
retoffset = b.Boffset + b.Bsize - funcoffset;
break;
}
}
if (configv.addlinenumbers && !(sfunc.ty() & mTYnaked))
/* put line number at end of function on the
start of the last instruction
*/
/* Instead, try offset to cleanup code */
if (retoffset < sfunc.Ssize)
objmod.linnum(sfunc.Sfunc.Fendline,sfunc.Sseg,funcoffset + retoffset);
static if (MARS)
{
if (config.exe == EX_WIN64)
win64_pdata(sfunc);
}
static if (MARS)
{
if (usednteh & NTEH_try)
{
// Do this before code is emitted because we patch some instructions
nteh_gentables(sfunc);
}
if (usednteh & (EHtry | EHcleanup) && // saw BCtry or BC_try or OPddtor
config.ehmethod == EHmethod.EH_DM)
{
except_gentables();
}
if (config.ehmethod == EHmethod.EH_DWARF)
{
sfunc.Sfunc.Fstartblock = startblock;
dwarf_except_gentables(sfunc, cast(uint)startoffset, cast(uint)retoffset);
sfunc.Sfunc.Fstartblock = null;
}
}
for (block* b = startblock; b; b = b.Bnext)
{
code_free(b.Bcode);
b.Bcode = null;
}
}
// Mask of regs saved
// BUG: do interrupt functions save BP?
tym_t functy = tybasic(sfunc.ty());
sfunc.Sregsaved = (functy == TYifunc) ? cast(regm_t) mBP : (mfuncreg | fregsaved);
debug
if (global87.stackused != 0)
printf("stackused = %d\n",global87.stackused);
assert(global87.stackused == 0); /* nobody in 8087 stack */
global87.save.dtor(); // clean up ndp save array
}
/*********************************************
* Align sections on the stack.
* base negative offset of section from frame pointer
* alignment alignment to use
* bias difference between where frame pointer points and the STACKALIGNed
* part of the stack
* Returns:
* base revised downward so it is aligned
*/
@trusted
targ_size_t alignsection(targ_size_t base, uint alignment, int bias)
{
assert(cast(long)base <= 0);
if (alignment > STACKALIGN)
alignment = STACKALIGN;
if (alignment)
{
long sz = cast(long)(-base + bias);
assert(sz >= 0);
sz &= (alignment - 1);
if (sz)
base -= alignment - sz;
}
return base;
}
/*******************************
* Generate code for a function start.
* Input:
* Offset(cseg) address of start of code
* Auto.alignment
* Output:
* Offset(cseg) adjusted for size of code generated
* EBPtoESP
* hasframe
* BPoff
*/
@trusted
void prolog(ref CodeBuilder cdb)
{
bool enter;
//printf("cod3.prolog() %s, needframe = %d, Auto.alignment = %d\n", funcsym_p.Sident.ptr, needframe, Auto.alignment);
debug debugw && printf("funcstart()\n");
regcon.immed.mval = 0; /* no values in registers yet */
version (FRAMEPTR)
EBPtoESP = 0;
else
EBPtoESP = -REGSIZE;
hasframe = 0;
bool pushds = false;
BPoff = 0;
bool pushalloc = false;
tym_t tyf = funcsym_p.ty();
tym_t tym = tybasic(tyf);
const farfunc = tyfarfunc(tym) != 0;
if (config.flags3 & CFG3ibt && !I16)
cdb.gen1(I32 ? ENDBR32 : ENDBR64);
// Special Intel 64 bit ABI prolog setup for variadic functions
Symbol *sv64 = null; // set to __va_argsave
if (I64 && variadic(funcsym_p.Stype))
{
/* The Intel 64 bit ABI scheme.
* abi_sysV_amd64.pdf
* Load arguments passed in registers into the varargs save area
* so they can be accessed by va_arg().
*/
/* Look for __va_argsave
*/
for (SYMIDX si = 0; si < globsym.length; si++)
{
Symbol *s = globsym[si];
if (s.Sident[0] == '_' && strcmp(s.Sident.ptr, "__va_argsave") == 0)
{
if (!(s.Sflags & SFLdead))
sv64 = s;
break;
}
}
}
if (config.flags & CFGalwaysframe ||
funcsym_p.Sfunc.Fflags3 & Ffakeeh ||
/* The exception stack unwinding mechanism relies on the EBP chain being intact,
* so need frame if function can possibly throw
*/
!(config.exe == EX_WIN32) && !(funcsym_p.Sfunc.Fflags3 & Fnothrow) ||
cgstate.accessedTLS ||
sv64
)
needframe = 1;
CodeBuilder cdbx; cdbx.ctor();
Lagain:
spoff = 0;
char guessneedframe = needframe;
int cfa_offset = 0;
// if (needframe && config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS) && !(usednteh & (NTEH_try | NTEH_except | NTEHcpp | EHcleanup | EHtry | NTEHpassthru)))
// usednteh |= NTEHpassthru;
/* Compute BP offsets for variables on stack.
* The organization is:
* Para.size parameters
* -------- stack is aligned to STACKALIGN
* seg of return addr (if far function)
* IP of return addr
* BP. caller's BP
* DS (if Windows prolog/epilog)
* exception handling context symbol
* Fast.size fastpar
* Auto.size autos and regs
* regsave.off any saved registers
* Foff floating register
* Alloca.size alloca temporary
* CSoff common subs
* NDPoff any 8087 saved registers
* monitor context record
* any saved registers
*/
if (tym == TYifunc)
Para.size = 26; // how is this number derived?
else
{
version (FRAMEPTR)
{
bool frame = needframe || tyf & mTYnaked;
Para.size = ((farfunc ? 2 : 1) + frame) * REGSIZE;
if (frame)
EBPtoESP = -REGSIZE;
}
else
Para.size = ((farfunc ? 2 : 1) + 1) * REGSIZE;
}
/* The real reason for the FAST section is because the implementation of contracts
* requires a consistent stack frame location for the 'this' pointer. But if varying
* stuff in Auto.offset causes different alignment for that section, the entire block can
* shift around, causing a crash in the contracts.
* Fortunately, the 'this' is always an SCfastpar, so we put the fastpar's in their
* own FAST section, which is never aligned at a size bigger than REGSIZE, and so
* its alignment never shifts around.
* But more work needs to be done, see Bugzilla 9200. Really, each section should be aligned
* individually rather than as a group.
*/
Fast.size = 0;
static if (NTEXCEPTIONS == 2)
{
Fast.size -= nteh_contextsym_size();
if (config.exe & EX_windos)
{
if (funcsym_p.Sfunc.Fflags3 & Ffakeeh && nteh_contextsym_size() == 0)
Fast.size -= 5 * 4;
}
}
/* Despite what the comment above says, aligning Fast section to size greater
* than REGSIZE does not break contract implementation. Fast.offset and
* Fast.alignment must be the same for the overriding and
* the overridden function, since they have the same parameters. Fast.size
* must be the same because otherwise, contract inheritance wouldn't work
* even if we didn't align Fast section to size greater than REGSIZE. Therefore,
* the only way aligning the section could cause problems with contract
* inheritance is if bias (declared below) differed for the overridden
* and the overriding function.
*
* Bias depends on Para.size and needframe. The value of Para.size depends on
* whether the function is an interrupt handler and whether it is a farfunc.
* DMD does not have _interrupt attribute and D does not make a distinction
* between near and far functions, so Para.size should always be 2 * REGSIZE
* for D.
*
* The value of needframe depends on a global setting that is only set
* during backend's initialization and on function flag Ffakeeh. On Windows,
* that flag is always set for virtual functions, for which contracts are
* defined and on other platforms, it is never set. Because of that
* the value of neadframe should always be the same for the overridden
* and the overriding function, and so bias should be the same too.
*/
version (FRAMEPTR)
int bias = enforcealign ? 0 : cast(int)(Para.size);
else
int bias = enforcealign ? 0 : cast(int)(Para.size + (needframe ? 0 : REGSIZE));
if (Fast.alignment < REGSIZE)
Fast.alignment = REGSIZE;
Fast.size = alignsection(Fast.size - Fast.offset, Fast.alignment, bias);
if (Auto.alignment < REGSIZE)
Auto.alignment = REGSIZE; // necessary because localsize must be REGSIZE aligned
Auto.size = alignsection(Fast.size - Auto.offset, Auto.alignment, bias);
regsave.off = alignsection(Auto.size - regsave.top, regsave.alignment, bias);
//printf("regsave.off = x%x, size = x%x, alignment = %x\n",
//cast(int)regsave.off, cast(int)(regsave.top), cast(int)regsave.alignment);
if (floatreg)
{
uint floatregsize = config.fpxmmregs || I32 ? 16 : DOUBLESIZE;
Foff = alignsection(regsave.off - floatregsize, STACKALIGN, bias);
//printf("Foff = x%x, size = x%x\n", cast(int)Foff, cast(int)floatregsize);
}
else
Foff = regsave.off;
Alloca.alignment = REGSIZE;
Alloca.offset = alignsection(Foff - Alloca.size, Alloca.alignment, bias);
CSoff = alignsection(Alloca.offset - CSE.size(), CSE.alignment(), bias);
//printf("CSoff = x%x, size = x%x, alignment = %x\n",
//cast(int)CSoff, CSE.size(), cast(int)CSE.alignment);
NDPoff = alignsection(CSoff - global87.save.length * tysize(TYldouble), REGSIZE, bias);
regm_t topush = fregsaved & ~mfuncreg; // mask of registers that need saving
pushoffuse = false;
pushoff = NDPoff;
/* We don't keep track of all the pushes and pops in a function. Hence,
* using POP REG to restore registers in the epilog doesn't work, because the Dwarf unwinder
* won't be setting ESP correctly. With pushoffuse, the registers are restored
* from EBP, which is kept track of properly.
*/
if ((config.flags4 & CFG4speed || config.ehmethod == EHmethod.EH_DWARF) && (I32 || I64))
{
/* Instead of pushing the registers onto the stack one by one,
* allocate space in the stack frame and copy/restore them there.
*/
int xmmtopush = popcnt(topush & XMMREGS); // XMM regs take 16 bytes
int gptopush = popcnt(topush) - xmmtopush; // general purpose registers to save
if (NDPoff || xmmtopush || cgstate.funcarg.size)
{
pushoff = alignsection(pushoff - (gptopush * REGSIZE + xmmtopush * 16),
xmmtopush ? STACKALIGN : REGSIZE, bias);
pushoffuse = true; // tell others we're using this strategy
}
}
//printf("Fast.size = x%x, Auto.size = x%x\n", cast(int)Fast.size, cast(int)Auto.size);
cgstate.funcarg.alignment = STACKALIGN;
/* If the function doesn't need the extra alignment, don't do it.
* Can expand on this by allowing for locals that don't need extra alignment
* and calling functions that don't need it.
*/
if (pushoff == 0 && !calledafunc && config.fpxmmregs && (I32 || I64))
{
cgstate.funcarg.alignment = I64 ? 8 : 4;
}
//printf("pushoff = %d, size = %d, alignment = %d, bias = %d\n", cast(int)pushoff, cast(int)cgstate.funcarg.size, cast(int)cgstate.funcarg.alignment, cast(int)bias);
cgstate.funcarg.offset = alignsection(pushoff - cgstate.funcarg.size, cgstate.funcarg.alignment, bias);
localsize = -cgstate.funcarg.offset;
//printf("Alloca.offset = x%llx, cstop = x%llx, CSoff = x%llx, NDPoff = x%llx, localsize = x%llx\n",
//(long long)Alloca.offset, (long long)CSE.size(), (long long)CSoff, (long long)NDPoff, (long long)localsize);
assert(cast(targ_ptrdiff_t)localsize >= 0);
// Keep the stack aligned by 8 for any subsequent function calls
if (!I16 && calledafunc &&
(STACKALIGN >= 16 || config.flags4 & CFG4stackalign))
{
int npush = popcnt(topush); // number of registers that need saving
npush += popcnt(topush & XMMREGS); // XMM regs take 16 bytes, so count them twice
if (pushoffuse)
npush = 0;
//printf("npush = %d Para.size = x%x needframe = %d localsize = x%x\n",
//npush, Para.size, needframe, localsize);
int sz = cast(int)(localsize + npush * REGSIZE);
if (!enforcealign)
{
version (FRAMEPTR)
sz += Para.size;
else
sz += Para.size + (needframe ? 0 : -REGSIZE);
}
if (sz & (STACKALIGN - 1))
localsize += STACKALIGN - (sz & (STACKALIGN - 1));
}
cgstate.funcarg.offset = -localsize;
//printf("Foff x%02x Auto.size x%02x NDPoff x%02x CSoff x%02x Para.size x%02x localsize x%02x\n",
//(int)Foff,(int)Auto.size,(int)NDPoff,(int)CSoff,(int)Para.size,(int)localsize);
uint xlocalsize = cast(uint)localsize; // amount to subtract from ESP to make room for locals
if (tyf & mTYnaked) // if no prolog/epilog for function
{
hasframe = 1;
return;
}
if (tym == TYifunc)
{
prolog_ifunc(cdbx,&tyf);
hasframe = 1;
cdb.append(cdbx);
goto Lcont;
}
/* Determine if we need BP set up */
if (enforcealign)
{
// we need BP to reset the stack before return
// otherwise the return address is lost
needframe = 1;
}
else if (config.flags & CFGalwaysframe)
needframe = 1;
else
{
if (localsize)
{
if (I16 ||
!(config.flags4 & CFG4speed) ||
config.target_cpu < TARGET_Pentium ||
farfunc ||
config.flags & CFGstack ||
xlocalsize >= 0x1000 ||
(usednteh & (NTEH_try | NTEH_except | NTEHcpp | EHcleanup | EHtry | NTEHpassthru)) ||
anyiasm ||
Alloca.size
)
{
needframe = 1;
}
}
if (refparam && (anyiasm || I16))
needframe = 1;
}
if (needframe)
{
assert(mfuncreg & mBP); // shouldn't have used mBP
if (!guessneedframe) // if guessed wrong
goto Lagain;
}
if (I16 && config.wflags & WFwindows && farfunc)
{
prolog_16bit_windows_farfunc(cdbx, &tyf, &pushds);
enter = false; // don't use ENTER instruction
hasframe = 1; // we have a stack frame
}
else if (needframe) // if variables or parameters
{
prolog_frame(cdbx, farfunc, xlocalsize, enter, cfa_offset);
hasframe = 1;
}
/* Align the stack if necessary */
prolog_stackalign(cdbx);
/* Subtract from stack pointer the size of the local stack frame
*/
if (config.flags & CFGstack) // if stack overflow check
{
prolog_frameadj(cdbx, tyf, xlocalsize, enter, &pushalloc);
if (Alloca.size)
prolog_setupalloca(cdbx);
}
else if (needframe) /* if variables or parameters */
{
if (xlocalsize) /* if any stack offset */
{
prolog_frameadj(cdbx, tyf, xlocalsize, enter, &pushalloc);
if (Alloca.size)
prolog_setupalloca(cdbx);
}
else
assert(Alloca.size == 0);
}
else if (xlocalsize)
{
assert(I32 || I64);
prolog_frameadj2(cdbx, tyf, xlocalsize, &pushalloc);
version (FRAMEPTR) { } else
BPoff += REGSIZE;
}
else
assert((localsize | Alloca.size) == 0 || (usednteh & NTEHjmonitor));
EBPtoESP += xlocalsize;
if (hasframe)
EBPtoESP += REGSIZE;
/* Win64 unwind needs the amount of code generated so far
*/
if (config.exe == EX_WIN64)
{
code *c = cdbx.peek();
pinholeopt(c, null);
prolog_allocoffset = calcblksize(c);
}
if (usednteh & NTEHjmonitor)
{ Symbol *sthis;
for (SYMIDX si = 0; 1; si++)
{ assert(si < globsym.length);
sthis = globsym[si];
if (strcmp(sthis.Sident.ptr,"this".ptr) == 0)
break;
}
nteh_monitor_prolog(cdbx,sthis);
EBPtoESP += 3 * 4;
}
cdb.append(cdbx);
prolog_saveregs(cdb, topush, cfa_offset);
Lcont:
if (config.exe == EX_WIN64)
{
if (variadic(funcsym_p.Stype))
prolog_gen_win64_varargs(cdb);
prolog_loadparams(cdb, tyf, pushalloc);
return;
}
prolog_ifunc2(cdb, tyf, tym, pushds);
static if (NTEXCEPTIONS == 2)
{
if (usednteh & NTEH_except)
nteh_setsp(cdb, 0x89); // MOV __context[EBP].esp,ESP
}
// Load register parameters off of the stack. Do not use
// assignaddr(), as it will replace the stack reference with
// the register!
prolog_loadparams(cdb, tyf, pushalloc);
if (sv64)
prolog_genvarargs(cdb, sv64);
/* Alignment checks
*/
//assert(Auto.alignment <= STACKALIGN);
//assert(((Auto.size + Para.size + BPoff) & (Auto.alignment - 1)) == 0);
}
/************************************
* Predicate for sorting auto symbols for qsort().
* Returns:
* < 0 s1 goes farther from frame pointer
* > 0 s1 goes nearer the frame pointer
* = 0 no difference
*/
@trusted
extern (C) int
autosort_cmp(scope const void *ps1, scope const void *ps2)
{
Symbol *s1 = *cast(Symbol **)ps1;
Symbol *s2 = *cast(Symbol **)ps2;
/* Largest align size goes furthest away from frame pointer,
* so they get allocated first.
*/
uint alignsize1 = Symbol_Salignsize(*s1);
uint alignsize2 = Symbol_Salignsize(*s2);
if (alignsize1 < alignsize2)
return 1;
else if (alignsize1 > alignsize2)
return -1;
/* move variables nearer the frame pointer that have higher Sweights
* because addressing mode is fewer bytes. Grouping together high Sweight
* variables also may put them in the same cache
*/
if (s1.Sweight < s2.Sweight)
return -1;
else if (s1.Sweight > s2.Sweight)
return 1;
/* More:
* 1. put static arrays nearest the frame pointer, so buffer overflows
* can't change other variable contents
* 2. Do the coloring at the byte level to minimize stack usage
*/
return 0;
}
/******************************
* Compute stack frame offsets for local variables.
* that did not make it into registers.
* Params:
* symtab = function's symbol table
* estimate = true for do estimate only, false for final
*/
@trusted
void stackoffsets(ref symtab_t symtab, bool estimate)
{
//printf("stackoffsets() %s\n", funcsym_p.Sident.ptr);
Para.initialize(); // parameter offset
Fast.initialize(); // SCfastpar offset
Auto.initialize(); // automatic & register offset
EEStack.initialize(); // for SCstack's
// Set if doing optimization of auto layout
bool doAutoOpt = estimate && config.flags4 & CFG4optimized;
// Put autos in another array so we can do optimizations on the stack layout
Symbol*[10] autotmp = void;
Symbol **autos = null;
if (doAutoOpt)
{
if (symtab.length <= autotmp.length)
autos = autotmp.ptr;
else
{ autos = cast(Symbol **)malloc(symtab.length * (*autos).sizeof);
assert(autos);
}
}
size_t autosi = 0; // number used in autos[]
for (int si = 0; si < symtab.length; si++)
{ Symbol *s = symtab[si];
/* Don't allocate space for dead or zero size parameters
*/
switch (s.Sclass)
{
case SC.fastpar:
if (!(funcsym_p.Sfunc.Fflags3 & Ffakeeh))
goto Ldefault; // don't need consistent stack frame
break;
case SC.parameter:
if (type_zeroSize(s.Stype, tybasic(funcsym_p.Stype.Tty)))
{
Para.offset = _align(REGSIZE,Para.offset); // align on word stack boundary
s.Soffset = Para.offset;
continue;
}
break; // allocate even if it's dead
case SC.shadowreg:
break; // allocate even if it's dead
default:
Ldefault:
if (Symbol_Sisdead(*s, anyiasm))
continue; // don't allocate space
break;
}
targ_size_t sz = type_size(s.Stype);
if (sz == 0)
sz++; // can't handle 0 length structs
uint alignsize = Symbol_Salignsize(*s);
if (alignsize > STACKALIGN)
alignsize = STACKALIGN; // no point if the stack is less aligned
//printf("symbol '%s', size = %d, alignsize = %d, read = %x\n",s.Sident.ptr, cast(int)sz, cast(int)alignsize, s.Sflags & SFLread);
assert(cast(int)sz >= 0);
switch (s.Sclass)
{
case SC.fastpar:
/* Get these
* right next to the stack frame pointer, EBP.
* Needed so we can call nested contract functions
* frequire and fensure.
*/
if (s.Sfl == FLreg) // if allocated in register
continue;
/* Needed because storing fastpar's on the stack in prolog()
* does the entire register
*/
if (sz < REGSIZE)
sz = REGSIZE;
Fast.offset = _align(sz,Fast.offset);
s.Soffset = Fast.offset;
Fast.offset += sz;
//printf("fastpar '%s' sz = %d, fast offset = x%x, %p\n", s.Sident, cast(int) sz, cast(int) s.Soffset, s);
if (alignsize > Fast.alignment)
Fast.alignment = alignsize;
break;
case SC.register:
case SC.auto_:
if (s.Sfl == FLreg) // if allocated in register
break;
if (doAutoOpt)
{ autos[autosi++] = s; // deal with later
break;
}
Auto.offset = _align(sz,Auto.offset);
s.Soffset = Auto.offset;
Auto.offset += sz;
//printf("auto '%s' sz = %d, auto offset = x%lx\n", s.Sident,sz, cast(long) s.Soffset);
if (alignsize > Auto.alignment)
Auto.alignment = alignsize;
break;
case SC.stack:
EEStack.offset = _align(sz,EEStack.offset);
s.Soffset = EEStack.offset;
//printf("EEStack.offset = x%lx\n",cast(long)s.Soffset);
EEStack.offset += sz;
break;
case SC.shadowreg:
case SC.parameter:
if (config.exe == EX_WIN64)
{
assert((Para.offset & 7) == 0);
s.Soffset = Para.offset;
Para.offset += 8;
break;
}
/* Alignment on OSX 32 is odd. reals are 16 byte aligned in general,
* but are 4 byte aligned on the OSX 32 stack.
*/
Para.offset = _align(REGSIZE,Para.offset); /* align on word stack boundary */
if (alignsize >= 16 &&
(I64 || (config.exe == EX_OSX &&
(tyaggregate(s.ty()) || tyvector(s.ty())))))
Para.offset = (Para.offset + (alignsize - 1)) & ~(alignsize - 1);
s.Soffset = Para.offset;
//printf("%s param offset = x%lx, alignsize = %d\n", s.Sident, cast(long) s.Soffset, cast(int) alignsize);
Para.offset += (s.Sflags & SFLdouble)
? type_size(tstypes[TYdouble]) // float passed as double
: type_size(s.Stype);
break;
case SC.pseudo:
case SC.static_:
case SC.bprel:
break;
default:
symbol_print(s);
assert(0);
}
}
if (autosi)
{
qsort(autos, autosi, (Symbol *).sizeof, &autosort_cmp);
vec_t tbl = vec_calloc(autosi);
for (size_t si = 0; si < autosi; si++)
{
Symbol *s = autos[si];
targ_size_t sz = type_size(s.Stype);
if (sz == 0)
sz++; // can't handle 0 length structs
uint alignsize = Symbol_Salignsize(*s);
if (alignsize > STACKALIGN)
alignsize = STACKALIGN; // no point if the stack is less aligned
/* See if we can share storage with another variable
* if their live ranges do not overlap.
*/
if (// Don't share because could stomp on variables
// used in finally blocks
!(usednteh & (NTEH_try | NTEH_except | NTEHcpp | EHcleanup | EHtry | NTEHpassthru)) &&
s.Srange && !(s.Sflags & SFLspill))
{
for (size_t i = 0; i < si; i++)
{
if (!vec_testbit(i,tbl))
continue;
Symbol *sp = autos[i];
//printf("auto s = '%s', sp = '%s', %d, %d, %d\n",s.Sident,sp.Sident,dfo.length,vec_numbits(s.Srange),vec_numbits(sp.Srange));
if (vec_disjoint(s.Srange,sp.Srange) &&
!(sp.Soffset & (alignsize - 1)) &&
sz <= type_size(sp.Stype))
{
vec_or(sp.Srange,sp.Srange,s.Srange);
//printf("sharing space - '%s' onto '%s'\n",s.Sident,sp.Sident);
s.Soffset = sp.Soffset;
goto L2;
}
}
}
Auto.offset = _align(sz,Auto.offset);
s.Soffset = Auto.offset;
//printf("auto '%s' sz = %d, auto offset = x%lx\n", s.Sident, sz, cast(long) s.Soffset);
Auto.offset += sz;
if (s.Srange && !(s.Sflags & SFLspill))
vec_setbit(si,tbl);
if (alignsize > Auto.alignment)
Auto.alignment = alignsize;
L2: { }
}
vec_free(tbl);
if (autos != autotmp.ptr)
free(autos);
}
}
/****************************
* Generate code for a block.
*/
@trusted
private void blcodgen(block *bl)
{
regm_t mfuncregsave = mfuncreg;
//dbg_printf("blcodgen(%p)\n",bl);
/* Determine existing immediate values in registers by ANDing
together the values from all the predecessors of b.
*/
assert(bl.Bregcon.immed.mval == 0);
regcon.immed.mval = 0; // assume no previous contents in registers
// regcon.cse.mval = 0;
foreach (bpl; ListRange(bl.Bpred))
{
block *bp = list_block(bpl);
if (bpl == bl.Bpred)
{ regcon.immed = bp.Bregcon.immed;
regcon.params = bp.Bregcon.params;
// regcon.cse = bp.Bregcon.cse;
}
else
{
int i;
regcon.params &= bp.Bregcon.params;
if ((regcon.immed.mval &= bp.Bregcon.immed.mval) != 0)
// Actual values must match, too
for (i = 0; i < REGMAX; i++)
{
if (regcon.immed.value[i] != bp.Bregcon.immed.value[i])
regcon.immed.mval &= ~mask(i);
}
}
}
regcon.cse.mops &= regcon.cse.mval;
// Set regcon.mvar according to what variables are in registers for this block
CodeBuilder cdb; cdb.ctor();
regcon.mvar = 0;
regcon.mpvar = 0;
regcon.indexregs = 1;
int anyspill = 0;
char *sflsave = null;
if (config.flags4 & CFG4optimized)
{
CodeBuilder cdbload; cdbload.ctor();
CodeBuilder cdbstore; cdbstore.ctor();
sflsave = cast(char *) alloca(globsym.length * char.sizeof);
for (SYMIDX i = 0; i < globsym.length; i++)
{
Symbol *s = globsym[i];
sflsave[i] = s.Sfl;
if (regParamInPreg(s) &&
regcon.params & s.Spregm() &&
vec_testbit(dfoidx,s.Srange))
{
// regcon.used |= s.Spregm();
}
if (s.Sfl == FLreg)
{
if (vec_testbit(dfoidx,s.Srange))
{
regcon.mvar |= s.Sregm;
if (s.Sclass == SC.fastpar || s.Sclass == SC.shadowreg)
regcon.mpvar |= s.Sregm;
}
}
else if (s.Sflags & SFLspill)
{
if (vec_testbit(dfoidx,s.Srange))
{
anyspill = cast(int)(i + 1);
cgreg_spillreg_prolog(bl,s,cdbstore,cdbload);
if (vec_testbit(dfoidx,s.Slvreg))
{
s.Sfl = FLreg;
regcon.mvar |= s.Sregm;
regcon.cse.mval &= ~s.Sregm;
regcon.immed.mval &= ~s.Sregm;
regcon.params &= ~s.Sregm;
if (s.Sclass == SC.fastpar || s.Sclass == SC.shadowreg)
regcon.mpvar |= s.Sregm;
}
}
}
}
if ((regcon.cse.mops & regcon.cse.mval) != regcon.cse.mops)
{
cse_save(cdb,regcon.cse.mops & ~regcon.cse.mval);
}
cdb.append(cdbstore);
cdb.append(cdbload);
mfuncreg &= ~regcon.mvar; // use these registers
regcon.used |= regcon.mvar;
// Determine if we have more than 1 uncommitted index register
regcon.indexregs = IDXREGS & ~regcon.mvar;
regcon.indexregs &= regcon.indexregs - 1;
}
/* This doesn't work when calling the BC_finally function,
* as it is one block calling another.
*/
//regsave.idx = 0;
reflocal = 0;
int refparamsave = refparam;
refparam = 0;
assert((regcon.cse.mops & regcon.cse.mval) == regcon.cse.mops);
outblkexitcode(cdb, bl, anyspill, sflsave, &retsym, mfuncregsave);
bl.Bcode = cdb.finish();
for (int i = 0; i < anyspill; i++)
{
Symbol *s = globsym[i];
s.Sfl = sflsave[i]; // undo block register assignments
}
if (reflocal)
bl.Bflags |= BFLreflocal;
if (refparam)
bl.Bflags |= BFLrefparam;
refparam |= refparamsave;
bl.Bregcon.immed = regcon.immed;
bl.Bregcon.cse = regcon.cse;
bl.Bregcon.used = regcon.used;
bl.Bregcon.params = regcon.params;
debug
debugw && printf("code gen complete\n");
}
/******************************
* Given a register mask, find and return the number
* of the first register that fits.
*/
@trusted
reg_t findreg(regm_t regm)
{
return findreg(regm, __LINE__, __FILE__);
}
@trusted
reg_t findreg(regm_t regm, int line, const(char)* file)
{
debug
regm_t regmsave = regm;
reg_t i = 0;
while (1)
{
if (!(regm & 0xF))
{
regm >>= 4;
i += 4;
if (!regm)
break;
}
if (regm & 1)
return i;
regm >>= 1;
i++;
}
debug
printf("findreg(%s, line=%d, file='%s', function = '%s')\n",regm_str(regmsave),line,file,funcsym_p.Sident.ptr);
fflush(stdout);
// *(char*)0=0;
assert(0);
}
/***************
* Free element (but not its leaves! (assume they are already freed))
* Don't decrement Ecount! This is so we can detect if the common subexp
* has already been evaluated.
* If common subexpression is not required anymore, eliminate
* references to it.
*/
@trusted
void freenode(elem *e)
{
elem_debug(e);
//dbg_printf("freenode(%p) : comsub = %d, count = %d\n",e,e.Ecomsub,e.Ecount);
if (e.Ecomsub--) return; /* usage count */
if (e.Ecount) /* if it was a CSE */
{
for (size_t i = 0; i < regcon.cse.value.length; i++)
{
if (regcon.cse.value[i] == e) /* if a register is holding it */
{
regcon.cse.mval &= ~mask(cast(uint)i);
regcon.cse.mops &= ~mask(cast(uint)i); /* free masks */
}
}
CSE.remove(e);
}
}
/*********************************
* Reset Ecomsub for all elem nodes, i.e. reverse the effects of freenode().
*/
@trusted
private void resetEcomsub(elem *e)
{
while (1)
{
elem_debug(e);
e.Ecomsub = e.Ecount;
const op = e.Eoper;
if (!OTleaf(op))
{
if (OTbinary(op))
resetEcomsub(e.EV.E2);
e = e.EV.E1;
}
else
break;
}
}
/*********************************
* Determine if elem e is a register variable.
* Params:
* e = a register variable
* pregm = set to mask of registers that make up the variable otherwise not changed
* reg = the least significant register in pregm, otherwise not changed
* Returns:
* true if register variable
*/
@trusted
bool isregvar(elem *e, ref regm_t pregm, ref reg_t preg)
{
regm_t regm;
reg_t reg;
elem_debug(e);
if (e.Eoper == OPvar || e.Eoper == OPrelconst)
{
Symbol* s = e.EV.Vsym;
switch (s.Sfl)
{
case FLreg:
if (s.Sclass == SC.parameter)
{ refparam = true;
reflocal = true;
}
reg = e.EV.Voffset == REGSIZE ? s.Sregmsw : s.Sreglsw;
regm = s.Sregm;
//assert(tyreg(s.ty()));
static if (0)
{
// Let's just see if there is a CSE in a reg we can use
// instead. This helps avoid AGI's.
if (e.Ecount && e.Ecount != e.Ecomsub)
{
foreach (i; 0 .. arraysize(regcon.cse.value))
{
if (regcon.cse.value[i] == e)
{ reg = i;
break;
}
}
}
}
assert(regm & regcon.mvar && !(regm & ~regcon.mvar));
preg = reg;
pregm = regm;
return true;
case FLpseudo:
uint u = s.Sreglsw;
regm_t m = mask(u);
if (m & ALLREGS && (u & ~3) != 4) // if not BP,SP,EBP,ESP,or ?H
{
preg = u & 7;
pregm = m;
return true;
}
break;
default:
break;
}
}
return false;
}
/*********************************
* Allocate some registers.
* Input:
* pretregs Pointer to mask of registers to make selection from.
* tym Mask of type we will store in registers.
* Output:
* *pretregs Mask of allocated registers.
* *preg Register number of first allocated register.
* msavereg,mfuncreg retregs bits are cleared.
* regcon.cse.mval,regcon.cse.mops updated
* Returns:
* pointer to code generated if necessary to save any regcon.cse.mops on the
* stack.
*/
void allocreg(ref CodeBuilder cdb,regm_t *pretregs,reg_t *preg,tym_t tym)
{
allocreg(cdb, pretregs, preg, tym, __LINE__, __FILE__);
}
@trusted
void allocreg(ref CodeBuilder cdb,regm_t *pretregs,reg_t *preg,tym_t tym
,int line,const(char)* file)
{
reg_t reg;
static if (0)
{
if (pass == BackendPass.final_)
{
printf("allocreg %s,%d: regcon.mvar %s regcon.cse.mval %s msavereg %s *pretregs %s tym %s\n",
file,line,regm_str(regcon.mvar),regm_str(regcon.cse.mval),
regm_str(msavereg),regm_str(*pretregs),tym_str(tym));
}
}
tym = tybasic(tym);
uint size = _tysize[tym];
*pretregs &= mES | allregs | XMMREGS;
regm_t retregs = *pretregs;
debug if (retregs == 0)
printf("allocreg: file %s(%d)\n", file, line);
if ((retregs & regcon.mvar) == retregs) // if exactly in reg vars
{
if (size <= REGSIZE || (retregs & XMMREGS))
{
*preg = findreg(retregs);
assert(retregs == mask(*preg)); /* no more bits are set */
}
else if (size <= 2 * REGSIZE)
{
*preg = findregmsw(retregs);
assert(retregs & mLSW);
}
else
assert(0);
getregs(cdb,retregs);
return;
}
int count = 0;
L1:
//printf("L1: allregs = %s, *pretregs = %s\n", regm_str(allregs), regm_str(*pretregs));
assert(++count < 20); /* fail instead of hanging if blocked */
assert(retregs);
reg_t msreg = NOREG, lsreg = NOREG; /* no value assigned yet */
L3:
//printf("L2: allregs = %s, *pretregs = %s\n", regm_str(allregs), regm_str(*pretregs));
regm_t r = retregs & ~(msavereg | regcon.cse.mval | regcon.params);
if (!r)
{
r = retregs & ~(msavereg | regcon.cse.mval);
if (!r)
{
r = retregs & ~(msavereg | regcon.cse.mops);
if (!r)
{ r = retregs & ~msavereg;
if (!r)
r = retregs;
}
}
}
if (size <= REGSIZE || retregs & XMMREGS)
{
if (r & ~mBP)
r &= ~mBP;
// If only one index register, prefer to not use LSW registers
if (!regcon.indexregs && r & ~mLSW)
r &= ~mLSW;
if (pass == BackendPass.final_ && r & ~lastretregs && !I16)
{ // Try not to always allocate the same register,
// to schedule better
r &= ~lastretregs;
if (r & ~last2retregs)
{
r &= ~last2retregs;
if (r & ~last3retregs)
{
r &= ~last3retregs;
if (r & ~last4retregs)
{
r &= ~last4retregs;
// if (r & ~last5retregs)
// r &= ~last5retregs;
}
}
}
if (r & ~mfuncreg)
r &= ~mfuncreg;
}
reg = findreg(r);
retregs = mask(reg);
}
else if (size <= 2 * REGSIZE)
{
/* Select pair with both regs free. Failing */
/* that, select pair with one reg free. */
if (r & mBP)
{
retregs &= ~mBP;
goto L3;
}
if (r & mMSW)
{
if (r & mDX)
msreg = DX; /* prefer to use DX over CX */
else
msreg = findregmsw(r);
r &= mLSW; /* see if there's an LSW also */
if (r)
lsreg = findreg(r);
else if (lsreg == NOREG) /* if don't have LSW yet */
{
retregs &= mLSW;
goto L3;
}
}
else
{
if (I64 && !(r & mLSW))
{
retregs = *pretregs & (mMSW | mLSW);
assert(retregs);
goto L1;
}
lsreg = findreglsw(r);
if (msreg == NOREG)
{
retregs &= mMSW;
assert(retregs);
goto L3;
}
}
reg = (msreg == ES) ? lsreg : msreg;
retregs = mask(msreg) | mask(lsreg);
}
else if (I16 && (tym == TYdouble || tym == TYdouble_alias))
{
debug
if (retregs != DOUBLEREGS)
printf("retregs = %s, *pretregs = %s\n", regm_str(retregs), regm_str(*pretregs));
assert(retregs == DOUBLEREGS);
reg = AX;
}
else
{
debug
{
printf("%s\nallocreg: fil %s lin %d, regcon.mvar %s msavereg %s *pretregs %s, reg %d, tym x%x\n",
tym_str(tym),file,line,regm_str(regcon.mvar),regm_str(msavereg),regm_str(*pretregs),*preg,tym);
}
assert(0);
}
if (retregs & regcon.mvar) // if conflict with reg vars
{
if (!(size > REGSIZE && *pretregs == (mAX | mDX)))
{
retregs = (*pretregs &= ~(retregs & regcon.mvar));
goto L1; // try other registers
}
}
*preg = reg;
*pretregs = retregs;
//printf("Allocating %s\n",regm_str(retregs));
last5retregs = last4retregs;
last4retregs = last3retregs;
last3retregs = last2retregs;
last2retregs = lastretregs;
lastretregs = retregs;
getregs(cdb, retregs);
}
/*****************************************
* Allocate a scratch register.
* Params:
* cdb = where to write any generated code to
* regm = mask of registers to pick one from
* Returns:
* selected register
*/
@trusted
reg_t allocScratchReg(ref CodeBuilder cdb, regm_t regm)
{
reg_t r;
allocreg(cdb, ®m, &r, TYoffset);
return r;
}
/******************************
* Determine registers that should be destroyed upon arrival
* to code entry point for exception handling.
*/
@trusted
regm_t lpadregs()
{
regm_t used;
if (config.ehmethod == EHmethod.EH_DWARF)
used = allregs & ~mfuncreg;
else
used = (I32 | I64) ? allregs : (ALLREGS | mES);
//printf("lpadregs(): used=%s, allregs=%s, mfuncreg=%s\n", regm_str(used), regm_str(allregs), regm_str(mfuncreg));
return used;
}
/*************************
* Mark registers as used.
*/
@trusted
void useregs(regm_t regm)
{
//printf("useregs(x%x) %s\n", regm, regm_str(regm));
mfuncreg &= ~regm;
regcon.used |= regm; // registers used in this block
regcon.params &= ~regm;
if (regm & regcon.mpvar) // if modified a fastpar register variable
regcon.params = 0; // toss them all out
}
/*************************
* We are going to use the registers in mask r.
* Generate any code necessary to save any regs.
*/
@trusted
void getregs(ref CodeBuilder cdb, regm_t r)
{
//printf("getregs(x%x) %s\n", r, regm_str(r));
regm_t ms = r & regcon.cse.mops; // mask of common subs we must save
useregs(r);
regcon.cse.mval &= ~r;
msavereg &= ~r; // regs that are destroyed
regcon.immed.mval &= ~r;
if (ms)
cse_save(cdb, ms);
}
/*************************
* We are going to use the registers in mask r.
* Same as getregs(), but assert if code is needed to be generated.
*/
@trusted
void getregsNoSave(regm_t r)
{
//printf("getregsNoSave(x%x) %s\n", r, regm_str(r));
assert(!(r & regcon.cse.mops)); // mask of common subs we must save
useregs(r);
regcon.cse.mval &= ~r;
msavereg &= ~r; // regs that are destroyed
regcon.immed.mval &= ~r;
}
/*****************************************
* Copy registers in cse.mops into memory.
*/
@trusted
private void cse_save(ref CodeBuilder cdb, regm_t ms)
{
assert((ms & regcon.cse.mops) == ms);
regcon.cse.mops &= ~ms;
/* Skip CSEs that are already saved */
for (regm_t regm = 1; regm < mask(NUMREGS); regm <<= 1)
{
if (regm & ms)
{
const e = regcon.cse.value[findreg(regm)];
const sz = tysize(e.Ety);
foreach (const ref cse; CSE.filter(e))
{
if (sz <= REGSIZE ||
sz <= 2 * REGSIZE &&
(regm & mMSW && cse.regm & mMSW ||
regm & mLSW && cse.regm & mLSW) ||
sz == 4 * REGSIZE && regm == cse.regm
)
{
ms &= ~regm;
if (!ms)
return;
break;
}
}
}
}
while (ms)
{
auto cse = CSE.add();
reg_t reg = findreg(ms); /* the register to save */
cse.e = regcon.cse.value[reg];
cse.regm = mask(reg);
ms &= ~mask(reg); /* turn off reg bit in ms */
// If we can simply reload the CSE, we don't need to save it
if (cse_simple(&cse.csimple, cse.e))
cse.flags |= CSEsimple;
else
{
CSE.updateSizeAndAlign(cse.e);
gen_storecse(cdb, cse.e.Ety, reg, cse.slot);
reflocal = true;
}
}
}
/******************************************
* Getregs without marking immediate register values as gone.
*/
@trusted
void getregs_imm(ref CodeBuilder cdb, regm_t r)
{
regm_t save = regcon.immed.mval;
getregs(cdb,r);
regcon.immed.mval = save;
}
/******************************************
* Flush all CSE's out of registers and into memory.
* Input:
* do87 !=0 means save 87 registers too
*/
@trusted
void cse_flush(ref CodeBuilder cdb, int do87)
{
//dbg_printf("cse_flush()\n");
cse_save(cdb,regcon.cse.mops); // save any CSEs to memory
if (do87)
save87(cdb); // save any 8087 temporaries
}
/*************************
* Common subexpressions exist in registers. Note this in regcon.cse.mval.
* Input:
* e the subexpression
* regm mask of registers holding it
* opsflag if != 0 then regcon.cse.mops gets set too
* Returns:
* false not saved as a CSE
* true saved as a CSE
*/
@trusted
bool cssave(elem *e,regm_t regm,uint opsflag)
{
bool result = false;
/*if (e.Ecount && e.Ecount == e.Ecomsub)*/
if (e.Ecount && e.Ecomsub)
{
if (!opsflag && pass != BackendPass.final_ && (I32 || I64))
return false;
//printf("cssave(e = %p, regm = %s, opsflag = x%x)\n", e, regm_str(regm), opsflag);
regm &= mBP | ALLREGS | mES | XMMREGS; /* just to be sure */
/+
/* Do not register CSEs if they are register variables and */
/* are not operator nodes. This forces the register allocation */
/* to go through allocreg(), which will prevent using register */
/* variables for scratch. */
if (opsflag || !(regm & regcon.mvar))
+/
for (uint i = 0; regm; i++)
{
regm_t mi = mask(i);
if (regm & mi)
{
regm &= ~mi;
// If we don't need this CSE, and the register already
// holds a CSE that we do need, don't mark the new one
if (regcon.cse.mval & mi && regcon.cse.value[i] != e &&
!opsflag && regcon.cse.mops & mi)
continue;
regcon.cse.mval |= mi;
if (opsflag)
regcon.cse.mops |= mi;
//printf("cssave set: regcon.cse.value[%s] = %p\n",regstring[i],e);
regcon.cse.value[i] = e;
result = true;
}
}
}
return result;
}
/*************************************
* Determine if a computation should be done into a register.
*/
@trusted
bool evalinregister(elem *e)
{
if (config.exe == EX_WIN64 && e.Eoper == OPrelconst)
return true;
if (e.Ecount == 0) /* elem is not a CSE, therefore */
/* we don't need to evaluate it */
/* in a register */
return false;
if (!OTleaf(e.Eoper)) /* operators are always in register */
return true;
// Need to rethink this code if float or double can be CSE'd
uint sz = tysize(e.Ety);
if (e.Ecount == e.Ecomsub) /* elem is a CSE that needs */
/* to be generated */
{
if ((I32 || I64) &&
//pass == BackendPass.final_ && // bug 8987
sz <= REGSIZE)
{
// Do it only if at least 2 registers are available
regm_t m = allregs & ~regcon.mvar;
if (sz == 1)
m &= BYTEREGS;
if (m & (m - 1)) // if more than one register
{ // Need to be at least 3 registers available, as
// addressing modes can use up 2.
while (!(m & 1))
m >>= 1;
m >>= 1;
if (m & (m - 1))
return true;
}
}
return false;
}
/* Elem is now a CSE that might have been generated. If so, and */
/* it's in a register already, the computation should be done */
/* using that register. */
regm_t emask = 0;
for (uint i = 0; i < regcon.cse.value.length; i++)
if (regcon.cse.value[i] == e)
emask |= mask(i);
emask &= regcon.cse.mval; // mask of available CSEs
if (sz <= REGSIZE)
return emask != 0; /* the CSE is in a register */
else if (sz <= 2 * REGSIZE)
return (emask & mMSW) && (emask & mLSW);
return true; /* cop-out for now */
}
/*******************************************************
* Return mask of scratch registers.
*/
@trusted
regm_t getscratch()
{
regm_t scratch = 0;
if (pass == BackendPass.final_)
{
scratch = allregs & ~(regcon.mvar | regcon.mpvar | regcon.cse.mval |
regcon.immed.mval | regcon.params | mfuncreg);
}
return scratch;
}
/******************************
* Evaluate an elem that is a common subexp that has been encountered
* before.
* Look first to see if it is already in a register.
* Params:
* cdb = sink for generated code
* e = the elem
* pretregs = input is mask of registers, output is result register
*/
@trusted
private void comsub(ref CodeBuilder cdb,elem *e, ref regm_t pretregs)
{
tym_t tym;
regm_t regm,emask;
reg_t reg;
uint byte_,sz;
//printf("comsub(e = %p, pretregs = %s)\n",e,regm_str(pretregs));
elem_debug(e);
debug
{
if (e.Ecomsub > e.Ecount)
elem_print(e);
}
assert(e.Ecomsub <= e.Ecount);
if (pretregs == 0) // no possible side effects anyway
{
return;
}
/* First construct a mask, emask, of all the registers that
* have the right contents.
*/
emask = 0;
for (uint i = 0; i < regcon.cse.value.length; i++)
{
//dbg_printf("regcon.cse.value[%d] = %p\n",i,regcon.cse.value[i]);
if (regcon.cse.value[i] == e) // if contents are right
emask |= mask(i); // turn on bit for reg
}
emask &= regcon.cse.mval; // make sure all bits are valid
if (emask & XMMREGS && pretregs == mPSW)
{ }
else if (tyxmmreg(e.Ety) && config.fpxmmregs)
{
if (pretregs & (mST0 | mST01))
{
regm_t retregs = pretregs & mST0 ? XMMREGS : mXMM0 | mXMM1;
comsub(cdb, e, retregs);
fixresult(cdb,e,retregs,&pretregs);
return;
}
}
else if (tyfloating(e.Ety) && config.inline8087)
{
comsub87(cdb,e,&pretregs);
return;
}
/* create mask of CSEs */
regm_t csemask = CSE.mask(e);
csemask &= ~emask; // stuff already in registers
debug if (debugw)
{
printf("comsub(e=%p): pretregs=%s, emask=%s, csemask=%s, regcon.cse.mval=%s, regcon.mvar=%s\n",
e,regm_str(pretregs),regm_str(emask),regm_str(csemask),
regm_str(regcon.cse.mval),regm_str(regcon.mvar));
if (regcon.cse.mval & 1)
elem_print(regcon.cse.value[0]);
}
tym = tybasic(e.Ety);
sz = _tysize[tym];
byte_ = sz == 1;
if (sz <= REGSIZE || (tyxmmreg(tym) && config.fpxmmregs)) // if data will fit in one register
{
/* First see if it is already in a correct register */
regm = emask & pretregs;
if (regm == 0)
regm = emask; /* try any other register */
if (regm) /* if it's in a register */
{
if (!OTleaf(e.Eoper) || !(regm & regcon.mvar) || (pretregs & regcon.mvar) == pretregs)
{
regm = mask(findreg(regm));
fixresult(cdb,e,regm,&pretregs);
return;
}
}
if (OTleaf(e.Eoper)) /* if not op or func */
goto reload; /* reload data */
foreach (ref cse; CSE.filter(e))
{
regm_t retregs;
if (cse.flags & CSEsimple)
{
retregs = pretregs;
if (byte_ && !(retregs & BYTEREGS))
retregs = BYTEREGS;
else if (!(retregs & allregs))
retregs = allregs;
allocreg(cdb,&retregs,®,tym);
code *cr = &cse.csimple;
cr.setReg(reg);
if (I64 && reg >= 4 && tysize(cse.e.Ety) == 1)
cr.Irex |= REX;
cdb.gen(cr);
goto L10;
}
else
{
reflocal = true;
cse.flags |= CSEload;
if (pretregs == mPSW) // if result in CCs only
{
if (config.fpxmmregs && (tyxmmreg(cse.e.Ety) || tyvector(cse.e.Ety)))
{
retregs = XMMREGS;
allocreg(cdb,&retregs,®,tym);
gen_loadcse(cdb, cse.e.Ety, reg, cse.slot);
regcon.cse.mval |= mask(reg); // cs is in a reg
regcon.cse.value[reg] = e;
fixresult(cdb,e,retregs,&pretregs);
}
else
{
// CMP cs[BP],0
gen_testcse(cdb, cse.e.Ety, sz, cse.slot);
}
}
else
{
retregs = pretregs;
if (byte_ && !(retregs & BYTEREGS))
retregs = BYTEREGS;
allocreg(cdb,&retregs,®,tym);
gen_loadcse(cdb, cse.e.Ety, reg, cse.slot);
L10:
regcon.cse.mval |= mask(reg); // cs is in a reg
regcon.cse.value[reg] = e;
fixresult(cdb,e,retregs,&pretregs);
}
}
return;
}
debug
{
printf("couldn't find cse e = %p, pass = %d\n",e,pass);
elem_print(e);
}
assert(0); /* should have found it */
}
else /* reg pair is req'd */
if (sz <= 2 * REGSIZE)
{
reg_t msreg,lsreg;
/* see if we have both */
if (!((emask | csemask) & mMSW && (emask | csemask) & (mLSW | mBP)))
{ /* we don't have both */
debug if (!OTleaf(e.Eoper))
{
printf("e = %p, op = x%x, emask = %s, csemask = %s\n",
e,e.Eoper,regm_str(emask),regm_str(csemask));
//printf("mMSW = x%x, mLSW = x%x\n", mMSW, mLSW);
elem_print(e);
}
assert(OTleaf(e.Eoper)); /* must have both for operators */
goto reload;
}
/* Look for right vals in any regs */
regm = pretregs & mMSW;
if (emask & regm)
msreg = findreg(emask & regm);
else if (emask & mMSW)
msreg = findregmsw(emask);
else /* reload from cse array */
{
if (!regm)
regm = mMSW & ALLREGS;
allocreg(cdb,®m,&msreg,TYint);
loadcse(cdb,e,msreg,mMSW);
}
regm = pretregs & (mLSW | mBP);
if (emask & regm)
lsreg = findreg(emask & regm);
else if (emask & (mLSW | mBP))
lsreg = findreglsw(emask);
else
{
if (!regm)
regm = mLSW;
allocreg(cdb,®m,&lsreg,TYint);
loadcse(cdb,e,lsreg,mLSW | mBP);
}
regm = mask(msreg) | mask(lsreg); /* mask of result */
fixresult(cdb,e,regm,&pretregs);
return;
}
else if (tym == TYdouble || tym == TYdouble_alias) // double
{
assert(I16);
if (((csemask | emask) & DOUBLEREGS_16) == DOUBLEREGS_16)
{
static const reg_t[4] dblreg = [ BX,DX,NOREG,CX ]; // duplicate of one in cod4.d
for (reg = 0; reg != NOREG; reg = dblreg[reg])
{
assert(cast(int) reg >= 0 && reg <= 7);
if (mask(reg) & csemask)
loadcse(cdb,e,reg,mask(reg));
}
regm = DOUBLEREGS_16;
fixresult(cdb,e,regm,&pretregs);
return;
}
if (OTleaf(e.Eoper)) goto reload;
debug
printf("e = %p, csemask = %s, emask = %s\n",e,regm_str(csemask),regm_str(emask));
assert(0);
}
else
{
debug
printf("e = %p, tym = x%x\n",e,tym);
assert(0);
}
reload: /* reload result from memory */
switch (e.Eoper)
{
case OPrelconst:
cdrelconst(cdb,e,&pretregs);
break;
case OPgot:
if (config.exe & EX_posix)
{
cdgot(cdb,e,&pretregs);
break;
}
goto default;
default:
if (pretregs == mPSW &&
config.fpxmmregs &&
(tyxmmreg(tym) || tysimd(tym)))
{
regm_t retregs = XMMREGS | mPSW;
loaddata(cdb,e,&retregs);
cssave(e,retregs,false);
return;
}
loaddata(cdb,e,&pretregs);
break;
}
cssave(e,pretregs,false);
}
/*****************************
* Load reg from cse save area on stack.
*/
@trusted
private void loadcse(ref CodeBuilder cdb,elem *e,reg_t reg,regm_t regm)
{
foreach (ref cse; CSE.filter(e))
{
//printf("CSE[%d] = %p, regm = %s\n", i, cse.e, regm_str(cse.regm));
if (cse.regm & regm)
{
reflocal = true;
cse.flags |= CSEload; /* it was loaded */
regcon.cse.value[reg] = e;
regcon.cse.mval |= mask(reg);
getregs(cdb,mask(reg));
gen_loadcse(cdb, cse.e.Ety, reg, cse.slot);
return;
}
}
debug
{
printf("loadcse(e = %p, reg = %d, regm = %s)\n",e,reg,regm_str(regm));
elem_print(e);
}
assert(0);
}
/***************************
* Generate code sequence for an elem.
* Input:
* pretregs = mask of possible registers to return result in
* Note: longs are in AX,BX or CX,DX or SI,DI
* doubles are AX,BX,CX,DX only
* constflag = 1 for user of result will not modify the
* registers returned in *pretregs.
* 2 for freenode() not called.
* Output:
* *pretregs mask of registers result is returned in
* Returns:
* pointer to code sequence generated
*/
@trusted
void callcdxxx(ref CodeBuilder cdb, elem *e, regm_t *pretregs, OPER op)
{
(*cdxxx[op])(cdb,e,pretregs);
}
// jump table
private extern (C++) __gshared nothrow void function (ref CodeBuilder,elem *,regm_t *)[OPMAX] cdxxx =
[
OPunde: &cderr,
OPadd: &cdorth,
OPmul: &cdmul,
OPand: &cdorth,
OPmin: &cdorth,
OPnot: &cdnot,
OPcom: &cdcom,
OPcond: &cdcond,
OPcomma: &cdcomma,
OPremquo: &cddiv,
OPdiv: &cddiv,
OPmod: &cddiv,
OPxor: &cdorth,
OPstring: &cderr,
OPrelconst: &cdrelconst,
OPinp: &cdport,
OPoutp: &cdport,
OPasm: &cdasm,
OPinfo: &cdinfo,
OPdctor: &cddctor,
OPddtor: &cdddtor,
OPctor: &cdctor,
OPdtor: &cddtor,
OPmark: &cdmark,
OPvoid: &cdvoid,
OPhalt: &cdhalt,
OPnullptr: &cderr,
OPpair: &cdpair,
OPrpair: &cdpair,
OPor: &cdorth,
OPoror: &cdloglog,
OPandand: &cdloglog,
OProl: &cdshift,
OPror: &cdshift,
OPshl: &cdshift,
OPshr: &cdshift,
OPashr: &cdshift,
OPbit: &cderr,
OPind: &cdind,
OPaddr: &cderr,
OPneg: &cdneg,
OPuadd: &cderr,
OPabs: &cdabs,
OPtoprec: &cdtoprec,
OPsqrt: &cdneg,
OPsin: &cdneg,
OPcos: &cdneg,
OPscale: &cdscale,
OPyl2x: &cdscale,
OPyl2xp1: &cdscale,
OPcmpxchg: &cdcmpxchg,
OPrint: &cdneg,
OPrndtol: &cdrndtol,
OPstrlen: &cdstrlen,
OPstrcpy: &cdstrcpy,
OPmemcpy: &cdmemcpy,
OPmemset: &cdmemset,
OPstrcat: &cderr,
OPstrcmp: &cdstrcmp,
OPmemcmp: &cdmemcmp,
OPsetjmp: &cdsetjmp,
OPnegass: &cdaddass,
OPpreinc: &cderr,
OPpredec: &cderr,
OPstreq: &cdstreq,
OPpostinc: &cdpost,
OPpostdec: &cdpost,
OPeq: &cdeq,
OPaddass: &cdaddass,
OPminass: &cdaddass,
OPmulass: &cdmulass,
OPdivass: &cddivass,
OPmodass: &cddivass,
OPshrass: &cdshass,
OPashrass: &cdshass,
OPshlass: &cdshass,
OPandass: &cdaddass,
OPxorass: &cdaddass,
OPorass: &cdaddass,
OPle: &cdcmp,
OPgt: &cdcmp,
OPlt: &cdcmp,
OPge: &cdcmp,
OPeqeq: &cdcmp,
OPne: &cdcmp,
OPunord: &cdcmp,
OPlg: &cdcmp,
OPleg: &cdcmp,
OPule: &cdcmp,
OPul: &cdcmp,
OPuge: &cdcmp,
OPug: &cdcmp,
OPue: &cdcmp,
OPngt: &cdcmp,
OPnge: &cdcmp,
OPnlt: &cdcmp,
OPnle: &cdcmp,
OPord: &cdcmp,
OPnlg: &cdcmp,
OPnleg: &cdcmp,
OPnule: &cdcmp,
OPnul: &cdcmp,
OPnuge: &cdcmp,
OPnug: &cdcmp,
OPnue: &cdcmp,
OPvp_fp: &cdcnvt,
OPcvp_fp: &cdcnvt,
OPoffset: &cdlngsht,
OPnp_fp: &cdshtlng,
OPnp_f16p: &cdfar16,
OPf16p_np: &cdfar16,
OPs16_32: &cdshtlng,
OPu16_32: &cdshtlng,
OPd_s32: &cdcnvt,
OPb_8: &cdcnvt,
OPs32_d: &cdcnvt,
OPd_s16: &cdcnvt,
OPs16_d: &cdcnvt,
OPd_u16: &cdcnvt,
OPu16_d: &cdcnvt,
OPd_u32: &cdcnvt,
OPu32_d: &cdcnvt,
OP32_16: &cdlngsht,
OPd_f: &cdcnvt,
OPf_d: &cdcnvt,
OPd_ld: &cdcnvt,
OPld_d: &cdcnvt,
OPc_r: &cdconvt87,
OPc_i: &cdconvt87,
OPu8_16: &cdbyteint,
OPs8_16: &cdbyteint,
OP16_8: &cdlngsht,
OPu32_64: &cdshtlng,
OPs32_64: &cdshtlng,
OP64_32: &cdlngsht,
OPu64_128: &cdshtlng,
OPs64_128: &cdshtlng,
OP128_64: &cdlngsht,
OPmsw: &cdmsw,
OPd_s64: &cdcnvt,
OPs64_d: &cdcnvt,
OPd_u64: &cdcnvt,
OPu64_d: &cdcnvt,
OPld_u64: &cdcnvt,
OPparam: &cderr,
OPsizeof: &cderr,
OParrow: &cderr,
OParrowstar: &cderr,
OPcolon: &cderr,
OPcolon2: &cderr,
OPbool: &cdnot,
OPcall: &cdfunc,
OPucall: &cdfunc,
OPcallns: &cdfunc,
OPucallns: &cdfunc,
OPstrpar: &cderr,
OPstrctor: &cderr,
OPstrthis: &cdstrthis,
OPconst: &cderr,
OPvar: &cderr,
OPnew: &cderr,
OPanew: &cderr,
OPdelete: &cderr,
OPadelete: &cderr,
OPbrack: &cderr,
OPframeptr: &cdframeptr,
OPgot: &cdgot,
OPbsf: &cdbscan,
OPbsr: &cdbscan,
OPbtst: &cdbtst,
OPbt: &cdbt,
OPbtc: &cdbt,
OPbtr: &cdbt,
OPbts: &cdbt,
OPbswap: &cdbswap,
OPpopcnt: &cdpopcnt,
OPvector: &cdvector,
OPvecsto: &cdvecsto,
OPvecfill: &cdvecfill,
OPva_start: &cderr,
OPprefetch: &cdprefetch,
];
@trusted
void codelem(ref CodeBuilder cdb,elem *e,regm_t *pretregs,uint constflag)
{
Symbol *s;
debug if (debugw)
{
printf("+codelem(e=%p,*pretregs=%s) %s ",e,regm_str(*pretregs),oper_str(e.Eoper));
printf("msavereg=%s regcon.cse.mval=%s regcon.cse.mops=%s\n",
regm_str(msavereg),regm_str(regcon.cse.mval),regm_str(regcon.cse.mops));
printf("Ecount = %d, Ecomsub = %d\n", e.Ecount, e.Ecomsub);
}
assert(e);
elem_debug(e);
if ((regcon.cse.mops & regcon.cse.mval) != regcon.cse.mops)
{
debug
{
printf("+codelem(e=%p,*pretregs=%s) ", e, regm_str(*pretregs));
elem_print(e);
printf("msavereg=%s regcon.cse.mval=%s regcon.cse.mops=%s\n",
regm_str(msavereg),regm_str(regcon.cse.mval),regm_str(regcon.cse.mops));
printf("Ecount = %d, Ecomsub = %d\n", e.Ecount, e.Ecomsub);
}
assert(0);
}
if (!(constflag & 1) && *pretregs & (mES | ALLREGS | mBP | XMMREGS) & ~regcon.mvar)
*pretregs &= ~regcon.mvar; /* can't use register vars */
uint op = e.Eoper;
if (e.Ecount && e.Ecount != e.Ecomsub) // if common subexp
{
comsub(cdb,e, *pretregs);
goto L1;
}
if (configv.addlinenumbers && e.Esrcpos.Slinnum)
cdb.genlinnum(e.Esrcpos);
switch (op)
{
default:
if (e.Ecount) /* if common subexp */
{
/* if no return value */
if ((*pretregs & (mSTACK | mES | ALLREGS | mBP | XMMREGS)) == 0)
{
if (*pretregs & (mST0 | mST01))
{
//printf("generate ST0 comsub for:\n");
//elem_print(e);
regm_t retregs = *pretregs & mST0 ? mXMM0 : mXMM0|mXMM1;
(*cdxxx[op])(cdb,e,&retregs);
cssave(e,retregs,!OTleaf(op));
fixresult(cdb, e, retregs, pretregs);
goto L1;
}
if (tysize(e.Ety) == 1)
*pretregs |= BYTEREGS;
else if ((tyxmmreg(e.Ety) || tysimd(e.Ety)) && config.fpxmmregs)
*pretregs |= XMMREGS;
else if (tybasic(e.Ety) == TYdouble || tybasic(e.Ety) == TYdouble_alias)
*pretregs |= DOUBLEREGS;
else
*pretregs |= ALLREGS; /* make one */
}
/* BUG: For CSEs, make sure we have both an MSW */
/* and an LSW specified in *pretregs */
}
assert(op <= OPMAX);
(*cdxxx[op])(cdb,e,pretregs);
break;
case OPrelconst:
cdrelconst(cdb,e,pretregs);
break;
case OPvar:
if (constflag & 1 && (s = e.EV.Vsym).Sfl == FLreg &&
(s.Sregm & *pretregs) == s.Sregm)
{
if (tysize(e.Ety) <= REGSIZE && tysize(s.Stype.Tty) == 2 * REGSIZE)
*pretregs &= mPSW | (s.Sregm & mLSW);
else
*pretregs &= mPSW | s.Sregm;
}
goto case OPconst;
case OPconst:
if (*pretregs == 0 && (e.Ecount >= 3 || e.Ety & mTYvolatile))
{
switch (tybasic(e.Ety))
{
case TYbool:
case TYchar:
case TYschar:
case TYuchar:
*pretregs |= BYTEREGS;
break;
case TYnref:
case TYnptr:
case TYsptr:
case TYcptr:
case TYfgPtr:
case TYimmutPtr:
case TYsharePtr:
case TYrestrictPtr:
*pretregs |= I16 ? IDXREGS : ALLREGS;
break;
case TYshort:
case TYushort:
case TYint:
case TYuint:
case TYlong:
case TYulong:
case TYllong:
case TYullong:
case TYcent:
case TYucent:
case TYfptr:
case TYhptr:
case TYvptr:
*pretregs |= ALLREGS;
break;
default:
break;
}
}
loaddata(cdb,e,pretregs);
break;
}
cssave(e,*pretregs,!OTleaf(op));
L1:
if (!(constflag & 2))
freenode(e);
debug if (debugw)
{
printf("-codelem(e=%p,*pretregs=%s) %s ",e,regm_str(*pretregs), oper_str(op));
printf("msavereg=%s regcon.cse.mval=%s regcon.cse.mops=%s\n",
regm_str(msavereg),regm_str(regcon.cse.mval),regm_str(regcon.cse.mops));
}
}
/*******************************
* Same as codelem(), but do not destroy the registers in keepmsk.
* Use scratch registers as much as possible, then use stack.
* Input:
* constflag true if user of result will not modify the
* registers returned in *pretregs.
*/
@trusted
void scodelem(ref CodeBuilder cdb, elem *e,regm_t *pretregs,regm_t keepmsk,bool constflag)
{
regm_t touse;
debug if (debugw)
printf("+scodelem(e=%p *pretregs=%s keepmsk=%s constflag=%d\n",
e,regm_str(*pretregs),regm_str(keepmsk),constflag);
elem_debug(e);
if (constflag)
{
regm_t regm;
reg_t reg;
if (isregvar(e, regm, reg) && // if e is a register variable
(regm & *pretregs) == regm && // in one of the right regs
e.EV.Voffset == 0
)
{
uint sz1 = tysize(e.Ety);
uint sz2 = tysize(e.EV.Vsym.Stype.Tty);
if (sz1 <= REGSIZE && sz2 > REGSIZE)
regm &= mLSW | XMMREGS;
fixresult(cdb,e,regm,pretregs);
cssave(e,regm,0);
freenode(e);
debug if (debugw)
printf("-scodelem(e=%p *pretregs=%s keepmsk=%s constflag=%d\n",
e,regm_str(*pretregs),regm_str(keepmsk),constflag);
return;
}
}
regm_t overlap = msavereg & keepmsk;
msavereg |= keepmsk; /* add to mask of regs to save */
regm_t oldregcon = regcon.cse.mval;
regm_t oldregimmed = regcon.immed.mval;
regm_t oldmfuncreg = mfuncreg; /* remember old one */
mfuncreg = (XMMREGS | mBP | mES | ALLREGS) & ~regcon.mvar;
uint stackpushsave = stackpush;
char calledafuncsave = calledafunc;
calledafunc = 0;
CodeBuilder cdbx; cdbx.ctor();
codelem(cdbx,e,pretregs,constflag); // generate code for the elem
regm_t tosave = keepmsk & ~msavereg; /* registers to save */
if (tosave)
{
cgstate.stackclean++;
genstackclean(cdbx,stackpush - stackpushsave,*pretregs | msavereg);
cgstate.stackclean--;
}
/* Assert that no new CSEs are generated that are not reflected */
/* in mfuncreg. */
debug if ((mfuncreg & (regcon.cse.mval & ~oldregcon)) != 0)
printf("mfuncreg %s, regcon.cse.mval %s, oldregcon %s, regcon.mvar %s\n",
regm_str(mfuncreg),regm_str(regcon.cse.mval),regm_str(oldregcon),regm_str(regcon.mvar));
assert((mfuncreg & (regcon.cse.mval & ~oldregcon)) == 0);
/* https://issues.dlang.org/show_bug.cgi?id=3521
* The problem is:
* reg op (reg = exp)
* where reg must be preserved (in keepregs) while the expression to be evaluated
* must change it.
* The only solution is to make this variable not a register.
*/
if (regcon.mvar & tosave)
{
//elem_print(e);
//printf("test1: regcon.mvar %s tosave %s\n", regm_str(regcon.mvar), regm_str(tosave));
cgreg_unregister(regcon.mvar & tosave);
}
/* which registers can we use to save other registers in? */
if (config.flags4 & CFG4space || // if optimize for space
config.target_cpu >= TARGET_80486) // PUSH/POP ops are 1 cycle
touse = 0; // PUSH/POP pairs are always shorter
else
{
touse = mfuncreg & allregs & ~(msavereg | oldregcon | regcon.cse.mval);
/* Don't use registers we'll have to save/restore */
touse &= ~(fregsaved & oldmfuncreg);
/* Don't use registers that have constant values in them, since
the code generated might have used the value.
*/
touse &= ~oldregimmed;
}
CodeBuilder cdbs1; cdbs1.ctor();
code *cs2 = null;
int adjesp = 0;
for (uint i = 0; tosave; i++)
{
regm_t mi = mask(i);
assert(i < REGMAX);
if (mi & tosave) /* i = register to save */
{
if (touse) /* if any scratch registers */
{
uint j;
for (j = 0; j < 8; j++)
{
regm_t mj = mask(j);
if (touse & mj)
{
genmovreg(cdbs1,j,i);
cs2 = cat(genmovreg(i,j),cs2);
touse &= ~mj;
mfuncreg &= ~mj;
regcon.used |= mj;
break;
}
}
assert(j < 8);
}
else // else use memory
{
CodeBuilder cdby; cdby.ctor();
uint size = gensaverestore(mask(i), cdbs1, cdby);
cs2 = cat(cdby.finish(),cs2);
if (size)
{
stackchanged = 1;
adjesp += size;
}
}
getregs(cdbx,mi);
tosave &= ~mi;
}
}
CodeBuilder cdbs2; cdbs2.ctor();
if (adjesp)
{
// If this is done an odd number of times, it
// will throw off the 8 byte stack alignment.
// We should *only* worry about this if a function
// was called in the code generation by codelem().
int sz = -(adjesp & (STACKALIGN - 1)) & (STACKALIGN - 1);
if (calledafunc && !I16 && sz && (STACKALIGN >= 16 || config.flags4 & CFG4stackalign))
{
regm_t mval_save = regcon.immed.mval;
regcon.immed.mval = 0; // prevent reghasvalue() optimizations
// because c hasn't been executed yet
cod3_stackadj(cdbs1, sz);
regcon.immed.mval = mval_save;
cdbs1.genadjesp(sz);
cod3_stackadj(cdbs2, -sz);
cdbs2.genadjesp(-sz);
}
cdbs2.append(cs2);
cdbs1.genadjesp(adjesp);
cdbs2.genadjesp(-adjesp);
}
else
cdbs2.append(cs2);
calledafunc |= calledafuncsave;
msavereg &= ~keepmsk | overlap; /* remove from mask of regs to save */
mfuncreg &= oldmfuncreg; /* update original */
debug if (debugw)
printf("-scodelem(e=%p *pretregs=%s keepmsk=%s constflag=%d\n",
e,regm_str(*pretregs),regm_str(keepmsk),constflag);
cdb.append(cdbs1);
cdb.append(cdbx);
cdb.append(cdbs2);
return;
}
/*********************************************
* Turn register mask into a string suitable for printing.
*/
@trusted
const(char)* regm_str(regm_t rm)
{
enum NUM = 10;
enum SMAX = 128;
__gshared char[SMAX + 1][NUM] str;
__gshared int i;
if (rm == 0)
return "0";
if (rm == ALLREGS)
return "ALLREGS";
if (rm == BYTEREGS)
return "BYTEREGS";
if (rm == allregs)
return "allregs";
if (rm == XMMREGS)
return "XMMREGS";
char *p = str[i].ptr;
if (++i == NUM)
i = 0;
*p = 0;
for (size_t j = 0; j < 32; j++)
{
if (mask(cast(uint)j) & rm)
{
strcat(p,regstring[j]);
rm &= ~mask(cast(uint)j);
if (rm)
strcat(p,"|");
}
}
if (rm)
{
const pstrlen = strlen(p);
char *s = p + pstrlen;
snprintf(s, SMAX - pstrlen, "x%02x",rm);
}
assert(strlen(p) <= SMAX);
return strdup(p);
}
/*********************************
* Scan down comma-expressions.
* Output:
* pe = first elem down right side that is not an OPcomma
* Returns:
* code generated for left branches of comma-expressions
*/
@trusted
void docommas(ref CodeBuilder cdb, ref elem *pe)
{
uint stackpushsave = stackpush;
int stackcleansave = cgstate.stackclean;
cgstate.stackclean = 0;
elem* e = pe;
while (1)
{
if (configv.addlinenumbers && e.Esrcpos.Slinnum)
{
cdb.genlinnum(e.Esrcpos);
//e.Esrcpos.Slinnum = 0; // don't do it twice
}
if (e.Eoper != OPcomma)
break;
regm_t retregs = 0;
codelem(cdb,e.EV.E1,&retregs,true);
elem* eold = e;
e = e.EV.E2;
freenode(eold);
}
pe = e;
assert(cgstate.stackclean == 0);
cgstate.stackclean = stackcleansave;
genstackclean(cdb,stackpush - stackpushsave,0);
}
/**************************
* For elems in regcon that don't match regconsave,
* clear the corresponding bit in regcon.cse.mval.
* Do same for regcon.immed.
*/
@trusted
void andregcon(ref con_t pregconsave)
{
regm_t m = ~1;
foreach (i; 0 ..REGMAX)
{
if (pregconsave.cse.value[i] != regcon.cse.value[i])
regcon.cse.mval &= m;
if (pregconsave.immed.value[i] != regcon.immed.value[i])
regcon.immed.mval &= m;
m <<= 1;
m |= 1;
}
//printf("regcon.cse.mval = %s, regconsave.mval = %s ",regm_str(regcon.cse.mval),regm_str(pregconsave.cse.mval));
regcon.used |= pregconsave.used;
regcon.cse.mval &= pregconsave.cse.mval;
regcon.immed.mval &= pregconsave.immed.mval;
regcon.params &= pregconsave.params;
//printf("regcon.cse.mval®con.cse.mops = %s, regcon.cse.mops = %s\n",regm_str(regcon.cse.mval & regcon.cse.mops), regm_str(regcon.cse.mops));
regcon.cse.mops &= regcon.cse.mval;
}
/**********************************************
* Disassemble the code instruction bytes
* Params:
* code = array of instruction bytes
*/
@trusted
private extern (D)
void disassemble(ubyte[] code)
{
printf("%s:\n", funcsym_p.Sident.ptr);
const model = I16 ? 16 : I32 ? 32 : 64; // 16/32/64
size_t i = 0;
while (i < code.length)
{
printf("%04x:", cast(int)i);
uint pc;
const sz = dmd.backend.disasm86.calccodsize(code, cast(uint)i, pc, model);
void put(char c) { printf("%c", c); }
dmd.backend.disasm86.getopstring(&put, code, cast(uint)i, sz, model, model == 16, true,
null, null, null, null);
printf("\n");
i += sz;
}
}
|
D
|
/**
* Defines the bulk of the classes which represent the AST at the expression level.
*
* Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions)
*
* 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/expression.d, _expression.d)
* Documentation: https://dlang.org/phobos/dmd_expression.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/expression.d
*/
module dmd.expression;
import core.stdc.stdarg;
import core.stdc.stdio;
import core.stdc.string;
import dmd.aggregate;
import dmd.aliasthis;
import dmd.apply;
import dmd.arrayop;
import dmd.arraytypes;
import dmd.ast_node;
import dmd.gluelayer;
import dmd.canthrow;
import dmd.complex;
import dmd.constfold;
import dmd.ctfeexpr;
import dmd.ctorflow;
import dmd.dcast;
import dmd.dclass;
import dmd.declaration;
import dmd.delegatize;
import dmd.dimport;
import dmd.dinterpret;
import dmd.dmodule;
import dmd.dscope;
import dmd.dstruct;
import dmd.dsymbol;
import dmd.dsymbolsem;
import dmd.dtemplate;
import dmd.errors;
import dmd.escape;
import dmd.expressionsem;
import dmd.func;
import dmd.globals;
import dmd.hdrgen;
import dmd.id;
import dmd.identifier;
import dmd.inline;
import dmd.mtype;
import dmd.nspace;
import dmd.objc;
import dmd.opover;
import dmd.optimize;
import dmd.root.ctfloat;
import dmd.root.filename;
import dmd.root.outbuffer;
import dmd.root.rmem;
import dmd.root.rootobject;
import dmd.root.string;
import dmd.safe;
import dmd.sideeffect;
import dmd.target;
import dmd.tokens;
import dmd.typesem;
import dmd.utf;
import dmd.visitor;
enum LOGSEMANTIC = false;
void emplaceExp(T : Expression, Args...)(void* p, Args args)
{
scope tmp = new T(args);
memcpy(p, cast(void*)tmp, __traits(classInstanceSize, T));
}
void emplaceExp(T : UnionExp)(T* p, Expression e)
{
memcpy(p, cast(void*)e, e.size);
}
// Return value for `checkModifiable`
enum Modifiable
{
/// Not modifiable
no,
/// Modifiable (the type is mutable)
yes,
/// Modifiable because it is initialization
initialization,
}
/****************************************
* Find the first non-comma expression.
* Params:
* e = Expressions connected by commas
* Returns:
* left-most non-comma expression
*/
inout(Expression) firstComma(inout Expression e)
{
Expression ex = cast()e;
while (ex.op == TOK.comma)
ex = (cast(CommaExp)ex).e1;
return cast(inout)ex;
}
/****************************************
* Find the last non-comma expression.
* Params:
* e = Expressions connected by commas
* Returns:
* right-most non-comma expression
*/
inout(Expression) lastComma(inout Expression e)
{
Expression ex = cast()e;
while (ex.op == TOK.comma)
ex = (cast(CommaExp)ex).e2;
return cast(inout)ex;
}
/*****************************************
* Determine if `this` is available by walking up the enclosing
* scopes until a function is found.
*
* Params:
* sc = where to start looking for the enclosing function
* Returns:
* Found function if it satisfies `isThis()`, otherwise `null`
*/
FuncDeclaration hasThis(Scope* sc)
{
//printf("hasThis()\n");
Dsymbol p = sc.parent;
while (p && p.isTemplateMixin())
p = p.parent;
FuncDeclaration fdthis = p ? p.isFuncDeclaration() : null;
//printf("fdthis = %p, '%s'\n", fdthis, fdthis ? fdthis.toChars() : "");
// Go upwards until we find the enclosing member function
FuncDeclaration fd = fdthis;
while (1)
{
if (!fd)
{
return null;
}
if (!fd.isNested() || fd.isThis() || (fd.isThis2 && fd.isMember2()))
break;
Dsymbol parent = fd.parent;
while (1)
{
if (!parent)
return null;
TemplateInstance ti = parent.isTemplateInstance();
if (ti)
parent = ti.parent;
else
break;
}
fd = parent.isFuncDeclaration();
}
if (!fd.isThis() && !(fd.isThis2 && fd.isMember2()))
{
return null;
}
assert(fd.vthis);
return fd;
}
/***********************************
* Determine if a `this` is needed to access `d`.
* Params:
* sc = context
* d = declaration to check
* Returns:
* true means a `this` is needed
*/
bool isNeedThisScope(Scope* sc, Declaration d)
{
if (sc.intypeof == 1)
return false;
AggregateDeclaration ad = d.isThis();
if (!ad)
return false;
//printf("d = %s, ad = %s\n", d.toChars(), ad.toChars());
for (Dsymbol s = sc.parent; s; s = s.toParentLocal())
{
//printf("\ts = %s %s, toParent2() = %p\n", s.kind(), s.toChars(), s.toParent2());
if (AggregateDeclaration ad2 = s.isAggregateDeclaration())
{
if (ad2 == ad)
return false;
else if (ad2.isNested())
continue;
else
return true;
}
if (FuncDeclaration f = s.isFuncDeclaration())
{
if (f.isMemberLocal())
break;
}
}
return true;
}
/******************************
* check e is exp.opDispatch!(tiargs) or not
* It's used to switch to UFCS the semantic analysis path
*/
bool isDotOpDispatch(Expression e)
{
if (auto dtie = e.isDotTemplateInstanceExp())
return dtie.ti.name == Id.opDispatch;
return false;
}
/****************************************
* Expand tuples.
* Input:
* exps aray of Expressions
* Output:
* exps rewritten in place
*/
extern (C++) void expandTuples(Expressions* exps)
{
//printf("expandTuples()\n");
if (exps is null)
return;
for (size_t i = 0; i < exps.dim; i++)
{
Expression arg = (*exps)[i];
if (!arg)
continue;
// Look for tuple with 0 members
if (auto e = arg.isTypeExp())
{
if (auto tt = e.type.toBasetype().isTypeTuple())
{
if (!tt.arguments || tt.arguments.dim == 0)
{
exps.remove(i);
if (i == exps.dim)
return;
}
else // Expand a TypeTuple
{
exps.remove(i);
auto texps = new Expressions(tt.arguments.length);
foreach (j, a; *tt.arguments)
(*texps)[j] = new TypeExp(e.loc, a.type);
exps.insert(i, texps);
}
i--;
continue;
}
}
// Inline expand all the tuples
while (arg.op == TOK.tuple)
{
TupleExp te = cast(TupleExp)arg;
exps.remove(i); // remove arg
exps.insert(i, te.exps); // replace with tuple contents
if (i == exps.dim)
return; // empty tuple, no more arguments
(*exps)[i] = Expression.combine(te.e0, (*exps)[i]);
arg = (*exps)[i];
}
}
}
/****************************************
* Expand alias this tuples.
*/
TupleDeclaration isAliasThisTuple(Expression e)
{
if (!e.type)
return null;
Type t = e.type.toBasetype();
while (true)
{
if (Dsymbol s = t.toDsymbol(null))
{
if (auto ad = s.isAggregateDeclaration())
{
s = ad.aliasthis ? ad.aliasthis.sym : null;
if (s && s.isVarDeclaration())
{
TupleDeclaration td = s.isVarDeclaration().toAlias().isTupleDeclaration();
if (td && td.isexp)
return td;
}
if (Type att = t.aliasthisOf())
{
t = att;
continue;
}
}
}
return null;
}
}
int expandAliasThisTuples(Expressions* exps, size_t starti = 0)
{
if (!exps || exps.dim == 0)
return -1;
for (size_t u = starti; u < exps.dim; u++)
{
Expression exp = (*exps)[u];
if (TupleDeclaration td = exp.isAliasThisTuple)
{
exps.remove(u);
foreach (i, o; *td.objects)
{
auto d = o.isExpression().isDsymbolExp().s.isDeclaration();
auto e = new DotVarExp(exp.loc, exp, d);
assert(d.type);
e.type = d.type;
exps.insert(u + i, e);
}
version (none)
{
printf("expansion ->\n");
foreach (e; exps)
{
printf("\texps[%d] e = %s %s\n", i, Token.tochars[e.op], e.toChars());
}
}
return cast(int)u;
}
}
return -1;
}
/****************************************
* If `s` is a function template, i.e. the only member of a template
* and that member is a function, return that template.
* Params:
* s = symbol that might be a function template
* Returns:
* template for that function, otherwise null
*/
TemplateDeclaration getFuncTemplateDecl(Dsymbol s)
{
FuncDeclaration f = s.isFuncDeclaration();
if (f && f.parent)
{
if (auto ti = f.parent.isTemplateInstance())
{
if (!ti.isTemplateMixin() && ti.tempdecl)
{
auto td = ti.tempdecl.isTemplateDeclaration();
if (td.onemember && td.ident == f.ident)
{
return td;
}
}
}
}
return null;
}
/************************************************
* If we want the value of this expression, but do not want to call
* the destructor on it.
*/
Expression valueNoDtor(Expression e)
{
auto ex = lastComma(e);
if (auto ce = ex.isCallExp())
{
/* The struct value returned from the function is transferred
* so do not call the destructor on it.
* Recognize:
* ((S _ctmp = S.init), _ctmp).this(...)
* and make sure the destructor is not called on _ctmp
* BUG: if ex is a CommaExp, we should go down the right side.
*/
if (auto dve = ce.e1.isDotVarExp())
{
if (dve.var.isCtorDeclaration())
{
// It's a constructor call
if (auto comma = dve.e1.isCommaExp())
{
if (auto ve = comma.e2.isVarExp())
{
VarDeclaration ctmp = ve.var.isVarDeclaration();
if (ctmp)
{
ctmp.storage_class |= STC.nodtor;
assert(!ce.isLvalue());
}
}
}
}
}
}
else if (auto ve = ex.isVarExp())
{
auto vtmp = ve.var.isVarDeclaration();
if (vtmp && (vtmp.storage_class & STC.rvalue))
{
vtmp.storage_class |= STC.nodtor;
}
}
return e;
}
/*********************************************
* If e is an instance of a struct, and that struct has a copy constructor,
* rewrite e as:
* (tmp = e),tmp
* Input:
* sc = just used to specify the scope of created temporary variable
* destinationType = the type of the object on which the copy constructor is called;
* may be null if the struct defines a postblit
*/
private Expression callCpCtor(Scope* sc, Expression e, Type destinationType)
{
if (auto ts = e.type.baseElemOf().isTypeStruct())
{
StructDeclaration sd = ts.sym;
if (sd.postblit || sd.hasCopyCtor)
{
/* Create a variable tmp, and replace the argument e with:
* (tmp = e),tmp
* and let AssignExp() handle the construction.
* This is not the most efficient, ideally tmp would be constructed
* directly onto the stack.
*/
auto tmp = copyToTemp(STC.rvalue, "__copytmp", e);
if (sd.hasCopyCtor && destinationType)
tmp.type = destinationType;
tmp.storage_class |= STC.nodtor;
tmp.dsymbolSemantic(sc);
Expression de = new DeclarationExp(e.loc, tmp);
Expression ve = new VarExp(e.loc, tmp);
de.type = Type.tvoid;
ve.type = e.type;
return Expression.combine(de, ve);
}
}
return e;
}
/************************************************
* Handle the postblit call on lvalue, or the move of rvalue.
*
* Params:
* sc = the scope where the expression is encountered
* e = the expression the needs to be moved or copied (source)
* t = if the struct defines a copy constructor, the type of the destination
*
* Returns:
* The expression that copy constructs or moves the value.
*/
extern (D) Expression doCopyOrMove(Scope *sc, Expression e, Type t = null)
{
if (auto ce = e.isCondExp())
{
ce.e1 = doCopyOrMove(sc, ce.e1);
ce.e2 = doCopyOrMove(sc, ce.e2);
}
else
{
e = e.isLvalue() ? callCpCtor(sc, e, t) : valueNoDtor(e);
}
return e;
}
/****************************************************************/
/* A type meant as a union of all the Expression types,
* to serve essentially as a Variant that will sit on the stack
* during CTFE to reduce memory consumption.
*/
extern (C++) struct UnionExp
{
// yes, default constructor does nothing
extern (D) this(Expression e)
{
memcpy(&this, cast(void*)e, e.size);
}
/* Extract pointer to Expression
*/
extern (C++) Expression exp() return
{
return cast(Expression)&u;
}
/* Convert to an allocated Expression
*/
extern (C++) Expression copy()
{
Expression e = exp();
//if (e.size > sizeof(u)) printf("%s\n", Token::toChars(e.op));
assert(e.size <= u.sizeof);
switch (e.op)
{
case TOK.cantExpression: return CTFEExp.cantexp;
case TOK.voidExpression: return CTFEExp.voidexp;
case TOK.break_: return CTFEExp.breakexp;
case TOK.continue_: return CTFEExp.continueexp;
case TOK.goto_: return CTFEExp.gotoexp;
default: return e.copy();
}
}
private:
// Ensure that the union is suitably aligned.
align(8) union __AnonStruct__u
{
char[__traits(classInstanceSize, Expression)] exp;
char[__traits(classInstanceSize, IntegerExp)] integerexp;
char[__traits(classInstanceSize, ErrorExp)] errorexp;
char[__traits(classInstanceSize, RealExp)] realexp;
char[__traits(classInstanceSize, ComplexExp)] complexexp;
char[__traits(classInstanceSize, SymOffExp)] symoffexp;
char[__traits(classInstanceSize, StringExp)] stringexp;
char[__traits(classInstanceSize, ArrayLiteralExp)] arrayliteralexp;
char[__traits(classInstanceSize, AssocArrayLiteralExp)] assocarrayliteralexp;
char[__traits(classInstanceSize, StructLiteralExp)] structliteralexp;
char[__traits(classInstanceSize, NullExp)] nullexp;
char[__traits(classInstanceSize, DotVarExp)] dotvarexp;
char[__traits(classInstanceSize, AddrExp)] addrexp;
char[__traits(classInstanceSize, IndexExp)] indexexp;
char[__traits(classInstanceSize, SliceExp)] sliceexp;
char[__traits(classInstanceSize, VectorExp)] vectorexp;
}
__AnonStruct__u u;
}
/********************************
* Test to see if two reals are the same.
* Regard NaN's as equivalent.
* Regard +0 and -0 as different.
* Params:
* x1 = first operand
* x2 = second operand
* Returns:
* true if x1 is x2
* else false
*/
bool RealIdentical(real_t x1, real_t x2)
{
return (CTFloat.isNaN(x1) && CTFloat.isNaN(x2)) || CTFloat.isIdentical(x1, x2);
}
/************************ TypeDotIdExp ************************************/
/* Things like:
* int.size
* foo.size
* (foo).size
* cast(foo).size
*/
DotIdExp typeDotIdExp(const ref Loc loc, Type type, Identifier ident)
{
return new DotIdExp(loc, new TypeExp(loc, type), ident);
}
/***************************************************
* Given an Expression, find the variable it really is.
*
* For example, `a[index]` is really `a`, and `s.f` is really `s`.
* Params:
* e = Expression to look at
* Returns:
* variable if there is one, null if not
*/
VarDeclaration expToVariable(Expression e)
{
while (1)
{
switch (e.op)
{
case TOK.variable:
return (cast(VarExp)e).var.isVarDeclaration();
case TOK.dotVariable:
e = (cast(DotVarExp)e).e1;
continue;
case TOK.index:
{
IndexExp ei = cast(IndexExp)e;
e = ei.e1;
Type ti = e.type.toBasetype();
if (ti.ty == Tsarray)
continue;
return null;
}
case TOK.slice:
{
SliceExp ei = cast(SliceExp)e;
e = ei.e1;
Type ti = e.type.toBasetype();
if (ti.ty == Tsarray)
continue;
return null;
}
case TOK.this_:
case TOK.super_:
return (cast(ThisExp)e).var.isVarDeclaration();
default:
return null;
}
}
}
enum OwnedBy : ubyte
{
code, // normal code expression in AST
ctfe, // value expression for CTFE
cache, // constant value cached for CTFE
}
enum WANTvalue = 0; // default
enum WANTexpand = 1; // expand const/immutable variables if possible
/***********************************************************
* http://dlang.org/spec/expression.html#expression
*/
extern (C++) abstract class Expression : ASTNode
{
const TOK op; // to minimize use of dynamic_cast
ubyte size; // # of bytes in Expression so we can copy() it
ubyte parens; // if this is a parenthesized expression
Type type; // !=null means that semantic() has been run
Loc loc; // file location
extern (D) this(const ref Loc loc, TOK op, int size)
{
//printf("Expression::Expression(op = %d) this = %p\n", op, this);
this.loc = loc;
this.op = op;
this.size = cast(ubyte)size;
}
static void _init()
{
CTFEExp.cantexp = new CTFEExp(TOK.cantExpression);
CTFEExp.voidexp = new CTFEExp(TOK.voidExpression);
CTFEExp.breakexp = new CTFEExp(TOK.break_);
CTFEExp.continueexp = new CTFEExp(TOK.continue_);
CTFEExp.gotoexp = new CTFEExp(TOK.goto_);
CTFEExp.showcontext = new CTFEExp(TOK.showCtfeContext);
}
/**
* Deinitializes the global state of the compiler.
*
* This can be used to restore the state set by `_init` to its original
* state.
*/
static void deinitialize()
{
CTFEExp.cantexp = CTFEExp.cantexp.init;
CTFEExp.voidexp = CTFEExp.voidexp.init;
CTFEExp.breakexp = CTFEExp.breakexp.init;
CTFEExp.continueexp = CTFEExp.continueexp.init;
CTFEExp.gotoexp = CTFEExp.gotoexp.init;
CTFEExp.showcontext = CTFEExp.showcontext.init;
}
/*********************************
* Does *not* do a deep copy.
*/
final Expression copy()
{
Expression e;
if (!size)
{
debug
{
fprintf(stderr, "No expression copy for: %s\n", toChars());
printf("op = %d\n", op);
}
assert(0);
}
// memory never freed, so can use the faster bump-pointer-allocation
e = cast(Expression)allocmemory(size);
//printf("Expression::copy(op = %d) e = %p\n", op, e);
return cast(Expression)memcpy(cast(void*)e, cast(void*)this, size);
}
Expression syntaxCopy()
{
//printf("Expression::syntaxCopy()\n");
//print();
return copy();
}
// kludge for template.isExpression()
override final DYNCAST dyncast() const
{
return DYNCAST.expression;
}
override const(char)* toChars() const
{
OutBuffer buf;
HdrGenState hgs;
toCBuffer(this, &buf, &hgs);
return buf.extractChars();
}
static if (__VERSION__ < 2092)
{
final void error(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.verror(loc, format, ap);
va_end(ap);
}
}
final void errorSupplemental(const(char)* format, ...)
{
if (type == Type.terror)
return;
va_list ap;
va_start(ap, format);
.verrorSupplemental(loc, format, ap);
va_end(ap);
}
final void warning(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.vwarning(loc, format, ap);
va_end(ap);
}
}
final void deprecation(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.vdeprecation(loc, format, ap);
va_end(ap);
}
}
}
else
{
pragma(printf) final void error(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.verror(loc, format, ap);
va_end(ap);
}
}
pragma(printf) final void errorSupplemental(const(char)* format, ...)
{
if (type == Type.terror)
return;
va_list ap;
va_start(ap, format);
.verrorSupplemental(loc, format, ap);
va_end(ap);
}
pragma(printf) final void warning(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.vwarning(loc, format, ap);
va_end(ap);
}
}
pragma(printf) final void deprecation(const(char)* format, ...) const
{
if (type != Type.terror)
{
va_list ap;
va_start(ap, format);
.vdeprecation(loc, format, ap);
va_end(ap);
}
}
}
/**********************************
* Combine e1 and e2 by CommaExp if both are not NULL.
*/
extern (D) static Expression combine(Expression e1, Expression e2)
{
if (e1)
{
if (e2)
{
e1 = new CommaExp(e1.loc, e1, e2);
e1.type = e2.type;
}
}
else
e1 = e2;
return e1;
}
extern (D) static Expression combine(Expression e1, Expression e2, Expression e3)
{
return combine(combine(e1, e2), e3);
}
extern (D) static Expression combine(Expression e1, Expression e2, Expression e3, Expression e4)
{
return combine(combine(e1, e2), combine(e3, e4));
}
/**********************************
* If 'e' is a tree of commas, returns the rightmost expression
* by stripping off it from the tree. The remained part of the tree
* is returned via e0.
* Otherwise 'e' is directly returned and e0 is set to NULL.
*/
extern (D) static Expression extractLast(Expression e, out Expression e0)
{
if (e.op != TOK.comma)
{
return e;
}
CommaExp ce = cast(CommaExp)e;
if (ce.e2.op != TOK.comma)
{
e0 = ce.e1;
return ce.e2;
}
else
{
e0 = e;
Expression* pce = &ce.e2;
while ((cast(CommaExp)(*pce)).e2.op == TOK.comma)
{
pce = &(cast(CommaExp)(*pce)).e2;
}
assert((*pce).op == TOK.comma);
ce = cast(CommaExp)(*pce);
*pce = ce.e1;
return ce.e2;
}
}
extern (D) static Expressions* arraySyntaxCopy(Expressions* exps)
{
Expressions* a = null;
if (exps)
{
a = new Expressions(exps.dim);
foreach (i, e; *exps)
{
(*a)[i] = e ? e.syntaxCopy() : null;
}
}
return a;
}
dinteger_t toInteger()
{
//printf("Expression %s\n", Token::toChars(op));
error("integer constant expression expected instead of `%s`", toChars());
return 0;
}
uinteger_t toUInteger()
{
//printf("Expression %s\n", Token::toChars(op));
return cast(uinteger_t)toInteger();
}
real_t toReal()
{
error("floating point constant expression expected instead of `%s`", toChars());
return CTFloat.zero;
}
real_t toImaginary()
{
error("floating point constant expression expected instead of `%s`", toChars());
return CTFloat.zero;
}
complex_t toComplex()
{
error("floating point constant expression expected instead of `%s`", toChars());
return complex_t(CTFloat.zero);
}
StringExp toStringExp()
{
return null;
}
TupleExp toTupleExp()
{
return null;
}
/***************************************
* Return !=0 if expression is an lvalue.
*/
bool isLvalue()
{
return false;
}
/*******************************
* Give error if we're not an lvalue.
* If we can, convert expression to be an lvalue.
*/
Expression toLvalue(Scope* sc, Expression e)
{
if (!e)
e = this;
else if (!loc.isValid())
loc = e.loc;
if (e.op == TOK.type)
error("`%s` is a `%s` definition and cannot be modified", e.type.toChars(), e.type.kind());
else
error("`%s` is not an lvalue and cannot be modified", e.toChars());
return ErrorExp.get();
}
Expression modifiableLvalue(Scope* sc, Expression e)
{
//printf("Expression::modifiableLvalue() %s, type = %s\n", toChars(), type.toChars());
// See if this expression is a modifiable lvalue (i.e. not const)
if (checkModifiable(sc) == Modifiable.yes)
{
assert(type);
if (!type.isMutable())
{
if (auto dve = this.isDotVarExp())
{
if (isNeedThisScope(sc, dve.var))
for (Dsymbol s = sc.func; s; s = s.toParentLocal())
{
FuncDeclaration ff = s.isFuncDeclaration();
if (!ff)
break;
if (!ff.type.isMutable)
{
error("cannot modify `%s` in `%s` function", toChars(), MODtoChars(type.mod));
return ErrorExp.get();
}
}
}
error("cannot modify `%s` expression `%s`", MODtoChars(type.mod), toChars());
return ErrorExp.get();
}
else if (!type.isAssignable())
{
error("cannot modify struct instance `%s` of type `%s` because it contains `const` or `immutable` members",
toChars(), type.toChars());
return ErrorExp.get();
}
}
return toLvalue(sc, e);
}
final Expression implicitCastTo(Scope* sc, Type t)
{
return .implicitCastTo(this, sc, t);
}
final MATCH implicitConvTo(Type t)
{
return .implicitConvTo(this, t);
}
final Expression castTo(Scope* sc, Type t)
{
return .castTo(this, sc, t);
}
/****************************************
* Resolve __FILE__, __LINE__, __MODULE__, __FUNCTION__, __PRETTY_FUNCTION__, __FILE_FULL_PATH__ to loc.
*/
Expression resolveLoc(const ref Loc loc, Scope* sc)
{
this.loc = loc;
return this;
}
/****************************************
* Check that the expression has a valid type.
* If not, generates an error "... has no type".
* Returns:
* true if the expression is not valid.
* Note:
* When this function returns true, `checkValue()` should also return true.
*/
bool checkType()
{
return false;
}
/****************************************
* Check that the expression has a valid value.
* If not, generates an error "... has no value".
* Returns:
* true if the expression is not valid or has void type.
*/
bool checkValue()
{
if (type && type.toBasetype().ty == Tvoid)
{
error("expression `%s` is `void` and has no value", toChars());
//print(); assert(0);
if (!global.gag)
type = Type.terror;
return true;
}
return false;
}
extern (D) final bool checkScalar()
{
if (op == TOK.error)
return true;
if (type.toBasetype().ty == Terror)
return true;
if (!type.isscalar())
{
error("`%s` is not a scalar, it is a `%s`", toChars(), type.toChars());
return true;
}
return checkValue();
}
extern (D) final bool checkNoBool()
{
if (op == TOK.error)
return true;
if (type.toBasetype().ty == Terror)
return true;
if (type.toBasetype().ty == Tbool)
{
error("operation not allowed on `bool` `%s`", toChars());
return true;
}
return false;
}
extern (D) final bool checkIntegral()
{
if (op == TOK.error)
return true;
if (type.toBasetype().ty == Terror)
return true;
if (!type.isintegral())
{
error("`%s` is not of integral type, it is a `%s`", toChars(), type.toChars());
return true;
}
return checkValue();
}
extern (D) final bool checkArithmetic()
{
if (op == TOK.error)
return true;
if (type.toBasetype().ty == Terror)
return true;
if (!type.isintegral() && !type.isfloating())
{
error("`%s` is not of arithmetic type, it is a `%s`", toChars(), type.toChars());
return true;
}
return checkValue();
}
final bool checkDeprecated(Scope* sc, Dsymbol s)
{
return s.checkDeprecated(loc, sc);
}
extern (D) final bool checkDisabled(Scope* sc, Dsymbol s)
{
if (auto d = s.isDeclaration())
{
return d.checkDisabled(loc, sc);
}
return false;
}
/*********************************************
* Calling function f.
* Check the purity, i.e. if we're in a pure function
* we can only call other pure functions.
* Returns true if error occurs.
*/
extern (D) final bool checkPurity(Scope* sc, FuncDeclaration f)
{
if (!sc.func)
return false;
if (sc.func == f)
return false;
if (sc.intypeof == 1)
return false;
if (sc.flags & (SCOPE.ctfe | SCOPE.debug_))
return false;
// If the call has a pure parent, then the called func must be pure.
if (!f.isPure() && checkImpure(sc))
{
error("`pure` %s `%s` cannot call impure %s `%s`",
sc.func.kind(), sc.func.toPrettyChars(), f.kind(),
f.toPrettyChars());
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().purity != PURE.impure, "impure");
return true;
}
return false;
}
/**
* Checks whether `f` is a generated `DtorDeclaration` that hides a user-defined one
* which passes `check` while `f` doesn't (e.g. when the user defined dtor is pure but
* the generated dtor is not).
* In that case the method will identify and print all members causing the attribute
* missmatch.
*
* Params:
* sc = scope
* f = potential `DtorDeclaration`
* check = current check (e.g. whether it's pure)
* checkName = the kind of check (e.g. `"pure"`)
*/
extern (D) final void checkOverridenDtor(Scope* sc, FuncDeclaration f,
scope bool function(DtorDeclaration) check, const string checkName
) {
auto dd = f.isDtorDeclaration();
if (!dd || !dd.generated)
return;
// DtorDeclaration without parents should fail at an earlier stage
auto ad = cast(AggregateDeclaration) f.toParent2();
assert(ad);
assert(ad.dtors.length);
// Search for the user-defined destructor (if any)
foreach(dtor; ad.dtors)
{
if (dtor.generated)
continue;
if (!check(dtor)) // doesn't match check (e.g. is impure as well)
return;
// Sanity check
assert(!check(cast(DtorDeclaration) ad.fieldDtor));
break;
}
dd.loc.errorSupplemental("%s`%s.~this` is %.*s because of the following field's destructors:",
dd.generated ? "generated " : "".ptr,
ad.toChars,
cast(int) checkName.length, checkName.ptr);
// Search for the offending fields
foreach (field; ad.fields)
{
// Only structs may define automatically called destructors
auto ts = field.type.isTypeStruct();
if (!ts)
{
// But they might be part of a static array
auto ta = field.type.isTypeSArray();
if (!ta)
continue;
ts = ta.baseElemOf().isTypeStruct();
if (!ts)
continue;
}
auto fieldSym = ts.toDsymbol(sc);
assert(fieldSym); // Resolving ts must succeed because missing defs. should error before
auto fieldSd = fieldSym.isStructDeclaration();
assert(fieldSd); // ts is a TypeStruct, this would imply a malformed ASR
if (fieldSd.dtor && !check(fieldSd.dtor))
{
field.loc.errorSupplemental(" - %s %s", field.type.toChars(), field.toChars());
if (fieldSd.dtor.generated)
checkOverridenDtor(sc, fieldSd.dtor, check, checkName);
else
fieldSd.dtor.loc.errorSupplemental(" %.*s `%s.~this` is declared here",
cast(int) checkName.length, checkName.ptr, fieldSd.toChars());
}
}
}
/*******************************************
* Accessing variable v.
* Check for purity and safety violations.
* Returns true if error occurs.
*/
extern (D) final bool checkPurity(Scope* sc, VarDeclaration v)
{
//printf("v = %s %s\n", v.type.toChars(), v.toChars());
/* Look for purity and safety violations when accessing variable v
* from current function.
*/
if (!sc.func)
return false;
if (sc.intypeof == 1)
return false; // allow violations inside typeof(expression)
if (sc.flags & (SCOPE.ctfe | SCOPE.debug_))
return false; // allow violations inside compile-time evaluated expressions and debug conditionals
if (v.ident == Id.ctfe)
return false; // magic variable never violates pure and safe
if (v.isImmutable())
return false; // always safe and pure to access immutables...
if (v.isConst() && !v.isRef() && (v.isDataseg() || v.isParameter()) && v.type.implicitConvTo(v.type.immutableOf()))
return false; // or const global/parameter values which have no mutable indirections
if (v.storage_class & STC.manifest)
return false; // ...or manifest constants
if (v.type.ty == Tstruct)
{
StructDeclaration sd = (cast(TypeStruct)v.type).sym;
if (sd.hasNoFields)
return false;
}
bool err = false;
if (v.isDataseg())
{
// https://issues.dlang.org/show_bug.cgi?id=7533
// Accessing implicit generated __gate is pure.
if (v.ident == Id.gate)
return false;
if (checkImpure(sc))
{
error("`pure` %s `%s` cannot access mutable static data `%s`",
sc.func.kind(), sc.func.toPrettyChars(), v.toChars());
err = true;
}
}
else
{
/* Given:
* void f() {
* int fx;
* pure void g() {
* int gx;
* /+pure+/ void h() {
* int hx;
* /+pure+/ void i() { }
* }
* }
* }
* i() can modify hx and gx but not fx
*/
Dsymbol vparent = v.toParent2();
for (Dsymbol s = sc.func; !err && s; s = s.toParentP(vparent))
{
if (s == vparent)
break;
if (AggregateDeclaration ad = s.isAggregateDeclaration())
{
if (ad.isNested())
continue;
break;
}
FuncDeclaration ff = s.isFuncDeclaration();
if (!ff)
break;
if (ff.isNested() || ff.isThis())
{
if (ff.type.isImmutable() ||
ff.type.isShared() && !MODimplicitConv(ff.type.mod, v.type.mod))
{
OutBuffer ffbuf;
OutBuffer vbuf;
MODMatchToBuffer(&ffbuf, ff.type.mod, v.type.mod);
MODMatchToBuffer(&vbuf, v.type.mod, ff.type.mod);
error("%s%s `%s` cannot access %sdata `%s`",
ffbuf.peekChars(), ff.kind(), ff.toPrettyChars(), vbuf.peekChars(), v.toChars());
err = true;
break;
}
continue;
}
break;
}
}
/* Do not allow safe functions to access __gshared data
*/
if (v.storage_class & STC.gshared)
{
if (sc.func.setUnsafe())
{
error("`@safe` %s `%s` cannot access `__gshared` data `%s`",
sc.func.kind(), sc.func.toChars(), v.toChars());
err = true;
}
}
return err;
}
/*
Check if sc.func is impure or can be made impure.
Returns true on error, i.e. if sc.func is pure and cannot be made impure.
*/
private static bool checkImpure(Scope* sc)
{
return sc.func && (sc.flags & SCOPE.compile
? sc.func.isPureBypassingInference() >= PURE.weak
: sc.func.setImpure());
}
/*********************************************
* Calling function f.
* Check the safety, i.e. if we're in a @safe function
* we can only call @safe or @trusted functions.
* Returns true if error occurs.
*/
extern (D) final bool checkSafety(Scope* sc, FuncDeclaration f)
{
if (!sc.func)
return false;
if (sc.func == f)
return false;
if (sc.intypeof == 1)
return false;
if (sc.flags & (SCOPE.ctfe | SCOPE.debug_))
return false;
if (!f.isSafe() && !f.isTrusted())
{
if (sc.flags & SCOPE.compile ? sc.func.isSafeBypassingInference() : sc.func.setUnsafe())
{
if (!loc.isValid()) // e.g. implicitly generated dtor
loc = sc.func.loc;
const prettyChars = f.toPrettyChars();
error("`@safe` %s `%s` cannot call `@system` %s `%s`",
sc.func.kind(), sc.func.toPrettyChars(), f.kind(),
prettyChars);
.errorSupplemental(f.loc, "`%s` is declared here", prettyChars);
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().trust > TRUST.system, "@system");
return true;
}
}
return false;
}
/*********************************************
* Calling function f.
* Check the @nogc-ness, i.e. if we're in a @nogc function
* we can only call other @nogc functions.
* Returns true if error occurs.
*/
extern (D) final bool checkNogc(Scope* sc, FuncDeclaration f)
{
if (!sc.func)
return false;
if (sc.func == f)
return false;
if (sc.intypeof == 1)
return false;
if (sc.flags & (SCOPE.ctfe | SCOPE.debug_))
return false;
if (!f.isNogc())
{
if (sc.flags & SCOPE.compile ? sc.func.isNogcBypassingInference() : sc.func.setGC())
{
if (loc.linnum == 0) // e.g. implicitly generated dtor
loc = sc.func.loc;
// Lowered non-@nogc'd hooks will print their own error message inside of nogc.d (NOGCVisitor.visit(CallExp e)),
// so don't print anything to avoid double error messages.
if (!(f.ident == Id._d_HookTraceImpl || f.ident == Id._d_arraysetlengthT))
error("`@nogc` %s `%s` cannot call non-@nogc %s `%s`",
sc.func.kind(), sc.func.toPrettyChars(), f.kind(), f.toPrettyChars());
checkOverridenDtor(sc, f, dd => dd.type.toTypeFunction().isnogc, "non-@nogc");
return true;
}
}
return false;
}
/********************************************
* Check that the postblit is callable if t is an array of structs.
* Returns true if error happens.
*/
extern (D) final bool checkPostblit(Scope* sc, Type t)
{
if (auto ts = t.baseElemOf().isTypeStruct())
{
if (global.params.useTypeInfo)
{
// https://issues.dlang.org/show_bug.cgi?id=11395
// Require TypeInfo generation for array concatenation
semanticTypeInfo(sc, t);
}
StructDeclaration sd = ts.sym;
if (sd.postblit)
{
if (sd.postblit.checkDisabled(loc, sc))
return true;
//checkDeprecated(sc, sd.postblit); // necessary?
checkPurity(sc, sd.postblit);
checkSafety(sc, sd.postblit);
checkNogc(sc, sd.postblit);
//checkAccess(sd, loc, sc, sd.postblit); // necessary?
return false;
}
}
return false;
}
extern (D) final bool checkRightThis(Scope* sc)
{
if (op == TOK.error)
return true;
if (op == TOK.variable && type.ty != Terror)
{
VarExp ve = cast(VarExp)this;
if (isNeedThisScope(sc, ve.var))
{
//printf("checkRightThis sc.intypeof = %d, ad = %p, func = %p, fdthis = %p\n",
// sc.intypeof, sc.getStructClassScope(), func, fdthis);
error("need `this` for `%s` of type `%s`", ve.var.toChars(), ve.var.type.toChars());
return true;
}
}
return false;
}
/*******************************
* Check whether the expression allows RMW operations, error with rmw operator diagnostic if not.
* ex is the RHS expression, or NULL if ++/-- is used (for diagnostics)
* Returns true if error occurs.
*/
extern (D) final bool checkReadModifyWrite(TOK rmwOp, Expression ex = null)
{
//printf("Expression::checkReadModifyWrite() %s %s", toChars(), ex ? ex.toChars() : "");
if (!type || !type.isShared() || type.isTypeStruct() || type.isTypeClass())
return false;
// atomicOp uses opAssign (+=/-=) rather than opOp (++/--) for the CT string literal.
switch (rmwOp)
{
case TOK.plusPlus:
case TOK.prePlusPlus:
rmwOp = TOK.addAssign;
break;
case TOK.minusMinus:
case TOK.preMinusMinus:
rmwOp = TOK.minAssign;
break;
default:
break;
}
error("read-modify-write operations are not allowed for `shared` variables");
errorSupplemental("Use `core.atomic.atomicOp!\"%s\"(%s, %s)` instead",
Token.toChars(rmwOp), toChars(), ex ? ex.toChars() : "1");
return true;
}
/***************************************
* Parameters:
* sc: scope
* flag: 1: do not issue error message for invalid modification
* Returns:
* Whether the type is modifiable
*/
Modifiable checkModifiable(Scope* sc, int flag = 0)
{
return type ? Modifiable.yes : Modifiable.no; // default modifiable
}
/*****************************
* If expression can be tested for true or false,
* returns the modified expression.
* Otherwise returns ErrorExp.
*/
Expression toBoolean(Scope* sc)
{
// Default is 'yes' - do nothing
Expression e = this;
Type t = type;
Type tb = type.toBasetype();
Type att = null;
while (1)
{
// Structs can be converted to bool using opCast(bool)()
if (auto ts = tb.isTypeStruct())
{
AggregateDeclaration ad = ts.sym;
/* Don't really need to check for opCast first, but by doing so we
* get better error messages if it isn't there.
*/
if (Dsymbol fd = search_function(ad, Id._cast))
{
e = new CastExp(loc, e, Type.tbool);
e = e.expressionSemantic(sc);
return e;
}
// Forward to aliasthis.
if (ad.aliasthis && tb != att)
{
if (!att && tb.checkAliasThisRec())
att = tb;
e = resolveAliasThis(sc, e);
t = e.type;
tb = e.type.toBasetype();
continue;
}
}
break;
}
if (!t.isBoolean())
{
if (tb != Type.terror)
error("expression `%s` of type `%s` does not have a boolean value", toChars(), t.toChars());
return ErrorExp.get();
}
return e;
}
/************************************************
* Destructors are attached to VarDeclarations.
* Hence, if expression returns a temp that needs a destructor,
* make sure and create a VarDeclaration for that temp.
*/
Expression addDtorHook(Scope* sc)
{
return this;
}
/******************************
* Take address of expression.
*/
final Expression addressOf()
{
//printf("Expression::addressOf()\n");
debug
{
assert(op == TOK.error || isLvalue());
}
Expression e = new AddrExp(loc, this, type.pointerTo());
return e;
}
/******************************
* If this is a reference, dereference it.
*/
final Expression deref()
{
//printf("Expression::deref()\n");
// type could be null if forward referencing an 'auto' variable
if (type)
if (auto tr = type.isTypeReference())
{
Expression e = new PtrExp(loc, this, tr.next);
return e;
}
return this;
}
final Expression optimize(int result, bool keepLvalue = false)
{
return Expression_optimize(this, result, keepLvalue);
}
// Entry point for CTFE.
// A compile-time result is required. Give an error if not possible
final Expression ctfeInterpret()
{
return .ctfeInterpret(this);
}
final int isConst()
{
return .isConst(this);
}
/********************************
* Does this expression statically evaluate to a boolean 'result' (true or false)?
*/
bool isBool(bool result)
{
return false;
}
bool hasCode()
{
return true;
}
final pure inout nothrow @nogc
{
inout(IntegerExp) isIntegerExp() { return op == TOK.int64 ? cast(typeof(return))this : null; }
inout(ErrorExp) isErrorExp() { return op == TOK.error ? cast(typeof(return))this : null; }
inout(VoidInitExp) isVoidInitExp() { return op == TOK.void_ ? cast(typeof(return))this : null; }
inout(RealExp) isRealExp() { return op == TOK.float64 ? cast(typeof(return))this : null; }
inout(ComplexExp) isComplexExp() { return op == TOK.complex80 ? cast(typeof(return))this : null; }
inout(IdentifierExp) isIdentifierExp() { return op == TOK.identifier ? cast(typeof(return))this : null; }
inout(DollarExp) isDollarExp() { return op == TOK.dollar ? cast(typeof(return))this : null; }
inout(DsymbolExp) isDsymbolExp() { return op == TOK.dSymbol ? cast(typeof(return))this : null; }
inout(ThisExp) isThisExp() { return op == TOK.this_ ? cast(typeof(return))this : null; }
inout(SuperExp) isSuperExp() { return op == TOK.super_ ? cast(typeof(return))this : null; }
inout(NullExp) isNullExp() { return op == TOK.null_ ? cast(typeof(return))this : null; }
inout(StringExp) isStringExp() { return op == TOK.string_ ? cast(typeof(return))this : null; }
inout(TupleExp) isTupleExp() { return op == TOK.tuple ? cast(typeof(return))this : null; }
inout(ArrayLiteralExp) isArrayLiteralExp() { return op == TOK.arrayLiteral ? cast(typeof(return))this : null; }
inout(AssocArrayLiteralExp) isAssocArrayLiteralExp() { return op == TOK.assocArrayLiteral ? cast(typeof(return))this : null; }
inout(StructLiteralExp) isStructLiteralExp() { return op == TOK.structLiteral ? cast(typeof(return))this : null; }
inout(TypeExp) isTypeExp() { return op == TOK.type ? cast(typeof(return))this : null; }
inout(ScopeExp) isScopeExp() { return op == TOK.scope_ ? cast(typeof(return))this : null; }
inout(TemplateExp) isTemplateExp() { return op == TOK.template_ ? cast(typeof(return))this : null; }
inout(NewExp) isNewExp() { return op == TOK.new_ ? cast(typeof(return))this : null; }
inout(NewAnonClassExp) isNewAnonClassExp() { return op == TOK.newAnonymousClass ? cast(typeof(return))this : null; }
inout(SymOffExp) isSymOffExp() { return op == TOK.symbolOffset ? cast(typeof(return))this : null; }
inout(VarExp) isVarExp() { return op == TOK.variable ? cast(typeof(return))this : null; }
inout(OverExp) isOverExp() { return op == TOK.overloadSet ? cast(typeof(return))this : null; }
inout(FuncExp) isFuncExp() { return op == TOK.function_ ? cast(typeof(return))this : null; }
inout(DeclarationExp) isDeclarationExp() { return op == TOK.declaration ? cast(typeof(return))this : null; }
inout(TypeidExp) isTypeidExp() { return op == TOK.typeid_ ? cast(typeof(return))this : null; }
inout(TraitsExp) isTraitsExp() { return op == TOK.traits ? cast(typeof(return))this : null; }
inout(HaltExp) isHaltExp() { return op == TOK.halt ? cast(typeof(return))this : null; }
inout(IsExp) isExp() { return op == TOK.is_ ? cast(typeof(return))this : null; }
inout(MixinExp) isMixinExp() { return op == TOK.mixin_ ? cast(typeof(return))this : null; }
inout(ImportExp) isImportExp() { return op == TOK.import_ ? cast(typeof(return))this : null; }
inout(AssertExp) isAssertExp() { return op == TOK.assert_ ? cast(typeof(return))this : null; }
inout(DotIdExp) isDotIdExp() { return op == TOK.dotIdentifier ? cast(typeof(return))this : null; }
inout(DotTemplateExp) isDotTemplateExp() { return op == TOK.dotTemplateDeclaration ? cast(typeof(return))this : null; }
inout(DotVarExp) isDotVarExp() { return op == TOK.dotVariable ? cast(typeof(return))this : null; }
inout(DotTemplateInstanceExp) isDotTemplateInstanceExp() { return op == TOK.dotTemplateInstance ? cast(typeof(return))this : null; }
inout(DelegateExp) isDelegateExp() { return op == TOK.delegate_ ? cast(typeof(return))this : null; }
inout(DotTypeExp) isDotTypeExp() { return op == TOK.dotType ? cast(typeof(return))this : null; }
inout(CallExp) isCallExp() { return op == TOK.call ? cast(typeof(return))this : null; }
inout(AddrExp) isAddrExp() { return op == TOK.address ? cast(typeof(return))this : null; }
inout(PtrExp) isPtrExp() { return op == TOK.star ? cast(typeof(return))this : null; }
inout(NegExp) isNegExp() { return op == TOK.negate ? cast(typeof(return))this : null; }
inout(UAddExp) isUAddExp() { return op == TOK.uadd ? cast(typeof(return))this : null; }
inout(ComExp) isComExp() { return op == TOK.tilde ? cast(typeof(return))this : null; }
inout(NotExp) isNotExp() { return op == TOK.not ? cast(typeof(return))this : null; }
inout(DeleteExp) isDeleteExp() { return op == TOK.delete_ ? cast(typeof(return))this : null; }
inout(CastExp) isCastExp() { return op == TOK.cast_ ? cast(typeof(return))this : null; }
inout(VectorExp) isVectorExp() { return op == TOK.vector ? cast(typeof(return))this : null; }
inout(VectorArrayExp) isVectorArrayExp() { return op == TOK.vectorArray ? cast(typeof(return))this : null; }
inout(SliceExp) isSliceExp() { return op == TOK.slice ? cast(typeof(return))this : null; }
inout(ArrayLengthExp) isArrayLengthExp() { return op == TOK.arrayLength ? cast(typeof(return))this : null; }
inout(ArrayExp) isArrayExp() { return op == TOK.array ? cast(typeof(return))this : null; }
inout(DotExp) isDotExp() { return op == TOK.dot ? cast(typeof(return))this : null; }
inout(CommaExp) isCommaExp() { return op == TOK.comma ? cast(typeof(return))this : null; }
inout(IntervalExp) isIntervalExp() { return op == TOK.interval ? cast(typeof(return))this : null; }
inout(DelegatePtrExp) isDelegatePtrExp() { return op == TOK.delegatePointer ? cast(typeof(return))this : null; }
inout(DelegateFuncptrExp) isDelegateFuncptrExp() { return op == TOK.delegateFunctionPointer ? cast(typeof(return))this : null; }
inout(IndexExp) isIndexExp() { return op == TOK.index ? cast(typeof(return))this : null; }
inout(PostExp) isPostExp() { return (op == TOK.plusPlus || op == TOK.minusMinus) ? cast(typeof(return))this : null; }
inout(PreExp) isPreExp() { return (op == TOK.prePlusPlus || op == TOK.preMinusMinus) ? cast(typeof(return))this : null; }
inout(AssignExp) isAssignExp() { return op == TOK.assign ? cast(typeof(return))this : null; }
inout(ConstructExp) isConstructExp() { return op == TOK.construct ? cast(typeof(return))this : null; }
inout(BlitExp) isBlitExp() { return op == TOK.blit ? cast(typeof(return))this : null; }
inout(AddAssignExp) isAddAssignExp() { return op == TOK.addAssign ? cast(typeof(return))this : null; }
inout(MinAssignExp) isMinAssignExp() { return op == TOK.minAssign ? cast(typeof(return))this : null; }
inout(MulAssignExp) isMulAssignExp() { return op == TOK.mulAssign ? cast(typeof(return))this : null; }
inout(DivAssignExp) isDivAssignExp() { return op == TOK.divAssign ? cast(typeof(return))this : null; }
inout(ModAssignExp) isModAssignExp() { return op == TOK.modAssign ? cast(typeof(return))this : null; }
inout(AndAssignExp) isAndAssignExp() { return op == TOK.andAssign ? cast(typeof(return))this : null; }
inout(OrAssignExp) isOrAssignExp() { return op == TOK.orAssign ? cast(typeof(return))this : null; }
inout(XorAssignExp) isXorAssignExp() { return op == TOK.xorAssign ? cast(typeof(return))this : null; }
inout(PowAssignExp) isPowAssignExp() { return op == TOK.powAssign ? cast(typeof(return))this : null; }
inout(ShlAssignExp) isShlAssignExp() { return op == TOK.leftShiftAssign ? cast(typeof(return))this : null; }
inout(ShrAssignExp) isShrAssignExp() { return op == TOK.rightShiftAssign ? cast(typeof(return))this : null; }
inout(UshrAssignExp) isUshrAssignExp() { return op == TOK.unsignedRightShiftAssign ? cast(typeof(return))this : null; }
inout(CatAssignExp) isCatAssignExp() { return op == TOK.concatenateAssign
? cast(typeof(return))this
: null; }
inout(CatElemAssignExp) isCatElemAssignExp() { return op == TOK.concatenateElemAssign
? cast(typeof(return))this
: null; }
inout(CatDcharAssignExp) isCatDcharAssignExp() { return op == TOK.concatenateDcharAssign
? cast(typeof(return))this
: null; }
inout(AddExp) isAddExp() { return op == TOK.add ? cast(typeof(return))this : null; }
inout(MinExp) isMinExp() { return op == TOK.min ? cast(typeof(return))this : null; }
inout(CatExp) isCatExp() { return op == TOK.concatenate ? cast(typeof(return))this : null; }
inout(MulExp) isMulExp() { return op == TOK.mul ? cast(typeof(return))this : null; }
inout(DivExp) isDivExp() { return op == TOK.div ? cast(typeof(return))this : null; }
inout(ModExp) isModExp() { return op == TOK.mod ? cast(typeof(return))this : null; }
inout(PowExp) isPowExp() { return op == TOK.pow ? cast(typeof(return))this : null; }
inout(ShlExp) isShlExp() { return op == TOK.leftShift ? cast(typeof(return))this : null; }
inout(ShrExp) isShrExp() { return op == TOK.rightShift ? cast(typeof(return))this : null; }
inout(UshrExp) isUshrExp() { return op == TOK.unsignedRightShift ? cast(typeof(return))this : null; }
inout(AndExp) isAndExp() { return op == TOK.and ? cast(typeof(return))this : null; }
inout(OrExp) isOrExp() { return op == TOK.or ? cast(typeof(return))this : null; }
inout(XorExp) isXorExp() { return op == TOK.xor ? cast(typeof(return))this : null; }
inout(LogicalExp) isLogicalExp() { return (op == TOK.andAnd || op == TOK.orOr) ? cast(typeof(return))this : null; }
//inout(CmpExp) isCmpExp() { return op == TOK. ? cast(typeof(return))this : null; }
inout(InExp) isInExp() { return op == TOK.in_ ? cast(typeof(return))this : null; }
inout(RemoveExp) isRemoveExp() { return op == TOK.remove ? cast(typeof(return))this : null; }
inout(EqualExp) isEqualExp() { return (op == TOK.equal || op == TOK.notEqual) ? cast(typeof(return))this : null; }
inout(IdentityExp) isIdentityExp() { return (op == TOK.identity || op == TOK.notIdentity) ? cast(typeof(return))this : null; }
inout(CondExp) isCondExp() { return op == TOK.question ? cast(typeof(return))this : null; }
inout(DefaultInitExp) isDefaultInitExp() { return isDefaultInitOp(op) ? cast(typeof(return))this: null; }
inout(FileInitExp) isFileInitExp() { return (op == TOK.file || op == TOK.fileFullPath) ? cast(typeof(return))this : null; }
inout(LineInitExp) isLineInitExp() { return op == TOK.line ? cast(typeof(return))this : null; }
inout(ModuleInitExp) isModuleInitExp() { return op == TOK.moduleString ? cast(typeof(return))this : null; }
inout(FuncInitExp) isFuncInitExp() { return op == TOK.functionString ? cast(typeof(return))this : null; }
inout(PrettyFuncInitExp) isPrettyFuncInitExp() { return op == TOK.prettyFunction ? cast(typeof(return))this : null; }
inout(ClassReferenceExp) isClassReferenceExp() { return op == TOK.classReference ? cast(typeof(return))this : null; }
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class IntegerExp : Expression
{
private dinteger_t value;
extern (D) this(const ref Loc loc, dinteger_t value, Type type)
{
super(loc, TOK.int64, __traits(classInstanceSize, IntegerExp));
//printf("IntegerExp(value = %lld, type = '%s')\n", value, type ? type.toChars() : "");
assert(type);
if (!type.isscalar())
{
//printf("%s, loc = %d\n", toChars(), loc.linnum);
if (type.ty != Terror)
error("integral constant must be scalar type, not `%s`", type.toChars());
type = Type.terror;
}
this.type = type;
this.value = normalize(type.toBasetype().ty, value);
}
extern (D) this(dinteger_t value)
{
super(Loc.initial, TOK.int64, __traits(classInstanceSize, IntegerExp));
this.type = Type.tint32;
this.value = cast(d_int32)value;
}
static IntegerExp create(Loc loc, dinteger_t value, Type type)
{
return new IntegerExp(loc, value, type);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, dinteger_t value, Type type)
{
emplaceExp!(IntegerExp)(pue, loc, value, type);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
if (auto ne = (cast(Expression)o).isIntegerExp())
{
if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && value == ne.value)
{
return true;
}
}
return false;
}
override dinteger_t toInteger()
{
// normalize() is necessary until we fix all the paints of 'type'
return value = normalize(type.toBasetype().ty, value);
}
override real_t toReal()
{
// normalize() is necessary until we fix all the paints of 'type'
const ty = type.toBasetype().ty;
const val = normalize(ty, value);
value = val;
return (ty == Tuns64)
? real_t(cast(d_uns64)val)
: real_t(cast(d_int64)val);
}
override real_t toImaginary()
{
return CTFloat.zero;
}
override complex_t toComplex()
{
return complex_t(toReal());
}
override bool isBool(bool result)
{
bool r = toInteger() != 0;
return result ? r : !r;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (!e)
e = this;
else if (!loc.isValid())
loc = e.loc;
e.error("cannot modify constant `%s`", e.toChars());
return ErrorExp.get();
}
override void accept(Visitor v)
{
v.visit(this);
}
dinteger_t getInteger()
{
return value;
}
void setInteger(dinteger_t value)
{
this.value = normalize(type.toBasetype().ty, value);
}
extern (D) static dinteger_t normalize(TY ty, dinteger_t value)
{
/* 'Normalize' the value of the integer to be in range of the type
*/
dinteger_t result;
switch (ty)
{
case Tbool:
result = (value != 0);
break;
case Tint8:
result = cast(d_int8)value;
break;
case Tchar:
case Tuns8:
result = cast(d_uns8)value;
break;
case Tint16:
result = cast(d_int16)value;
break;
case Twchar:
case Tuns16:
result = cast(d_uns16)value;
break;
case Tint32:
result = cast(d_int32)value;
break;
case Tdchar:
case Tuns32:
result = cast(d_uns32)value;
break;
case Tint64:
result = cast(d_int64)value;
break;
case Tuns64:
result = cast(d_uns64)value;
break;
case Tpointer:
if (target.ptrsize == 8)
goto case Tuns64;
if (target.ptrsize == 4)
goto case Tuns32;
if (target.ptrsize == 2)
goto case Tuns16;
assert(0);
default:
break;
}
return result;
}
override Expression syntaxCopy()
{
return this;
}
/**
* Use this instead of creating new instances for commonly used literals
* such as 0 or 1.
*
* Parameters:
* v = The value of the expression
* Returns:
* A static instance of the expression, typed as `Tint32`.
*/
static IntegerExp literal(int v)()
{
__gshared IntegerExp theConstant;
if (!theConstant)
theConstant = new IntegerExp(v);
return theConstant;
}
/**
* Use this instead of creating new instances for commonly used bools.
*
* Parameters:
* b = The value of the expression
* Returns:
* A static instance of the expression, typed as `Type.tbool`.
*/
static IntegerExp createBool(bool b)
{
__gshared IntegerExp trueExp, falseExp;
if (!trueExp)
{
trueExp = new IntegerExp(Loc.initial, 1, Type.tbool);
falseExp = new IntegerExp(Loc.initial, 0, Type.tbool);
}
return b ? trueExp : falseExp;
}
}
/***********************************************************
* Use this expression for error recovery.
* It should behave as a 'sink' to prevent further cascaded error messages.
*/
extern (C++) final class ErrorExp : Expression
{
private extern (D) this()
{
super(Loc.initial, TOK.error, __traits(classInstanceSize, ErrorExp));
type = Type.terror;
}
static ErrorExp get ()
{
if (errorexp is null)
errorexp = new ErrorExp();
if (global.errors == 0 && global.gaggedErrors == 0)
{
/* Unfortunately, errors can still leak out of gagged errors,
* and we need to set the error count to prevent bogus code
* generation. At least give a message.
*/
.error(Loc.initial, "unknown, please file report on issues.dlang.org");
}
return errorexp;
}
override Expression toLvalue(Scope* sc, Expression e)
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
extern (C++) __gshared ErrorExp errorexp; // handy shared value
}
/***********************************************************
* An uninitialized value,
* generated from void initializers.
*/
extern (C++) final class VoidInitExp : Expression
{
VarDeclaration var; /// the variable from where the void value came from, null if not known
/// Useful for error messages
extern (D) this(VarDeclaration var)
{
super(var.loc, TOK.void_, __traits(classInstanceSize, VoidInitExp));
this.var = var;
this.type = var.type;
}
override const(char)* toChars() const
{
return "void";
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class RealExp : Expression
{
real_t value;
extern (D) this(const ref Loc loc, real_t value, Type type)
{
super(loc, TOK.float64, __traits(classInstanceSize, RealExp));
//printf("RealExp::RealExp(%Lg)\n", value);
this.value = value;
this.type = type;
}
static RealExp create(Loc loc, real_t value, Type type)
{
return new RealExp(loc, value, type);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, real_t value, Type type)
{
emplaceExp!(RealExp)(pue, loc, value, type);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
if (auto ne = (cast(Expression)o).isRealExp())
{
if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(value, ne.value))
{
return true;
}
}
return false;
}
override dinteger_t toInteger()
{
return cast(sinteger_t)toReal();
}
override uinteger_t toUInteger()
{
return cast(uinteger_t)toReal();
}
override real_t toReal()
{
return type.isreal() ? value : CTFloat.zero;
}
override real_t toImaginary()
{
return type.isreal() ? CTFloat.zero : value;
}
override complex_t toComplex()
{
return complex_t(toReal(), toImaginary());
}
override bool isBool(bool result)
{
return result ? cast(bool)value : !cast(bool)value;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ComplexExp : Expression
{
complex_t value;
extern (D) this(const ref Loc loc, complex_t value, Type type)
{
super(loc, TOK.complex80, __traits(classInstanceSize, ComplexExp));
this.value = value;
this.type = type;
//printf("ComplexExp::ComplexExp(%s)\n", toChars());
}
static ComplexExp create(Loc loc, complex_t value, Type type)
{
return new ComplexExp(loc, value, type);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, complex_t value, Type type)
{
emplaceExp!(ComplexExp)(pue, loc, value, type);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
if (auto ne = (cast(Expression)o).isComplexExp())
{
if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && RealIdentical(creall(value), creall(ne.value)) && RealIdentical(cimagl(value), cimagl(ne.value)))
{
return true;
}
}
return false;
}
override dinteger_t toInteger()
{
return cast(sinteger_t)toReal();
}
override uinteger_t toUInteger()
{
return cast(uinteger_t)toReal();
}
override real_t toReal()
{
return creall(value);
}
override real_t toImaginary()
{
return cimagl(value);
}
override complex_t toComplex()
{
return value;
}
override bool isBool(bool result)
{
if (result)
return cast(bool)value;
else
return !value;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) class IdentifierExp : Expression
{
Identifier ident;
extern (D) this(const ref Loc loc, Identifier ident)
{
super(loc, TOK.identifier, __traits(classInstanceSize, IdentifierExp));
this.ident = ident;
}
static IdentifierExp create(Loc loc, Identifier ident)
{
return new IdentifierExp(loc, ident);
}
override final bool isLvalue()
{
return true;
}
override final Expression toLvalue(Scope* sc, Expression e)
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DollarExp : IdentifierExp
{
extern (D) this(const ref Loc loc)
{
super(loc, Id.dollar);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Won't be generated by parser.
*/
extern (C++) final class DsymbolExp : Expression
{
Dsymbol s;
bool hasOverloads;
extern (D) this(const ref Loc loc, Dsymbol s, bool hasOverloads = true)
{
super(loc, TOK.dSymbol, __traits(classInstanceSize, DsymbolExp));
this.s = s;
this.hasOverloads = hasOverloads;
}
override bool isLvalue()
{
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#this
*/
extern (C++) class ThisExp : Expression
{
VarDeclaration var;
extern (D) this(const ref Loc loc)
{
super(loc, TOK.this_, __traits(classInstanceSize, ThisExp));
//printf("ThisExp::ThisExp() loc = %d\n", loc.linnum);
}
this(const ref Loc loc, const TOK tok)
{
super(loc, tok, __traits(classInstanceSize, ThisExp));
//printf("ThisExp::ThisExp() loc = %d\n", loc.linnum);
}
override Expression syntaxCopy()
{
auto r = cast(ThisExp) super.syntaxCopy();
// require new semantic (possibly new `var` etc.)
r.type = null;
r.var = null;
return r;
}
override final bool isBool(bool result)
{
return result;
}
override final bool isLvalue()
{
// Class `this` should be an rvalue; struct `this` should be an lvalue.
return type.toBasetype().ty != Tclass;
}
override final Expression toLvalue(Scope* sc, Expression e)
{
if (type.toBasetype().ty == Tclass)
{
// Class `this` is an rvalue; struct `this` is an lvalue.
return Expression.toLvalue(sc, e);
}
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#super
*/
extern (C++) final class SuperExp : ThisExp
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.super_);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#null
*/
extern (C++) final class NullExp : Expression
{
extern (D) this(const ref Loc loc, Type type = null)
{
super(loc, TOK.null_, __traits(classInstanceSize, NullExp));
this.type = type;
}
override bool equals(const RootObject o) const
{
if (auto e = o.isExpression())
{
if (e.op == TOK.null_ && type.equals(e.type))
{
return true;
}
}
return false;
}
override bool isBool(bool result)
{
return result ? false : true;
}
override StringExp toStringExp()
{
if (implicitConvTo(Type.tstring))
{
auto se = new StringExp(loc, (cast(char*)mem.xcalloc(1, 1))[0 .. 0]);
se.type = Type.tstring;
return se;
}
return null;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#string_literals
*/
extern (C++) final class StringExp : Expression
{
private union
{
char* string; // if sz == 1
wchar* wstring; // if sz == 2
dchar* dstring; // if sz == 4
} // (const if ownedByCtfe == OwnedBy.code)
size_t len; // number of code units
ubyte sz = 1; // 1: char, 2: wchar, 4: dchar
ubyte committed; // !=0 if type is committed
enum char NoPostfix = 0;
char postfix = NoPostfix; // 'c', 'w', 'd'
OwnedBy ownedByCtfe = OwnedBy.code;
extern (D) this(const ref Loc loc, const(void)[] string)
{
super(loc, TOK.string_, __traits(classInstanceSize, StringExp));
this.string = cast(char*)string.ptr; // note that this.string should be const
this.len = string.length;
this.sz = 1; // work around LDC bug #1286
}
extern (D) this(const ref Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix = NoPostfix)
{
super(loc, TOK.string_, __traits(classInstanceSize, StringExp));
this.string = cast(char*)string.ptr; // note that this.string should be const
this.len = len;
this.sz = sz;
this.postfix = postfix;
}
static StringExp create(Loc loc, char* s)
{
return new StringExp(loc, s.toDString());
}
static StringExp create(Loc loc, void* string, size_t len)
{
return new StringExp(loc, string[0 .. len]);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, char* s)
{
emplaceExp!(StringExp)(pue, loc, s.toDString());
}
extern (D) static void emplace(UnionExp* pue, Loc loc, const(void)[] string)
{
emplaceExp!(StringExp)(pue, loc, string);
}
extern (D) static void emplace(UnionExp* pue, Loc loc, const(void)[] string, size_t len, ubyte sz, char postfix)
{
emplaceExp!(StringExp)(pue, loc, string, len, sz, postfix);
}
override bool equals(const RootObject o) const
{
//printf("StringExp::equals('%s') %s\n", o.toChars(), toChars());
if (auto e = o.isExpression())
{
if (auto se = e.isStringExp())
{
return compare(se) == 0;
}
}
return false;
}
/**********************************
* Return the number of code units the string would be if it were re-encoded
* as tynto.
* Params:
* tynto = code unit type of the target encoding
* Returns:
* number of code units
*/
size_t numberOfCodeUnits(int tynto = 0) const
{
int encSize;
switch (tynto)
{
case 0: return len;
case Tchar: encSize = 1; break;
case Twchar: encSize = 2; break;
case Tdchar: encSize = 4; break;
default:
assert(0);
}
if (sz == encSize)
return len;
size_t result = 0;
dchar c;
switch (sz)
{
case 1:
for (size_t u = 0; u < len;)
{
if (const s = utf_decodeChar(string[0 .. len], u, c))
{
error("%.*s", cast(int)s.length, s.ptr);
return 0;
}
result += utf_codeLength(encSize, c);
}
break;
case 2:
for (size_t u = 0; u < len;)
{
if (const s = utf_decodeWchar(wstring[0 .. len], u, c))
{
error("%.*s", cast(int)s.length, s.ptr);
return 0;
}
result += utf_codeLength(encSize, c);
}
break;
case 4:
foreach (u; 0 .. len)
{
result += utf_codeLength(encSize, dstring[u]);
}
break;
default:
assert(0);
}
return result;
}
/**********************************************
* Write the contents of the string to dest.
* Use numberOfCodeUnits() to determine size of result.
* Params:
* dest = destination
* tyto = encoding type of the result
* zero = add terminating 0
*/
void writeTo(void* dest, bool zero, int tyto = 0) const
{
int encSize;
switch (tyto)
{
case 0: encSize = sz; break;
case Tchar: encSize = 1; break;
case Twchar: encSize = 2; break;
case Tdchar: encSize = 4; break;
default:
assert(0);
}
if (sz == encSize)
{
memcpy(dest, string, len * sz);
if (zero)
memset(dest + len * sz, 0, sz);
}
else
assert(0);
}
/*********************************************
* Get the code unit at index i
* Params:
* i = index
* Returns:
* code unit at index i
*/
dchar getCodeUnit(size_t i) const pure
{
assert(i < len);
final switch (sz)
{
case 1:
return string[i];
case 2:
return wstring[i];
case 4:
return dstring[i];
}
}
/*********************************************
* Set the code unit at index i to c
* Params:
* i = index
* c = code unit to set it to
*/
void setCodeUnit(size_t i, dchar c)
{
assert(i < len);
final switch (sz)
{
case 1:
string[i] = cast(char)c;
break;
case 2:
wstring[i] = cast(wchar)c;
break;
case 4:
dstring[i] = c;
break;
}
}
override StringExp toStringExp()
{
return this;
}
/****************************************
* Convert string to char[].
*/
StringExp toUTF8(Scope* sc)
{
if (sz != 1)
{
// Convert to UTF-8 string
committed = 0;
Expression e = castTo(sc, Type.tchar.arrayOf());
e = e.optimize(WANTvalue);
auto se = e.isStringExp();
assert(se.sz == 1);
return se;
}
return this;
}
/**
* Compare two `StringExp` by length, then value
*
* The comparison is not the usual C-style comparison as seen with
* `strcmp` or `memcmp`, but instead first compare based on the length.
* This allows both faster lookup and sorting when comparing sparse data.
*
* This ordering scheme is relied on by the string-switching feature.
* Code in Druntime's `core.internal.switch_` relies on this ordering
* when doing a binary search among case statements.
*
* Both `StringExp` should be of the same encoding.
*
* Params:
* se2 = String expression to compare `this` to
*
* Returns:
* `0` when `this` is equal to se2, a value greater than `0` if
* `this` should be considered greater than `se2`,
* and a value less than `0` if `this` is lesser than `se2`.
*/
int compare(const StringExp se2) const nothrow pure @nogc
{
//printf("StringExp::compare()\n");
const len1 = len;
const len2 = se2.len;
assert(this.sz == se2.sz, "Comparing string expressions of different sizes");
//printf("sz = %d, len1 = %d, len2 = %d\n", sz, (int)len1, (int)len2);
if (len1 == len2)
{
switch (sz)
{
case 1:
return memcmp(string, se2.string, len1);
case 2:
{
wchar* s1 = cast(wchar*)string;
wchar* s2 = cast(wchar*)se2.string;
foreach (u; 0 .. len)
{
if (s1[u] != s2[u])
return s1[u] - s2[u];
}
}
break;
case 4:
{
dchar* s1 = cast(dchar*)string;
dchar* s2 = cast(dchar*)se2.string;
foreach (u; 0 .. len)
{
if (s1[u] != s2[u])
return s1[u] - s2[u];
}
}
break;
default:
assert(0);
}
}
return cast(int)(len1 - len2);
}
override bool isBool(bool result)
{
return result;
}
override bool isLvalue()
{
/* string literal is rvalue in default, but
* conversion to reference of static array is only allowed.
*/
return (type && type.toBasetype().ty == Tsarray);
}
override Expression toLvalue(Scope* sc, Expression e)
{
//printf("StringExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL);
return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e);
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
error("cannot modify string literal `%s`", toChars());
return ErrorExp.get();
}
uint charAt(uinteger_t i) const
{
uint value;
switch (sz)
{
case 1:
value = (cast(char*)string)[cast(size_t)i];
break;
case 2:
value = (cast(ushort*)string)[cast(size_t)i];
break;
case 4:
value = (cast(uint*)string)[cast(size_t)i];
break;
default:
assert(0);
}
return value;
}
/********************************
* Convert string contents to a 0 terminated string,
* allocated by mem.xmalloc().
*/
extern (D) const(char)[] toStringz() const
{
auto nbytes = len * sz;
char* s = cast(char*)mem.xmalloc(nbytes + sz);
writeTo(s, true);
return s[0 .. nbytes];
}
extern (D) const(char)[] peekString() const
{
assert(sz == 1);
return this.string[0 .. len];
}
extern (D) const(wchar)[] peekWstring() const
{
assert(sz == 2);
return this.wstring[0 .. len];
}
extern (D) const(dchar)[] peekDstring() const
{
assert(sz == 4);
return this.dstring[0 .. len];
}
/*******************
* Get a slice of the data.
*/
extern (D) const(ubyte)[] peekData() const
{
return cast(const(ubyte)[])this.string[0 .. len * sz];
}
/*******************
* Borrow a slice of the data, so the caller can modify
* it in-place (!)
*/
extern (D) ubyte[] borrowData()
{
return cast(ubyte[])this.string[0 .. len * sz];
}
/***********************
* Set new string data.
* `this` becomes the new owner of the data.
*/
extern (D) void setData(void* s, size_t len, ubyte sz)
{
this.string = cast(char*)s;
this.len = len;
this.sz = sz;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class TupleExp : Expression
{
/* Tuple-field access may need to take out its side effect part.
* For example:
* foo().tupleof
* is rewritten as:
* (ref __tup = foo(); tuple(__tup.field0, __tup.field1, ...))
* The declaration of temporary variable __tup will be stored in TupleExp.e0.
*/
Expression e0;
Expressions* exps;
extern (D) this(const ref Loc loc, Expression e0, Expressions* exps)
{
super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp));
//printf("TupleExp(this = %p)\n", this);
this.e0 = e0;
this.exps = exps;
}
extern (D) this(const ref Loc loc, Expressions* exps)
{
super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp));
//printf("TupleExp(this = %p)\n", this);
this.exps = exps;
}
extern (D) this(const ref Loc loc, TupleDeclaration tup)
{
super(loc, TOK.tuple, __traits(classInstanceSize, TupleExp));
this.exps = new Expressions();
this.exps.reserve(tup.objects.dim);
foreach (o; *tup.objects)
{
if (Dsymbol s = getDsymbol(o))
{
/* If tuple element represents a symbol, translate to DsymbolExp
* to supply implicit 'this' if needed later.
*/
Expression e = new DsymbolExp(loc, s);
this.exps.push(e);
}
else if (auto eo = o.isExpression())
{
auto e = eo.copy();
e.loc = loc; // https://issues.dlang.org/show_bug.cgi?id=15669
this.exps.push(e);
}
else if (auto t = o.isType())
{
Expression e = new TypeExp(loc, t);
this.exps.push(e);
}
else
{
error("`%s` is not an expression", o.toChars());
}
}
}
static TupleExp create(Loc loc, Expressions* exps)
{
return new TupleExp(loc, exps);
}
override TupleExp toTupleExp()
{
return this;
}
override Expression syntaxCopy()
{
return new TupleExp(loc, e0 ? e0.syntaxCopy() : null, arraySyntaxCopy(exps));
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
if (auto e = o.isExpression())
if (auto te = e.isTupleExp())
{
if (exps.dim != te.exps.dim)
return false;
if (e0 && !e0.equals(te.e0) || !e0 && te.e0)
return false;
foreach (i, e1; *exps)
{
auto e2 = (*te.exps)[i];
if (!e1.equals(e2))
return false;
}
return true;
}
return false;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* [ e1, e2, e3, ... ]
*
* http://dlang.org/spec/expression.html#array_literals
*/
extern (C++) final class ArrayLiteralExp : Expression
{
/** If !is null, elements[] can be sparse and basis is used for the
* "default" element value. In other words, non-null elements[i] overrides
* this 'basis' value.
*/
Expression basis;
Expressions* elements;
OwnedBy ownedByCtfe = OwnedBy.code;
extern (D) this(const ref Loc loc, Type type, Expressions* elements)
{
super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp));
this.type = type;
this.elements = elements;
}
extern (D) this(const ref Loc loc, Type type, Expression e)
{
super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp));
this.type = type;
elements = new Expressions();
elements.push(e);
}
extern (D) this(const ref Loc loc, Type type, Expression basis, Expressions* elements)
{
super(loc, TOK.arrayLiteral, __traits(classInstanceSize, ArrayLiteralExp));
this.type = type;
this.basis = basis;
this.elements = elements;
}
static ArrayLiteralExp create(Loc loc, Expressions* elements)
{
return new ArrayLiteralExp(loc, null, elements);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, Expressions* elements)
{
emplaceExp!(ArrayLiteralExp)(pue, loc, null, elements);
}
override Expression syntaxCopy()
{
return new ArrayLiteralExp(loc,
null,
basis ? basis.syntaxCopy() : null,
arraySyntaxCopy(elements));
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
auto e = o.isExpression();
if (!e)
return false;
if (auto ae = e.isArrayLiteralExp())
{
if (elements.dim != ae.elements.dim)
return false;
if (elements.dim == 0 && !type.equals(ae.type))
{
return false;
}
foreach (i, e1; *elements)
{
auto e2 = (*ae.elements)[i];
auto e1x = e1 ? e1 : basis;
auto e2x = e2 ? e2 : ae.basis;
if (e1x != e2x && (!e1x || !e2x || !e1x.equals(e2x)))
return false;
}
return true;
}
return false;
}
Expression getElement(size_t i)
{
return this[i];
}
Expression opIndex(size_t i)
{
auto el = (*elements)[i];
return el ? el : basis;
}
override bool isBool(bool result)
{
size_t dim = elements ? elements.dim : 0;
return result ? (dim != 0) : (dim == 0);
}
override StringExp toStringExp()
{
TY telem = type.nextOf().toBasetype().ty;
if (telem.isSomeChar || (telem == Tvoid && (!elements || elements.dim == 0)))
{
ubyte sz = 1;
if (telem == Twchar)
sz = 2;
else if (telem == Tdchar)
sz = 4;
OutBuffer buf;
if (elements)
{
foreach (i; 0 .. elements.dim)
{
auto ch = this[i];
if (ch.op != TOK.int64)
return null;
if (sz == 1)
buf.writeByte(cast(uint)ch.toInteger());
else if (sz == 2)
buf.writeword(cast(uint)ch.toInteger());
else
buf.write4(cast(uint)ch.toInteger());
}
}
char prefix;
if (sz == 1)
{
prefix = 'c';
buf.writeByte(0);
}
else if (sz == 2)
{
prefix = 'w';
buf.writeword(0);
}
else
{
prefix = 'd';
buf.write4(0);
}
const size_t len = buf.length / sz - 1;
auto se = new StringExp(loc, buf.extractSlice()[0 .. len * sz], len, sz, prefix);
se.sz = sz;
se.type = type;
return se;
}
return null;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* [ key0 : value0, key1 : value1, ... ]
*
* http://dlang.org/spec/expression.html#associative_array_literals
*/
extern (C++) final class AssocArrayLiteralExp : Expression
{
Expressions* keys;
Expressions* values;
OwnedBy ownedByCtfe = OwnedBy.code;
extern (D) this(const ref Loc loc, Expressions* keys, Expressions* values)
{
super(loc, TOK.assocArrayLiteral, __traits(classInstanceSize, AssocArrayLiteralExp));
assert(keys.dim == values.dim);
this.keys = keys;
this.values = values;
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
auto e = o.isExpression();
if (!e)
return false;
if (auto ae = e.isAssocArrayLiteralExp())
{
if (keys.dim != ae.keys.dim)
return false;
size_t count = 0;
foreach (i, key; *keys)
{
foreach (j, akey; *ae.keys)
{
if (key.equals(akey))
{
if (!(*values)[i].equals((*ae.values)[j]))
return false;
++count;
}
}
}
return count == keys.dim;
}
return false;
}
override Expression syntaxCopy()
{
return new AssocArrayLiteralExp(loc, arraySyntaxCopy(keys), arraySyntaxCopy(values));
}
override bool isBool(bool result)
{
size_t dim = keys.dim;
return result ? (dim != 0) : (dim == 0);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
enum stageScrub = 0x1; /// scrubReturnValue is running
enum stageSearchPointers = 0x2; /// hasNonConstPointers is running
enum stageOptimize = 0x4; /// optimize is running
enum stageApply = 0x8; /// apply is running
enum stageInlineScan = 0x10; /// inlineScan is running
enum stageToCBuffer = 0x20; /// toCBuffer is running
/***********************************************************
* sd( e1, e2, e3, ... )
*/
extern (C++) final class StructLiteralExp : Expression
{
StructDeclaration sd; /// which aggregate this is for
Expressions* elements; /// parallels sd.fields[] with null entries for fields to skip
Type stype; /// final type of result (can be different from sd's type)
Symbol* sym; /// back end symbol to initialize with literal
/** pointer to the origin instance of the expression.
* once a new expression is created, origin is set to 'this'.
* anytime when an expression copy is created, 'origin' pointer is set to
* 'origin' pointer value of the original expression.
*/
StructLiteralExp origin;
/// those fields need to prevent a infinite recursion when one field of struct initialized with 'this' pointer.
StructLiteralExp inlinecopy;
/** anytime when recursive function is calling, 'stageflags' marks with bit flag of
* current stage and unmarks before return from this function.
* 'inlinecopy' uses similar 'stageflags' and from multiple evaluation 'doInline'
* (with infinite recursion) of this expression.
*/
int stageflags;
bool useStaticInit; /// if this is true, use the StructDeclaration's init symbol
bool isOriginal = false; /// used when moving instances to indicate `this is this.origin`
OwnedBy ownedByCtfe = OwnedBy.code;
extern (D) this(const ref Loc loc, StructDeclaration sd, Expressions* elements, Type stype = null)
{
super(loc, TOK.structLiteral, __traits(classInstanceSize, StructLiteralExp));
this.sd = sd;
if (!elements)
elements = new Expressions();
this.elements = elements;
this.stype = stype;
this.origin = this;
//printf("StructLiteralExp::StructLiteralExp(%s)\n", toChars());
}
static StructLiteralExp create(Loc loc, StructDeclaration sd, void* elements, Type stype = null)
{
return new StructLiteralExp(loc, sd, cast(Expressions*)elements, stype);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
auto e = o.isExpression();
if (!e)
return false;
if (auto se = e.isStructLiteralExp())
{
if (!type.equals(se.type))
return false;
if (elements.dim != se.elements.dim)
return false;
foreach (i, e1; *elements)
{
auto e2 = (*se.elements)[i];
if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2)))
return false;
}
return true;
}
return false;
}
override Expression syntaxCopy()
{
auto exp = new StructLiteralExp(loc, sd, arraySyntaxCopy(elements), type ? type : stype);
exp.origin = this;
return exp;
}
/**************************************
* Gets expression at offset of type.
* Returns NULL if not found.
*/
Expression getField(Type type, uint offset)
{
//printf("StructLiteralExp::getField(this = %s, type = %s, offset = %u)\n",
// /*toChars()*/"", type.toChars(), offset);
Expression e = null;
int i = getFieldIndex(type, offset);
if (i != -1)
{
//printf("\ti = %d\n", i);
if (i >= sd.nonHiddenFields())
return null;
assert(i < elements.dim);
e = (*elements)[i];
if (e)
{
//printf("e = %s, e.type = %s\n", e.toChars(), e.type.toChars());
/* If type is a static array, and e is an initializer for that array,
* then the field initializer should be an array literal of e.
*/
auto tsa = type.isTypeSArray();
if (tsa && e.type.castMod(0) != type.castMod(0))
{
const length = cast(size_t)tsa.dim.toInteger();
auto z = new Expressions(length);
foreach (ref q; *z)
q = e.copy();
e = new ArrayLiteralExp(loc, type, z);
}
else
{
e = e.copy();
e.type = type;
}
if (useStaticInit && e.type.needsNested())
if (auto se = e.isStructLiteralExp())
{
se.useStaticInit = true;
}
}
}
return e;
}
/************************************
* Get index of field.
* Returns -1 if not found.
*/
int getFieldIndex(Type type, uint offset)
{
/* Find which field offset is by looking at the field offsets
*/
if (elements.dim)
{
foreach (i, v; sd.fields)
{
if (offset == v.offset && type.size() == v.type.size())
{
/* context fields might not be filled. */
if (i >= sd.nonHiddenFields())
return cast(int)i;
if (auto e = (*elements)[i])
{
return cast(int)i;
}
break;
}
}
}
return -1;
}
override Expression addDtorHook(Scope* sc)
{
/* If struct requires a destructor, rewrite as:
* (S tmp = S()),tmp
* so that the destructor can be hung on tmp.
*/
if (sd.dtor && sc.func)
{
/* Make an identifier for the temporary of the form:
* __sl%s%d, where %s is the struct name
*/
char[10] buf = void;
const prefix = "__sl";
const ident = sd.ident.toString;
const fullLen = prefix.length + ident.length;
const len = fullLen < buf.length ? fullLen : buf.length;
buf[0 .. prefix.length] = prefix;
buf[prefix.length .. len] = ident[0 .. len - prefix.length];
auto tmp = copyToTemp(0, buf[0 .. len], this);
Expression ae = new DeclarationExp(loc, tmp);
Expression e = new CommaExp(loc, ae, new VarExp(loc, tmp));
e = e.expressionSemantic(sc);
return e;
}
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Mainly just a placeholder
*/
extern (C++) final class TypeExp : Expression
{
extern (D) this(const ref Loc loc, Type type)
{
super(loc, TOK.type, __traits(classInstanceSize, TypeExp));
//printf("TypeExp::TypeExp(%s)\n", type.toChars());
this.type = type;
}
override Expression syntaxCopy()
{
return new TypeExp(loc, type.syntaxCopy());
}
override bool checkType()
{
error("type `%s` is not an expression", toChars());
return true;
}
override bool checkValue()
{
error("type `%s` has no value", toChars());
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Mainly just a placeholder of
* Package, Module, Nspace, and TemplateInstance (including TemplateMixin)
*
* A template instance that requires IFTI:
* foo!tiargs(fargs) // foo!tiargs
* is left until CallExp::semantic() or resolveProperties()
*/
extern (C++) final class ScopeExp : Expression
{
ScopeDsymbol sds;
extern (D) this(const ref Loc loc, ScopeDsymbol sds)
{
super(loc, TOK.scope_, __traits(classInstanceSize, ScopeExp));
//printf("ScopeExp::ScopeExp(sds = '%s')\n", sds.toChars());
//static int count; if (++count == 38) *(char*)0=0;
this.sds = sds;
assert(!sds.isTemplateDeclaration()); // instead, you should use TemplateExp
}
override Expression syntaxCopy()
{
return new ScopeExp(loc, cast(ScopeDsymbol)sds.syntaxCopy(null));
}
override bool checkType()
{
if (sds.isPackage())
{
error("%s `%s` has no type", sds.kind(), sds.toChars());
return true;
}
if (auto ti = sds.isTemplateInstance())
{
//assert(ti.needsTypeInference(sc));
if (ti.tempdecl &&
ti.semantictiargsdone &&
ti.semanticRun == PASS.init)
{
error("partial %s `%s` has no type", sds.kind(), toChars());
return true;
}
}
return false;
}
override bool checkValue()
{
error("%s `%s` has no value", sds.kind(), sds.toChars());
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Mainly just a placeholder
*/
extern (C++) final class TemplateExp : Expression
{
TemplateDeclaration td;
FuncDeclaration fd;
extern (D) this(const ref Loc loc, TemplateDeclaration td, FuncDeclaration fd = null)
{
super(loc, TOK.template_, __traits(classInstanceSize, TemplateExp));
//printf("TemplateExp(): %s\n", td.toChars());
this.td = td;
this.fd = fd;
}
override bool isLvalue()
{
return fd !is null;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (!fd)
return Expression.toLvalue(sc, e);
assert(sc);
return symbolToExp(fd, loc, sc, true);
}
override bool checkType()
{
error("%s `%s` has no type", td.kind(), toChars());
return true;
}
override bool checkValue()
{
error("%s `%s` has no value", td.kind(), toChars());
return true;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* thisexp.new(newargs) newtype(arguments)
*/
extern (C++) final class NewExp : Expression
{
Expression thisexp; // if !=null, 'this' for class being allocated
Expressions* newargs; // Array of Expression's to call new operator
Type newtype;
Expressions* arguments; // Array of Expression's
Expression argprefix; // expression to be evaluated just before arguments[]
CtorDeclaration member; // constructor function
NewDeclaration allocator; // allocator function
bool onstack; // allocate on stack
bool thrownew; // this NewExp is the expression of a ThrowStatement
extern (D) this(const ref Loc loc, Expression thisexp, Expressions* newargs, Type newtype, Expressions* arguments)
{
super(loc, TOK.new_, __traits(classInstanceSize, NewExp));
this.thisexp = thisexp;
this.newargs = newargs;
this.newtype = newtype;
this.arguments = arguments;
}
static NewExp create(Loc loc, Expression thisexp, Expressions* newargs, Type newtype, Expressions* arguments)
{
return new NewExp(loc, thisexp, newargs, newtype, arguments);
}
override Expression syntaxCopy()
{
return new NewExp(loc,
thisexp ? thisexp.syntaxCopy() : null,
arraySyntaxCopy(newargs),
newtype.syntaxCopy(),
arraySyntaxCopy(arguments));
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* thisexp.new(newargs) class baseclasses { } (arguments)
*/
extern (C++) final class NewAnonClassExp : Expression
{
Expression thisexp; // if !=null, 'this' for class being allocated
Expressions* newargs; // Array of Expression's to call new operator
ClassDeclaration cd; // class being instantiated
Expressions* arguments; // Array of Expression's to call class constructor
extern (D) this(const ref Loc loc, Expression thisexp, Expressions* newargs, ClassDeclaration cd, Expressions* arguments)
{
super(loc, TOK.newAnonymousClass, __traits(classInstanceSize, NewAnonClassExp));
this.thisexp = thisexp;
this.newargs = newargs;
this.cd = cd;
this.arguments = arguments;
}
override Expression syntaxCopy()
{
return new NewAnonClassExp(loc, thisexp ? thisexp.syntaxCopy() : null, arraySyntaxCopy(newargs), cast(ClassDeclaration)cd.syntaxCopy(null), arraySyntaxCopy(arguments));
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) class SymbolExp : Expression
{
Declaration var;
Dsymbol originalScope; // original scope before inlining
bool hasOverloads;
extern (D) this(const ref Loc loc, TOK op, int size, Declaration var, bool hasOverloads)
{
super(loc, op, size);
assert(var);
this.var = var;
this.hasOverloads = hasOverloads;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Offset from symbol
*/
extern (C++) final class SymOffExp : SymbolExp
{
dinteger_t offset;
extern (D) this(const ref Loc loc, Declaration var, dinteger_t offset, bool hasOverloads = true)
{
if (auto v = var.isVarDeclaration())
{
// FIXME: This error report will never be handled anyone.
// It should be done before the SymOffExp construction.
if (v.needThis())
.error(loc, "need `this` for address of `%s`", v.toChars());
hasOverloads = false;
}
super(loc, TOK.symbolOffset, __traits(classInstanceSize, SymOffExp), var, hasOverloads);
this.offset = offset;
}
override bool isBool(bool result)
{
return result ? true : false;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Variable
*/
extern (C++) final class VarExp : SymbolExp
{
bool delegateWasExtracted;
extern (D) this(const ref Loc loc, Declaration var, bool hasOverloads = true)
{
if (var.isVarDeclaration())
hasOverloads = false;
super(loc, TOK.variable, __traits(classInstanceSize, VarExp), var, hasOverloads);
//printf("VarExp(this = %p, '%s', loc = %s)\n", this, var.toChars(), loc.toChars());
//if (strcmp(var.ident.toChars(), "func") == 0) assert(0);
this.type = var.type;
}
static VarExp create(Loc loc, Declaration var, bool hasOverloads = true)
{
return new VarExp(loc, var, hasOverloads);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
if (auto ne = o.isExpression().isVarExp())
{
if (type.toHeadMutable().equals(ne.type.toHeadMutable()) && var == ne.var)
{
return true;
}
}
return false;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
//printf("VarExp::checkModifiable %s", toChars());
assert(type);
return var.checkModify(loc, sc, null, flag);
}
override bool isLvalue()
{
if (var.storage_class & (STC.lazy_ | STC.rvalue | STC.manifest))
return false;
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (var.storage_class & STC.manifest)
{
error("manifest constant `%s` cannot be modified", var.toChars());
return ErrorExp.get();
}
if (var.storage_class & STC.lazy_ && !delegateWasExtracted)
{
error("lazy variable `%s` cannot be modified", var.toChars());
return ErrorExp.get();
}
if (var.ident == Id.ctfe)
{
error("cannot modify compiler-generated variable `__ctfe`");
return ErrorExp.get();
}
if (var.ident == Id.dollar) // https://issues.dlang.org/show_bug.cgi?id=13574
{
error("cannot modify operator `$`");
return ErrorExp.get();
}
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
//printf("VarExp::modifiableLvalue('%s')\n", var.toChars());
if (var.storage_class & STC.manifest)
{
error("cannot modify manifest constant `%s`", toChars());
return ErrorExp.get();
}
// See if this expression is a modifiable lvalue (i.e. not const)
return Expression.modifiableLvalue(sc, e);
}
override void accept(Visitor v)
{
v.visit(this);
}
override Expression syntaxCopy()
{
auto ret = super.syntaxCopy();
return ret;
}
}
/***********************************************************
* Overload Set
*/
extern (C++) final class OverExp : Expression
{
OverloadSet vars;
extern (D) this(const ref Loc loc, OverloadSet s)
{
super(loc, TOK.overloadSet, __traits(classInstanceSize, OverExp));
//printf("OverExp(this = %p, '%s')\n", this, var.toChars());
vars = s;
type = Type.tvoid;
}
override bool isLvalue()
{
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Function/Delegate literal
*/
extern (C++) final class FuncExp : Expression
{
FuncLiteralDeclaration fd;
TemplateDeclaration td;
TOK tok;
extern (D) this(const ref Loc loc, Dsymbol s)
{
super(loc, TOK.function_, __traits(classInstanceSize, FuncExp));
this.td = s.isTemplateDeclaration();
this.fd = s.isFuncLiteralDeclaration();
if (td)
{
assert(td.literal);
assert(td.members && td.members.dim == 1);
fd = (*td.members)[0].isFuncLiteralDeclaration();
}
tok = fd.tok; // save original kind of function/delegate/(infer)
assert(fd.fbody);
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
auto e = o.isExpression();
if (!e)
return false;
if (auto fe = e.isFuncExp())
{
return fd == fe.fd;
}
return false;
}
extern (D) void genIdent(Scope* sc)
{
if (fd.ident == Id.empty)
{
const(char)[] s;
if (fd.fes)
s = "__foreachbody";
else if (fd.tok == TOK.reserved)
s = "__lambda";
else if (fd.tok == TOK.delegate_)
s = "__dgliteral";
else
s = "__funcliteral";
DsymbolTable symtab;
if (FuncDeclaration func = sc.parent.isFuncDeclaration())
{
if (func.localsymtab is null)
{
// Inside template constraint, symtab is not set yet.
// Initialize it lazily.
func.localsymtab = new DsymbolTable();
}
symtab = func.localsymtab;
}
else
{
ScopeDsymbol sds = sc.parent.isScopeDsymbol();
if (!sds.symtab)
{
// Inside template constraint, symtab may not be set yet.
// Initialize it lazily.
assert(sds.isTemplateInstance());
sds.symtab = new DsymbolTable();
}
symtab = sds.symtab;
}
assert(symtab);
Identifier id = Identifier.generateId(s, symtab.length() + 1);
fd.ident = id;
if (td)
td.ident = id;
symtab.insert(td ? cast(Dsymbol)td : cast(Dsymbol)fd);
}
}
override Expression syntaxCopy()
{
if (td)
return new FuncExp(loc, td.syntaxCopy(null));
else if (fd.semanticRun == PASS.init)
return new FuncExp(loc, fd.syntaxCopy(null));
else // https://issues.dlang.org/show_bug.cgi?id=13481
// Prevent multiple semantic analysis of lambda body.
return new FuncExp(loc, fd);
}
extern (D) MATCH matchType(Type to, Scope* sc, FuncExp* presult, int flag = 0)
{
static MATCH cannotInfer(Expression e, Type to, int flag)
{
if (!flag)
e.error("cannot infer parameter types from `%s`", to.toChars());
return MATCH.nomatch;
}
//printf("FuncExp::matchType('%s'), to=%s\n", type ? type.toChars() : "null", to.toChars());
if (presult)
*presult = null;
TypeFunction tof = null;
if (to.ty == Tdelegate)
{
if (tok == TOK.function_)
{
if (!flag)
error("cannot match function literal to delegate type `%s`", to.toChars());
return MATCH.nomatch;
}
tof = cast(TypeFunction)to.nextOf();
}
else if (to.ty == Tpointer && (tof = to.nextOf().isTypeFunction()) !is null)
{
if (tok == TOK.delegate_)
{
if (!flag)
error("cannot match delegate literal to function pointer type `%s`", to.toChars());
return MATCH.nomatch;
}
}
if (td)
{
if (!tof)
{
return cannotInfer(this, to, flag);
}
// Parameter types inference from 'tof'
assert(td._scope);
TypeFunction tf = fd.type.isTypeFunction();
//printf("\ttof = %s\n", tof.toChars());
//printf("\ttf = %s\n", tf.toChars());
const dim = tf.parameterList.length;
if (tof.parameterList.length != dim || tof.parameterList.varargs != tf.parameterList.varargs)
return cannotInfer(this, to, flag);
auto tiargs = new Objects();
tiargs.reserve(td.parameters.dim);
foreach (tp; *td.parameters)
{
size_t u = 0;
foreach (i, p; tf.parameterList)
{
if (auto ti = p.type.isTypeIdentifier())
if (ti && ti.ident == tp.ident)
break;
++u;
}
assert(u < dim);
Parameter pto = tof.parameterList[u];
Type t = pto.type;
if (t.ty == Terror)
return cannotInfer(this, to, flag);
tiargs.push(t);
}
// Set target of return type inference
if (!tf.next && tof.next)
fd.treq = to;
auto ti = new TemplateInstance(loc, td, tiargs);
Expression ex = (new ScopeExp(loc, ti)).expressionSemantic(td._scope);
// Reset inference target for the later re-semantic
fd.treq = null;
if (ex.op == TOK.error)
return MATCH.nomatch;
if (auto ef = ex.isFuncExp())
return ef.matchType(to, sc, presult, flag);
else
return cannotInfer(this, to, flag);
}
if (!tof || !tof.next)
return MATCH.nomatch;
assert(type && type != Type.tvoid);
if (fd.type.ty == Terror)
return MATCH.nomatch;
auto tfx = fd.type.isTypeFunction();
bool convertMatch = (type.ty != to.ty);
if (fd.inferRetType && tfx.next.implicitConvTo(tof.next) == MATCH.convert)
{
/* If return type is inferred and covariant return,
* tweak return statements to required return type.
*
* interface I {}
* class C : Object, I{}
*
* I delegate() dg = delegate() { return new class C(); }
*/
convertMatch = true;
auto tfy = new TypeFunction(tfx.parameterList, tof.next,
tfx.linkage, STC.undefined_);
tfy.mod = tfx.mod;
tfy.isnothrow = tfx.isnothrow;
tfy.isnogc = tfx.isnogc;
tfy.purity = tfx.purity;
tfy.isproperty = tfx.isproperty;
tfy.isref = tfx.isref;
tfy.isInOutParam = tfx.isInOutParam;
tfy.isInOutQual = tfx.isInOutQual;
tfy.deco = tfy.merge().deco;
tfx = tfy;
}
Type tx;
if (tok == TOK.delegate_ ||
tok == TOK.reserved && (type.ty == Tdelegate || type.ty == Tpointer && to.ty == Tdelegate))
{
// Allow conversion from implicit function pointer to delegate
tx = new TypeDelegate(tfx);
tx.deco = tx.merge().deco;
}
else
{
assert(tok == TOK.function_ || tok == TOK.reserved && type.ty == Tpointer);
tx = tfx.pointerTo();
}
//printf("\ttx = %s, to = %s\n", tx.toChars(), to.toChars());
MATCH m = tx.implicitConvTo(to);
if (m > MATCH.nomatch)
{
// MATCH.exact: exact type match
// MATCH.constant: covairiant type match (eg. attributes difference)
// MATCH.convert: context conversion
m = convertMatch ? MATCH.convert : tx.equals(to) ? MATCH.exact : MATCH.constant;
if (presult)
{
(*presult) = cast(FuncExp)copy();
(*presult).type = to;
// https://issues.dlang.org/show_bug.cgi?id=12508
// Tweak function body for covariant returns.
(*presult).fd.modifyReturns(sc, tof.next);
}
}
else if (!flag)
{
auto ts = toAutoQualChars(tx, to);
error("cannot implicitly convert expression `%s` of type `%s` to `%s`",
toChars(), ts[0], ts[1]);
}
return m;
}
override const(char)* toChars() const
{
return fd.toChars();
}
override bool checkType()
{
if (td)
{
error("template lambda has no type");
return true;
}
return false;
}
override bool checkValue()
{
if (td)
{
error("template lambda has no value");
return true;
}
return false;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Declaration of a symbol
*
* D grammar allows declarations only as statements. However in AST representation
* it can be part of any expression. This is used, for example, during internal
* syntax re-writes to inject hidden symbols.
*/
extern (C++) final class DeclarationExp : Expression
{
Dsymbol declaration;
extern (D) this(const ref Loc loc, Dsymbol declaration)
{
super(loc, TOK.declaration, __traits(classInstanceSize, DeclarationExp));
this.declaration = declaration;
}
override Expression syntaxCopy()
{
return new DeclarationExp(loc, declaration.syntaxCopy(null));
}
override bool hasCode()
{
if (auto vd = declaration.isVarDeclaration())
{
return !(vd.storage_class & (STC.manifest | STC.static_));
}
return false;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* typeid(int)
*/
extern (C++) final class TypeidExp : Expression
{
RootObject obj;
extern (D) this(const ref Loc loc, RootObject o)
{
super(loc, TOK.typeid_, __traits(classInstanceSize, TypeidExp));
this.obj = o;
}
override Expression syntaxCopy()
{
return new TypeidExp(loc, objectSyntaxCopy(obj));
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* __traits(identifier, args...)
*/
extern (C++) final class TraitsExp : Expression
{
Identifier ident;
Objects* args;
extern (D) this(const ref Loc loc, Identifier ident, Objects* args)
{
super(loc, TOK.traits, __traits(classInstanceSize, TraitsExp));
this.ident = ident;
this.args = args;
}
override Expression syntaxCopy()
{
return new TraitsExp(loc, ident, TemplateInstance.arraySyntaxCopy(args));
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class HaltExp : Expression
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.halt, __traits(classInstanceSize, HaltExp));
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* is(targ id tok tspec)
* is(targ id == tok2)
*/
extern (C++) final class IsExp : Expression
{
Type targ;
Identifier id; // can be null
Type tspec; // can be null
TemplateParameters* parameters;
TOK tok; // ':' or '=='
TOK tok2; // 'struct', 'union', etc.
extern (D) this(const ref Loc loc, Type targ, Identifier id, TOK tok, Type tspec, TOK tok2, TemplateParameters* parameters)
{
super(loc, TOK.is_, __traits(classInstanceSize, IsExp));
this.targ = targ;
this.id = id;
this.tok = tok;
this.tspec = tspec;
this.tok2 = tok2;
this.parameters = parameters;
}
override Expression syntaxCopy()
{
// This section is identical to that in TemplateDeclaration::syntaxCopy()
TemplateParameters* p = null;
if (parameters)
{
p = new TemplateParameters(parameters.dim);
foreach (i, el; *parameters)
(*p)[i] = el.syntaxCopy();
}
return new IsExp(loc, targ.syntaxCopy(), id, tok, tspec ? tspec.syntaxCopy() : null, tok2, p);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) abstract class UnaExp : Expression
{
Expression e1;
Type att1; // Save alias this type to detect recursion
extern (D) this(const ref Loc loc, TOK op, int size, Expression e1)
{
super(loc, op, size);
this.e1 = e1;
}
override Expression syntaxCopy()
{
UnaExp e = cast(UnaExp)copy();
e.type = null;
e.e1 = e.e1.syntaxCopy();
return e;
}
/********************************
* The type for a unary expression is incompatible.
* Print error message.
* Returns:
* ErrorExp
*/
final Expression incompatibleTypes()
{
if (e1.type.toBasetype() == Type.terror)
return e1;
if (e1.op == TOK.type)
{
error("incompatible type for `%s(%s)`: cannot use `%s` with types", Token.toChars(op), e1.toChars(), Token.toChars(op));
}
else
{
error("incompatible type for `%s(%s)`: `%s`", Token.toChars(op), e1.toChars(), e1.type.toChars());
}
return ErrorExp.get();
}
/*********************
* Mark the operand as will never be dereferenced,
* which is useful info for @safe checks.
* Do before semantic() on operands rewrites them.
*/
final void setNoderefOperand()
{
if (auto edi = e1.isDotIdExp())
edi.noderef = true;
}
override final Expression resolveLoc(const ref Loc loc, Scope* sc)
{
e1 = e1.resolveLoc(loc, sc);
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
alias fp_t = UnionExp function(const ref Loc loc, Type, Expression, Expression);
alias fp2_t = bool function(const ref Loc loc, TOK, Expression, Expression);
/***********************************************************
*/
extern (C++) abstract class BinExp : Expression
{
Expression e1;
Expression e2;
Type att1; // Save alias this type to detect recursion
Type att2; // Save alias this type to detect recursion
extern (D) this(const ref Loc loc, TOK op, int size, Expression e1, Expression e2)
{
super(loc, op, size);
this.e1 = e1;
this.e2 = e2;
}
override Expression syntaxCopy()
{
BinExp e = cast(BinExp)copy();
e.type = null;
e.e1 = e.e1.syntaxCopy();
e.e2 = e.e2.syntaxCopy();
return e;
}
/********************************
* The types for a binary expression are incompatible.
* Print error message.
* Returns:
* ErrorExp
*/
final Expression incompatibleTypes()
{
if (e1.type.toBasetype() == Type.terror)
return e1;
if (e2.type.toBasetype() == Type.terror)
return e2;
// CondExp uses 'a ? b : c' but we're comparing 'b : c'
TOK thisOp = (op == TOK.question) ? TOK.colon : op;
if (e1.op == TOK.type || e2.op == TOK.type)
{
error("incompatible types for `(%s) %s (%s)`: cannot use `%s` with types",
e1.toChars(), Token.toChars(thisOp), e2.toChars(), Token.toChars(op));
}
else if (e1.type.equals(e2.type))
{
error("incompatible types for `(%s) %s (%s)`: both operands are of type `%s`",
e1.toChars(), Token.toChars(thisOp), e2.toChars(), e1.type.toChars());
}
else
{
auto ts = toAutoQualChars(e1.type, e2.type);
error("incompatible types for `(%s) %s (%s)`: `%s` and `%s`",
e1.toChars(), Token.toChars(thisOp), e2.toChars(), ts[0], ts[1]);
}
return ErrorExp.get();
}
extern (D) final Expression checkOpAssignTypes(Scope* sc)
{
// At that point t1 and t2 are the merged types. type is the original type of the lhs.
Type t1 = e1.type;
Type t2 = e2.type;
// T opAssign floating yields a floating. Prevent truncating conversions (float to int).
// See issue 3841.
// Should we also prevent double to float (type.isfloating() && type.size() < t2.size()) ?
if (op == TOK.addAssign || op == TOK.minAssign ||
op == TOK.mulAssign || op == TOK.divAssign || op == TOK.modAssign ||
op == TOK.powAssign)
{
if ((type.isintegral() && t2.isfloating()))
{
warning("`%s %s %s` is performing truncating conversion", type.toChars(), Token.toChars(op), t2.toChars());
}
}
// generate an error if this is a nonsensical *=,/=, or %=, eg real *= imaginary
if (op == TOK.mulAssign || op == TOK.divAssign || op == TOK.modAssign)
{
// Any multiplication by an imaginary or complex number yields a complex result.
// r *= c, i*=c, r*=i, i*=i are all forbidden operations.
const(char)* opstr = Token.toChars(op);
if (t1.isreal() && t2.iscomplex())
{
error("`%s %s %s` is undefined. Did you mean `%s %s %s.re`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars());
return ErrorExp.get();
}
else if (t1.isimaginary() && t2.iscomplex())
{
error("`%s %s %s` is undefined. Did you mean `%s %s %s.im`?", t1.toChars(), opstr, t2.toChars(), t1.toChars(), opstr, t2.toChars());
return ErrorExp.get();
}
else if ((t1.isreal() || t1.isimaginary()) && t2.isimaginary())
{
error("`%s %s %s` is an undefined operation", t1.toChars(), opstr, t2.toChars());
return ErrorExp.get();
}
}
// generate an error if this is a nonsensical += or -=, eg real += imaginary
if (op == TOK.addAssign || op == TOK.minAssign)
{
// Addition or subtraction of a real and an imaginary is a complex result.
// Thus, r+=i, r+=c, i+=r, i+=c are all forbidden operations.
if ((t1.isreal() && (t2.isimaginary() || t2.iscomplex())) || (t1.isimaginary() && (t2.isreal() || t2.iscomplex())))
{
error("`%s %s %s` is undefined (result is complex)", t1.toChars(), Token.toChars(op), t2.toChars());
return ErrorExp.get();
}
if (type.isreal() || type.isimaginary())
{
assert(global.errors || t2.isfloating());
e2 = e2.castTo(sc, t1);
}
}
if (op == TOK.mulAssign)
{
if (t2.isfloating())
{
if (t1.isreal())
{
if (t2.isimaginary() || t2.iscomplex())
{
e2 = e2.castTo(sc, t1);
}
}
else if (t1.isimaginary())
{
if (t2.isimaginary() || t2.iscomplex())
{
switch (t1.ty)
{
case Timaginary32:
t2 = Type.tfloat32;
break;
case Timaginary64:
t2 = Type.tfloat64;
break;
case Timaginary80:
t2 = Type.tfloat80;
break;
default:
assert(0);
}
e2 = e2.castTo(sc, t2);
}
}
}
}
else if (op == TOK.divAssign)
{
if (t2.isimaginary())
{
if (t1.isreal())
{
// x/iv = i(-x/v)
// Therefore, the result is 0
e2 = new CommaExp(loc, e2, new RealExp(loc, CTFloat.zero, t1));
e2.type = t1;
Expression e = new AssignExp(loc, e1, e2);
e.type = t1;
return e;
}
else if (t1.isimaginary())
{
Type t3;
switch (t1.ty)
{
case Timaginary32:
t3 = Type.tfloat32;
break;
case Timaginary64:
t3 = Type.tfloat64;
break;
case Timaginary80:
t3 = Type.tfloat80;
break;
default:
assert(0);
}
e2 = e2.castTo(sc, t3);
Expression e = new AssignExp(loc, e1, e2);
e.type = t1;
return e;
}
}
}
else if (op == TOK.modAssign)
{
if (t2.iscomplex())
{
error("cannot perform modulo complex arithmetic");
return ErrorExp.get();
}
}
return this;
}
extern (D) final bool checkIntegralBin()
{
bool r1 = e1.checkIntegral();
bool r2 = e2.checkIntegral();
return (r1 || r2);
}
extern (D) final bool checkArithmeticBin()
{
bool r1 = e1.checkArithmetic();
bool r2 = e2.checkArithmetic();
return (r1 || r2);
}
extern (D) final bool checkSharedAccessBin(Scope* sc)
{
const r1 = e1.checkSharedAccess(sc);
const r2 = e2.checkSharedAccess(sc);
return (r1 || r2);
}
/*********************
* Mark the operands as will never be dereferenced,
* which is useful info for @safe checks.
* Do before semantic() on operands rewrites them.
*/
final void setNoderefOperands()
{
if (auto edi = e1.isDotIdExp())
edi.noderef = true;
if (auto edi = e2.isDotIdExp())
edi.noderef = true;
}
final Expression reorderSettingAAElem(Scope* sc)
{
BinExp be = this;
auto ie = be.e1.isIndexExp();
if (!ie)
return be;
if (ie.e1.type.toBasetype().ty != Taarray)
return be;
/* Fix evaluation order of setting AA element
* https://issues.dlang.org/show_bug.cgi?id=3825
* Rewrite:
* aa[k1][k2][k3] op= val;
* as:
* auto ref __aatmp = aa;
* auto ref __aakey3 = k1, __aakey2 = k2, __aakey1 = k3;
* auto ref __aaval = val;
* __aatmp[__aakey3][__aakey2][__aakey1] op= __aaval; // assignment
*/
Expression e0;
while (1)
{
Expression de;
ie.e2 = extractSideEffect(sc, "__aakey", de, ie.e2);
e0 = Expression.combine(de, e0);
auto ie1 = ie.e1.isIndexExp();
if (!ie1 ||
ie1.e1.type.toBasetype().ty != Taarray)
{
break;
}
ie = ie1;
}
assert(ie.e1.type.toBasetype().ty == Taarray);
Expression de;
ie.e1 = extractSideEffect(sc, "__aatmp", de, ie.e1);
e0 = Expression.combine(de, e0);
be.e2 = extractSideEffect(sc, "__aaval", e0, be.e2, true);
//printf("-e0 = %s, be = %s\n", e0.toChars(), be.toChars());
return Expression.combine(e0, be);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) class BinAssignExp : BinExp
{
extern (D) this(const ref Loc loc, TOK op, int size, Expression e1, Expression e2)
{
super(loc, op, size, e1, e2);
}
override final bool isLvalue()
{
return true;
}
override final Expression toLvalue(Scope* sc, Expression ex)
{
// Lvalue-ness will be handled in glue layer.
return this;
}
override final Expression modifiableLvalue(Scope* sc, Expression e)
{
// should check e1.checkModifiable() ?
return toLvalue(sc, this);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* https://dlang.org/spec/expression.html#mixin_expressions
*/
extern (C++) final class MixinExp : Expression
{
Expressions* exps;
extern (D) this(const ref Loc loc, Expressions* exps)
{
super(loc, TOK.mixin_, __traits(classInstanceSize, MixinExp));
this.exps = exps;
}
override Expression syntaxCopy()
{
return new MixinExp(loc, arraySyntaxCopy(exps));
}
override bool equals(const RootObject o) const
{
if (this == o)
return true;
auto e = o.isExpression();
if (!e)
return false;
if (auto ce = e.isMixinExp())
{
if (exps.dim != ce.exps.dim)
return false;
foreach (i, e1; *exps)
{
auto e2 = (*ce.exps)[i];
if (e1 != e2 && (!e1 || !e2 || !e1.equals(e2)))
return false;
}
return true;
}
return false;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ImportExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.import_, __traits(classInstanceSize, ImportExp), e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* https://dlang.org/spec/expression.html#assert_expressions
*/
extern (C++) final class AssertExp : UnaExp
{
Expression msg;
extern (D) this(const ref Loc loc, Expression e, Expression msg = null)
{
super(loc, TOK.assert_, __traits(classInstanceSize, AssertExp), e);
this.msg = msg;
}
override Expression syntaxCopy()
{
return new AssertExp(loc, e1.syntaxCopy(), msg ? msg.syntaxCopy() : null);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DotIdExp : UnaExp
{
Identifier ident;
bool noderef; // true if the result of the expression will never be dereferenced
bool wantsym; // do not replace Symbol with its initializer during semantic()
extern (D) this(const ref Loc loc, Expression e, Identifier ident)
{
super(loc, TOK.dotIdentifier, __traits(classInstanceSize, DotIdExp), e);
this.ident = ident;
}
static DotIdExp create(Loc loc, Expression e, Identifier ident)
{
return new DotIdExp(loc, e, ident);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Mainly just a placeholder
*/
extern (C++) final class DotTemplateExp : UnaExp
{
TemplateDeclaration td;
extern (D) this(const ref Loc loc, Expression e, TemplateDeclaration td)
{
super(loc, TOK.dotTemplateDeclaration, __traits(classInstanceSize, DotTemplateExp), e);
this.td = td;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DotVarExp : UnaExp
{
Declaration var;
bool hasOverloads;
extern (D) this(const ref Loc loc, Expression e, Declaration var, bool hasOverloads = true)
{
if (var.isVarDeclaration())
hasOverloads = false;
super(loc, TOK.dotVariable, __traits(classInstanceSize, DotVarExp), e);
//printf("DotVarExp()\n");
this.var = var;
this.hasOverloads = hasOverloads;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
//printf("DotVarExp::checkModifiable %s %s\n", toChars(), type.toChars());
if (checkUnsafeAccess(sc, this, false, !flag))
return Modifiable.initialization;
if (e1.op == TOK.this_)
return var.checkModify(loc, sc, e1, flag);
/* https://issues.dlang.org/show_bug.cgi?id=12764
* If inside a constructor and an expression of type `this.field.var`
* is encountered, where `field` is a struct declaration with
* default construction disabled, we must make sure that
* assigning to `var` does not imply that `field` was initialized
*/
if (sc.func && sc.func.isCtorDeclaration())
{
// if inside a constructor scope and e1 of this DotVarExp
// is a DotVarExp, then check if e1.e1 is a `this` identifier
if (auto dve = e1.isDotVarExp())
{
if (dve.e1.op == TOK.this_)
{
scope v = dve.var.isVarDeclaration();
/* if v is a struct member field with no initializer, no default construction
* and v wasn't intialized before
*/
if (v && v.isField() && !v._init && !v.ctorinit)
{
if (auto ts = v.type.isTypeStruct())
{
if (ts.sym.noDefaultCtor)
{
/* checkModify will consider that this is an initialization
* of v while it is actually an assignment of a field of v
*/
scope modifyLevel = v.checkModify(loc, sc, dve.e1, flag);
// reflect that assigning a field of v is not initialization of v
v.ctorinit = false;
if (modifyLevel == Modifiable.initialization)
return Modifiable.yes;
return modifyLevel;
}
}
}
}
}
}
//printf("\te1 = %s\n", e1.toChars());
return e1.checkModifiable(sc, flag);
}
override bool isLvalue()
{
if (e1.op != TOK.structLiteral)
return true;
auto vd = var.isVarDeclaration();
return !(vd && vd.isField());
}
override Expression toLvalue(Scope* sc, Expression e)
{
//printf("DotVarExp::toLvalue(%s)\n", toChars());
if (!isLvalue())
return Expression.toLvalue(sc, e);
if (e1.op == TOK.this_ && sc.ctorflow.fieldinit.length && !(sc.ctorflow.callSuper & CSX.any_ctor))
{
if (VarDeclaration vd = var.isVarDeclaration())
{
auto ad = vd.isMember2();
if (ad && ad.fields.dim == sc.ctorflow.fieldinit.length)
{
foreach (i, f; ad.fields)
{
if (f == vd)
{
if (!(sc.ctorflow.fieldinit[i].csx & CSX.this_ctor))
{
/* If the address of vd is taken, assume it is thereby initialized
* https://issues.dlang.org/show_bug.cgi?id=15869
*/
modifyFieldVar(loc, sc, vd, e1);
}
break;
}
}
}
}
}
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
version (none)
{
printf("DotVarExp::modifiableLvalue(%s)\n", toChars());
printf("e1.type = %s\n", e1.type.toChars());
printf("var.type = %s\n", var.type.toChars());
}
return Expression.modifiableLvalue(sc, e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* foo.bar!(args)
*/
extern (C++) final class DotTemplateInstanceExp : UnaExp
{
TemplateInstance ti;
extern (D) this(const ref Loc loc, Expression e, Identifier name, Objects* tiargs)
{
super(loc, TOK.dotTemplateInstance, __traits(classInstanceSize, DotTemplateInstanceExp), e);
//printf("DotTemplateInstanceExp()\n");
this.ti = new TemplateInstance(loc, name, tiargs);
}
extern (D) this(const ref Loc loc, Expression e, TemplateInstance ti)
{
super(loc, TOK.dotTemplateInstance, __traits(classInstanceSize, DotTemplateInstanceExp), e);
this.ti = ti;
}
override Expression syntaxCopy()
{
return new DotTemplateInstanceExp(loc, e1.syntaxCopy(), ti.name, TemplateInstance.arraySyntaxCopy(ti.tiargs));
}
bool findTempDecl(Scope* sc)
{
static if (LOGSEMANTIC)
{
printf("DotTemplateInstanceExp::findTempDecl('%s')\n", toChars());
}
if (ti.tempdecl)
return true;
Expression e = new DotIdExp(loc, e1, ti.name);
e = e.expressionSemantic(sc);
if (e.op == TOK.dot)
e = (cast(DotExp)e).e2;
Dsymbol s = null;
switch (e.op)
{
case TOK.overloadSet:
s = (cast(OverExp)e).vars;
break;
case TOK.dotTemplateDeclaration:
s = (cast(DotTemplateExp)e).td;
break;
case TOK.scope_:
s = (cast(ScopeExp)e).sds;
break;
case TOK.dotVariable:
s = (cast(DotVarExp)e).var;
break;
case TOK.variable:
s = (cast(VarExp)e).var;
break;
default:
return false;
}
return ti.updateTempDecl(sc, s);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DelegateExp : UnaExp
{
FuncDeclaration func;
bool hasOverloads;
VarDeclaration vthis2; // container for multi-context
extern (D) this(const ref Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true, VarDeclaration vthis2 = null)
{
super(loc, TOK.delegate_, __traits(classInstanceSize, DelegateExp), e);
this.func = f;
this.hasOverloads = hasOverloads;
this.vthis2 = vthis2;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DotTypeExp : UnaExp
{
Dsymbol sym; // symbol that represents a type
extern (D) this(const ref Loc loc, Expression e, Dsymbol s)
{
super(loc, TOK.dotType, __traits(classInstanceSize, DotTypeExp), e);
this.sym = s;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class CallExp : UnaExp
{
Expressions* arguments; // function arguments
FuncDeclaration f; // symbol to call
bool directcall; // true if a virtual call is devirtualized
bool inDebugStatement; /// true if this was in a debug statement
VarDeclaration vthis2; // container for multi-context
extern (D) this(const ref Loc loc, Expression e, Expressions* exps)
{
super(loc, TOK.call, __traits(classInstanceSize, CallExp), e);
this.arguments = exps;
}
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.call, __traits(classInstanceSize, CallExp), e);
}
extern (D) this(const ref Loc loc, Expression e, Expression earg1)
{
super(loc, TOK.call, __traits(classInstanceSize, CallExp), e);
this.arguments = new Expressions();
if (earg1)
this.arguments.push(earg1);
}
extern (D) this(const ref Loc loc, Expression e, Expression earg1, Expression earg2)
{
super(loc, TOK.call, __traits(classInstanceSize, CallExp), e);
auto arguments = new Expressions(2);
(*arguments)[0] = earg1;
(*arguments)[1] = earg2;
this.arguments = arguments;
}
/***********************************************************
* Instatiates a new function call expression
* Params:
* loc = location
* fd = the declaration of the function to call
* earg1 = the function argument
*/
extern(D) this(const ref Loc loc, FuncDeclaration fd, Expression earg1)
{
this(loc, new VarExp(loc, fd, false), earg1);
this.f = fd;
}
static CallExp create(Loc loc, Expression e, Expressions* exps)
{
return new CallExp(loc, e, exps);
}
static CallExp create(Loc loc, Expression e)
{
return new CallExp(loc, e);
}
static CallExp create(Loc loc, Expression e, Expression earg1)
{
return new CallExp(loc, e, earg1);
}
/***********************************************************
* Creates a new function call expression
* Params:
* loc = location
* fd = the declaration of the function to call
* earg1 = the function argument
*/
static CallExp create(Loc loc, FuncDeclaration fd, Expression earg1)
{
return new CallExp(loc, fd, earg1);
}
override Expression syntaxCopy()
{
return new CallExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments));
}
override bool isLvalue()
{
Type tb = e1.type.toBasetype();
if (tb.ty == Tdelegate || tb.ty == Tpointer)
tb = tb.nextOf();
auto tf = tb.isTypeFunction();
if (tf && tf.isref)
{
if (auto dve = e1.isDotVarExp())
if (dve.var.isCtorDeclaration())
return false;
return true; // function returns a reference
}
return false;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (isLvalue())
return this;
return Expression.toLvalue(sc, e);
}
override Expression addDtorHook(Scope* sc)
{
/* Only need to add dtor hook if it's a type that needs destruction.
* Use same logic as VarDeclaration::callScopeDtor()
*/
if (auto tf = e1.type.isTypeFunction())
{
if (tf.isref)
return this;
}
Type tv = type.baseElemOf();
if (auto ts = tv.isTypeStruct())
{
StructDeclaration sd = ts.sym;
if (sd.dtor)
{
/* Type needs destruction, so declare a tmp
* which the back end will recognize and call dtor on
*/
auto tmp = copyToTemp(0, "__tmpfordtor", this);
auto de = new DeclarationExp(loc, tmp);
auto ve = new VarExp(loc, tmp);
Expression e = new CommaExp(loc, de, ve);
e = e.expressionSemantic(sc);
return e;
}
}
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null)
{
if (auto ae = e.isAddrExp())
{
auto ae1 = ae.e1;
if (auto ve = ae1.isVarExp())
{
if (hasOverloads)
*hasOverloads = ve.hasOverloads;
return ve.var.isFuncDeclaration();
}
if (auto dve = ae1.isDotVarExp())
{
if (hasOverloads)
*hasOverloads = dve.hasOverloads;
return dve.var.isFuncDeclaration();
}
}
else
{
if (auto soe = e.isSymOffExp())
{
if (hasOverloads)
*hasOverloads = soe.hasOverloads;
return soe.var.isFuncDeclaration();
}
if (auto dge = e.isDelegateExp())
{
if (hasOverloads)
*hasOverloads = dge.hasOverloads;
return dge.func.isFuncDeclaration();
}
}
return null;
}
/***********************************************************
*/
extern (C++) final class AddrExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.address, __traits(classInstanceSize, AddrExp), e);
}
extern (D) this(const ref Loc loc, Expression e, Type t)
{
this(loc, e);
type = t;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class PtrExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.star, __traits(classInstanceSize, PtrExp), e);
//if (e.type)
// type = ((TypePointer *)e.type).next;
}
extern (D) this(const ref Loc loc, Expression e, Type t)
{
super(loc, TOK.star, __traits(classInstanceSize, PtrExp), e);
type = t;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
if (auto se = e1.isSymOffExp())
{
return se.var.checkModify(loc, sc, null, flag);
}
else if (auto ae = e1.isAddrExp())
{
return ae.e1.checkModifiable(sc, flag);
}
return Modifiable.yes;
}
override bool isLvalue()
{
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
//printf("PtrExp::modifiableLvalue() %s, type %s\n", toChars(), type.toChars());
return Expression.modifiableLvalue(sc, e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class NegExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.negate, __traits(classInstanceSize, NegExp), e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class UAddExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.uadd, __traits(classInstanceSize, UAddExp), e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ComExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.tilde, __traits(classInstanceSize, ComExp), e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class NotExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e)
{
super(loc, TOK.not, __traits(classInstanceSize, NotExp), e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DeleteExp : UnaExp
{
bool isRAII; // true if called automatically as a result of scoped destruction
extern (D) this(const ref Loc loc, Expression e, bool isRAII)
{
super(loc, TOK.delete_, __traits(classInstanceSize, DeleteExp), e);
this.isRAII = isRAII;
}
override Expression toBoolean(Scope* sc)
{
error("`delete` does not give a boolean result");
return ErrorExp.get();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* Possible to cast to one type while painting to another type
*/
extern (C++) final class CastExp : UnaExp
{
Type to; // type to cast to
ubyte mod = cast(ubyte)~0; // MODxxxxx
extern (D) this(const ref Loc loc, Expression e, Type t)
{
super(loc, TOK.cast_, __traits(classInstanceSize, CastExp), e);
this.to = t;
}
/* For cast(const) and cast(immutable)
*/
extern (D) this(const ref Loc loc, Expression e, ubyte mod)
{
super(loc, TOK.cast_, __traits(classInstanceSize, CastExp), e);
this.mod = mod;
}
override Expression syntaxCopy()
{
return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) : new CastExp(loc, e1.syntaxCopy(), mod);
}
override bool isLvalue()
{
//printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars());
if (!e1.isLvalue())
return false;
return (to.ty == Tsarray && (e1.type.ty == Tvector || e1.type.ty == Tsarray)) ||
e1.type.mutableOf().unSharedOf().equals(to.mutableOf().unSharedOf());
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (isLvalue())
return this;
return Expression.toLvalue(sc, e);
}
override Expression addDtorHook(Scope* sc)
{
if (to.toBasetype().ty == Tvoid) // look past the cast(void)
e1 = e1.addDtorHook(sc);
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class VectorExp : UnaExp
{
TypeVector to; // the target vector type before semantic()
uint dim = ~0; // number of elements in the vector
OwnedBy ownedByCtfe = OwnedBy.code;
extern (D) this(const ref Loc loc, Expression e, Type t)
{
super(loc, TOK.vector, __traits(classInstanceSize, VectorExp), e);
assert(t.ty == Tvector);
to = cast(TypeVector)t;
}
static VectorExp create(Loc loc, Expression e, Type t)
{
return new VectorExp(loc, e, t);
}
// Same as create, but doesn't allocate memory.
static void emplace(UnionExp* pue, Loc loc, Expression e, Type type)
{
emplaceExp!(VectorExp)(pue, loc, e, type);
}
override Expression syntaxCopy()
{
return new VectorExp(loc, e1.syntaxCopy(), to.syntaxCopy());
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* e1.array property for vectors.
*
* https://dlang.org/spec/simd.html#properties
*/
extern (C++) final class VectorArrayExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e1)
{
super(loc, TOK.vectorArray, __traits(classInstanceSize, VectorArrayExp), e1);
}
override bool isLvalue()
{
return e1.isLvalue();
}
override Expression toLvalue(Scope* sc, Expression e)
{
e1 = e1.toLvalue(sc, e);
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* e1 [lwr .. upr]
*
* http://dlang.org/spec/expression.html#slice_expressions
*/
extern (C++) final class SliceExp : UnaExp
{
Expression upr; // null if implicit 0
Expression lwr; // null if implicit [length - 1]
VarDeclaration lengthVar;
bool upperIsInBounds; // true if upr <= e1.length
bool lowerIsLessThanUpper; // true if lwr <= upr
bool arrayop; // an array operation, rather than a slice
/************************************************************/
extern (D) this(const ref Loc loc, Expression e1, IntervalExp ie)
{
super(loc, TOK.slice, __traits(classInstanceSize, SliceExp), e1);
this.upr = ie ? ie.upr : null;
this.lwr = ie ? ie.lwr : null;
}
extern (D) this(const ref Loc loc, Expression e1, Expression lwr, Expression upr)
{
super(loc, TOK.slice, __traits(classInstanceSize, SliceExp), e1);
this.upr = upr;
this.lwr = lwr;
}
override Expression syntaxCopy()
{
auto se = new SliceExp(loc, e1.syntaxCopy(), lwr ? lwr.syntaxCopy() : null, upr ? upr.syntaxCopy() : null);
se.lengthVar = this.lengthVar; // bug7871
return se;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
//printf("SliceExp::checkModifiable %s\n", toChars());
if (e1.type.ty == Tsarray || (e1.op == TOK.index && e1.type.ty != Tarray) || e1.op == TOK.slice)
{
return e1.checkModifiable(sc, flag);
}
return Modifiable.yes;
}
override bool isLvalue()
{
/* slice expression is rvalue in default, but
* conversion to reference of static array is only allowed.
*/
return (type && type.toBasetype().ty == Tsarray);
}
override Expression toLvalue(Scope* sc, Expression e)
{
//printf("SliceExp::toLvalue(%s) type = %s\n", toChars(), type ? type.toChars() : NULL);
return (type && type.toBasetype().ty == Tsarray) ? this : Expression.toLvalue(sc, e);
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
error("slice expression `%s` is not a modifiable lvalue", toChars());
return this;
}
override bool isBool(bool result)
{
return e1.isBool(result);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ArrayLengthExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e1)
{
super(loc, TOK.arrayLength, __traits(classInstanceSize, ArrayLengthExp), e1);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* e1 [ a0, a1, a2, a3 ,... ]
*
* http://dlang.org/spec/expression.html#index_expressions
*/
extern (C++) final class ArrayExp : UnaExp
{
Expressions* arguments; // Array of Expression's a0..an
size_t currentDimension; // for opDollar
VarDeclaration lengthVar;
extern (D) this(const ref Loc loc, Expression e1, Expression index = null)
{
super(loc, TOK.array, __traits(classInstanceSize, ArrayExp), e1);
arguments = new Expressions();
if (index)
arguments.push(index);
}
extern (D) this(const ref Loc loc, Expression e1, Expressions* args)
{
super(loc, TOK.array, __traits(classInstanceSize, ArrayExp), e1);
arguments = args;
}
override Expression syntaxCopy()
{
auto ae = new ArrayExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments));
ae.lengthVar = this.lengthVar; // bug7871
return ae;
}
override bool isLvalue()
{
if (type && type.toBasetype().ty == Tvoid)
return false;
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (type && type.toBasetype().ty == Tvoid)
error("`void`s have no value");
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DotExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.dot, __traits(classInstanceSize, DotExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class CommaExp : BinExp
{
/// This is needed because AssignExp rewrites CommaExp, hence it needs
/// to trigger the deprecation.
const bool isGenerated;
/// Temporary variable to enable / disable deprecation of comma expression
/// depending on the context.
/// Since most constructor calls are rewritting, the only place where
/// false will be passed will be from the parser.
bool allowCommaExp;
extern (D) this(const ref Loc loc, Expression e1, Expression e2, bool generated = true)
{
super(loc, TOK.comma, __traits(classInstanceSize, CommaExp), e1, e2);
allowCommaExp = isGenerated = generated;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
return e2.checkModifiable(sc, flag);
}
override bool isLvalue()
{
return e2.isLvalue();
}
override Expression toLvalue(Scope* sc, Expression e)
{
e2 = e2.toLvalue(sc, null);
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
e2 = e2.modifiableLvalue(sc, e);
return this;
}
override bool isBool(bool result)
{
return e2.isBool(result);
}
override Expression toBoolean(Scope* sc)
{
auto ex2 = e2.toBoolean(sc);
if (ex2.op == TOK.error)
return ex2;
e2 = ex2;
type = e2.type;
return this;
}
override Expression addDtorHook(Scope* sc)
{
e2 = e2.addDtorHook(sc);
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
/**
* If the argument is a CommaExp, set a flag to prevent deprecation messages
*
* It's impossible to know from CommaExp.semantic if the result will
* be used, hence when there is a result (type != void), a deprecation
* message is always emitted.
* However, some construct can produce a result but won't use it
* (ExpStatement and for loop increment). Those should call this function
* to prevent unwanted deprecations to be emitted.
*
* Params:
* exp = An expression that discards its result.
* If the argument is null or not a CommaExp, nothing happens.
*/
static void allow(Expression exp)
{
if (exp)
if (auto ce = exp.isCommaExp())
ce.allowCommaExp = true;
}
}
/***********************************************************
* Mainly just a placeholder
*/
extern (C++) final class IntervalExp : Expression
{
Expression lwr;
Expression upr;
extern (D) this(const ref Loc loc, Expression lwr, Expression upr)
{
super(loc, TOK.interval, __traits(classInstanceSize, IntervalExp));
this.lwr = lwr;
this.upr = upr;
}
override Expression syntaxCopy()
{
return new IntervalExp(loc, lwr.syntaxCopy(), upr.syntaxCopy());
}
override void accept(Visitor v)
{
v.visit(this);
}
}
extern (C++) final class DelegatePtrExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e1)
{
super(loc, TOK.delegatePointer, __traits(classInstanceSize, DelegatePtrExp), e1);
}
override bool isLvalue()
{
return e1.isLvalue();
}
override Expression toLvalue(Scope* sc, Expression e)
{
e1 = e1.toLvalue(sc, e);
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
if (sc.func.setUnsafe())
{
error("cannot modify delegate pointer in `@safe` code `%s`", toChars());
return ErrorExp.get();
}
return Expression.modifiableLvalue(sc, e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DelegateFuncptrExp : UnaExp
{
extern (D) this(const ref Loc loc, Expression e1)
{
super(loc, TOK.delegateFunctionPointer, __traits(classInstanceSize, DelegateFuncptrExp), e1);
}
override bool isLvalue()
{
return e1.isLvalue();
}
override Expression toLvalue(Scope* sc, Expression e)
{
e1 = e1.toLvalue(sc, e);
return this;
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
if (sc.func.setUnsafe())
{
error("cannot modify delegate function pointer in `@safe` code `%s`", toChars());
return ErrorExp.get();
}
return Expression.modifiableLvalue(sc, e);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* e1 [ e2 ]
*/
extern (C++) final class IndexExp : BinExp
{
VarDeclaration lengthVar;
bool modifiable = false; // assume it is an rvalue
bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.index, __traits(classInstanceSize, IndexExp), e1, e2);
//printf("IndexExp::IndexExp('%s')\n", toChars());
}
override Expression syntaxCopy()
{
auto ie = new IndexExp(loc, e1.syntaxCopy(), e2.syntaxCopy());
ie.lengthVar = this.lengthVar; // bug7871
return ie;
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
if (e1.type.ty == Tsarray ||
e1.type.ty == Taarray ||
(e1.op == TOK.index && e1.type.ty != Tarray) ||
e1.op == TOK.slice)
{
return e1.checkModifiable(sc, flag);
}
return Modifiable.yes;
}
override bool isLvalue()
{
if (e1.op == TOK.assocArrayLiteral)
return false;
if (e1.type.ty == Tsarray ||
(e1.op == TOK.index && e1.type.ty != Tarray))
{
return e1.isLvalue();
}
return true;
}
override Expression toLvalue(Scope* sc, Expression e)
{
if (isLvalue())
return this;
return Expression.toLvalue(sc, e);
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
//printf("IndexExp::modifiableLvalue(%s)\n", toChars());
Expression ex = markSettingAAElem();
if (ex.op == TOK.error)
return ex;
return Expression.modifiableLvalue(sc, e);
}
extern (D) Expression markSettingAAElem()
{
if (e1.type.toBasetype().ty == Taarray)
{
Type t2b = e2.type.toBasetype();
if (t2b.ty == Tarray && t2b.nextOf().isMutable())
{
error("associative arrays can only be assigned values with immutable keys, not `%s`", e2.type.toChars());
return ErrorExp.get();
}
modifiable = true;
if (auto ie = e1.isIndexExp())
{
Expression ex = ie.markSettingAAElem();
if (ex.op == TOK.error)
return ex;
assert(ex == e1);
}
}
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* For both i++ and i--
*/
extern (C++) final class PostExp : BinExp
{
extern (D) this(TOK op, const ref Loc loc, Expression e)
{
super(loc, op, __traits(classInstanceSize, PostExp), e, IntegerExp.literal!1);
assert(op == TOK.minusMinus || op == TOK.plusPlus);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* For both ++i and --i
*/
extern (C++) final class PreExp : UnaExp
{
extern (D) this(TOK op, const ref Loc loc, Expression e)
{
super(loc, op, __traits(classInstanceSize, PreExp), e);
assert(op == TOK.preMinusMinus || op == TOK.prePlusPlus);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
enum MemorySet
{
none = 0, // simple assignment
blockAssign = 1, // setting the contents of an array
referenceInit = 2, // setting the reference of STC.ref_ variable
}
/***********************************************************
*/
extern (C++) class AssignExp : BinExp
{
MemorySet memset;
/************************************************************/
/* op can be TOK.assign, TOK.construct, or TOK.blit */
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.assign, __traits(classInstanceSize, AssignExp), e1, e2);
}
this(const ref Loc loc, TOK tok, Expression e1, Expression e2)
{
super(loc, tok, __traits(classInstanceSize, AssignExp), e1, e2);
}
override final bool isLvalue()
{
// Array-op 'x[] = y[]' should make an rvalue.
// Setting array length 'x.length = v' should make an rvalue.
if (e1.op == TOK.slice || e1.op == TOK.arrayLength)
{
return false;
}
return true;
}
override final Expression toLvalue(Scope* sc, Expression ex)
{
if (e1.op == TOK.slice || e1.op == TOK.arrayLength)
{
return Expression.toLvalue(sc, ex);
}
/* In front-end level, AssignExp should make an lvalue of e1.
* Taking the address of e1 will be handled in low level layer,
* so this function does nothing.
*/
return this;
}
override final Expression toBoolean(Scope* sc)
{
// Things like:
// if (a = b) ...
// are usually mistakes.
error("assignment cannot be used as a condition, perhaps `==` was meant?");
return ErrorExp.get();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ConstructExp : AssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.construct, e1, e2);
}
// Internal use only. If `v` is a reference variable, the assignment
// will become a reference initialization automatically.
extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2)
{
auto ve = new VarExp(loc, v);
assert(v.type && ve.type);
super(loc, TOK.construct, ve, e2);
if (v.storage_class & (STC.ref_ | STC.out_))
memset = MemorySet.referenceInit;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class BlitExp : AssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.blit, e1, e2);
}
// Internal use only. If `v` is a reference variable, the assinment
// will become a reference rebinding automatically.
extern (D) this(const ref Loc loc, VarDeclaration v, Expression e2)
{
auto ve = new VarExp(loc, v);
assert(v.type && ve.type);
super(loc, TOK.blit, ve, e2);
if (v.storage_class & (STC.ref_ | STC.out_))
memset = MemorySet.referenceInit;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class AddAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.addAssign, __traits(classInstanceSize, AddAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class MinAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.minAssign, __traits(classInstanceSize, MinAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class MulAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.mulAssign, __traits(classInstanceSize, MulAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class DivAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.divAssign, __traits(classInstanceSize, DivAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ModAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.modAssign, __traits(classInstanceSize, ModAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class AndAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.andAssign, __traits(classInstanceSize, AndAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class OrAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.orAssign, __traits(classInstanceSize, OrAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class XorAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.xorAssign, __traits(classInstanceSize, XorAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class PowAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.powAssign, __traits(classInstanceSize, PowAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ShlAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.leftShiftAssign, __traits(classInstanceSize, ShlAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ShrAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.rightShiftAssign, __traits(classInstanceSize, ShrAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class UshrAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.unsignedRightShiftAssign, __traits(classInstanceSize, UshrAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* The ~= operator. It can have one of the following operators:
*
* TOK.concatenateAssign - appending T[] to T[]
* TOK.concatenateElemAssign - appending T to T[]
* TOK.concatenateDcharAssign - appending dchar to T[]
*
* The parser initially sets it to TOK.concatenateAssign, and semantic() later decides which
* of the three it will be set to.
*/
extern (C++) class CatAssignExp : BinAssignExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.concatenateAssign, __traits(classInstanceSize, CatAssignExp), e1, e2);
}
extern (D) this(const ref Loc loc, TOK tok, Expression e1, Expression e2)
{
super(loc, tok, __traits(classInstanceSize, CatAssignExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
///
extern (C++) final class CatElemAssignExp : CatAssignExp
{
extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2)
{
super(loc, TOK.concatenateElemAssign, e1, e2);
this.type = type;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
///
extern (C++) final class CatDcharAssignExp : CatAssignExp
{
extern (D) this(const ref Loc loc, Type type, Expression e1, Expression e2)
{
super(loc, TOK.concatenateDcharAssign, e1, e2);
this.type = type;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#add_expressions
*/
extern (C++) final class AddExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.add, __traits(classInstanceSize, AddExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class MinExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.min, __traits(classInstanceSize, MinExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#cat_expressions
*/
extern (C++) final class CatExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.concatenate, __traits(classInstanceSize, CatExp), e1, e2);
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
e1 = e1.resolveLoc(loc, sc);
e2 = e2.resolveLoc(loc, sc);
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#mul_expressions
*/
extern (C++) final class MulExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.mul, __traits(classInstanceSize, MulExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#mul_expressions
*/
extern (C++) final class DivExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.div, __traits(classInstanceSize, DivExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#mul_expressions
*/
extern (C++) final class ModExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.mod, __traits(classInstanceSize, ModExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#pow_expressions
*/
extern (C++) final class PowExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.pow, __traits(classInstanceSize, PowExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ShlExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.leftShift, __traits(classInstanceSize, ShlExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ShrExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.rightShift, __traits(classInstanceSize, ShrExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class UshrExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.unsignedRightShift, __traits(classInstanceSize, UshrExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class AndExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.and, __traits(classInstanceSize, AndExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class OrExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.or, __traits(classInstanceSize, OrExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class XorExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.xor, __traits(classInstanceSize, XorExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* http://dlang.org/spec/expression.html#andand_expressions
* http://dlang.org/spec/expression.html#oror_expressions
*/
extern (C++) final class LogicalExp : BinExp
{
extern (D) this(const ref Loc loc, TOK op, Expression e1, Expression e2)
{
super(loc, op, __traits(classInstanceSize, LogicalExp), e1, e2);
assert(op == TOK.andAnd || op == TOK.orOr);
}
override Expression toBoolean(Scope* sc)
{
auto ex2 = e2.toBoolean(sc);
if (ex2.op == TOK.error)
return ex2;
e2 = ex2;
return this;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* `op` is one of:
* TOK.lessThan, TOK.lessOrEqual, TOK.greaterThan, TOK.greaterOrEqual
*
* http://dlang.org/spec/expression.html#relation_expressions
*/
extern (C++) final class CmpExp : BinExp
{
extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2)
{
super(loc, op, __traits(classInstanceSize, CmpExp), e1, e2);
assert(op == TOK.lessThan || op == TOK.lessOrEqual || op == TOK.greaterThan || op == TOK.greaterOrEqual);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class InExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.in_, __traits(classInstanceSize, InExp), e1, e2);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* This deletes the key e1 from the associative array e2
*/
extern (C++) final class RemoveExp : BinExp
{
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
{
super(loc, TOK.remove, __traits(classInstanceSize, RemoveExp), e1, e2);
type = Type.tbool;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* `==` and `!=`
*
* TOK.equal and TOK.notEqual
*
* http://dlang.org/spec/expression.html#equality_expressions
*/
extern (C++) final class EqualExp : BinExp
{
extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2)
{
super(loc, op, __traits(classInstanceSize, EqualExp), e1, e2);
assert(op == TOK.equal || op == TOK.notEqual);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* `is` and `!is`
*
* TOK.identity and TOK.notIdentity
*
* http://dlang.org/spec/expression.html#identity_expressions
*/
extern (C++) final class IdentityExp : BinExp
{
extern (D) this(TOK op, const ref Loc loc, Expression e1, Expression e2)
{
super(loc, op, __traits(classInstanceSize, IdentityExp), e1, e2);
assert(op == TOK.identity || op == TOK.notIdentity);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
* `econd ? e1 : e2`
*
* http://dlang.org/spec/expression.html#conditional_expressions
*/
extern (C++) final class CondExp : BinExp
{
Expression econd;
extern (D) this(const ref Loc loc, Expression econd, Expression e1, Expression e2)
{
super(loc, TOK.question, __traits(classInstanceSize, CondExp), e1, e2);
this.econd = econd;
}
override Expression syntaxCopy()
{
return new CondExp(loc, econd.syntaxCopy(), e1.syntaxCopy(), e2.syntaxCopy());
}
override Modifiable checkModifiable(Scope* sc, int flag)
{
if (e1.checkModifiable(sc, flag) != Modifiable.no
&& e2.checkModifiable(sc, flag) != Modifiable.no)
return Modifiable.yes;
return Modifiable.no;
}
override bool isLvalue()
{
return e1.isLvalue() && e2.isLvalue();
}
override Expression toLvalue(Scope* sc, Expression ex)
{
// convert (econd ? e1 : e2) to *(econd ? &e1 : &e2)
CondExp e = cast(CondExp)copy();
e.e1 = e1.toLvalue(sc, null).addressOf();
e.e2 = e2.toLvalue(sc, null).addressOf();
e.type = type.pointerTo();
return new PtrExp(loc, e, type);
}
override Expression modifiableLvalue(Scope* sc, Expression e)
{
//error("conditional expression %s is not a modifiable lvalue", toChars());
e1 = e1.modifiableLvalue(sc, e1);
e2 = e2.modifiableLvalue(sc, e2);
return toLvalue(sc, this);
}
override Expression toBoolean(Scope* sc)
{
auto ex1 = e1.toBoolean(sc);
auto ex2 = e2.toBoolean(sc);
if (ex1.op == TOK.error)
return ex1;
if (ex2.op == TOK.error)
return ex2;
e1 = ex1;
e2 = ex2;
return this;
}
void hookDtors(Scope* sc)
{
extern (C++) final class DtorVisitor : StoppableVisitor
{
alias visit = typeof(super).visit;
public:
Scope* sc;
CondExp ce;
VarDeclaration vcond;
bool isThen;
extern (D) this(Scope* sc, CondExp ce)
{
this.sc = sc;
this.ce = ce;
}
override void visit(Expression e)
{
//printf("(e = %s)\n", e.toChars());
}
override void visit(DeclarationExp e)
{
auto v = e.declaration.isVarDeclaration();
if (v && !v.isDataseg())
{
if (v._init)
{
if (auto ei = v._init.isExpInitializer())
walkPostorder(ei.exp, this);
}
if (v.edtor)
walkPostorder(v.edtor, this);
if (v.needsScopeDtor())
{
if (!vcond)
{
vcond = copyToTemp(STC.volatile_, "__cond", ce.econd);
vcond.dsymbolSemantic(sc);
Expression de = new DeclarationExp(ce.econd.loc, vcond);
de = de.expressionSemantic(sc);
Expression ve = new VarExp(ce.econd.loc, vcond);
ce.econd = Expression.combine(de, ve);
}
//printf("\t++v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars());
Expression ve = new VarExp(vcond.loc, vcond);
if (isThen)
v.edtor = new LogicalExp(v.edtor.loc, TOK.andAnd, ve, v.edtor);
else
v.edtor = new LogicalExp(v.edtor.loc, TOK.orOr, ve, v.edtor);
v.edtor = v.edtor.expressionSemantic(sc);
//printf("\t--v = %s, v.edtor = %s\n", v.toChars(), v.edtor.toChars());
}
}
}
}
scope DtorVisitor v = new DtorVisitor(sc, this);
//printf("+%s\n", toChars());
v.isThen = true;
walkPostorder(e1, v);
v.isThen = false;
walkPostorder(e2, v);
//printf("-%s\n", toChars());
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/// Returns: if this token is the `op` for a derived `DefaultInitExp` class.
bool isDefaultInitOp(TOK op) pure nothrow @safe @nogc
{
return op == TOK.prettyFunction || op == TOK.functionString ||
op == TOK.line || op == TOK.moduleString ||
op == TOK.file || op == TOK.fileFullPath ;
}
/***********************************************************
*/
extern (C++) class DefaultInitExp : Expression
{
extern (D) this(const ref Loc loc, TOK op, int size)
{
super(loc, op, size);
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class FileInitExp : DefaultInitExp
{
extern (D) this(const ref Loc loc, TOK tok)
{
super(loc, tok, __traits(classInstanceSize, FileInitExp));
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
//printf("FileInitExp::resolve() %s\n", toChars());
const(char)* s;
if (op == TOK.fileFullPath)
s = FileName.toAbsolute(loc.isValid() ? loc.filename : sc._module.srcfile.toChars());
else
s = loc.isValid() ? loc.filename : sc._module.ident.toChars();
Expression e = new StringExp(loc, s.toDString());
e = e.expressionSemantic(sc);
e = e.castTo(sc, type);
return e;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class LineInitExp : DefaultInitExp
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.line, __traits(classInstanceSize, LineInitExp));
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
Expression e = new IntegerExp(loc, loc.linnum, Type.tint32);
e = e.castTo(sc, type);
return e;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class ModuleInitExp : DefaultInitExp
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.moduleString, __traits(classInstanceSize, ModuleInitExp));
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
const auto s = (sc.callsc ? sc.callsc : sc)._module.toPrettyChars().toDString();
Expression e = new StringExp(loc, s);
e = e.expressionSemantic(sc);
e = e.castTo(sc, type);
return e;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class FuncInitExp : DefaultInitExp
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.functionString, __traits(classInstanceSize, FuncInitExp));
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
const(char)* s;
if (sc.callsc && sc.callsc.func)
s = sc.callsc.func.Dsymbol.toPrettyChars();
else if (sc.func)
s = sc.func.Dsymbol.toPrettyChars();
else
s = "";
Expression e = new StringExp(loc, s.toDString());
e = e.expressionSemantic(sc);
e.type = Type.tstring;
return e;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/***********************************************************
*/
extern (C++) final class PrettyFuncInitExp : DefaultInitExp
{
extern (D) this(const ref Loc loc)
{
super(loc, TOK.prettyFunction, __traits(classInstanceSize, PrettyFuncInitExp));
}
override Expression resolveLoc(const ref Loc loc, Scope* sc)
{
FuncDeclaration fd = (sc.callsc && sc.callsc.func)
? sc.callsc.func
: sc.func;
const(char)* s;
if (fd)
{
const funcStr = fd.Dsymbol.toPrettyChars();
OutBuffer buf;
functionToBufferWithIdent(fd.type.isTypeFunction(), &buf, funcStr);
s = buf.extractChars();
}
else
{
s = "";
}
Expression e = new StringExp(loc, s.toDString());
e = e.expressionSemantic(sc);
e.type = Type.tstring;
return e;
}
override void accept(Visitor v)
{
v.visit(this);
}
}
/**
* Objective-C class reference expression.
*
* Used to get the metaclass of an Objective-C class, `NSObject.Class`.
*/
extern (C++) final class ObjcClassReferenceExp : Expression
{
ClassDeclaration classDeclaration;
extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration)
{
super(loc, TOK.objcClassReference,
__traits(classInstanceSize, ObjcClassReferenceExp));
this.classDeclaration = classDeclaration;
type = objc.getRuntimeMetaclass(classDeclaration).getType();
}
override void accept(Visitor v)
{
v.visit(this);
}
}
|
D
|
employing variations in pitch to distinguish meanings of otherwise similar words
having tonality
|
D
|
/**
* Contains all implicitly declared types and variables.
*
* Copyright: Copyright Digital Mars 2000 - 2011.
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
* Authors: Walter Bright, Sean Kelly
*
* Copyright Digital Mars 2000 - 2011.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module object;
private
{
extern(C) void rt_finalize(void *ptr, bool det=true);
}
alias typeof(int.sizeof) size_t;
alias typeof(cast(void*)0 - cast(void*)0) ptrdiff_t;
alias ptrdiff_t sizediff_t; //For backwards compatibility only.
alias size_t hash_t; //For backwards compatibility only.
alias bool equals_t; //For backwards compatibility only.
alias immutable(char)[] string;
alias immutable(wchar)[] wstring;
alias immutable(dchar)[] dstring;
class Object
{
string toString();
size_t toHash() @trusted nothrow;
int opCmp(Object o);
bool opEquals(Object o);
interface Monitor
{
void lock();
void unlock();
}
static Object factory(string classname);
}
bool opEquals(const Object lhs, const Object rhs);
bool opEquals(Object lhs, Object rhs);
void setSameMutex(shared Object ownee, shared Object owner);
struct Interface
{
TypeInfo_Class classinfo;
void*[] vtbl;
size_t offset; // offset to Interface 'this' from Object 'this'
}
struct OffsetTypeInfo
{
size_t offset;
TypeInfo ti;
}
class TypeInfo
{
override string toString() const;
override size_t toHash() @trusted const;
override int opCmp(Object o);
override bool opEquals(Object o);
size_t getHash(in void* p) @trusted nothrow const;
bool equals(in void* p1, in void* p2) const;
int compare(in void* p1, in void* p2) const;
@property size_t tsize() nothrow pure const @safe;
void swap(void* p1, void* p2) const;
@property inout(TypeInfo) next() nothrow pure inout;
const(void)[] init() nothrow pure const @safe; // TODO: make this a property, but may need to be renamed to diambiguate with T.init...
@property uint flags() nothrow pure const @safe;
// 1: // has possible pointers into GC memory
const(OffsetTypeInfo)[] offTi() const;
void destroy(void* p) const;
void postblit(void* p) const;
@property size_t talign() nothrow pure const @safe;
version (X86_64) int argTypes(out TypeInfo arg1, out TypeInfo arg2) @safe nothrow;
@property immutable(void)* rtInfo() nothrow pure const @safe;
}
class TypeInfo_Typedef : TypeInfo
{
TypeInfo base;
string name;
void[] m_init;
}
class TypeInfo_Enum : TypeInfo_Typedef
{
}
class TypeInfo_Pointer : TypeInfo
{
TypeInfo m_next;
}
class TypeInfo_Array : TypeInfo
{
override string toString() const;
override bool opEquals(Object o);
override size_t getHash(in void* p) @trusted const;
override bool equals(in void* p1, in void* p2) const;
override int compare(in void* p1, in void* p2) const;
override @property size_t tsize() nothrow pure const;
override void swap(void* p1, void* p2) const;
override @property inout(TypeInfo) next() nothrow pure inout;
override @property uint flags() nothrow pure const;
override @property size_t talign() nothrow pure const;
version (X86_64) override int argTypes(out TypeInfo arg1, out TypeInfo arg2);
TypeInfo value;
}
class TypeInfo_StaticArray : TypeInfo
{
TypeInfo value;
size_t len;
}
class TypeInfo_AssociativeArray : TypeInfo
{
TypeInfo value;
TypeInfo key;
TypeInfo impl;
}
class TypeInfo_Vector : TypeInfo
{
TypeInfo base;
}
class TypeInfo_Function : TypeInfo
{
TypeInfo next;
string deco;
}
class TypeInfo_Delegate : TypeInfo
{
TypeInfo next;
string deco;
}
class TypeInfo_Class : TypeInfo
{
@property auto info() @safe nothrow pure const { return this; }
@property auto typeinfo() @safe nothrow pure const { return this; }
byte[] init; // class static initializer
string name; // class name
void*[] vtbl; // virtual function pointer table
Interface[] interfaces;
TypeInfo_Class base;
void* destructor;
void function(Object) classInvariant;
enum ClassFlags : uint
{
isCOMclass = 0x1,
noPointers = 0x2,
hasOffTi = 0x4,
hasCtor = 0x8,
hasGetMembers = 0x10,
hasTypeInfo = 0x20,
isAbstract = 0x40,
isCPPclass = 0x80,
}
ClassFlags m_flags;
void* deallocator;
OffsetTypeInfo[] m_offTi;
void* defaultConstructor;
immutable(void)* m_rtInfo; // data for precise GC
static const(TypeInfo_Class) find(in char[] classname);
Object create() const;
}
alias TypeInfo_Class ClassInfo;
class TypeInfo_Interface : TypeInfo
{
ClassInfo info;
}
class TypeInfo_Struct : TypeInfo
{
string name;
void[] m_init;
@safe pure nothrow
{
uint function(in void*) xtoHash;
bool function(in void*, in void*) xopEquals;
int function(in void*, in void*) xopCmp;
string function(in void*) xtoString;
enum StructFlags : uint
{
hasPointers = 0x1,
}
StructFlags m_flags;
}
void function(void*) xdtor;
void function(void*) xpostblit;
uint m_align;
version (X86_64)
{
TypeInfo m_arg1;
TypeInfo m_arg2;
}
immutable(void)* m_rtInfo;
}
class TypeInfo_Tuple : TypeInfo
{
TypeInfo[] elements;
}
class TypeInfo_Const : TypeInfo
{
TypeInfo next;
}
class TypeInfo_Invariant : TypeInfo_Const
{
}
class TypeInfo_Shared : TypeInfo_Const
{
}
class TypeInfo_Inout : TypeInfo_Const
{
}
abstract class MemberInfo
{
@property string name() nothrow pure;
}
class MemberInfo_field : MemberInfo
{
this(string name, TypeInfo ti, size_t offset);
override @property string name() nothrow pure;
@property TypeInfo typeInfo() nothrow pure;
@property size_t offset() nothrow pure;
}
class MemberInfo_function : MemberInfo
{
enum
{
Virtual = 1,
Member = 2,
Static = 4,
}
this(string name, TypeInfo ti, void* fp, uint flags);
override @property string name() nothrow pure;
@property TypeInfo typeInfo() nothrow pure;
@property void* fp() nothrow pure;
@property uint flags() nothrow pure;
}
struct ModuleInfo
{
uint _flags;
uint _index;
@property uint index() nothrow pure;
@property void index(uint i) nothrow pure;
@property uint flags() nothrow pure;
@property void flags(uint f) nothrow pure;
@property void function() tlsctor() nothrow pure;
@property void function() tlsdtor() nothrow pure;
@property void* xgetMembers() nothrow pure;
@property void function() ctor() nothrow pure;
@property void function() dtor() nothrow pure;
@property void function() ictor() nothrow pure;
@property void function() unitTest() nothrow pure;
@property ModuleInfo*[] importedModules() nothrow pure;
@property TypeInfo_Class[] localClasses() nothrow pure;
@property string name() nothrow pure;
static int opApply(scope int delegate(ref ModuleInfo*) dg);
}
class Throwable : Object
{
interface TraceInfo
{
int opApply(scope int delegate(ref const(char[]))) const;
int opApply(scope int delegate(ref size_t, ref const(char[]))) const;
string toString() const;
}
string msg;
string file;
size_t line;
TraceInfo info;
Throwable next;
@safe pure nothrow this(string msg, Throwable next = null);
@safe pure nothrow this(string msg, string file, size_t line, Throwable next = null);
override string toString();
void toString(scope void delegate(in char[]) sink) const;
}
class Exception : Throwable
{
@safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{
super(msg, file, line, next);
}
@safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line, next);
}
}
class Error : Throwable
{
@safe pure nothrow this(string msg, Throwable next = null)
{
super(msg, next);
bypassedException = null;
}
@safe pure nothrow this(string msg, string file, size_t line, Throwable next = null)
{
super(msg, file, line, next);
bypassedException = null;
}
Throwable bypassedException;
}
extern (C)
{
// from druntime/src/rt/aaA.d
size_t _aaLen(in void* p) pure nothrow;
void* _aaGetX(void** pp, const TypeInfo keyti, in size_t valuesize, in void* pkey);
inout(void)* _aaGetRvalueX(inout void* p, in TypeInfo keyti, in size_t valuesize, in void* pkey);
inout(void)[] _aaValues(inout void* p, in size_t keysize, in size_t valuesize) pure nothrow;
inout(void)[] _aaKeys(inout void* p, in size_t keysize) pure nothrow;
void* _aaRehash(void** pp, in TypeInfo keyti) pure nothrow;
extern (D) alias scope int delegate(void *) _dg_t;
int _aaApply(void* aa, size_t keysize, _dg_t dg);
extern (D) alias scope int delegate(void *, void *) _dg2_t;
int _aaApply2(void* aa, size_t keysize, _dg2_t dg);
private struct AARange { void* impl, current; }
AARange _aaRange(void* aa);
bool _aaRangeEmpty(AARange r);
void* _aaRangeFrontKey(AARange r);
void* _aaRangeFrontValue(AARange r);
void _aaRangePopFront(ref AARange r);
}
struct AssociativeArray(Key, Value)
{
private:
void* p;
public:
@property size_t length() const { return _aaLen(p); }
Value[Key] rehash()
{
auto p = _aaRehash(cast(void**) &p, typeid(Value[Key]));
return *cast(Value[Key]*)(&p);
}
// Note: can't make `values` and `keys` inout as it is used
// e.g. in Phobos like `ReturnType!(aa.keys)` instead of `typeof(aa.keys)`
// which will result in `inout` propagation.
inout(Value)[] inout_values() inout @property
{
auto a = _aaValues(p, Key.sizeof, Value.sizeof);
return *cast(inout Value[]*) &a;
}
inout(Key)[] inout_keys() inout @property
{
auto a = _aaKeys(p, Key.sizeof);
return *cast(inout Key[]*) &a;
}
Value[] values() @property
{ return inout_values; }
Key[] keys() @property
{ return inout_keys; }
const(Value)[] values() const @property
{ return inout_values; }
const(Key)[] keys() const @property
{ return inout_keys; }
int opApply(scope int delegate(ref Key, ref Value) dg)
{
return _aaApply2(p, Key.sizeof, cast(_dg2_t)dg);
}
int opApply(scope int delegate(ref Value) dg)
{
return _aaApply(p, Key.sizeof, cast(_dg_t)dg);
}
Value get(Key key, lazy Value defaultValue)
{
auto p = key in *cast(Value[Key]*)(&p);
return p ? *p : defaultValue;
}
static if (is(typeof({
ref Value get(); // pseudo lvalue of Value
Value[Key] r; r[Key.init] = get();
// bug 10720 - check whether Value is copyable
})))
{
Value[Key] dup()
{
Value[Key] result;
foreach (k, v; this)
{
result[k] = v;
}
return result;
}
}
else
@disable Value[Key] dup(); // for better error message
auto byKey()
{
static struct Result
{
AARange r;
@property bool empty() { return _aaRangeEmpty(r); }
@property ref Key front() { return *cast(Key*)_aaRangeFrontKey(r); }
void popFront() { _aaRangePopFront(r); }
Result save() { return this; }
}
return Result(_aaRange(p));
}
auto byValue()
{
static struct Result
{
AARange r;
@property bool empty() { return _aaRangeEmpty(r); }
@property ref Value front() { return *cast(Value*)_aaRangeFrontValue(r); }
void popFront() { _aaRangePopFront(r); }
Result save() { return this; }
}
return Result(_aaRange(p));
}
}
// Scheduled for deprecation in December 2012.
// Please use destroy instead of clear.
alias destroy clear;
void destroy(T)(T obj) if (is(T == class))
{
rt_finalize(cast(void*)obj);
}
void destroy(T)(T obj) if (is(T == interface))
{
destroy(cast(Object)obj);
}
void destroy(T)(ref T obj) if (is(T == struct))
{
typeid(T).destroy(&obj);
auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof];
auto init = cast(ubyte[])typeid(T).init();
if(init.ptr is null) // null ptr means initialize to 0s
buf[] = 0;
else
buf[] = init[];
}
void destroy(T : U[n], U, size_t n)(ref T obj) if (!is(T == struct))
{
obj[] = U.init;
}
void destroy(T)(ref T obj)
if (!is(T == struct) && !is(T == interface) && !is(T == class) && !_isStaticArray!T)
{
obj = T.init;
}
template _isStaticArray(T : U[N], U, size_t N)
{
enum bool _isStaticArray = true;
}
template _isStaticArray(T)
{
enum bool _isStaticArray = false;
}
private
{
extern (C) void _d_arrayshrinkfit(TypeInfo ti, void[] arr);
extern (C) size_t _d_arraysetcapacity(TypeInfo ti, size_t newcapacity, void *arrptr) pure nothrow;
}
@property size_t capacity(T)(T[] arr) pure nothrow
{
return _d_arraysetcapacity(typeid(T[]), 0, cast(void *)&arr);
}
size_t reserve(T)(ref T[] arr, size_t newcapacity) pure nothrow @trusted
{
return _d_arraysetcapacity(typeid(T[]), newcapacity, cast(void *)&arr);
}
auto ref inout(T[]) assumeSafeAppend(T)(auto ref inout(T[]) arr)
{
_d_arrayshrinkfit(typeid(T[]), *(cast(void[]*)&arr));
return arr;
}
bool _ArrayEq(T1, T2)(T1[] a1, T2[] a2)
{
if (a1.length != a2.length)
return false;
foreach(i, a; a1)
{ if (a != a2[i])
return false;
}
return true;
}
bool _xopEquals(in void* ptr, in void* ptr);
bool _xopCmp(in void* ptr, in void* ptr);
void __ctfeWrite(T...)(auto ref T) {}
void __ctfeWriteln(T...)(auto ref T values) { __ctfeWrite(values, "\n"); }
template RTInfo(T)
{
enum RTInfo = cast(void*)0x12345678;
}
version (unittest)
{
string __unittest_toString(T)(ref T value) pure nothrow @trusted
{
static if (is(T == string))
return `"` ~ value ~ `"`; // TODO: Escape internal double-quotes.
else
{
version (druntime_unittest)
{
return T.stringof;
}
else
{
enum phobos_impl = q{
import std.traits;
alias Unqual!T U;
static if (isFloatingPoint!U)
{
import std.string;
enum format_string = is(U == float) ? "%.7g" :
is(U == double) ? "%.16g" : "%.20g";
return (cast(string function(...) pure nothrow @safe)&format)(format_string, value);
}
else
{
import std.conv;
alias to!string toString;
alias toString!T f;
return (cast(string function(T) pure nothrow @safe)&f)(value);
}
};
enum tango_impl = q{
import tango.util.Convert;
alias to!(string, T) f;
return (cast(string function(T) pure nothrow @safe)&f)(value);
};
static if (__traits(compiles, { mixin(phobos_impl); }))
mixin(phobos_impl);
else static if (__traits(compiles, { mixin(tango_impl); }))
mixin(tango_impl);
else
return T.stringof;
}
}
}
}
|
D
|
/**
* Copyright: Enalye
* License: Zlib
* Authors: Enalye
*/
module grimoire.runtime.channel;
alias GrIntChannel = GrChannel!int;
alias GrFloatChannel = GrChannel!float;
alias GrStringChannel = GrChannel!string;
alias GrObjectChannel = GrChannel!(void*);
/**
A pipe that allow synchronised communication between coroutines.
*/
final class GrChannel(T) {
/// The channel is active.
bool isOwned = true;
private {
T[] _buffer;
uint _size, _capacity;
bool _isReceiverReady;
}
@property {
/**
On a channel of size 1, the sender is blocked
until something tells him he is ready to receive the value.
For any other size, the sender is never blocked
until the buffer is full.
*/
bool canSend() const {
if (_capacity == 1u)
return _isReceiverReady && _size < 1u;
else
return _size < _capacity;
}
/**
You can receive whenever there is a value stored
without being blocked.
*/
bool canReceive() const {
return _size > 0u;
}
/// Number of values the channel is currently storing
uint size() const {
return _size;
}
/// Maximum number of values the channel can store
uint capacity() const {
return _capacity;
}
/// Is the channel empty ?
bool isEmpty() const {
return _size == 0u;
}
/// Is the channel full ?
bool isFull() const {
return _size == _capacity;
}
}
/// Buffer of size 1.
this() {
_capacity = 1u;
}
/// Fixed size buffer.
this(uint buffSize) {
_capacity = buffSize;
}
/// Always check canSend() before.
void send()(auto ref T value) {
if (_size == _capacity || (_capacity == 1u && !_isReceiverReady))
throw new Exception("Attempt to write on a full channel");
_buffer ~= value;
_size++;
}
/// Always check canReceive() before.
T receive() {
if (_size == 0)
throw new Exception("Attempt to read an empty channel");
T value = _buffer[0];
_buffer = _buffer[1 .. $];
_size--;
_isReceiverReady = false;
return value;
}
/**
Notify the senders that they can write to
this channel because you are blocked on it.
*/
void setReceiverReady() {
_isReceiverReady = true;
}
}
|
D
|
/Users/pramonowang/Desktop/anyhour/DerivedData/anyhour/Build/Intermediates/anyhour.build/Debug-iphoneos/anyhour.build/Objects-normal/armv7/ViewController.o : /Users/pramonowang/Desktop/anyhour/anyhour/MyAnnotation.swift /Users/pramonowang/Desktop/anyhour/ShowMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/SearchMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourCustomCell.swift /Users/pramonowang/Desktop/anyhour/anyhour/Restaurant.swift /Users/pramonowang/Desktop/anyhour/anyhour/ViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourTableViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreLocation.swiftmodule
/Users/pramonowang/Desktop/anyhour/DerivedData/anyhour/Build/Intermediates/anyhour.build/Debug-iphoneos/anyhour.build/Objects-normal/armv7/ViewController~partial.swiftmodule : /Users/pramonowang/Desktop/anyhour/anyhour/MyAnnotation.swift /Users/pramonowang/Desktop/anyhour/ShowMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/SearchMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourCustomCell.swift /Users/pramonowang/Desktop/anyhour/anyhour/Restaurant.swift /Users/pramonowang/Desktop/anyhour/anyhour/ViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourTableViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreLocation.swiftmodule
/Users/pramonowang/Desktop/anyhour/DerivedData/anyhour/Build/Intermediates/anyhour.build/Debug-iphoneos/anyhour.build/Objects-normal/armv7/ViewController~partial.swiftdoc : /Users/pramonowang/Desktop/anyhour/anyhour/MyAnnotation.swift /Users/pramonowang/Desktop/anyhour/ShowMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/SearchMapViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourCustomCell.swift /Users/pramonowang/Desktop/anyhour/anyhour/Restaurant.swift /Users/pramonowang/Desktop/anyhour/anyhour/ViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AnyHourTableViewController.swift /Users/pramonowang/Desktop/anyhour/anyhour/AppDelegate.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/Swift.swiftmodule /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 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/armv7/CoreLocation.swiftmodule
|
D
|
// Written in the D programming language.
module windows.windowsremotemanagement;
public import windows.core;
public import windows.automation : BSTR, IDispatch, VARIANT;
public import windows.com : HRESULT, IUnknown;
public import windows.systemservices : BOOL, HANDLE, PWSTR;
extern(Windows) @nogc nothrow:
// Enums
///Specifies the current data type of the union in the WSMAN_DATA structure.
enum WSManDataType : int
{
///The structure is not valid yet.
WSMAN_DATA_NONE = 0x00000000,
///The structure contains text.
WSMAN_DATA_TYPE_TEXT = 0x00000001,
///The structure contains binary data.
WSMAN_DATA_TYPE_BINARY = 0x00000002,
WSMAN_DATA_TYPE_DWORD = 0x00000004,
}
///Determines the authentication method for the operation.
enum WSManAuthenticationFlags : int
{
///Use the default authentication.
WSMAN_FLAG_DEFAULT_AUTHENTICATION = 0x00000000,
///Use no authentication for a remote operation.
WSMAN_FLAG_NO_AUTHENTICATION = 0x00000001,
///Use Digest authentication. Only the client computer can initiate a Digest authentication request. The client
///sends a request to the server to authenticate and receives from the server a token string. The client then sends
///the resource request, including the user name and a cryptographic hash of the password combined with the token
///string. Digest authentication is supported for HTTP and HTTPS. WinRM Shell client scripts and applications can
///specify Digest authentication, but the service cannot.
WSMAN_FLAG_AUTH_DIGEST = 0x00000002,
///Use Negotiate authentication. The client sends a request to the server to authenticate. The server determines
///whether to use Kerberos or NTLM. In general, Kerberos is selected to authenticate a domain account and NTLM is
///selected for local computer accounts. But there are also some special cases in which Kerberos/NTLM are selected.
///The user name should be specified in the form DOMAIN\username for a domain user or SERVERNAME\username for a
///local user on a server computer.
WSMAN_FLAG_AUTH_NEGOTIATE = 0x00000004,
///Use Basic authentication. The client presents credentials in the form of a user name and password that are
///directly transmitted in the request message. You can specify the credentials only of a local administrator
///account on the remote computer.
WSMAN_FLAG_AUTH_BASIC = 0x00000008,
///Use Kerberos authentication. The client and server mutually authenticate by using Kerberos certificates.
WSMAN_FLAG_AUTH_KERBEROS = 0x00000010,
///Use CredSSP authentication for a remote operation. If a certificate from the local machine is used to
///authenticate the server, the Network service must be allowed access to the private key of the certificate.
WSMAN_FLAG_AUTH_CREDSSP = 0x00000080,
WSMAN_FLAG_AUTH_CLIENT_CERTIFICATE = 0x00000020,
}
///Defines the proxy access type.
enum WSManProxyAccessType : int
{
///Use the Internet Explorer proxy configuration for the current user. This is the default setting.
WSMAN_OPTION_PROXY_IE_PROXY_CONFIG = 0x00000001,
///Use the proxy settings configured for WinHTTP.
WSMAN_OPTION_PROXY_WINHTTP_PROXY_CONFIG = 0x00000002,
///Force autodetection of a proxy.
WSMAN_OPTION_PROXY_AUTO_DETECT = 0x00000004,
///Do not use a proxy server. All host names are resolved locally.
WSMAN_OPTION_PROXY_NO_PROXY_SERVER = 0x00000008,
}
///Defines a set of extended options for the session. These options are used with the WSManSetSessionOption method.
enum WSManSessionOption : int
{
///Default time-out in milliseconds that applies to all operations on the client side.
WSMAN_OPTION_DEFAULT_OPERATION_TIMEOUTMS = 0x00000001,
WSMAN_OPTION_MAX_RETRY_TIME = 0x0000000b,
///Time-out in milliseconds for WSManCreateShell operations.
WSMAN_OPTION_TIMEOUTMS_CREATE_SHELL = 0x0000000c,
///Time-out in milliseconds for WSManRunShellCommand operations.
WSMAN_OPTION_TIMEOUTMS_RUN_SHELL_COMMAND = 0x0000000d,
///Time-out in milliseconds for WSManReceiveShellOutput operations.
WSMAN_OPTION_TIMEOUTMS_RECEIVE_SHELL_OUTPUT = 0x0000000e,
///Time-out in milliseconds for WSManSendShellInput operations.
WSMAN_OPTION_TIMEOUTMS_SEND_SHELL_INPUT = 0x0000000f,
///Time-out in milliseconds for WSManSignalShell and WSManCloseCommand operations.
WSMAN_OPTION_TIMEOUTMS_SIGNAL_SHELL = 0x00000010,
///Time-out in milliseconds for WSManCloseShell operations connection options.
WSMAN_OPTION_TIMEOUTMS_CLOSE_SHELL = 0x00000011,
///Set to 1 to not validate the CA on the server certificate. The default is 0.
WSMAN_OPTION_SKIP_CA_CHECK = 0x00000012,
///Set to 1 to not validate the CN on the server certificate. The default is 0.
WSMAN_OPTION_SKIP_CN_CHECK = 0x00000013,
///Set to 1 to not encrypt messages. The default is 0.
WSMAN_OPTION_UNENCRYPTED_MESSAGES = 0x00000014,
///Set to 1 to send all network packets for remote operations in UTF16. Default of 0 causes network packets to be
///sent in UTF8.
WSMAN_OPTION_UTF16 = 0x00000015,
///Set to 1 when using Negotiate authentication and the port number is included in the connection. Default is 0.
WSMAN_OPTION_ENABLE_SPN_SERVER_PORT = 0x00000016,
///Set to 1 to identify this machine to the server by including the MachineID. The default is 0.
WSMAN_OPTION_MACHINE_ID = 0x00000017,
///The language locale options. For more information about the language locales, see the RFC 3066 specification from
///the Internet Engineering Task Force at http://www.ietf.org/rfc/rfc3066.txt.
WSMAN_OPTION_LOCALE = 0x00000019,
///The UI language options. The UI language options are defined in RFC 3066 format. For more information about the
///UI language options, see the RFC 3066 specification from the Internet Engineering Task Force at
///http://www.ietf.org/rfc/rfc3066.txt.
WSMAN_OPTION_UI_LANGUAGE = 0x0000001a,
///The maximum Simple Object Access Protocol (SOAP) envelope size. The default is 150 KB.
WSMAN_OPTION_MAX_ENVELOPE_SIZE_KB = 0x0000001c,
///The maximum size of the data that is provided by the client.
WSMAN_OPTION_SHELL_MAX_DATA_SIZE_PER_MESSAGE_KB = 0x0000001d,
///The redirect location. <div class="alert"><b>Note</b> It is recommended that all redirection use Secure Sockets
///Layer (SSL) and that all applications validate the redirected URI before creating a new session.</div> <div>
///</div>
WSMAN_OPTION_REDIRECT_LOCATION = 0x0000001e,
///Set to 1 to not validate the revocation status on the server certificate. The default is 0.
WSMAN_OPTION_SKIP_REVOCATION_CHECK = 0x0000001f,
///Set to 1 to allow default credentials for Negotiate. The default is 0.
WSMAN_OPTION_ALLOW_NEGOTIATE_IMPLICIT_CREDENTIALS = 0x00000020,
WSMAN_OPTION_USE_SSL = 0x00000021,
WSMAN_OPTION_USE_INTEARACTIVE_TOKEN = 0x00000022,
}
///Defines a set of flags used by all callback functions.
enum WSManCallbackFlags : int
{
///Indicates the end of a single step of a multi-step operation. This flag is used for optimization purposes if the
///shell cannot be determined.
WSMAN_FLAG_CALLBACK_END_OF_OPERATION = 0x00000001,
///Indicates the end of a particular stream. This flag is used for optimization purposes if an indication has been
///provided to the shell that no more output will occur for this stream.
WSMAN_FLAG_CALLBACK_END_OF_STREAM = 0x00000008,
WSMAN_FLAG_CALLBACK_SHELL_SUPPORTS_DISCONNECT = 0x00000020,
WSMAN_FLAG_CALLBACK_SHELL_AUTODISCONNECTED = 0x00000040,
WSMAN_FLAG_CALLBACK_NETWORK_FAILURE_DETECTED = 0x00000100,
WSMAN_FLAG_CALLBACK_RETRYING_AFTER_NETWORK_FAILURE = 0x00000200,
WSMAN_FLAG_CALLBACK_RECONNECTED_AFTER_NETWORK_FAILURE = 0x00000400,
WSMAN_FLAG_CALLBACK_SHELL_AUTODISCONNECTING = 0x00000800,
WSMAN_FLAG_CALLBACK_RETRY_ABORTED_DUE_TO_INTERNAL_ERROR = 0x00001000,
WSMAN_FLAG_CALLBACK_RECEIVE_DELAY_STREAM_REQUEST_PROCESSED = 0x00002000,
}
enum WSManShellFlag : int
{
WSMAN_FLAG_NO_COMPRESSION = 0x00000001,
WSMAN_FLAG_DELETE_SERVER_SESSION = 0x00000002,
WSMAN_FLAG_SERVER_BUFFERING_MODE_DROP = 0x00000004,
WSMAN_FLAG_SERVER_BUFFERING_MODE_BLOCK = 0x00000008,
WSMAN_FLAG_RECEIVE_DELAY_OUTPUT_STREAM = 0x00000010,
}
enum WSManSessionFlags : int
{
WSManFlagUTF8 = 0x00000001,
WSManFlagCredUsernamePassword = 0x00001000,
WSManFlagSkipCACheck = 0x00002000,
WSManFlagSkipCNCheck = 0x00004000,
WSManFlagUseNoAuthentication = 0x00008000,
WSManFlagUseDigest = 0x00010000,
WSManFlagUseNegotiate = 0x00020000,
WSManFlagUseBasic = 0x00040000,
WSManFlagUseKerberos = 0x00080000,
WSManFlagNoEncryption = 0x00100000,
WSManFlagUseClientCertificate = 0x00200000,
WSManFlagEnableSPNServerPort = 0x00400000,
WSManFlagUTF16 = 0x00800000,
WSManFlagUseCredSsp = 0x01000000,
WSManFlagSkipRevocationCheck = 0x02000000,
WSManFlagAllowNegotiateImplicitCredentials = 0x04000000,
WSManFlagUseSsl = 0x08000000,
}
enum WSManEnumFlags : int
{
WSManFlagNonXmlText = 0x00000001,
WSManFlagReturnObject = 0x00000000,
WSManFlagReturnEPR = 0x00000002,
WSManFlagReturnObjectAndEPR = 0x00000004,
WSManFlagHierarchyDeep = 0x00000000,
WSManFlagHierarchyShallow = 0x00000020,
WSManFlagHierarchyDeepBasePropsOnly = 0x00000040,
WSManFlagAssociatedInstance = 0x00000000,
WSManFlagAssociationInstance = 0x00000080,
}
///Defines the proxy access type flags.
enum WSManProxyAccessTypeFlags : int
{
///Use the Internet Explorer proxy configuration for the current user.
WSManProxyIEConfig = 0x00000001,
///Use the proxy settings configured for WinHTTP. This is the default setting.
WSManProxyWinHttpConfig = 0x00000002,
///Force autodetection of a proxy.
WSManProxyAutoDetect = 0x00000004,
WSManProxyNoProxyServer = 0x00000008,
}
///Determines the proxy authentication mechanism.
enum WSManProxyAuthenticationFlags : int
{
///Use Negotiate authentication. The client sends a request to the server to authenticate. The server determines
///whether to use Kerberos or NTLM. In general, Kerberos is selected to authenticate a domain account and NTLM is
///selected for local computer accounts. But there are also some special cases in which Kerberos/NTLM are selected.
///The user name should be specified in the form DOMAIN\username for a domain user or SERVERNAME\username for a
///local user on a server computer.
WSManFlagProxyAuthenticationUseNegotiate = 0x00000001,
///Use Basic authentication. The client presents credentials in the form of a user name and password that are
///directly transmitted in the request message.
WSManFlagProxyAuthenticationUseBasic = 0x00000002,
WSManFlagProxyAuthenticationUseDigest = 0x00000004,
}
// Callbacks
///The callback function that is called for shell operations, which result in a remote request.
///Params:
/// operationContext = Represents user-defined context passed to the WinRM (WinRM) Client Shell application programming interface (API)
/// .
/// flags = Specifies one or more flags from the WSManCallbackFlags enumeration.
/// error = Defines the WSMAN_ERROR structure, which is valid in the callback only.
/// shell = Specifies the shell handle associated with the user context. The shell handle must be closed by calling the
/// WSManCloseShell method.
/// command = Specifies the command handle associated with the user context. The command handle must be closed by calling the
/// WSManCloseCommand API method.
/// operationHandle = Defines the operation handle associated with the user context. The operation handle is valid only for callbacks
/// that are associated with WSManReceiveShellOutput, WSManSendShellInput, and WSManSignalShell calls. This handle
/// must be closed by calling the WSManCloseOperation method.
alias WSMAN_SHELL_COMPLETION_FUNCTION = void function(void* operationContext, uint flags, WSMAN_ERROR* error,
WSMAN_SHELL* shell, WSMAN_COMMAND* command,
WSMAN_OPERATION* operationHandle, WSMAN_RESPONSE_DATA* data);
///Defines the release shell callback for the plug-in. This function is called to delete the plug-in shell context. The
///DLL entry point name must be WSManPluginReleaseCommandContext.
alias WSMAN_PLUGIN_RELEASE_SHELL_CONTEXT = void function(void* shellContext);
///Defines the release command callback for the plug-in. This function is called to delete the plug-in command context.
///The DLL entry point name must be <b>WSManPluginReleaseCommandContext</b>.
///Params:
/// shellContext = Specifies the context that was received when the shell was created.
alias WSMAN_PLUGIN_RELEASE_COMMAND_CONTEXT = void function(void* shellContext, void* commandContext);
///Defines the startup callback for the plug-in. Because multiple applications can be hosted in the same process, this
///method can be called multiple times, but only once for each application initialization. A plug-in can be initialized
///more than once within the same process but only once for each <i>applicationIdentification</i> value. The context
///that is returned from this method should be application specific. The returned context will be passed into all future
///plug-in calls that are specific to the application. All Windows Remote Management (WinRM) plug-ins must implement
///this callback function. The DLL entry point name for this method must be <b>WSManPluginStartup</b>.
///Params:
/// flags = Reserved for future use. Must be zero.
/// applicationIdentification = A unique identifier for the hosted application. For the main WinRM service, the default is <b>wsman</b>. For an
/// Internet Information Services (IIS) host, this identifier is related to the application endpoint for that host.
/// For example, <b>wsman/MyCompany/MyApplication</b>.
/// extraInfo = A string that contains configuration information, if any information was stored when the plug-in was registered.
/// When the plug-in is registered using the WinRM configuration, the plug-in can add extra configuration parameters
/// that are useful during initialization to an optional node. This information can be especially useful if a plug-in
/// is used in different IIS hosting scenarios and requires slightly different run-time semantics during
/// initialization. This string is a copy of the XML from the configuration, if one is present. Otherwise, this
/// parameter is set to <b>NULL</b>.
/// pluginContext = The context for the specific application initialization. This context is passed through to all other WinRM
/// plug-in calls that are associated with this <i>applicationIdentifier</i>.
alias WSMAN_PLUGIN_STARTUP = uint function(uint flags, const(PWSTR) applicationIdentification,
const(PWSTR) extraInfo, void** pluginContext);
///Defines the shutdown callback for the plug-in. This function is called after all operations have been canceled and
///before the Windows Remote Management plug-in DLL is unloaded. All WinRM plug-ins must implement this callback
///function. The DLL entry point name must be <b>WSManPluginShutdown</b>.
///Params:
/// pluginContext = Specifies the context that was returned by a call to the WSManPluginStartup method. This parameter represents a
/// specific application initialization of a WinRM plug-in. The shutdown entry point will be called for each
/// application that initialized it.
/// flags = Reserved for future use. Must be set to zero.
/// reason = Specifies the reason that the plug-in is shutting down.
///Returns:
/// The method returns <b>NO_ERROR</b> if it succeeded; otherwise, it returns an error code. <div
/// class="alert"><b>Note</b> If this method fails, the plug-in will not call back in.</div> <div> </div>
///
alias WSMAN_PLUGIN_SHUTDOWN = uint function(void* pluginContext, uint flags, uint reason);
///Defines the shell callback for a plug-in. This function is called when a request for a new shell is received. All
///Windows Remote Management plug-ins that support shell operations need to implement this callback. The DLL entry point
///name must be <b>WSManPluginShell</b>.
///Params:
/// pluginContext = Specifies the context that was returned by a call to the WSManPluginStartup method. This parameter represents a
/// specific application initialization of a WinRM plug-in.
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be set to zero.
/// startupInfo = A pointer to a WSMAN_SHELL_STARTUP_INFO structure that contains startup information for the shell.
/// inboundShellInformation = A pointer to a WSMAN_DATA structure that specifies an optional inbound object that contains extra data for the
/// shell.
alias WSMAN_PLUGIN_SHELL = void function(void* pluginContext, WSMAN_PLUGIN_REQUEST* requestDetails, uint flags,
WSMAN_SHELL_STARTUP_INFO_V11* startupInfo,
WSMAN_DATA* inboundShellInformation);
///Defines the command callback for a plug-in. This function is called when a request for a command is received. All
///Windows Remote Management plug-ins that support shell operations and need to create commands must implement this
///callback. The DLL entry point name must be <b>WSManPluginCommand</b>.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be set to zero.
/// shellContext = Specifies the context returned from creating the shell for which this command needs to be associated.
/// commandLine = Specifies the command line to be run.
/// arguments = A pointer to a WSMAN_COMMAND_ARG_SET structure that specifies the command-line arguments to be passed to the
/// command.
alias WSMAN_PLUGIN_COMMAND = void function(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* shellContext,
const(PWSTR) commandLine, WSMAN_COMMAND_ARG_SET* arguments);
///Defines the send callback for a plug-in. This function is called for each object that is received from a client. Each
///object received causes the callback to be called once. After the data is processed, the Windows Remote Management
///(WinRM) plug-in calls WSManPluginOperationComplete to acknowledge receipt and to allow the next object to be
///delivered. The DLL entry point name must be <b>WSManPluginSend</b>.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = If this is the last object for the stream, this parameter is set to <b>WSMAN_FLAG_NO_MORE_DATA</b>. Otherwise, it
/// is set to zero.
/// shellContext = Specifies the context that was received when the shell was created.
/// commandContext = If this request is aimed at a command and not a shell, this is the context returned from the <b>winrm create</b>
/// operation; otherwise, this parameter is <b>NULL</b>.
/// stream = Specifies the stream that is associated with the inbound object.
alias WSMAN_PLUGIN_SEND = void function(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* shellContext,
void* commandContext, const(PWSTR) stream, WSMAN_DATA* inboundData);
///Defines the receive callback for a plug-in. This function is called when an inbound request to receive data is
///received. The DLL entry point name must be <b>WSManPluginReceive</b>.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be zero.
/// shellContext = Specifies the context that was received when the shell was created.
/// commandContext = If this request is aimed at a command and not a shell, this is the context returned from the <b>winrm create</b>
/// operation; otherwise, this parameter is <b>NULL</b>.
/// streamSet = A WSMAN_STREAM_ID_SET structure that contains a list of streams for which data is to be received. If this list is
/// empty, all streams that were configured in the shell are implied, which means that all streams are available.
alias WSMAN_PLUGIN_RECEIVE = void function(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* shellContext,
void* commandContext, WSMAN_STREAM_ID_SET* streamSet);
///Defines the signal callback for a plug-in. This function is called when an inbound signal is received from a client
///call. The DLL entry point name for this method must be <b>WSManPluginSignal</b>.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be zero.
/// shellContext = Specifies the context that was received when the shell was created.
/// commandContext = If this request is aimed at a command and not a shell, this is the context returned from the <b>winrm create</b>
/// operation; otherwise, this parameter is <b>NULL</b>.
/// code = Specifies the signal that is received from the client. The following codes are common.
alias WSMAN_PLUGIN_SIGNAL = void function(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* shellContext,
void* commandContext, const(PWSTR) code);
///Defines the connect callback for a plug-in. The DLL entry point name must be <b>WSManPluginConnect</b>.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be set to zero.
/// shellContext = Specifies the context returned from creating the shell for which this connection request needs to be associated.
/// commandContext = If this request is aimed at a command and not a shell, this is the context returned from the <b>winrm create</b>
/// operation; otherwise, this parameter is <b>NULL</b>.
alias WSMAN_PLUGIN_CONNECT = void function(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* shellContext,
void* commandContext, WSMAN_DATA* inboundConnectInformation);
///Authorizes a connection. The plug-in should verify that this user is allowed to perform any operations. If the user
///is allowed to perform operations, the plug-in must report a success. If the user is not allowed to carry out any type
///of operation, a failure must be returned. Every new connection does not need to be authorized. After a user has been
///authorized to connect, a user record is created to track the activities of the user. While that record exists, all
///new connections will automatically be authorized. The user record will time-out after a configurable amount of time
///after no activity is detected. The DLL entry point name for this method must be <b>WSManPluginAuthzUser</b>.
///Params:
/// pluginContext = Specifies the context that was returned by a call to WSManPluginStartup. This parameter represents a specific
/// application initialization of a WinRM plug-in.
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that specifies the identification information of the user to be
/// authorized.
/// flags = Reserved for future use. Must be set to zero.
alias WSMAN_PLUGIN_AUTHORIZE_USER = void function(void* pluginContext, WSMAN_SENDER_DETAILS* senderDetails,
uint flags);
///Authorizes a specific operation. The DLL entry point name for this method must be <b>WSManPluginAuthzOperation</b>.
///Params:
/// pluginContext = Specifies the context that was returned by a call to WSManPluginStartup. This parameter represents a specific
/// application initialization of a WinRM plug-in.
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that specifies the identification information of the user.
/// flags = Reserved for future use. Must be set to zero.
/// operation = Represents the operation that is being performed. This parameter can be one of the following values:
/// action = Specifies the action of the request received. This parameter can be one of the following values:
/// resourceUri = Specifies the resource URI of the inbound operation.
alias WSMAN_PLUGIN_AUTHORIZE_OPERATION = void function(void* pluginContext, WSMAN_SENDER_DETAILS* senderDetails,
uint flags, uint operation, const(PWSTR) action,
const(PWSTR) resourceUri);
///Retrieves quota information for the user after a connection has been authorized. This method will be called only if
///the configuration specifies that quotas are enabled within the authorization plug-in. The DLL entry point name for
///this method must be <b>WSManPluginAuthzQueryQuota</b>.
///Params:
/// pluginContext = Specifies the context that was returned by a call to WSManPluginStartup. This parameter represents a specific
/// application initialization of a WinRM plug-in.
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that specifies the identification information of the user.
/// flags = Reserved for future use. Must be zero.
alias WSMAN_PLUGIN_AUTHORIZE_QUERY_QUOTA = void function(void* pluginContext, WSMAN_SENDER_DETAILS* senderDetails,
uint flags);
///Releases the context that a plug-in reports from either WSManPluginAuthzUserComplete or
///WSManPluginAuthzOperationComplete. For a particular user, the context reported for both calls is allowed to be the
///same, as long as the plug-in infrastructure handles the scenario appropriately. This method is synchronous, and there
///are no callbacks that are called as a result. This method will be called under the following scenarios: <ul>
///<li>After the operation is complete, the WSManPluginAuthzOperationComplete context is released. For some operations,
///such as get, the context will be released after the response is sent for the get operation. For more complex
///operations, such as enumeration, the context will not be released until the enumeration has completed.</li> <li>When
///the user record times out due to inactivity, the WSManPluginAuthzUser method will be called again the next time a
///request comes in for that user.</li> <li>If re-authorization needs to occur, the old context will be released after
///the new one is acquired. The old context will always be released regardless of whether the authorization
///succeeds.</li> </ul>The DLL entry point name for this method must be <b>WSManPluginAuthzReleaseContext</b>.
alias WSMAN_PLUGIN_AUTHORIZE_RELEASE_CONTEXT = void function(void* userAuthorizationContext);
// Structs
///A WSMAN_DATA structure component that holds textual data for use with various Windows Remote Management functions.
struct WSMAN_DATA_TEXT
{
///Specifies the number of UNICODE characters stored in the buffer.
uint bufferLength;
const(PWSTR) buffer;
}
///A WSMAN_DATA structure component that holds binary data for use with various Windows Remote Management functions.
struct WSMAN_DATA_BINARY
{
///Represents the number of BYTEs stored in the data field.
uint dataLength;
ubyte* data;
}
///Contains inbound and outbound data used in the Windows Remote Management (WinRM) API.
struct WSMAN_DATA
{
///Specifies the type of data currently stored in the union.
WSManDataType type;
union
{
WSMAN_DATA_TEXT text;
WSMAN_DATA_BINARY binaryData;
uint number;
}
}
///Contains error information that is returned by a Windows Remote Management (WinRM) client. The WSMAN_ERROR structure
///is used by all callbacks to return error information and is valid only for the callback.
struct WSMAN_ERROR
{
///Specifies an error code. This error can be a general error code that is defined in winerror.h or a WinRM-specific
///error code.
uint code;
///Specifies extended error information that relates to a failed call. This field contains the fault detail text if
///it is present in the fault. If there is no fault detail, this field contains the fault reason text. This field
///can be set to <b>NULL</b>.
const(PWSTR) errorDetail;
///Specifies the language for the error description. This field can be set to <b>NULL</b>. For more information
///about the language format, see the RFC 3066 specification from the Internet Engineering Task Force at
///http://www.ietf.org/rfc/rfc3066.txt.
const(PWSTR) language;
///Specifies the name of the computer. This field can be set to <b>NULL</b>.
const(PWSTR) machineName;
const(PWSTR) pluginName;
}
///Defines the credentials used for authentication.
struct WSMAN_USERNAME_PASSWORD_CREDS
{
///Defines the user name for a local or domain account. It cannot be <b>NULL</b>.
const(PWSTR) username;
///Defines the password for a local or domain account. It cannot be <b>NULL</b>.
const(PWSTR) password;
}
///Defines the authentication method and the credentials used for server or proxy authentication.
struct WSMAN_AUTHENTICATION_CREDENTIALS
{
///Defines the authentication mechanism. This member can be set to zero. If it is set to zero, the WinRM client will
///choose between Kerberos and Negotiate. If it is not set to zero, this member must be one of the values of the
///WSManAuthenticationFlags enumeration.
uint authenticationMechanism;
union
{
WSMAN_USERNAME_PASSWORD_CREDS userAccount;
const(PWSTR) certificateThumbprint;
}
}
///Represents a specific option name and value pair. An option that is not understood and has a <b>mustComply</b> value
///of <b>TRUE</b> should result in the plug-in operation failing the request with an error.
struct WSMAN_OPTION
{
///Specifies the name of the option.
const(PWSTR) name;
///Specifies the value of the option.
const(PWSTR) value;
BOOL mustComply;
}
///Represents a set of options. Additionally, this structure defines a flag that specifies whether all options must be
///understood.
struct WSMAN_OPTION_SET
{
///Specifies the number of options in the <b>options</b> array.
uint optionsCount;
///Specifies an array of option names and values
WSMAN_OPTION* options;
BOOL optionsMustUnderstand;
}
struct WSMAN_OPTION_SETEX
{
uint optionsCount;
WSMAN_OPTION* options;
BOOL optionsMustUnderstand;
PWSTR* optionTypes;
}
///Represents a key and value pair within a selector set and is used to identify a particular resource.
struct WSMAN_KEY
{
///Specifies the key name.
const(PWSTR) key;
const(PWSTR) value;
}
///Defines a set of keys that represent the identity of a resource.
struct WSMAN_SELECTOR_SET
{
///Specifies the number of keys (selectors).
uint numberKeys;
WSMAN_KEY* keys;
}
///<p class="CCE_Message">[<b>WSMAN_FRAGMENT</b> is reserved for future use.] Defines the fragment information for an
///operation. Currently, this structure is reserved for future use.
struct WSMAN_FRAGMENT
{
///Reserved for future use. This parameter must be <b>NULL</b>.
const(PWSTR) path;
const(PWSTR) dialect;
}
///<p class="CCE_Message">[<b>WSMAN_FILTER</b> is reserved for future use.] Defines the filtering that is used for an
///operation.
struct WSMAN_FILTER
{
///Reserved for future use. This parameter must be <b>NULL</b>.
const(PWSTR) filter;
const(PWSTR) dialect;
}
///Represents a specific resource endpoint for which the plug-in must perform the request.
struct WSMAN_OPERATION_INFO
{
///A WSMAN_FRAGMENT structure that specifies the subset of data to be used for the operation. This parameter is
///reserved for future use and is ignored on receipt.
WSMAN_FRAGMENT fragment;
///A WSMAN_FILTER structure that specifies the filtering that is used for the operation. This parameter is reserved
///for future use and is ignored on receipt.
WSMAN_FILTER filter;
///A WSMAN_SELECTOR_SET structure that identifies the specific resource to use for the request.
WSMAN_SELECTOR_SET selectorSet;
///A WSMAN_OPTION_SET structure that specifies the set of options for the request.
WSMAN_OPTION_SET optionSet;
void* reserved;
uint version_;
}
struct WSMAN_OPERATION_INFOEX
{
WSMAN_FRAGMENT fragment;
WSMAN_FILTER filter;
WSMAN_SELECTOR_SET selectorSet;
WSMAN_OPTION_SETEX optionSet;
uint version_;
const(PWSTR) uiLocale;
const(PWSTR) dataLocale;
}
struct WSMAN_API
{
}
///Specifies proxy information.
struct WSMAN_PROXY_INFO
{
///Specifies the access type for the proxy. This member must be set to one of the values defined in the
///WSManProxyAccessType enumeration.
uint accessType;
WSMAN_AUTHENTICATION_CREDENTIALS authenticationCredentials;
}
struct WSMAN_SESSION
{
}
struct WSMAN_OPERATION
{
}
struct WSMAN_SHELL
{
}
struct WSMAN_COMMAND
{
}
///Lists all the streams that are used for either input or output for the shell and commands.
struct WSMAN_STREAM_ID_SET
{
///Defines the number of stream IDs in <b>streamIDs</b>.
uint streamIDsCount;
PWSTR* streamIDs;
}
///Defines an individual environment variable by using a name and value pair. This structure is used by the
///WSManCreateShell method. The representation of the <b>value</b> variable is shell specific. The client and server
///must agree on the format of the <b>value</b> variable.
struct WSMAN_ENVIRONMENT_VARIABLE
{
///Defines the environment variable name. This parameter cannot be <b>NULL</b>.
const(PWSTR) name;
const(PWSTR) value;
}
///Defines an array of environment variables.
struct WSMAN_ENVIRONMENT_VARIABLE_SET
{
///Specifies the number of environment variables contained within the <b>vars</b> array.
uint varsCount;
WSMAN_ENVIRONMENT_VARIABLE* vars;
}
///Defines the shell startup parameters to be used with the WSManCreateShell function. The structure must be allocated
///by the client and passed to the <b>WSManCreateShell</b> function. The configuration passed to the WSManCreateShell
///function can directly affect the behavior of a command executed within the shell. A typical example is the
///<i>workingDirectory</i> argument that describes the working directory associated with each process, which the
///operating system uses when attempting to locate files specified by using a relative path. In the absence of specific
///requirements for stream naming, clients and services should attempt to use <b>STDIN</b> for input streams,
///<b>STDOUT</b> for the default output stream, and <b>STDERR</b> for the error or status output stream.
struct WSMAN_SHELL_STARTUP_INFO_V10
{
///A pointer to a WSMAN_STREAM_ID_SET structure that specifies a set of input streams for the shell. Streams not
///present in the filter can be ignored by the shell implementation. For the Windows Cmd.exe shell, this value
///should be L"stdin". If the value is <b>NULL</b>, the implementation uses an array with L"stdin" as the default
///value.
WSMAN_STREAM_ID_SET* inputStreamSet;
///A pointer to a WSMAN_STREAM_ID_SET structure that specifies a set of output streams for the shell. Streams not
///present in the filter can be ignored by the shell implementation. For the Windows cmd.exe shell, this value
///should be L"stdout stderr". If the value is <b>NULL</b>, the implementation uses an array with L"stdout" and
///L"stderr" as the default value.
WSMAN_STREAM_ID_SET* outputStreamSet;
///Specifies the maximum duration, in milliseconds, the shell will stay open without any client request. When the
///maximum duration is exceeded, the shell is automatically deleted. Any value from 0 to 0xFFFFFFFF can be set. This
///duration has a maximum value specified by the Idle time-out GPO setting, if enabled, or by the IdleTimeout local
///configuration. The default value of the maximum duration in the GPO/local configuration is 15 minutes. However, a
///system administrator can change this value. To use the maximum value from the GPO/local configuration, the client
///should specify 0 (zero) in this field. If an explicit value between 0 to 0xFFFFFFFF is used, the minimum value
///between the explicit API value and the value from the GPO/local configuration is used.
uint idleTimeoutMs;
///Specifies the starting directory for a shell. It is used with any execution command. If this member is a
///<b>NULL</b> value, a default directory will be used by the remote machine when executing the command. An empty
///value is treated by the underlying protocol as an omitted value.
const(PWSTR) workingDirectory;
///A pointer to a WSMAN_ENVIRONMENT_VARIABLE_SET structure that specifies an array of variable name and value pairs,
///which describe the starting environment for the shell. The content of these elements is shell specific and can be
///defined in terms of other environment variables. If a <b>NULL</b> value is passed, the default environment is
///used on the server side.
WSMAN_ENVIRONMENT_VARIABLE_SET* variableSet;
}
///Defines the shell startup parameters to be used with the WSManCreateShell function. The structure must be allocated
///by the client and passed to the <b>WSManCreateShell</b> function. The configuration passed to the WSManCreateShell
///function can directly affect the behavior of a command executed within the shell. A typical example is the
///<i>workingDirectory</i> argument that describes the working directory associated with each process, which the
///operating system uses when attempting to locate files specified by using a relative path. In the absence of specific
///requirements for stream naming, clients and services should attempt to use <b>STDIN</b> for input streams,
///<b>STDOUT</b> for the default output stream, and <b>STDERR</b> for the error or status output stream.
struct WSMAN_SHELL_STARTUP_INFO_V11
{
WSMAN_SHELL_STARTUP_INFO_V10 __AnonymousBase_wsman_L665_C48;
///Specifies an optional friendly name to be associated with the shell. This parameter is only functional when the
///client passes the flag <b>WSMAN_FLAG_REQUESTED_API_VERSION_1_1</b> to WSManInitialize.
const(PWSTR) name;
}
///Specifies the maximum duration, in milliseconds, the shell will stay open after the client has disconnected.
struct WSMAN_SHELL_DISCONNECT_INFO
{
///Specifies the maximum time in milliseconds that the shell will stay open after the client has disconnected. When
///this maximum duration has been exceeded, the shell will be deleted. Specifying this value overrides the initial
///idle timeout value that is set as part of the WSMAN_SHELL_STARTUP_INFO structure in the WSManCreateShell method.
uint idleTimeoutMs;
}
///Represents the output data received from a WSManReceiveShellOutput method.
struct WSMAN_RECEIVE_DATA_RESULT
{
///Represents the <b>streamId</b> for which <b>streamData</b> is defined.
const(PWSTR) streamId;
///Represents the data associated with <b>streamId</b>. The data can be stream text, binary content, or XML. For
///more information about the possible data, see WSMAN_DATA.
WSMAN_DATA streamData;
///Specifies the status of the command. If this member is set to <b>WSMAN_COMMAND_STATE_DONE</b>, the command should
///be immediately closed.
const(PWSTR) commandState;
uint exitCode;
}
struct WSMAN_CONNECT_DATA
{
WSMAN_DATA data;
}
struct WSMAN_CREATE_SHELL_DATA
{
WSMAN_DATA data;
}
///Represents the output data received from a WSMan operation.
union WSMAN_RESPONSE_DATA
{
///Represents the output data received from a WSManReceiveShellOutput method.
WSMAN_RECEIVE_DATA_RESULT receiveData;
///Represents the output data received from a WSManConnectShell or WSManConnectShellCommand method.
WSMAN_CONNECT_DATA connectData;
WSMAN_CREATE_SHELL_DATA createData;
}
///Defines an asynchronous structure to be passed to all shell operations. It contains an optional user context and the
///callback function.
struct WSMAN_SHELL_ASYNC
{
///Specifies the optional user context associated with the operation.
void* operationContext;
WSMAN_SHELL_COMPLETION_FUNCTION completionFunction;
}
///Represents the set of arguments that are passed in to the command line.
struct WSMAN_COMMAND_ARG_SET
{
///Specifies the number of arguments in the array.
uint argsCount;
PWSTR* args;
}
///Stores client information for an inbound request that was sent with a client certificate. The individual fields
///represent the fields within the client certificate.
struct WSMAN_CERTIFICATE_DETAILS
{
///Specifies the subject that is identified by the certificate.
const(PWSTR) subject;
///Specifies the name of the issuer of the certificate.
const(PWSTR) issuerName;
///Specifies the thumbprint of the issuer.
const(PWSTR) issuerThumbprint;
const(PWSTR) subjectName;
}
///Specifies the client details for every inbound request.
struct WSMAN_SENDER_DETAILS
{
///Specifies the user name of the client making the request. The content of this parameter varies depending on the
///type of authentication. The value of the <i>senderName</i> is formatted as follows: <table> <tr>
///<th>Authentication mechanism</th> <th>Value of <i>senderName</i></th> </tr> <tr> <td> Windows Authentication
///</td> <td> The domain and user name. </td> </tr> <tr> <td> Basic Authentication </td> <td> The user name
///specified. </td> </tr> <tr> <td> Client Certificates </td> <td> The subject of the certificate. </td> </tr> <tr>
///<td> LiveID </td> <td> The LiveID PUID as a string. </td> </tr> </table>
const(PWSTR) senderName;
///Specifies a string that indicates which authentication mechanism was used by the client. The following values are
///predefined: <ul> <li>Basic</li> <li>ClientCertificate</li> </ul> All other types are queried directly from the
///security package. For Internet Information Services (IIS) hosting, this string is retrieved from the IIS
///infrastructure.
const(PWSTR) authenticationMechanism;
///A pointer to a WSMAN_CERTIFICATE_DETAILS structure that specifies the details of the client's certificate. This
///parameter is valid only if the <i>authenticationMechanism</i>is set to ClientCertificate.
WSMAN_CERTIFICATE_DETAILS* certificateDetails;
///Specifies the identity token of the user if a Windows security token is available for a user. This token will be
///used by the thread to impersonate this user for all calls into the plug-in. <div class="alert"><b>Note</b>
///Authorization plug-ins can change the user context and use a different impersonation token.</div> <div> </div>
HANDLE clientToken;
const(PWSTR) httpURL;
}
///Specifies information for a plug-in request. A pointer to a <b>WSMAN_PLUGIN_REQUEST</b> structure is passed to all
///operation entry points within the plug-in. All result notification methods use this pointer to match the result with
///the request. All information in the structure will stay valid until the plug-in calls WSManPluginOperationCompleteon
///the operation.
struct WSMAN_PLUGIN_REQUEST
{
///A pointer to a WSMAN_SENDER_DETAILS structure that specifies details about the client that initiated the request.
WSMAN_SENDER_DETAILS* senderDetails;
///Specifies the locale that the user requested results to be in. If the requested locale is not available, the
///following options are available: <ul> <li>The system locale is used.</li> <li>The request is rejected with an
///invalid locale error.</li> </ul> Any call into the plug-in will have the locale on the thread set to the locale
///that is specified in this member. If the plug-in has other threads working on the request, the plug-in will need
///to set the locale accordingly on each thread that it uses.
const(PWSTR) locale;
///Specifies the resource URI for this operation.
const(PWSTR) resourceUri;
///A pointer to a WSMAN_OPERATION_INFO structure that contains extra information about the operation. Some of the
///information in this structure will be <b>NULL</b> because not all of the parameters are relevant to all
///operations.
WSMAN_OPERATION_INFO* operationInfo;
///If the operation is canceled, the <b>shutdownNotification</b> member is set to <b>TRUE</b>.
int shutdownNotification;
///If the operation is canceled, <b>shutdownNotification</b> is signaled.
HANDLE shutdownNotificationHandle;
const(PWSTR) dataLocale;
}
///Reports quota information on a per-user basis for authorization plug-ins.
struct WSMAN_AUTHZ_QUOTA
{
///Specifies the maximum number of concurrent shells that a user is allowed to create.
uint maxAllowedConcurrentShells;
///Specifies the maximum number of concurrent operations that a user is allowed to perform. Only top-level
///operations are counted. Simple operations such as get, put, and delete are counted as one operation each. More
///complex operations are also counted as one. For example, the enumeration operation and any associated operations
///that are related to enumeration are counted as one operation.
uint maxAllowedConcurrentOperations;
///Time-slot length for determining the maximum number of operations per time slot. This value is specified in units
///of seconds.
uint timeslotSize;
uint maxAllowedOperationsPerTimeslot;
}
// Functions
///Initializes the Windows Remote Management Client API. <b>WSManInitialize</b> can be used by different clients on the
///same process.
///Params:
/// flags = A flag of type <b>WSMAN_FLAG_REQUESTED_API_VERSION_1_0</b> or <b>WSMAN_FLAG_REQUESTED_API_VERSION_1_1</b>. The
/// client that will use the disconnect-reconnect functionality should use the
/// <b>WSMAN_FLAG_REQUESTED_API_VERSION_1_1</b> flag.
/// apiHandle = Defines a handle that uniquely identifies the client. This parameter cannot be <b>NULL</b>. When you have
/// finished used the handle, close it by calling the WSManDeinitialize method.
@DllImport("WsmSvc")
uint WSManInitialize(uint flags, WSMAN_API** apiHandle);
///Deinitializes the Windows Remote Management client stack. All operations must be complete before a call to this
///function will return. This is a synchronous call. It is recommended that all operations are explicitly canceled and
///that all sessions are closed before calling this function.
///Params:
/// apiHandle = Specifies the API handle returned by a WSManInitialize call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be zero.
@DllImport("WsmSvc")
uint WSManDeinitialize(WSMAN_API* apiHandle, uint flags);
///Retrieves the error messages associated with a particular error and language codes.
///Params:
/// apiHandle = Specifies the API handle returned by a WSManInitialize call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be zero.
/// languageCode = Specifies the language code name that should be used to localize the error. For more information about the
/// language code names, see the RFC 3066 specification from the Internet Engineering Task Force at
/// http://www.ietf.org/rfc/rfc3066.txt. If a language code is not specified, the user interface language of the
/// thread is used.
/// errorCode = Specifies the error code for the requested error message. This error code can be a hexadecimal or decimal error
/// code from a WinRM, WinHTTP, or other Windows operating system feature.
/// messageLength = Specifies the number of characters that can be stored in the output message buffer, including the <b>null</b>
/// terminator. If this parameter is zero, the <i>message</i> parameter must be <b>NULL</b>.
/// message = Specifies the output buffer to store the message in. This buffer must be allocated and deallocated by the client.
/// The buffer must be large enough to store the message and the <b>null</b> terminator. If this parameter is
/// <b>NULL</b>, the <i>messageLength</i> parameter must be <b>NULL</b>.
/// messageLengthUsed = Specifies the actual number of characters written to the output buffer, including the <b>null</b> terminator.
/// This parameter cannot be <b>NULL</b>. If either the <i>messageLength</i> or <i>message</i> parameters are zero,
/// the function will return <b>ERROR_INSUFFICIENT_BUFFER</b> and this parameter will be set to the number of
/// characters needed to store the message, including the <b>null</b> terminator.
@DllImport("WsmSvc")
uint WSManGetErrorMessage(WSMAN_API* apiHandle, uint flags, const(PWSTR) languageCode, uint errorCode,
uint messageLength, PWSTR message, uint* messageLengthUsed);
///Creates a session object.
///Params:
/// apiHandle = Specifies the API handle returned by the WSManInitialize call. This parameter cannot be <b>NULL</b>.
/// connection = Indicates to which protocol and agent to connect. If this parameter is <b>NULL</b>, the connection will default
/// to localhost (127.0.0.1). This parameter can be a simple host name or a complete URL. The format is the
/// following: [transport://]host[:port][/prefix] where: <table> <tr> <th>Element</th> <th>Description</th> </tr>
/// <tr> <td> transport </td> <td> Either HTTP or HTTPS. Default is HTTP. </td> </tr> <tr> <td> host </td> <td> Can
/// be in a DNS name, NetBIOS name, or IP address. </td> </tr> <tr> <td> port </td> <td> Defaults to 80 for HTTP and
/// to 443 for HTTPS. The defaults can be changed in the local configuration. </td> </tr> <tr> <td> prefix </td> <td>
/// Any string. Default is "wsman". The default can be changed in the local configuration. </td> </tr> </table>
/// flags = Reserved for future use. Must be zero.
/// serverAuthenticationCredentials = Defines the authentication method such as Negotiate, Kerberos, Digest, Basic, or client certificate. If the
/// authentication mechanism is Negotiate, Kerberos, Digest, or Basic, the structure can also contain the credentials
/// used for authentication. If client certificate authentication is used, the certificate thumbprint must be
/// specified. If credentials are specified, this parameter contains the user name and password of a local account or
/// domain account. If this parameter is <b>NULL</b>, the default credentials are used. The default credentials are
/// the credentials that the current thread is executing under. The client must explicitly specify the credentials
/// when Basic or Digest authentication is used. If explicit credentials are used, both the user name and the
/// password must be valid. For more information about the authentication credentials, see the
/// WSMAN_AUTHENTICATION_CREDENTIALS structure.
/// proxyInfo = A pointer to a WSMAN_PROXY_INFO structure that specifies proxy information. This value can be <b>NULL</b>.
/// session = Defines the session handle that uniquely identifies the session. This parameter cannot be <b>NULL</b>. This
/// handle should be closed by calling the WSManCloseSession method.
@DllImport("WsmSvc")
uint WSManCreateSession(WSMAN_API* apiHandle, const(PWSTR) connection, uint flags,
WSMAN_AUTHENTICATION_CREDENTIALS* serverAuthenticationCredentials,
WSMAN_PROXY_INFO* proxyInfo, WSMAN_SESSION** session);
///Closes a session object.
///Params:
/// session = Specifies the session handle to close. This handle is returned by a WSManCreateSession call. This parameter
/// cannot be NULL.
/// flags = Reserved for future use. Must be zero.
///Returns:
/// This method returns zero on success. Otherwise, this method returns an error code.
///
@DllImport("WsmSvc")
uint WSManCloseSession(WSMAN_SESSION* session, uint flags);
///Sets an extended set of options for the session.
///Params:
/// session = Specifies the session handle returned by a WSManCreateSession call. This parameter cannot be <b>NULL</b>.
/// option = Specifies the option to be set. This parameter must be set to one of the values in the WSManSessionOption
/// enumeration.
/// data = A pointer to a WSMAN_DATA structure that defines the option value.
///Returns:
/// This method returns zero on success. Otherwise, this method returns an error code.
///
@DllImport("WsmSvc")
uint WSManSetSessionOption(WSMAN_SESSION* session, WSManSessionOption option, WSMAN_DATA* data);
///Gets the value of a session option.
///Params:
/// session = Specifies the handle returned by a WSManCreateSession call. This parameter cannot be <b>NULL</b>.
/// option = Specifies the option to get. Not all session options can be retrieved. The options are defined in the
/// WSManSessionOption enumeration.
/// value = Specifies the value of specified session option.
@DllImport("WsmSvc")
uint WSManGetSessionOptionAsDword(WSMAN_SESSION* session, WSManSessionOption option, uint* value);
///Gets the value of a session option.
///Params:
/// session = Specifies the session handle returned by a WSManCreateSession call. This parameter cannot be <b>NULL</b>.
/// option = Specifies the option to get. Not all session options can be retrieved. The values for the options are defined in
/// the WSManSessionOption enumeration.
/// stringLength = Specifies the length of the storage location for <i>string</i> parameter.
/// string = A pointer to the storage location for the value of the specified session option.
/// stringLengthUsed = Specifies the length of the string returned in the <i>string</i> parameter.
@DllImport("WsmSvc")
uint WSManGetSessionOptionAsString(WSMAN_SESSION* session, WSManSessionOption option, uint stringLength,
PWSTR string, uint* stringLengthUsed);
///Cancels or closes an asynchronous operation. All resources that are associated with the operation are freed.
///Params:
/// operationHandle = Specifies the operation handle to be closed.
/// flags = Reserved for future use. Set to zero.
///Returns:
/// This method returns zero on success. Otherwise, this method returns an error code.
///
@DllImport("WsmSvc")
uint WSManCloseOperation(WSMAN_OPERATION* operationHandle, uint flags);
///Creates a shell object. The returned shell handle identifies an object that defines the context in which commands can
///be run. The context is defined by the environment variables, the input and output streams, and the working directory.
///The context can directly affect the behavior of a command. A shell context is created on the remote computer
///specified by the connection parameter and authenticated by using the credentials parameter.
///Params:
/// session = Specifies the session handle returned by a WSManCreateSession call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be zero.
/// resourceUri = Defines the shell type to create. The shell type is defined by a unique URI. The actual shell object returned by
/// the call is dependent on the URI specified. This parameter cannot be <b>NULL</b>. To create a Windows cmd.exe
/// shell, use the <b>WSMAN_CMDSHELL_URI</b> resource URI.
/// startupInfo = A pointer to a WSMAN_SHELL_STARTUP_INFO structure that specifies the input and output streams, working directory,
/// idle time-out, and options for the shell. If this parameter is <b>NULL</b>, the default values will be used.
/// options = A pointer to a WSMAN_OPTION_SET structure that specifies a set of options for the shell.
/// createXml = A pointer to a WSMAN_DATA structure that defines an open context for the shell. The content should be a valid XML
/// string. This parameter can be <b>NULL</b>.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseShell method.
@DllImport("WsmSvc")
void WSManCreateShell(WSMAN_SESSION* session, uint flags, const(PWSTR) resourceUri,
WSMAN_SHELL_STARTUP_INFO_V11* startupInfo, WSMAN_OPTION_SET* options, WSMAN_DATA* createXml,
WSMAN_SHELL_ASYNC* async, WSMAN_SHELL** shell);
///Starts the execution of a command within an existing shell and does not wait for the completion of the command.
///Params:
/// shell = Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be zero.
/// commandLine = Defines a required <b>null</b>-terminated string that represents the command to be executed. Typically, the
/// command is specified without any arguments, which are specified separately. However, a user can specify the
/// command line and all of the arguments by using this parameter. If arguments are specified for the
/// <i>commandLine</i> parameter, the <i>args</i> parameter should be <b>NULL</b>.
/// args = A pointer to a WSMAN_COMMAND_ARG_SET structure that defines an array of argument values, which are passed to the
/// command on creation. If no arguments are required, this parameter should be <b>NULL</b>.
/// options = Defines a set of options for the command. These options are passed to the service to modify or refine the command
/// execution. This parameter can be <b>NULL</b>. For more information about the options, see WSMAN_OPTION_SET.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseCommand method.
@DllImport("WsmSvc")
void WSManRunShellCommand(WSMAN_SHELL* shell, uint flags, const(PWSTR) commandLine, WSMAN_COMMAND_ARG_SET* args,
WSMAN_OPTION_SET* options, WSMAN_SHELL_ASYNC* async, WSMAN_COMMAND** command);
///Sends a control code to an existing command or to the shell itself.
///Params:
/// shell = Specifies the handle returned by a WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// command = Specifies the command handle returned by a WSManRunShellCommand call. If this value is <b>NULL</b>, the signal
/// code is sent to the shell.
/// flags = Reserved for future use. Must be set to zero.
/// code = Specifies the signal code to send to the command or shell. The following codes are common.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseOperation method.
@DllImport("WsmSvc")
void WSManSignalShell(WSMAN_SHELL* shell, WSMAN_COMMAND* command, uint flags, const(PWSTR) code,
WSMAN_SHELL_ASYNC* async, WSMAN_OPERATION** signalOperation);
///Retrieves output from a running command or from the shell.
///Params:
/// shell = Specifies the shell handle returned by a WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// command = Specifies the command handle returned by a WSManRunShellCommand call.
/// flags = Reserved for future use. Must be set to zero.
/// desiredStreamSet = Specifies the requested output from a particular stream or a list of streams.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseOperation method.
@DllImport("WsmSvc")
void WSManReceiveShellOutput(WSMAN_SHELL* shell, WSMAN_COMMAND* command, uint flags,
WSMAN_STREAM_ID_SET* desiredStreamSet, WSMAN_SHELL_ASYNC* async,
WSMAN_OPERATION** receiveOperation);
///Pipes the input stream to a running command or to the shell.
///Params:
/// shell = Specifies the shell handle returned by a WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// command = Specifies the command handle returned by a WSManRunShellCommand call. This handle should be closed by calling the
/// WSManCloseCommand method.
/// flags = Reserved for future use. Must be set to zero.
/// streamId = Specifies the input stream ID. This parameter cannot be <b>NULL</b>.
/// streamData = Uses the WSMAN_DATA structure to specify the stream data to be sent to the command or shell. This structure
/// should be allocated by the calling client and must remain allocated until <b>WSManSendShellInput</b> completes.
/// If the end of the stream has been reached, the <i>endOfStream</i> parameter should be set to <b>TRUE</b>.
/// endOfStream = Set to <b>TRUE</b>, if the end of the stream has been reached. Otherwise, this parameter is set to <b>FALSE</b>.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseCommand method.
@DllImport("WsmSvc")
void WSManSendShellInput(WSMAN_SHELL* shell, WSMAN_COMMAND* command, uint flags, const(PWSTR) streamId,
WSMAN_DATA* streamData, BOOL endOfStream, WSMAN_SHELL_ASYNC* async,
WSMAN_OPERATION** sendOperation);
///Deletes a command and frees the resources that are associated with it.
///Params:
/// commandHandle = Specifies the command handle to be closed. This handle is returned by a WSManRunShellCommand call.
/// flags = Reserved for future use. Must be set to zero.
@DllImport("WsmSvc")
void WSManCloseCommand(WSMAN_COMMAND* commandHandle, uint flags, WSMAN_SHELL_ASYNC* async);
///Deletes a shell object and frees the resources associated with the shell.
///Params:
/// shellHandle = Specifies the shell handle to close. This handle is returned by a WSManCreateShell call. This parameter cannot be
/// <b>NULL</b>.
/// flags = Reserved for future use. Must be set to zero.
@DllImport("WsmSvc")
void WSManCloseShell(WSMAN_SHELL* shellHandle, uint flags, WSMAN_SHELL_ASYNC* async);
///Creates a shell object by using the same functionality as the WSManCreateShell function, with the addition of a
///client-specified shell ID. The returned shell handle identifies an object that defines the context in which commands
///can be run. The context is defined by the environment variables, the input and output streams, and the working
///directory. The context can directly affect the behavior of a command. A shell context is created on the remote
///computer specified by the connection parameter and authenticated by using the credentials parameter.
///Params:
/// session = Specifies the session handle returned by a WSManCreateSession call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be 0.
/// resourceUri = Defines the shell type to create. The shell type is defined by a unique URI. The actual shell object returned by
/// the call is dependent on the URI specified. This parameter cannot be <b>NULL</b>. To create a Windows cmd.exe
/// shell, use the <b>WSMAN_CMDSHELL_URI</b> resource URI.
/// shellId = The client specified <i>shellID</i>.
/// startupInfo = A pointer to a WSMAN_SHELL_STARTUP_INFO structure that specifies the input and output streams, working directory,
/// idle timeout, and options for the shell. If this parameter is <b>NULL</b>, the default values will be used.
/// options = A pointer to a WSMAN_OPTION_SET structure that specifies a set of options for the shell.
/// createXml = A pointer to a WSMAN_DATA structure that defines an open context for the shell. The content should be a valid XML
/// string. This parameter can be <b>NULL</b>.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseShell method.
@DllImport("WsmSvc")
void WSManCreateShellEx(WSMAN_SESSION* session, uint flags, const(PWSTR) resourceUri, const(PWSTR) shellId,
WSMAN_SHELL_STARTUP_INFO_V11* startupInfo, WSMAN_OPTION_SET* options, WSMAN_DATA* createXml,
WSMAN_SHELL_ASYNC* async, WSMAN_SHELL** shell);
///Provides the same functionality as the WSManRunShellCommand function, with the addition of a command ID option. If
///the server supports the protocol, it will create the command instance using the ID specified by the client. If a
///command with the specified ID already exists, the server will fail to create the command instance. This new
///functionality is only available when the client application passes the <b>WSMAN_FLAG_REQUESTED_API_VERSION_1_1</b>
///flag as part of the call to the WSManInitialize function.
///Params:
/// shell = Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be 0.
/// commandId = The client specified command Id.
/// commandLine = Defines a required null-terminated string that represents the command to be executed. Typically, the command is
/// specified without any arguments, which are specified separately. However, a user can specify the command line and
/// all of the arguments by using this parameter. If arguments are specified for the commandLine parameter, the args
/// parameter should be <b>NULL</b>.
/// args = A pointer to a WSMAN_COMMAND_ARG_SET structure that defines an array of argument values, which are passed to the
/// command on creation. If no arguments are required, this parameter should be <b>NULL</b>.
/// options = Defines a set of options for the command. These options are passed to the service to modify or refine the command
/// execution. This parameter can be <b>NULL</b>. For more information about the options, see WSMAN_OPTION_SET.
/// async = Defines an asynchronous structure. The asynchronous structure contains an optional user context and a mandatory
/// callback function. See the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be <b>NULL</b>
/// and should be closed by calling the WSManCloseCommand method.
@DllImport("WsmSvc")
void WSManRunShellCommandEx(WSMAN_SHELL* shell, uint flags, const(PWSTR) commandId, const(PWSTR) commandLine,
WSMAN_COMMAND_ARG_SET* args, WSMAN_OPTION_SET* options, WSMAN_SHELL_ASYNC* async,
WSMAN_COMMAND** command);
///Disconnects the network connection of an active shell and its associated commands.
///Params:
/// shell = Specifies the handle returned by a call to the WSManCreateShell function. This parameter cannot be <b>NULL</b>.
/// flags = Can be a <b>WSMAN_FLAG_SERVER_BUFFERING_MODE_DROP</b> flag or a <b>WSMAN_FLAG_SERVER_BUFFERING_MODE_BLOCK</b>
/// flag.
/// disconnectInfo = A pointer to a WSMAN_SHELL_DISCONNECT_INFO structure that specifies an idle time-out that the server session may
/// enforce. If this parameter is <b>NULL</b>, the server session idle time-out will not be changed.
/// async = Defines an asynchronous structure to contain an optional user context and a mandatory callback function. For more
/// information, see WSMAN_SHELL_ASYNC. This parameter cannot be <b>NULL</b>.
@DllImport("WsmSvc")
void WSManDisconnectShell(WSMAN_SHELL* shell, uint flags, WSMAN_SHELL_DISCONNECT_INFO* disconnectInfo,
WSMAN_SHELL_ASYNC* async);
///Reconnects a previously disconnected shell session. To reconnect the shell session's associated commands, use
///WSManReconnectShellCommand.
///Params:
/// shell = Specifies the handle returned by a call to the WSManCreateShell function. This parameter cannot be <b>NULL</b>.
/// flags = This parameter is reserved for future use and must be set to zero.
@DllImport("WsmSvc")
void WSManReconnectShell(WSMAN_SHELL* shell, uint flags, WSMAN_SHELL_ASYNC* async);
///Reconnects a previously disconnected command.
///Params:
/// commandHandle = Specifies the handle returned by a WSManRunShellCommand call or a WSManConnectShellCommand call. This parameter
/// cannot be NULL.
/// flags = Reserved for future use. Must be set to zero.
@DllImport("WsmSvc")
void WSManReconnectShellCommand(WSMAN_COMMAND* commandHandle, uint flags, WSMAN_SHELL_ASYNC* async);
///Connects to an existing server session.
///Params:
/// session = Specifies the session handle returned by a WSManCreateSession function. This parameter cannot be NULL.
/// flags = Reserved for future use. Must be zero.
/// resourceUri = Defines the shell type to which the connection will be made. The shell type is defined by a unique URI, therefore
/// the shell object returned by the call is dependent on the URI that is specified by this parameter. The
/// <i>resourceUri</i> parameter cannot be NULL and it is a null-terminated string.
/// shellID = Specifies the shell identifier that is associated with the server shell session to which the client intends to
/// connect.
/// options = A pointer to a WSMAN_OPTION_SET structure that specifies a set of options for the shell. This parameter is
/// optional.
/// connectXml = A pointer to a WSMAN_DATA structure that defines an open context for the connect shell operation. The content
/// should be a valid XML string. This parameter can be NULL.
/// async = Defines an asynchronous structure that contains an optional user context and a mandatory callback function. See
/// the WSMAN_SHELL_ASYNC structure for more information. This parameter cannot be NULL.
/// shell = Specifies a shell handle that uniquely identifies the shell object that was returned by <i>resourceURI</i>. The
/// resource handle tracks the client endpoint for the shell and is used by other WinRM methods to interact with the
/// shell object. The shell object should be deleted by calling the WSManCloseShell method. This parameter cannot be
/// NULL.
@DllImport("WsmSvc")
void WSManConnectShell(WSMAN_SESSION* session, uint flags, const(PWSTR) resourceUri, const(PWSTR) shellID,
WSMAN_OPTION_SET* options, WSMAN_DATA* connectXml, WSMAN_SHELL_ASYNC* async,
WSMAN_SHELL** shell);
///Connects to an existing command running in a shell.
///Params:
/// shell = Specifies the shell handle returned by the WSManCreateShell call. This parameter cannot be <b>NULL</b>.
/// flags = Reserved for future use. Must be zero.
/// commandID = A null-terminated string that identifies a specific command, currently running in the server session, that the
/// client intends to connect to.
/// options = Defines a set of options for the command. These options are passed to the service to modify or refine the command
/// execution. This parameter can be <b>NULL</b>. For more information about the options, see WSMAN_OPTION_SET.
/// connectXml = A pointer to a WSMAN_DATA structure that defines an open context for the connect shell operation. The content
/// must be a valid XML string. This parameter can be <b>NULL</b>.
/// async = Defines an asynchronous structure to contain an optional user context and a mandatory callback function. For more
/// information, see WSMAN_SHELL_ASYNC. This parameter cannot be <b>NULL</b>.
@DllImport("WsmSvc")
void WSManConnectShellCommand(WSMAN_SHELL* shell, uint flags, const(PWSTR) commandID, WSMAN_OPTION_SET* options,
WSMAN_DATA* connectXml, WSMAN_SHELL_ASYNC* async, WSMAN_COMMAND** command);
///Reports shell and command context back to the Windows Remote Management (WinRM) infrastructure so that further
///operations can be performed against the shell and/or command. This method is called only for WSManPluginShell and
///WSManPluginCommand plug-in entry points.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be set to zero.
/// context = Defines the value to pass into all future shell and command operations. Represents either the shell or the
/// command. This value should be unique for all shells, and it should also be unique for all commands associated
/// with a shell.
@DllImport("WsmSvc")
uint WSManPluginReportContext(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, void* context);
///Reports results for the WSMAN_PLUGIN_RECEIVE plug-in call and is used by most shell plug-ins that return results.
///After all of the data is received, the WSManPluginOperationComplete method must be called.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be set to zero.
/// stream = Specifies the stream that the data is associated with. Any stream can be used, but the standard streams are
/// STDIN, STDOUT, and STDERR.
/// streamResult = A pointer to a WSMAN_DATA structure that specifies the result object that is returned to the client. The result
/// can be in either binary or XML format.
/// commandState = Specifies the state of the command. This parameter must be set either to one of the following values or to a
/// value defined by the plug-in.
@DllImport("WsmSvc")
uint WSManPluginReceiveResult(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, const(PWSTR) stream,
WSMAN_DATA* streamResult, const(PWSTR) commandState, uint exitCode);
///Reports the completion of an operation by all operation entry points except for the WSManPluginStartup and
///WSManPluginShutdown methods.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Reserved for future use. Must be zero.
/// errorCode = Reports any failure in the operation. If this parameter is not <b>NO_ERROR</b>, any result data that has not been
/// sent will be discarded and the error will be sent.
/// extendedInformation = Specifies an XML document that contains any extra error information that needs to be reported to the client. This
/// parameter is ignored if <i>errorCode</i> is <b>NO_ERROR</b>. The user interface language of the thread should be
/// used for localization.
///Returns:
/// The method returns <b>NO_ERROR</b> if it succeeded; otherwise, it returns an error code. If the operation is
/// unsuccessful, the plug-in must stop the current operation and clean up any data associated with this operation.
/// The <i>requestDetails</i> structure is not valid if an error is received and must not be passed to any other
/// WinRM (WinRM) method.
///
@DllImport("WsmSvc")
uint WSManPluginOperationComplete(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, uint errorCode,
const(PWSTR) extendedInformation);
///Gets operational information for items such as time-outs and data restrictions that are associated with the
///operation. A plug-in should not use these parameters for anything other than informational purposes.
///Params:
/// requestDetails = A pointer to a WSMAN_PLUGIN_REQUEST structure that specifies the resource URI, options, locale, shutdown flag,
/// and handle for the request.
/// flags = Specifies the options that are available for retrieval. This parameter must be set to either one of the following
/// values or to a value defined by the plug-in.
/// data = A pointer to a WSMAN_DATA structure that specifies the result object.
@DllImport("WsmSvc")
uint WSManPluginGetOperationParameters(WSMAN_PLUGIN_REQUEST* requestDetails, uint flags, WSMAN_DATA* data);
@DllImport("WsmSvc")
uint WSManPluginGetConfiguration(void* pluginContext, uint flags, WSMAN_DATA* data);
@DllImport("WsmSvc")
uint WSManPluginReportCompletion(void* pluginContext, uint flags);
///Releases memory that is allocated for the WSMAN_PLUGIN_REQUEST structure, which is passed into operation plug-in
///entry points. This method is optional and can be called at any point after a plug-in entry point is called and before
///the entry point calls the WSManPluginOperationComplete method. After this method is called, the memory will be
///released and the plug-in will be unable to access any of the parameters in the WSMAN_PLUGIN_REQUEST structure.
@DllImport("WsmSvc")
uint WSManPluginFreeRequestDetails(WSMAN_PLUGIN_REQUEST* requestDetails);
///Called from the WSManPluginAuthzUser plug-in entry point and reports either a successful or failed user connection
///authorization.
///Params:
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that was passed into the WSManPluginAuthzUser plug-in call.
/// flags = Reserved for future use. Must be set to zero.
/// userAuthorizationContext = Specifies a plug-in defined context that is used to help track user context information. This context can be
/// returned to multiple calls, to this call, or to an operation call. The plug-in manages reference counting for all
/// calls. If the user record times out or re-authorization is required, the WinRM infrastructure calls
/// WSManPluginAuthzReleaseContext.
/// impersonationToken = Specifies the identity of the user. This parameter is the <i>clientToken</i> that was passed into
/// <i>senderDetails</i>. If the plug-in changes the user context, a new impersonation token should be returned. <div
/// class="alert"><b>Note</b> This token is released after the operation has been completed.</div> <div> </div>
/// userIsAdministrator = Set to <b>TRUE</b> if the user is an administrator. Otherwise, this parameter is <b>FALSE</b>.
/// errorCode = Reports either a successful or failed authorization. If the authorization is successful, the code should be
/// <b>ERROR_SUCCESS</b>. If the user is not authorized to perform the operation, the error should be
/// <b>ERROR_ACCESS_DENIED</b>. If a failure happens for any other reason, an appropriate error code should be used.
/// Any error from this call will be sent back as a SOAP fault packet.
/// extendedErrorInformation = Specifies an XML document that contains any extra error information that needs to be reported to the client. This
/// parameter is ignored if <i>errorCode</i> is <b>NO_ERROR</b>. The user interface language of the thread should be
/// used for localization.
///Returns:
/// The method returns <b>ERROR_SUCCESS</b> if it succeeded; otherwise, it returns <b>ERROR_INVALID_PARAMETER</b>. If
/// <b>ERROR_INVALID_PARAMETER</b> is returned, either the <i>senderDetails</i> parameter was <b>NULL</b> or the
/// <i>flags</i> parameter was not zero.
///
@DllImport("WsmSvc")
uint WSManPluginAuthzUserComplete(WSMAN_SENDER_DETAILS* senderDetails, uint flags, void* userAuthorizationContext,
HANDLE impersonationToken, BOOL userIsAdministrator, uint errorCode,
const(PWSTR) extendedErrorInformation);
///Called from the WSManPluginAuthzOperation plug-in entry point. It reports either a successful or failed authorization
///for a user operation.
///Params:
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that was passed into the WSManPluginAuthzOperation plug-in call.
/// flags = Reserved for future use. Must be zero.
/// userAuthorizationContext = Specifies a plug-in defined context that is used to help track user context information. This context can be
/// returned to multiple calls, to this call, or to an operation call. The plug-in manages reference counting for all
/// calls. If the user record times out or re-authorization is required, the WinRM (WinRM) infrastructure calls
/// WSManPluginAuthzReleaseContext.
/// errorCode = Reports either a successful or failed authorization. If the authorization is successful, the code should be
/// <b>ERROR_SUCCESS</b>. If the user is not authorized to perform the operation, the error should be
/// <b>ERROR_ACCESS_DENIED</b>. If a failure happens for any other reason, an appropriate error code should be used.
/// Any error from this call will be sent back as a Simple Object Access Protocol (SOAP) fault packet.
/// extendedErrorInformation = Specifies an XML document that contains any extra error information that needs to be reported to the client. This
/// parameter is ignored if <i>errorCode</i> is <b>NO_ERROR</b>. The user interface language of the thread should be
/// used for localization.
@DllImport("WsmSvc")
uint WSManPluginAuthzOperationComplete(WSMAN_SENDER_DETAILS* senderDetails, uint flags,
void* userAuthorizationContext, uint errorCode,
const(PWSTR) extendedErrorInformation);
///Called from the WSManPluginAuthzQueryQuota plug-in entry point and must be called whether or not the plug-in can
///carry out the request.
///Params:
/// senderDetails = A pointer to the WSMAN_SENDER_DETAILS structure that was passed into the WSManPluginAuthzQueryQuota plug-in call.
/// flags = Reserved for future use. Must be zero.
/// quota = A pointer to a WSMAN_AUTHZ_QUOTA structure that specifies quota information for a specific user.
/// errorCode = Reports either a successful or failed authorization. If the authorization is successful, the code should be
/// <b>ERROR_SUCCESS</b>. If a failure happens for any other reason, an appropriate error code should be used. Any
/// error from this call will be sent back as a Simple Object Access Protocol (SOAP) fault packet.
/// extendedErrorInformation = Specifies an XML document that contains any extra error information that needs to be reported to the client. This
/// parameter is ignored if <i>errorCode</i> is <b>NO_ERROR</b>. The user interface language of the thread should be
/// used for localization.
///Returns:
/// The method returns <b>ERROR_SUCCESS</b> if it succeeded; otherwise, it returns <b>ERROR_INVALID_PARAMETER</b>. If
/// <b>ERROR_INVALID_PARAMETER</b> is returned, either the <i>senderDetails</i> parameter was <b>NULL</b> or the
/// <i>flags</i> parameter was not zero. If the method fails, the default quota is used.
///
@DllImport("WsmSvc")
uint WSManPluginAuthzQueryQuotaComplete(WSMAN_SENDER_DETAILS* senderDetails, uint flags, WSMAN_AUTHZ_QUOTA* quota,
uint errorCode, const(PWSTR) extendedErrorInformation);
// Interfaces
@GUID("BCED617B-EC03-420B-8508-977DC7A686BD")
struct WSMan;
@GUID("7DE087A5-5DCB-4DF7-BB12-0924AD8FBD9A")
struct WSManInternal;
///Provides methods and properties used to create a session, represented by a Session object. Any Windows Remote
///Management operations require creation of a Session that connects to a remote computer, base management controller
///(BMC), or the local computer. Operations include getting, writing, or enumerating data, or invoking methods.
@GUID("190D8637-5CD3-496D-AD24-69636BB5A3B5")
interface IWSMan : IDispatch
{
///Creates a Session object that can then be used for subsequent network operations.
///Params:
/// connection = The protocol and service to connect to, including either IPv4 or IPv6. The format of the connection
/// information is as follows: <<i>Transport</i>><<i>Address</i>><<i>Suffix</i>>. For examples,
/// see Remarks. If no connection information is provided, the local computer is used.
/// flags = The session flags that specify the authentication method, such as Negotiate authentication or Digest
/// authentication, for connecting to a remote computer. These flags also specify other session connection
/// information, such as encoding or encryption. This parameter must contain one or more of the flags in
/// <b>__WSManSessionFlags</b> for a remote connection. For more information, see Session Constants. No flag
/// settings are required for a connection to the WinRM service on the local computer. If no authentication flags
/// are specified, Kerberos is used unless one of the following conditions is true, in which case Negotiate is
/// used: <ul> <li>explicit credentials are supplied and the destination host is trusted</li> <li>the destination
/// host is "localhost", "127.0.0.1" or "[::1]"</li> <li>the client computer is in a workgroup and the
/// destination host is trusted</li> </ul> For more information, see Authentication for Remote Connections and
/// the <i>connectionOptions</i> parameter.
/// connectionOptions = A pointer to an IWSManConnectionOptions object that contains a user name and password. The default is
/// <b>NULL</b>.
/// session = A pointer to a new IWSManSession object.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT CreateSession(BSTR connection, int flags, IDispatch connectionOptions, IDispatch* session);
///Creates an IWSManConnectionOptions object that specifies the user name and password used when creating a session.
///Params:
/// connectionOptions = A pointer to a new IWSManConnectionOptions object.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT CreateConnectionOptions(IDispatch* connectionOptions);
///Gets the command line of the process that loads the automation component. This property is read-only.
HRESULT get_CommandLine(BSTR* value);
///Gets additional error information, in an XML stream, for the preceding call to an IWSMan method if Windows Remote
///Management service was unable to create an IWSManSession object, an IWSManConnectionOptions object, or an
///IWSManResourceLocator object. This property is read-only.
HRESULT get_Error(BSTR* value);
}
///Extends the methods and properties of the IWSMan interface to include creating IWSManResourceLocator objects, methods
///that return enumeration and session flag values, and a method to get extended error information.
@GUID("2D53BDAA-798E-49E6-A1AA-74D01256F411")
interface IWSManEx : IWSMan
{
///Creates a ResourceLocator object that can be used instead of a resource URI in Session object operations such as
///IWSManSession.Get, IWSManSession.Put, or Session.Enumerate.
///Params:
/// strResourceLocator = The resource URI for the resource. For more information about URI strings, see Resource URIs.
/// newResourceLocator = A pointer to a new instance of IWSManResourceLocator.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT CreateResourceLocator(BSTR strResourceLocator, IDispatch* newResourceLocator);
///The WSMan.SessionFlagUTF8 method returns the value of the authentication flag <b>WSManFlagUTF8</b> for use in the
///<i>flags</i> parameter of IWSMan::CreateSession. <b>WSManFlagUTF8</b> is a constant in the
///<b>__WSManSessionFlags</b> enumeration. For more information, see Other Session Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUTF8(int* flags);
///The <b>IWSMan.SessionFlagCredUsernamePassword</b> method returns the value of the authentication flag
///<b>WSManFlagCredUsernamePassword</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagCredUsernamePassword</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more
///information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagCredUsernamePassword(int* flags);
///The WSMan.SessionFlagSkipCACheck method returns the value of the <b>WSManFlagSkipCACheck</b> authentication flag
///for use in the <i>flags</i> parameter of the IWSMan::CreateSession method. <b>WSManFlagSkipCACheck</b> is a
///constant in the <b>__WSManSessionFlags</b> enumeration. For more information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagSkipCACheck(int* flags);
///The WSMan.SessionFlagSkipCNCheck method returns the value of the authentication flag <b>WSManFlagSkipCNCheck</b>
///for use in the <i>flags</i> parameter of IWSMan::CreateSession. <b>WSManFlagSkipCNCheck</b> is a constant in the
///<b>__WSManSessionFlags</b> enumeration. For more information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagSkipCNCheck(int* flags);
///The WSMan.SessionFlagUseDigest method returns the value of the authentication flag <b>WSManFlagUseDigest</b> for
///use in the <i>flags</i> parameter of IWSMan::CreateSession. <b>WSManFlagUseDigest</b> is a constant in the
///<b>__WSManSessionFlags</b> enumeration. For more information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUseDigest(int* flags);
///The WSMan.SessionFlagUseNegotiate method returns the value of the authentication flag
///<b>WSManFlagUseNegotiate</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagUseNegotiate</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more information,
///see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUseNegotiate(int* flags);
///The WSMan.SessionFlagUseBasic method returns the value of the authentication flag <b>WSManFlagUseBasic</b> for
///use in the <i>flags</i> parameter of IWSMan::CreateSession. <b>WSManFlagUseBasic</b> is a constant in the
///<b>__WSManSessionFlags</b> enumeration. For more information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUseBasic(int* flags);
///The WSMan.WSMan.SessionFlagUseKerberos method returns the value of the authentication flag
///<b>WSManFlagUseKerberos</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagUseKerberos</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more information,
///see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUseKerberos(int* flags);
///The WSMan.SessionFlagNoEncryption method returns the value of the authentication flag
///<b>WSManFlagNoEncryption</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagNoEncryption</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more information,
///see Other Session Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagNoEncryption(int* flags);
///The WSMan.SessionFlagEnableSPNServerPort method returns the value of the authentication flag
///<b>WSManFlagEnableSPNServerPort</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagEnableSPNServerPort</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more
///information, see Other Session Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagEnableSPNServerPort(int* flags);
///The WSMan.SessionFlagUseNoAuthentication method returns the value of the authentication flag
///<b>WSManFlagUseNoAuthentication</b> for use in the <i>flags</i> parameter of IWSMan::CreateSession.
///<b>WSManFlagUseNoAuthentication</b> is a constant in the <b>__WSManSessionFlags</b> enumeration. For more
///information, see Authentication Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SessionFlagUseNoAuthentication(int* flags);
///The <b>IWSManEx::EnumerationFlagNonXmlText</b> method returns the value of the enumeration constant
///<b>WSManFlagNonXmlText</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate method.
///<b>WSManFlagNonXmlText</b> is a constant in the <b>__WSManEnumFlags</b> enumeration. For more information, see
///Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagNonXmlText(int* flags);
///The <b>IWSManEx::EnumerationFlagReturnEPR</b> method returns the value of the enumeration constant
///<b>EnumerationFlagReturnEPR</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate method.
///<b>EnumerationFlagReturnEPR</b> is a constant in the <b>_WSManEnumFlags</b> enumeration and is described in
///Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagReturnEPR(int* flags);
///The <b>IWSManEx::EnumerationFlagReturnObjectAndEPR</b> method returns the value of the enumeration constant
///<b>EnumerationFlagReturnObjectAndEPR</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate
///method. <b>EnumerationFlagReturnObjectAndEPR</b> is a constant in the <b>_WSManEnumFlags</b> enumeration and is
///described in Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagReturnObjectAndEPR(int* flags);
///Returns a formatted string containing the text of an error number. This method performs the same operation as the
///<b>Winrm</b> command-line <b>winrm helpmsg </b><i>error number</i>.
///Params:
/// errorNumber = Error message number in decimal or hexadecimal from WinRM, WinHTTP, or other operating system components.
/// errorMessage = Error message string formatted like messages returned from the <b>Winrm</b> command.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT GetErrorMessage(uint errorNumber, BSTR* errorMessage);
///The <b>IWSManEx::EnumerationFlagHierarchyDeep</b> method returns the value of the enumeration constant
///<b>EnumerationFlagHierarchyDeep</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate method.
///<b>EnumerationFlagHierarchyDeep</b> is a constant in the <b>_WSManEnumFlags</b> enumeration and is described in
///Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagHierarchyDeep(int* flags);
///The <b>IWSManEx::EnumerationFlagHierarchyShallow</b> method returns the value of the enumeration constant
///<b>EnumerationFlagHierarchyShallow</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate
///method. <b>EnumerationFlagHierarchyShallow</b> is a constant in the <b>_WSManEnumFlags</b> enumeration and is
///described in Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagHierarchyShallow(int* flags);
///The <b>IWSManEx::EnumerationFlagHierarchyDeepBasePropsOnly</b> method returns the value of the enumeration
///constant <b>EnumerationFlagHierarchyDeepBasePropsOnly</b> for use in the <i>flags</i> parameter of the
///IWSManSession::Enumerate method. <b>EnumerationFlagHierarchyDeepBasePropsOnly</b> is a constant in the
///<b>_WSManEnumFlags</b> enumeration and is described in Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagHierarchyDeepBasePropsOnly(int* flags);
///The <b>IWSManEx::EnumerationFlagReturnObject</b> method returns the value of the enumeration constant
///<b>EnumerationFlagReturnObject</b> for use in the <i>flags</i> parameter of the IWSManSession::Enumerate method.
///<b>EnumerationFlagReturnObject</b> is a constant in the <b>_WSManEnumFlags</b> enumeration and is described in
///Enumeration Constants.
///Params:
/// flags = The value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT EnumerationFlagReturnObject(int* flags);
}
///Extends the methods and properties of the IWSManEx interface to include a method that returns a session flag value
///related to authentication using client certificates.
@GUID("1D1B5AE0-42D9-4021-8261-3987619512E9")
interface IWSManEx2 : IWSManEx
{
///Returns the value of the authentication flag <b>WSManFlagUseClientCertificate</b> for use in the <i>flags</i>
///parameter of IWSMan::CreateSession. <b>WSManFlagUseClientCertificate</b> is a constant in the
///<b>__WSManSessionFlags</b> enumeration. For more information, see Authentication Constants.
///Params:
/// flags = The session flags to use.
HRESULT SessionFlagUseClientCertificate(int* flags);
}
///Extends the methods and properties of the IWSManEx interface to include a method that returns a session flag value
///related to authentication using the Credential Security Support Provider (CredSSP).
@GUID("6400E966-011D-4EAC-8474-049E0848AFAD")
interface IWSManEx3 : IWSManEx2
{
HRESULT SessionFlagUTF16(int* flags);
///Returns the value of the authentication flag <b>WSManFlagUseCredSsp</b> for use in the <i>flags</i> parameter of
///IWSMan::CreateSession. <b>WSManFlagUseCredSsp</b> is a constant in the <b>__WSManSessionFlags</b> enumeration.
///For more information, see Authentication Constants.
///Params:
/// flags = Specifies the authentication flag to use.
///Returns:
/// If the method succeeds, it returns the authentication flag. Otherwise, it returns an HRESULT error code.
///
HRESULT SessionFlagUseCredSsp(int* flags);
HRESULT EnumerationFlagAssociationInstance(int* flags);
HRESULT EnumerationFlagAssociatedInstance(int* flags);
HRESULT SessionFlagSkipRevocationCheck(int* flags);
HRESULT SessionFlagAllowNegotiateImplicitCredentials(int* flags);
HRESULT SessionFlagUseSsl(int* flags);
}
///The <b>IWSManConnectionOptions</b> object is passed to the IWSMan::CreateSession method to provide the user name and
///password associated with the local account on the remote computer. If no parameters are supplied, then the
///credentials of the account running the script are the default values.
@GUID("F704E861-9E52-464F-B786-DA5EB2320FDD")
interface IWSManConnectionOptions : IDispatch
{
///Sets and gets the user name of a local or a domain account on the remote computer. This property determines the
///user name for authentication. If no value is supplied and the <b>WSManFlagCredUsernamePassword</b> flag is not
///set, then the user name of the account that is running the script is used. If the
///<b>WSManFlagCredUsernamePassword</b> flag is set but no user name is specified, the script prompts the user to
///enter the user name and password. If no user name and password are entered then an access denied error is
///returned. For more information, see Authentication for Remote Connections. This property is read/write.
HRESULT get_UserName(BSTR* name);
///Sets and gets the user name of a local or a domain account on the remote computer. This property determines the
///user name for authentication. If no value is supplied and the <b>WSManFlagCredUsernamePassword</b> flag is not
///set, then the user name of the account that is running the script is used. If the
///<b>WSManFlagCredUsernamePassword</b> flag is set but no user name is specified, the script prompts the user to
///enter the user name and password. If no user name and password are entered then an access denied error is
///returned. For more information, see Authentication for Remote Connections. This property is read/write.
HRESULT put_UserName(BSTR name);
///Sets the password of a local or a domain account on the remote computer. For more information, see Authentication
///for Remote Connections. This property is write-only.
HRESULT put_Password(BSTR password);
}
///The <b>IWSManConnectionOptionsEx</b> object is passed to the IWSMan::CreateSession method to provide the thumbprint
///of the client certificate used for authentication.
@GUID("EF43EDF7-2A48-4D93-9526-8BD6AB6D4A6B")
interface IWSManConnectionOptionsEx : IWSManConnectionOptions
{
///Sets or gets the certificate thumbprint to use when authenticating by using client certificate authentication.
///This property is read/write.
HRESULT get_CertificateThumbprint(BSTR* thumbprint);
///Sets or gets the certificate thumbprint to use when authenticating by using client certificate authentication.
///This property is read/write.
HRESULT put_CertificateThumbprint(BSTR thumbprint);
}
///The <b>IWSManConnectionOptionsEx2</b> object is passed to the IWSMan::CreateSession method to provide the
///authentication mechanism, access type, and credentials to connect to a proxy server.
@GUID("F500C9EC-24EE-48AB-B38D-FC9A164C658E")
interface IWSManConnectionOptionsEx2 : IWSManConnectionOptionsEx
{
///Sets the proxy information for the session.
///Params:
/// accessType = Specifies the proxy access type. This parameter must be set to one of the values in the
/// WSManProxyAccessTypeFlags enumeration. The default value is <b>WSManProxyWinHttpConfig</b>.
/// authenticationMechanism = Specifies the authentication mechanism to use for the proxy. This parameter is optional and the default value
/// is 0. If this parameter is set to 0, the WinRM client chooses either Kerberos or Negotiate. Otherwise, this
/// parameter must be set to one of the values in the WSManProxyAuthenticationFlags enumeration. The default
/// value from the enumeration is <b>WSManFlagProxyAuthenticationUseNegotiate</b>.
/// userName = Specifies the user name for proxy authentication. This parameter is optional. If a value is not specified for
/// this parameter, the default credentials are used.
/// password = Specifies the password for proxy authentication. This parameter is optional. If a value is not specified for
/// this parameter, the default credentials are used.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT SetProxy(int accessType, int authenticationMechanism, BSTR userName, BSTR password);
///Returns the value of the proxy access type flag <b>WSManProxyIEConfig</b> for use in the <i>accessType</i>
///parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyIEConfig(int* value);
///Returns the value of the proxy access type flag <b>WSManProxyWinHttpConfig</b> for use in the <i>accessType</i>
///parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyWinHttpConfig(int* value);
///Returns the value of the proxy access type flag <b>WSManProxyAutoDetect</b> for use in the <i>accessType</i>
///parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyAutoDetect(int* value);
///Returns the value of the proxy access type flag <b>WSManProxyNoProxyServer</b> for use in the <i>accessType</i>
///parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyNoProxyServer(int* value);
///Returns the value of the proxy authentication flag <b>WSManFlagProxyAuthenticationUseNegotiate</b> for use in the
///<i>authenticationMechanism</i> parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyAuthenticationUseNegotiate(int* value);
///Returns the value of the proxy authentication flag <b>WSManFlagProxyAuthenticationUseBasic</b> for use in the
///<i>authenticationMechanism</i> parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyAuthenticationUseBasic(int* value);
///Returns the value of the proxy authentication flag <b>WSManFlagProxyAuthenticationUseDigest</b> for use in the
///<i>authenticationMechanism</i> parameter of the IWSManConnectionOptionsEx2::SetProxy method.
///Params:
/// value = Specifies the value of the constant.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ProxyAuthenticationUseDigest(int* value);
}
///Defines operations and session settings. Any Windows Remote Management operations require creation of an
///<b>IWSManSession</b> object that connects to a remote computer, base management controller (BMC), or the local
///computer. WinRM network operations include getting, writing, enumerating data, or invoking methods. The methods of
///the <b>IWSManSession</b> object mirror the basic operations defined in the WS-Management protocol.
@GUID("FC84FC58-1286-40C4-9DA0-C8EF6EC241E0")
interface IWSManSession : IDispatch
{
///Retrieves the resource specified by the URI and returns an XML representation of the current instance of the
///resource.
///Params:
/// resourceUri = The identifier of the resource to be retrieved. This parameter can contain one of the following: <ul> <li>URI
/// with or without selectors. When calling the Get method to obtain a WMI resource, use the key property or
/// properties of the object.</li> <li> ResourceLocator object which may contain selectors, fragments, or
/// options.</li> <li>WS-Addressing endpoint reference as described in the WS-Management protocol standard. For
/// more information about the public specification for the WS-Management protocol, see Management Specifications
/// Index Page.</li> </ul>
/// flags = Reserved for future use. Must be set to 0.
/// resource = A value that, upon success, is an XML representation of the resource.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Get(VARIANT resourceUri, int flags, BSTR* resource);
///Updates a resource.
///Params:
/// resourceUri = The identifier of the resource to be updated. This parameter can contain one of the following: <ul> <li>URI
/// with or without selectors. When calling the <b>Put</b> method to obtain a WMI resource, use the key property
/// or properties of the object.</li> <li> ResourceLocator object which may contain selectors, fragments, or
/// options.</li> <li>WS-Addressing endpoint reference as described in the WS-Management protocol standard. For
/// more information about the public specification for the WS-Management protocol, see Management Specifications
/// Index Page.</li> </ul>
/// resource = The updated resource content.
/// flags = Reserved for future use. Must be set to 0.
/// resultResource = The XML stream that contains the updated resource content.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Put(VARIANT resourceUri, BSTR resource, int flags, BSTR* resultResource);
///Creates a new instance of a resource and returns the endpoint reference (EPR) of the new object.
///Params:
/// resourceUri = The identifier of the resource to create. This parameter can contain one of the following: <ul> <li>URI with
/// one or more selectors. Be aware that the WMI plug-in does not support creating any resource other than a
/// WS-Management protocol listener.</li> <li> ResourceLocator object which may contain selectors, fragments, or
/// options.</li> <li>WS-Addressing endpoint reference as described in the WS-Management protocol standard. For
/// more information about the public specification for the WS-Management protocol, see Management Specifications
/// Index Page.</li> </ul>
/// resource = An XML string that contains resource content.
/// flags = Reserved. Must be set to 0.
/// newUri = The EPR of the new resource.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Create(VARIANT resourceUri, BSTR resource, int flags, BSTR* newUri);
///Deletes the resource specified in the resource URI.
///Params:
/// resourceUri = The URI of the resource to be deleted. You can also use an IWSManResourceLocator object to specify the
/// resource.
/// flags = Reserved for future use. Must be set to 0.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Delete(VARIANT resourceUri, int flags);
///Invokes a method and returns the results of the method call.
///Params:
/// actionUri = The URI of the method to invoke.
/// resourceUri = The identifier of the resource to invoke a method. This parameter can contain one of the following: <ul>
/// <li>URI with or without selectors.</li> <li> ResourceLocator object which may contain selectors, fragments,
/// or options.</li> <li>WS-Addressing endpoint reference as described in the WS-Management protocol standard.
/// For more information about the public specification for the WS-Management protocol, see Management
/// Specifications Index Page.</li> </ul>
/// parameters = An XML representation of the input for the method. This string must be supplied or this method will fail.
/// flags = Reserved for future use. Must be set to 0.
/// result = An XML representation of the method output.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Invoke(BSTR actionUri, VARIANT resourceUri, BSTR parameters, int flags, BSTR* result);
///Enumerates a table, data collection, or log resource. To create a query, include a <i>filter</i> parameter and a
///<i>dialect</i> parameter in an enumeration. You can also use an IWSManResourceLocator object to create queries.
///For more information, see Enumerating or Listing All the Instances of a Resource.
///Params:
/// resourceUri = The identifier of the resource to be retrieved. The following list contains identifiers that this parameter
/// can contain: <ul> <li>URI with one or more selectors. When calling the <b>Enumerate</b> method to obtain a
/// WMI resource, use the key property or properties of the object.</li> <li>You can use selectors, fragments, or
/// options. For more information, see IWSManResourceLocator.</li> <li>WS-Addressing endpoint reference as
/// described in the WS-Management protocol standard. For more information about the public specification for the
/// WS-Management protocol, see the Management Specifications Index Page.</li> </ul>
/// filter = A filter that defines what items in the resource are returned by the enumeration. When the resource is
/// enumerated, only those items that match the filter criteria are returned. Including a <i>filter</i> parameter
/// and a <i>dialect</i> parameter in an enumeration converts the enumeration into a query. If you have an
/// IWSManResourceLocator object for the <i>resourceURI</i> parameter, then this parameter should not be used.
/// Instead, use the selector and fragment functionality of <b>IWSManResourceLocator</b>.
/// dialect = The language used by the filter. WQL, a subset of SQL used by WMI, is the only language supported. If you
/// have a IWSManResourceLocator object for the <i>resourceURI</i> parameter, then this parameter should not be
/// used. Instead, use the selector and fragment functionality of <b>IWSManResourceLocator</b>.
/// flags = This parameter must contain a flag in the <b>__WSManEnumFlags</b> enumeration. For more information, see
/// Enumeration Constants.
/// resultSet = An IWSManEnumerator object that contains the results of the enumeration.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Enumerate(VARIANT resourceUri, BSTR filter, BSTR dialect, int flags, IDispatch* resultSet);
///The <b>IWSManSession::Identify</b> method queries a remote computer to determine if it supports the WS-Management
///protocol. For more information, see Detecting Whether a Remote Computer Supports WS-Management Protocol.
///Params:
/// flags = The only flag that is accepted is <b>WSManFlagUseNoAuthentication</b>.
/// result = A value that, upon success, is an XML string that specifies the WS-Management protocol version, the operating
/// system vendor and, if the request was sent authenticated, the operating system version.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT Identify(int flags, BSTR* result);
///Gets additional error information in an XML stream for the preceding call to an IWSManSession object method. This
///property is read-only.
HRESULT get_Error(BSTR* value);
///Sets and gets the number of items in each enumeration batch. This value cannot be changed during an enumeration.
///The resource provider may set a limit. This property is read/write.
HRESULT get_BatchItems(int* value);
///Sets and gets the number of items in each enumeration batch. This value cannot be changed during an enumeration.
///The resource provider may set a limit. This property is read/write.
HRESULT put_BatchItems(int value);
///Sets and gets the maximum amount of time, in milliseconds, that the client application waits for Windows Remote
///Management to complete its operations. This property is read/write.
HRESULT get_Timeout(int* value);
///Sets and gets the maximum amount of time, in milliseconds, that the client application waits for Windows Remote
///Management to complete its operations. This property is read/write.
HRESULT put_Timeout(int value);
}
///Represents a stream of results returned from operations such as a WS-Management protocol WS-Enumeration:Enumerate
///operation.
@GUID("F3457CA9-ABB9-4FA5-B850-90E8CA300E7F")
interface IWSManEnumerator : IDispatch
{
///Retrieves an item from the resource and returns an XML representation of the item.
///Params:
/// resource = The XML representation of the item.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ReadItem(BSTR* resource);
///Indicates that the end of items in the IWSManEnumerator object has been reached by calls to
///IWSManEnumerator::ReadItem. This property is read-only.
HRESULT get_AtEndOfStream(short* eos);
///Gets an XML representation of additional error information. This property is read-only.
HRESULT get_Error(BSTR* value);
}
///Supplies the path to a resource. You can use an <b>IWSManResourceLocator</b> object instead of a resource URI in
///IWSManSession object operations such as IWSManSession.Get, IWSManSession.Put, or IWSManSession.Enumerate.
@GUID("A7A1BA28-DE41-466A-AD0A-C4059EAD7428")
interface IWSManResourceLocator : IDispatch
{
///The resource URI of the requested resource. This property can contain only the path, not a query string for
///specific instances. This property is read/write.
HRESULT put_ResourceURI(BSTR uri);
///The resource URI of the requested resource. This property can contain only the path, not a query string for
///specific instances. This property is read/write.
HRESULT get_ResourceURI(BSTR* uri);
///Adds a selector to the ResourceLocator object. The selector specifies a particular instance of a <i>resource</i>.
///You can provide an IWSManResourceLocator object instead of specifying a resource URI in IWSManSession object
///operations such as Get, Put, or Enumerate.
///Params:
/// resourceSelName = The selector name. For example, when requesting WMI data, this parameter is the key property for a WMI class.
/// selValue = The selector value. For example, for WMI data, this parameter contains a value for a key property that
/// identifies a specific instance.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT AddSelector(BSTR resourceSelName, VARIANT selValue);
///Removes all the selectors from a ResourceLocator object. You can provide a ResourceLocator object instead of
///specifying a resource URI in IWSManSession object operations such as Get, Put, or Enumerate.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ClearSelectors();
///Gets or sets the path for a resource fragment or property when ResourceLocator is used in IWSManSession object
///methods such as Get, Put, or Enumerate. A fragment represents one property or part of a resource. You can provide
///an IWSManResourceLocator object instead of specifying a resource URI in IWSManSession object operations. This
///property is read/write.
HRESULT get_FragmentPath(BSTR* text);
///Gets or sets the path for a resource fragment or property when ResourceLocator is used in IWSManSession object
///methods such as Get, Put, or Enumerate. A fragment represents one property or part of a resource. You can provide
///an IWSManResourceLocator object instead of specifying a resource URI in IWSManSession object operations. This
///property is read/write.
HRESULT put_FragmentPath(BSTR text);
///Gets or sets the language dialect for a resource fragment <i>dialect</i> when IWSManResourceLocator is used in
///IWSManSession object methods such as Get, Put, or Enumerate. A fragment represents one property or part of a
///resource. You can provide an IWSManResourceLocator object instead of specifying a resource URI in IWSManSession
///object operations. This property is read/write.
HRESULT get_FragmentDialect(BSTR* text);
///Gets or sets the language dialect for a resource fragment <i>dialect</i> when IWSManResourceLocator is used in
///IWSManSession object methods such as Get, Put, or Enumerate. A fragment represents one property or part of a
///resource. You can provide an IWSManResourceLocator object instead of specifying a resource URI in IWSManSession
///object operations. This property is read/write.
HRESULT put_FragmentDialect(BSTR text);
///Adds data required to process the request. For example, some WMI providers may require an IWbemContext or
///SWbemNamedValueSet object with provider-specific information. You can provide a ResourceLocator object instead of
///specifying a resource URI in IWSManSession object operations such as Get, Put, or Enumerate.
///Params:
/// OptionName = The name of the optional data object.
/// OptionValue = A value supplied for the optional data object.
/// mustComply = A flag that indicates the option must be processed. The default is <b>False</b> (0).
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT AddOption(BSTR OptionName, VARIANT OptionValue, BOOL mustComply);
///Gets or sets the <b>MustUnderstandOptions</b> value for the ResourceLocator object. You can provide an
///IWSManResourceLocator object instead of specifying a resource URI in IWSManSession object operations such as Get,
///Put, or Enumerate. This property is read/write.
HRESULT put_MustUnderstandOptions(BOOL mustUnderstand);
///Gets or sets the <b>MustUnderstandOptions</b> value for the ResourceLocator object. You can provide an
///IWSManResourceLocator object instead of specifying a resource URI in IWSManSession object operations such as Get,
///Put, or Enumerate. This property is read/write.
HRESULT get_MustUnderstandOptions(BOOL* mustUnderstand);
///Removes any options from the ResourceLocator object. You can provide a ResourceLocator object instead of
///specifying a resource URI in IWSManSession object operations such as Get, Put, or Enumerate.
///Returns:
/// If this method succeeds, it returns <b xmlns:loc="http://microsoft.com/wdcml/l10n">S_OK</b>. Otherwise, it
/// returns an <b xmlns:loc="http://microsoft.com/wdcml/l10n">HRESULT</b> error code.
///
HRESULT ClearOptions();
///Gets an XML representation of additional error information. This property is read-only.
HRESULT get_Error(BSTR* value);
}
@GUID("EFFAEAD7-7EC8-4716-B9BE-F2E7E9FB4ADB")
interface IWSManResourceLocatorInternal : IUnknown
{
}
@GUID("04AE2B1D-9954-4D99-94A9-A961E72C3A13")
interface IWSManInternal : IDispatch
{
HRESULT ConfigSDDL(IDispatch session, VARIANT resourceUri, int flags, BSTR* resource);
}
// GUIDs
const GUID CLSID_WSMan = GUIDOF!WSMan;
const GUID CLSID_WSManInternal = GUIDOF!WSManInternal;
const GUID IID_IWSMan = GUIDOF!IWSMan;
const GUID IID_IWSManConnectionOptions = GUIDOF!IWSManConnectionOptions;
const GUID IID_IWSManConnectionOptionsEx = GUIDOF!IWSManConnectionOptionsEx;
const GUID IID_IWSManConnectionOptionsEx2 = GUIDOF!IWSManConnectionOptionsEx2;
const GUID IID_IWSManEnumerator = GUIDOF!IWSManEnumerator;
const GUID IID_IWSManEx = GUIDOF!IWSManEx;
const GUID IID_IWSManEx2 = GUIDOF!IWSManEx2;
const GUID IID_IWSManEx3 = GUIDOF!IWSManEx3;
const GUID IID_IWSManInternal = GUIDOF!IWSManInternal;
const GUID IID_IWSManResourceLocator = GUIDOF!IWSManResourceLocator;
const GUID IID_IWSManResourceLocatorInternal = GUIDOF!IWSManResourceLocatorInternal;
const GUID IID_IWSManSession = GUIDOF!IWSManSession;
|
D
|
module utils.exception;
import std.conv;
@safe:
class NoTextNumberException:Exception{
this(int num){
string msg="Text Number "~to!string(num)~" not found.";
super(msg);
}
}
class stringToIntException:Exception{
this(string str){
string msg="\""~str~"\" cannot be converted from \'string\' to \'int\'.";
super(msg);
}
this(string str,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'int\' in text "~to!string(text)~".";
super(msg);
}
this(string str,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'int\' in sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
this(string str,int phrase,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'int\' in phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
this(string str,int word,int phrase,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'int\' in word "~to!string(word)~",phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
}
class stringToFloatException:Exception{
this(string str){
string msg="\""~str~"\" cannot be converted from \'string\' to \'float\'.";
super(msg);
}
this(string str,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'float\' in text "~to!string(text)~".";
super(msg);
}
this(string str,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'float\' in sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
this(string str,int phrase,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'float\' in phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
this(string str,int word,int phrase,int sentence,int text){
string msg="\""~str~"\" cannot be converted from \'string\' to \'float\' in word "~to!string(word)~",phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text)~".";
super(msg);
}
}
class ScoreException:Exception{
/*
this(int min,int max,int text){
string cursor="text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(int min,int max,int sentence,int text){
string cursor="sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(int min,int max,int phrase,int sentence,int text){
string cursor="phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(int min,int max,int word,int phrase,int sentence,int text){
string cursor="word "~to!string(word)~",phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
*/
this(float min,float max,int text){
string cursor="text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(float min,float max,int sentence,int text){
string cursor="sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(float min,float max,int phrase,int sentence,int text){
string cursor="phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
this(float min,float max,int word,int phrase,int sentence,int text){
string cursor="word "~to!string(word)~",phrase "~to!string(phrase)~",sentence "~to!string(sentence)~",text "~to!string(text);
super(cursor~": score must be in range "~to!string(min)~" ~ "~to!string(max)~".");
}
}
class ArgumentException:Exception{
this(string reason){
super("Invalid argument: "~reason);
}
}
class NeuronInitializeException:Exception{
this(int input_len,int weight_len,int number,string layer){
super("Number of inputs,"~input_len.to!string~
" is different from number of weights,"~weight_len.to!string~
" in Neuron "~number.to!string~", Layer "~layer);
}
}
class ElementEmptyException:Exception{
private string msg="Element is Empty: ";
this(size_t text){
string cursor="text "~to!string(text);
super(msg~cursor);
}
this(size_t sentence,size_t text){
string cursor="sentence "~to!string(sentence)~
", in text "~to!string(text);
super(msg~cursor);
}
this(size_t phrase,size_t sentence,size_t text){
string cursor="phrase "~to!string(phrase)~
", sentence "~to!string(sentence)~", in text "~to!string(text);
super(msg~cursor);
}
this(size_t word,size_t phrase,size_t sentence,size_t text){
string cursor="word "~to!string(word)~
", phrase "~to!string(phrase)~", sentence "~to!string(sentence)~
", in text "~to!string(text);
super(msg~cursor);
}
}
class NoInputException:Exception{
this(string msg){
super(msg);
}
}
//
//class Termination:Exception{
// private bool failure;
// @property bool isfailure(){return failure;}
// this(string msg,bool failure=false){
// this.failure=failure;
// super(msg);
// }
//}
|
D
|
/// Translated from C to D
module glfw3.wl_init;
extern(C): @nogc: nothrow: __gshared:
private template HasVersion(string versionId) {
mixin("version("~versionId~") {enum HasVersion = true;} else {enum HasVersion = false;}");
}
import core.stdc.config: c_long, c_ulong;
//========================================================================
// GLFW 3.3 Wayland - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2014 Jonas Ådahl <jadahl@gmail.com>
//
// 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.
//
//========================================================================
// It is fine to use C99 in this file because it will not be built with VS
//========================================================================
public import glfw3.internal;
import core.stdc.assert_;
import core.stdc.errno;
import core.stdc.limits;
import glfw3.linuxinput;
import core.stdc.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import core.sys.posix.sys.mman;
import core.sys.linux.timerfd;
import core.sys.posix.unistd;
import xkbcommon.xkbcommon;
//public import wayland-client;
//import wayland.native.util;
pragma(inline, true) extern(D) static int min(int n1, int n2) {
return n1 < n2 ? n1 : n2;
}
static _GLFWwindow* findWindowFromDecorationSurface(wl_surface* surface, int* which) {
int focus;
_GLFWwindow* window = _glfw.windowListHead;
if (!which)
which = &focus;
while (window)
{
if (surface == window.wl.decorations.top.surface)
{
*which = topDecoration;
break;
}
if (surface == window.wl.decorations.left.surface)
{
*which = leftDecoration;
break;
}
if (surface == window.wl.decorations.right.surface)
{
*which = rightDecoration;
break;
}
if (surface == window.wl.decorations.bottom.surface)
{
*which = bottomDecoration;
break;
}
window = window.next;
}
return window;
}
static void pointerHandleEnter(void* data, wl_pointer* pointer, uint serial, wl_surface* surface, wl_fixed_t sx, wl_fixed_t sy) {
// Happens in the case we just destroyed the surface.
if (!surface)
return;
int focus = 0;
_GLFWwindow* window = cast(_GLFWwindow*) wl_surface_get_user_data(surface);
if (!window)
{
window = findWindowFromDecorationSurface(surface, &focus);
if (!window)
return;
}
window.wl.decorations.focus = focus;
_glfw.wl.serial = serial;
_glfw.wl.pointerFocus = window;
window.wl.hovered = GLFW_TRUE;
_glfwPlatformSetCursor(window, window.wl.currentCursor);
_glfwInputCursorEnter(window, GLFW_TRUE);
}
static void pointerHandleLeave(void* data, wl_pointer* pointer, uint serial, wl_surface* surface) {
_GLFWwindow* window = _glfw.wl.pointerFocus;
if (!window)
return;
window.wl.hovered = GLFW_FALSE;
_glfw.wl.serial = serial;
_glfw.wl.pointerFocus = null;
_glfwInputCursorEnter(window, GLFW_FALSE);
_glfw.wl.cursorPreviousName = null;
}
static void setCursor(_GLFWwindow* window, const(char)* name) {
wl_buffer* buffer;
wl_cursor* cursor;
wl_cursor_image* image;
wl_surface* surface = _glfw.wl.cursorSurface;
wl_cursor_theme* theme = _glfw.wl.cursorTheme;
int scale = 1;
if (window.wl.scale > 1 && _glfw.wl.cursorThemeHiDPI)
{
// We only support up to scale=2 for now, since libwayland-cursor
// requires us to load a different theme for each size.
scale = 2;
theme = _glfw.wl.cursorThemeHiDPI;
}
cursor = _glfw.wl.cursor.theme_get_cursor(theme, name);
if (!cursor)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Standard cursor not found");
return;
}
// TODO: handle animated cursors too.
image = cursor.images[0];
if (!image)
return;
buffer = _glfw.wl.cursor.image_get_buffer(image);
if (!buffer)
return;
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
surface,
image.hotspot_x / scale,
image.hotspot_y / scale);
wl_surface_set_buffer_scale(surface, scale);
wl_surface_attach(surface, buffer, 0, 0);
wl_surface_damage(surface, 0, 0,
image.width, image.height);
wl_surface_commit(surface);
_glfw.wl.cursorPreviousName = name;
}
static void pointerHandleMotion(void* data, wl_pointer* pointer, uint time, wl_fixed_t sx, wl_fixed_t sy) {
_GLFWwindow* window = _glfw.wl.pointerFocus;
const(char)* cursorName = null;
double x;double y;
if (!window)
return;
if (window.cursorMode == GLFW_CURSOR_DISABLED)
return;
x = wl_fixed_to_double(sx);
y = wl_fixed_to_double(sy);
switch (window.wl.decorations.focus)
{
case mainWindow:
window.wl.cursorPosX = x;
window.wl.cursorPosY = y;
_glfwInputCursorPos(window, x, y);
_glfw.wl.cursorPreviousName = null;
return;
case topDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "n-resize";
else
cursorName = "left_ptr";
break;
case leftDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "nw-resize";
else
cursorName = "w-resize";
break;
case rightDecoration:
if (y < _GLFW_DECORATION_WIDTH)
cursorName = "ne-resize";
else
cursorName = "e-resize";
break;
case bottomDecoration:
if (x < _GLFW_DECORATION_WIDTH)
cursorName = "sw-resize";
else if (x > window.wl.width + _GLFW_DECORATION_WIDTH)
cursorName = "se-resize";
else
cursorName = "s-resize";
break;
default:
assert(0);
}
if (_glfw.wl.cursorPreviousName != cursorName)
setCursor(window, cursorName);
}
static void pointerHandleButton(void* data, wl_pointer* pointer, uint serial, uint time, uint button, uint state) {
_GLFWwindow* window = _glfw.wl.pointerFocus;
int glfwButton;
// Both xdg-shell and wl_shell use the same values.
uint edges = WL_SHELL_SURFACE_RESIZE_NONE;
if (!window)
return;
if (button == BTN_LEFT)
{
switch (window.wl.decorations.focus)
{
case mainWindow:
break;
case topDecoration:
if (window.wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP;
else
{
if (window.wl.xdg.toplevel)
xdg_toplevel_move(window.wl.xdg.toplevel, _glfw.wl.seat, serial);
else
wl_shell_surface_move(window.wl.shellSurface, _glfw.wl.seat, serial);
}
break;
case leftDecoration:
if (window.wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
else
edges = WL_SHELL_SURFACE_RESIZE_LEFT;
break;
case rightDecoration:
if (window.wl.cursorPosY < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_TOP_RIGHT;
else
edges = WL_SHELL_SURFACE_RESIZE_RIGHT;
break;
case bottomDecoration:
if (window.wl.cursorPosX < _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
else if (window.wl.cursorPosX > window.wl.width + _GLFW_DECORATION_WIDTH)
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
else
edges = WL_SHELL_SURFACE_RESIZE_BOTTOM;
break;
default:
assert(0);
}
if (edges != WL_SHELL_SURFACE_RESIZE_NONE)
{
if (window.wl.xdg.toplevel)
xdg_toplevel_resize(window.wl.xdg.toplevel, _glfw.wl.seat,
serial, edges);
else
wl_shell_surface_resize(window.wl.shellSurface, _glfw.wl.seat,
serial, edges);
}
}
else if (button == BTN_RIGHT)
{
if (window.wl.decorations.focus != mainWindow && window.wl.xdg.toplevel)
{
xdg_toplevel_show_window_menu(window.wl.xdg.toplevel,
_glfw.wl.seat, serial,
window.wl.cursorPosX,
window.wl.cursorPosY);
return;
}
}
// Don’t pass the button to the user if it was related to a decoration.
if (window.wl.decorations.focus != mainWindow)
return;
_glfw.wl.serial = serial;
/* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
* codes. */
glfwButton = button - BTN_LEFT;
_glfwInputMouseClick(window,
glfwButton,
state == WL_POINTER_BUTTON_STATE_PRESSED
? GLFW_PRESS
: GLFW_RELEASE,
_glfw.wl.xkb.modifiers);
}
static void pointerHandleAxis(void* data, wl_pointer* pointer, uint time, uint axis, wl_fixed_t value) {
_GLFWwindow* window = _glfw.wl.pointerFocus;
double x = 0.0;double y = 0.0;
// Wayland scroll events are in pointer motion coordinate space (think two
// finger scroll). The factor 10 is commonly used to convert to "scroll
// step means 1.0.
const(double) scrollFactor = 1.0 / 10.0;
if (!window)
return;
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
x = wl_fixed_to_double(value) * scrollFactor;
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
y = wl_fixed_to_double(value) * scrollFactor;
_glfwInputScroll(window, x, y);
}
static const(wl_pointer_listener) pointerListener = wl_pointer_listener(
&pointerHandleEnter,
&pointerHandleLeave,
&pointerHandleMotion,
&pointerHandleButton,
&pointerHandleAxis,
);
static void keyboardHandleKeymap(void* data, wl_keyboard* keyboard, uint format, int fd, uint size) {
xkb_keymap* keymap;
xkb_state* state;
version (HAVE_XKBCOMMON_COMPOSE_H) {
xkb_compose_table* composeTable;
xkb_compose_state* composeState;
}
char* mapStr;
const(char)* locale;
if (format != WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1)
{
close(fd);
return;
}
mapStr = cast(char*) mmap(null, size, PROT_READ, MAP_SHARED, fd, 0);
if (mapStr == MAP_FAILED) {
close(fd);
return;
}
keymap = _glfw.wl.xkb.keymap_new_from_string(_glfw.wl.xkb.context,
mapStr,
XKB_KEYMAP_FORMAT_TEXT_V1,
0);
munmap(mapStr, size);
close(fd);
if (!keymap)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to compile keymap");
return;
}
state = _glfw.wl.xkb.state_new(keymap);
if (!state)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB state");
_glfw.wl.xkb.keymap_unref(keymap);
return;
}
// Look up the preferred locale, falling back to "C" as default.
locale = getenv("LC_ALL");
if (!locale)
locale = getenv("LC_CTYPE");
if (!locale)
locale = getenv("LANG");
if (!locale)
locale = "C";
version (HAVE_XKBCOMMON_COMPOSE_H) {
composeTable =
xkb_compose_table_new_from_locale(_glfw.wl.xkb.context, locale,
XKB_COMPOSE_COMPILE_NO_FLAGS);
if (composeTable)
{
composeState =
xkb_compose_state_new(composeTable, XKB_COMPOSE_STATE_NO_FLAGS);
xkb_compose_table_unref(composeTable);
if (composeState)
_glfw.wl.xkb.composeState = composeState;
else
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB compose state");
}
else
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to create XKB compose table");
}
}
_glfw.wl.xkb.keymap_unref(_glfw.wl.xkb.keymap);
_glfw.wl.xkb.state_unref(_glfw.wl.xkb.state);
_glfw.wl.xkb.keymap = keymap;
_glfw.wl.xkb.state = state;
_glfw.wl.xkb.controlMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Control");
_glfw.wl.xkb.altMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod1");
_glfw.wl.xkb.shiftMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Shift");
_glfw.wl.xkb.superMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod4");
_glfw.wl.xkb.capsLockMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Lock");
_glfw.wl.xkb.numLockMask =
1 << _glfw.wl.xkb.keymap_mod_get_index(_glfw.wl.xkb.keymap, "Mod2");
}
static void keyboardHandleEnter(void* data, wl_keyboard* keyboard, uint serial, wl_surface* surface, wl_array* keys) {
// Happens in the case we just destroyed the surface.
if (!surface)
return;
_GLFWwindow* window = wl_surface_get_user_data(surface);
if (!window)
{
window = findWindowFromDecorationSurface(surface, null);
if (!window)
return;
}
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = window;
_glfwInputWindowFocus(window, GLFW_TRUE);
}
static void keyboardHandleLeave(void* data, wl_keyboard* keyboard, uint serial, wl_surface* surface) {
_GLFWwindow* window = _glfw.wl.keyboardFocus;
if (!window)
return;
_glfw.wl.serial = serial;
_glfw.wl.keyboardFocus = null;
_glfwInputWindowFocus(window, GLFW_FALSE);
}
static int toGLFWKeyCode(uint key) {
if (key < _glfw.wl.keycodes.length)
return _glfw.wl.keycodes[key];
return GLFW_KEY_UNKNOWN;
}
version (HAVE_XKBCOMMON_COMPOSE_H) {
static xkb_keysym_t composeSymbol(xkb_keysym_t sym) {
if (sym == XKB_KEY_NoSymbol || !_glfw.wl.xkb.composeState)
return sym;
if (xkb_compose_state_feed(_glfw.wl.xkb.composeState, sym)
!= XKB_COMPOSE_FEED_ACCEPTED)
return sym;
switch (xkb_compose_state_get_status(_glfw.wl.xkb.composeState))
{
case XKB_COMPOSE_COMPOSED:
return xkb_compose_state_get_one_sym(_glfw.wl.xkb.composeState);
case XKB_COMPOSE_COMPOSING:
case XKB_COMPOSE_CANCELLED:
return XKB_KEY_NoSymbol;
case XKB_COMPOSE_NOTHING:
default:
return sym;
}
}
}
static GLFWbool inputChar(_GLFWwindow* window, uint key) {
uint code;uint numSyms;
c_long cp;
const(xkb_keysym_t)* syms;
xkb_keysym_t sym;
code = key + 8;
numSyms = _glfw.wl.xkb.state_key_get_syms(_glfw.wl.xkb.state, code, &syms);
if (numSyms == 1)
{
version (HAVE_XKBCOMMON_COMPOSE_H) {
sym = composeSymbol(syms[0]);
} else {
sym = syms[0];
}
cp = _glfwKeySym2Unicode(sym);
if (cp != -1)
{
const(int) mods = _glfw.wl.xkb.modifiers;
const(int) plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
_glfwInputChar(window, cast(uint) cp, mods, plain);
}
}
return _glfw.wl.xkb.keymap_key_repeats(_glfw.wl.xkb.keymap, syms[0]);
}
static void keyboardHandleKey(void* data, wl_keyboard* keyboard, uint serial, uint time, uint key, uint state) {
int keyCode;
int action;
_GLFWwindow* window = _glfw.wl.keyboardFocus;
GLFWbool shouldRepeat;
itimerspec timer = {};
if (!window)
return;
keyCode = toGLFWKeyCode(key);
action = state == WL_KEYBOARD_KEY_STATE_PRESSED
? GLFW_PRESS : GLFW_RELEASE;
_glfw.wl.serial = serial;
_glfwInputKey(window, keyCode, key, action,
_glfw.wl.xkb.modifiers);
if (action == GLFW_PRESS)
{
shouldRepeat = inputChar(window, key);
if (shouldRepeat && _glfw.wl.keyboardRepeatRate > 0)
{
_glfw.wl.keyboardLastKey = keyCode;
_glfw.wl.keyboardLastScancode = key;
if (_glfw.wl.keyboardRepeatRate > 1)
timer.it_interval.tv_nsec = 1000000000 / _glfw.wl.keyboardRepeatRate;
else
timer.it_interval.tv_sec = 1;
timer.it_value.tv_sec = _glfw.wl.keyboardRepeatDelay / 1000;
timer.it_value.tv_nsec = (_glfw.wl.keyboardRepeatDelay % 1000) * 1000000;
}
}
timerfd_settime(_glfw.wl.timerfd, 0, &timer, null);
}
static void keyboardHandleModifiers(void* data, wl_keyboard* keyboard, uint serial, uint modsDepressed, uint modsLatched, uint modsLocked, uint group) {
xkb_mod_mask_t mask;
uint modifiers = 0;
_glfw.wl.serial = serial;
if (!_glfw.wl.xkb.keymap)
return;
_glfw.wl.xkb.state_update_mask(_glfw.wl.xkb.state,
modsDepressed,
modsLatched,
modsLocked,
0,
0,
group);
mask = _glfw.wl.xkb.state_serialize_mods(_glfw.wl.xkb.state,
XKB_STATE_MODS_DEPRESSED |
XKB_STATE_LAYOUT_DEPRESSED |
XKB_STATE_MODS_LATCHED |
XKB_STATE_LAYOUT_LATCHED);
if (mask & _glfw.wl.xkb.controlMask)
modifiers |= GLFW_MOD_CONTROL;
if (mask & _glfw.wl.xkb.altMask)
modifiers |= GLFW_MOD_ALT;
if (mask & _glfw.wl.xkb.shiftMask)
modifiers |= GLFW_MOD_SHIFT;
if (mask & _glfw.wl.xkb.superMask)
modifiers |= GLFW_MOD_SUPER;
if (mask & _glfw.wl.xkb.capsLockMask)
modifiers |= GLFW_MOD_CAPS_LOCK;
if (mask & _glfw.wl.xkb.numLockMask)
modifiers |= GLFW_MOD_NUM_LOCK;
_glfw.wl.xkb.modifiers = modifiers;
}
version (WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) {
static void keyboardHandleRepeatInfo(void* data, wl_keyboard* keyboard, int rate, int delay) {
if (keyboard != _glfw.wl.keyboard)
return;
_glfw.wl.keyboardRepeatRate = rate;
_glfw.wl.keyboardRepeatDelay = delay;
}
static const(wl_keyboard_listener) keyboardListener = wl_keyboard_listener(
&keyboardHandleKeymap,
&keyboardHandleEnter,
&keyboardHandleLeave,
&keyboardHandleKey,
&keyboardHandleModifiers,
&keyboardHandleRepeatInfo,
);
} else {
static const(wl_keyboard_listener) keyboardListener = wl_keyboard_listener(
&keyboardHandleKeymap,
&keyboardHandleEnter,
&keyboardHandleLeave,
&keyboardHandleKey,
&keyboardHandleModifiers,
// no keyboardHandleRepeatInfo,
);
}
static void seatHandleCapabilities(void* data, wl_seat* seat, /*enum wl_seat_capability*/ uint caps) {
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !_glfw.wl.pointer)
{
_glfw.wl.pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(_glfw.wl.pointer, &pointerListener, null);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && _glfw.wl.pointer)
{
wl_pointer_destroy(_glfw.wl.pointer);
_glfw.wl.pointer = null;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard)
{
_glfw.wl.keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_add_listener(_glfw.wl.keyboard, &keyboardListener, null);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && _glfw.wl.keyboard)
{
wl_keyboard_destroy(_glfw.wl.keyboard);
_glfw.wl.keyboard = null;
}
}
static void seatHandleName(void* data, wl_seat* seat, const(char)* name) {
}
static const(wl_seat_listener) seatListener = wl_seat_listener(
&seatHandleCapabilities,
&seatHandleName,
);
static void dataOfferHandleOffer(void* data, wl_data_offer* dataOffer, const(char)* mimeType) {
}
static const(wl_data_offer_listener) dataOfferListener = wl_data_offer_listener(
&dataOfferHandleOffer,
);
static void dataDeviceHandleDataOffer(void* data, wl_data_device* dataDevice, wl_data_offer* id) {
if (_glfw.wl.dataOffer)
wl_data_offer_destroy(_glfw.wl.dataOffer);
_glfw.wl.dataOffer = id;
wl_data_offer_add_listener(_glfw.wl.dataOffer, &dataOfferListener, null);
}
static void dataDeviceHandleEnter(void* data, wl_data_device* dataDevice, uint serial, wl_surface* surface, wl_fixed_t x, wl_fixed_t y, wl_data_offer* id) {
}
static void dataDeviceHandleLeave(void* data, wl_data_device* dataDevice) {
}
static void dataDeviceHandleMotion(void* data, wl_data_device* dataDevice, uint time, wl_fixed_t x, wl_fixed_t y) {
}
static void dataDeviceHandleDrop(void* data, wl_data_device* dataDevice) {
}
static void dataDeviceHandleSelection(void* data, wl_data_device* dataDevice, wl_data_offer* id) {
}
static const(wl_data_device_listener) dataDeviceListener = wl_data_device_listener(
&dataDeviceHandleDataOffer,
&dataDeviceHandleEnter,
&dataDeviceHandleLeave,
&dataDeviceHandleMotion,
&dataDeviceHandleDrop,
&dataDeviceHandleSelection,
);
static void wmBaseHandlePing(void* data, xdg_wm_base* wmBase, uint serial) {
xdg_wm_base_pong(wmBase, serial);
}
static const(xdg_wm_base_listener) wmBaseListener = xdg_wm_base_listener(
&wmBaseHandlePing
);
static void registryHandleGlobal(void* data, wl_registry* registry, uint name, const(char)* interface_, uint version_) {
if (strcmp(interface_, "wl_compositor") == 0)
{
_glfw.wl.compositorVersion = min(3, version_);
_glfw.wl.compositor = cast(wl_compositor*)
wl_registry_bind(registry, name, &wl_compositor_interface,
_glfw.wl.compositorVersion);
}
else if (strcmp(interface_, "wl_subcompositor") == 0)
{
_glfw.wl.subcompositor = cast(wl_subcompositor*)
wl_registry_bind(registry, name, &wl_subcompositor_interface, 1);
}
else if (strcmp(interface_, "wl_shm") == 0)
{
_glfw.wl.shm = cast(wl_shm*)
wl_registry_bind(registry, name, &wl_shm_interface, 1);
}
else if (strcmp(interface_, "wl_shell") == 0)
{
_glfw.wl.shell = cast(wl_shell*)
wl_registry_bind(registry, name, &wl_shell_interface, 1);
}
else if (strcmp(interface_, "wl_output") == 0)
{
_glfwAddOutputWayland(name, version_);
}
else if (strcmp(interface_, "wl_seat") == 0)
{
if (!_glfw.wl.seat)
{
_glfw.wl.seatVersion = min(4, version_);
_glfw.wl.seat = cast(wl_seat*)
wl_registry_bind(registry, name, &wl_seat_interface,
_glfw.wl.seatVersion);
wl_seat_add_listener(_glfw.wl.seat, &seatListener, null);
}
}
else if (strcmp(interface_, "wl_data_device_manager") == 0)
{
if (!_glfw.wl.dataDeviceManager)
{
_glfw.wl.dataDeviceManager = cast(wl_data_device_manager*)
wl_registry_bind(registry, name,
&wl_data_device_manager_interface, 1);
}
}
else if (strcmp(interface_, "xdg_wm_base") == 0)
{
_glfw.wl.wmBase =
wl_registry_bind(registry, name, &xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(_glfw.wl.wmBase, &wmBaseListener, null);
}
else if (strcmp(interface_, "zxdg_decoration_manager_v1") == 0)
{
_glfw.wl.decorationManager =
wl_registry_bind(registry, name,
&zxdg_decoration_manager_v1_interface,
1);
}
else if (strcmp(interface_, "wp_viewporter") == 0)
{
_glfw.wl.viewporter =
wl_registry_bind(registry, name, &wp_viewporter_interface, 1);
}
else if (strcmp(interface_, "zwp_relative_pointer_manager_v1") == 0)
{
_glfw.wl.relativePointerManager =
wl_registry_bind(registry, name,
&zwp_relative_pointer_manager_v1_interface,
1);
}
else if (strcmp(interface_, "zwp_pointer_constraints_v1") == 0)
{
_glfw.wl.pointerConstraints =
wl_registry_bind(registry, name,
&zwp_pointer_constraints_v1_interface,
1);
}
else if (strcmp(interface_, "zwp_idle_inhibit_manager_v1") == 0)
{
_glfw.wl.idleInhibitManager =
wl_registry_bind(registry, name,
&zwp_idle_inhibit_manager_v1_interface,
1);
}
}
static void registryHandleGlobalRemove(void* data, wl_registry* registry, uint name) {
int i;
_GLFWmonitor* monitor;
for (i = 0; i < _glfw.monitorCount; ++i)
{
monitor = _glfw.monitors[i];
if (monitor.wl.name == name)
{
_glfwInputMonitor(monitor, GLFW_DISCONNECTED, 0);
return;
}
}
}
static const(wl_registry_listener) registryListener = wl_registry_listener(
®istryHandleGlobal,
®istryHandleGlobalRemove
);
// Create key code translation tables
//
static void createKeyTables() {
int scancode;
memset(_glfw.wl.keycodes.ptr, -1, typeof(_glfw.wl.keycodes).sizeof);
memset(_glfw.wl.scancodes.ptr, -1, typeof(_glfw.wl.scancodes).sizeof);
_glfw.wl.keycodes[KEY_GRAVE] = GLFW_KEY_GRAVE_ACCENT;
_glfw.wl.keycodes[KEY_1] = GLFW_KEY_1;
_glfw.wl.keycodes[KEY_2] = GLFW_KEY_2;
_glfw.wl.keycodes[KEY_3] = GLFW_KEY_3;
_glfw.wl.keycodes[KEY_4] = GLFW_KEY_4;
_glfw.wl.keycodes[KEY_5] = GLFW_KEY_5;
_glfw.wl.keycodes[KEY_6] = GLFW_KEY_6;
_glfw.wl.keycodes[KEY_7] = GLFW_KEY_7;
_glfw.wl.keycodes[KEY_8] = GLFW_KEY_8;
_glfw.wl.keycodes[KEY_9] = GLFW_KEY_9;
_glfw.wl.keycodes[KEY_0] = GLFW_KEY_0;
_glfw.wl.keycodes[KEY_SPACE] = GLFW_KEY_SPACE;
_glfw.wl.keycodes[KEY_MINUS] = GLFW_KEY_MINUS;
_glfw.wl.keycodes[KEY_EQUAL] = GLFW_KEY_EQUAL;
_glfw.wl.keycodes[KEY_Q] = GLFW_KEY_Q;
_glfw.wl.keycodes[KEY_W] = GLFW_KEY_W;
_glfw.wl.keycodes[KEY_E] = GLFW_KEY_E;
_glfw.wl.keycodes[KEY_R] = GLFW_KEY_R;
_glfw.wl.keycodes[KEY_T] = GLFW_KEY_T;
_glfw.wl.keycodes[KEY_Y] = GLFW_KEY_Y;
_glfw.wl.keycodes[KEY_U] = GLFW_KEY_U;
_glfw.wl.keycodes[KEY_I] = GLFW_KEY_I;
_glfw.wl.keycodes[KEY_O] = GLFW_KEY_O;
_glfw.wl.keycodes[KEY_P] = GLFW_KEY_P;
_glfw.wl.keycodes[KEY_LEFTBRACE] = GLFW_KEY_LEFT_BRACKET;
_glfw.wl.keycodes[KEY_RIGHTBRACE] = GLFW_KEY_RIGHT_BRACKET;
_glfw.wl.keycodes[KEY_A] = GLFW_KEY_A;
_glfw.wl.keycodes[KEY_S] = GLFW_KEY_S;
_glfw.wl.keycodes[KEY_D] = GLFW_KEY_D;
_glfw.wl.keycodes[KEY_F] = GLFW_KEY_F;
_glfw.wl.keycodes[KEY_G] = GLFW_KEY_G;
_glfw.wl.keycodes[KEY_H] = GLFW_KEY_H;
_glfw.wl.keycodes[KEY_J] = GLFW_KEY_J;
_glfw.wl.keycodes[KEY_K] = GLFW_KEY_K;
_glfw.wl.keycodes[KEY_L] = GLFW_KEY_L;
_glfw.wl.keycodes[KEY_SEMICOLON] = GLFW_KEY_SEMICOLON;
_glfw.wl.keycodes[KEY_APOSTROPHE] = GLFW_KEY_APOSTROPHE;
_glfw.wl.keycodes[KEY_Z] = GLFW_KEY_Z;
_glfw.wl.keycodes[KEY_X] = GLFW_KEY_X;
_glfw.wl.keycodes[KEY_C] = GLFW_KEY_C;
_glfw.wl.keycodes[KEY_V] = GLFW_KEY_V;
_glfw.wl.keycodes[KEY_B] = GLFW_KEY_B;
_glfw.wl.keycodes[KEY_N] = GLFW_KEY_N;
_glfw.wl.keycodes[KEY_M] = GLFW_KEY_M;
_glfw.wl.keycodes[KEY_COMMA] = GLFW_KEY_COMMA;
_glfw.wl.keycodes[KEY_DOT] = GLFW_KEY_PERIOD;
_glfw.wl.keycodes[KEY_SLASH] = GLFW_KEY_SLASH;
_glfw.wl.keycodes[KEY_BACKSLASH] = GLFW_KEY_BACKSLASH;
_glfw.wl.keycodes[KEY_ESC] = GLFW_KEY_ESCAPE;
_glfw.wl.keycodes[KEY_TAB] = GLFW_KEY_TAB;
_glfw.wl.keycodes[KEY_LEFTSHIFT] = GLFW_KEY_LEFT_SHIFT;
_glfw.wl.keycodes[KEY_RIGHTSHIFT] = GLFW_KEY_RIGHT_SHIFT;
_glfw.wl.keycodes[KEY_LEFTCTRL] = GLFW_KEY_LEFT_CONTROL;
_glfw.wl.keycodes[KEY_RIGHTCTRL] = GLFW_KEY_RIGHT_CONTROL;
_glfw.wl.keycodes[KEY_LEFTALT] = GLFW_KEY_LEFT_ALT;
_glfw.wl.keycodes[KEY_RIGHTALT] = GLFW_KEY_RIGHT_ALT;
_glfw.wl.keycodes[KEY_LEFTMETA] = GLFW_KEY_LEFT_SUPER;
_glfw.wl.keycodes[KEY_RIGHTMETA] = GLFW_KEY_RIGHT_SUPER;
_glfw.wl.keycodes[KEY_MENU] = GLFW_KEY_MENU;
_glfw.wl.keycodes[KEY_NUMLOCK] = GLFW_KEY_NUM_LOCK;
_glfw.wl.keycodes[KEY_CAPSLOCK] = GLFW_KEY_CAPS_LOCK;
_glfw.wl.keycodes[KEY_PRINT] = GLFW_KEY_PRINT_SCREEN;
_glfw.wl.keycodes[KEY_SCROLLLOCK] = GLFW_KEY_SCROLL_LOCK;
_glfw.wl.keycodes[KEY_PAUSE] = GLFW_KEY_PAUSE;
_glfw.wl.keycodes[KEY_DELETE] = GLFW_KEY_DELETE;
_glfw.wl.keycodes[KEY_BACKSPACE] = GLFW_KEY_BACKSPACE;
_glfw.wl.keycodes[KEY_ENTER] = GLFW_KEY_ENTER;
_glfw.wl.keycodes[KEY_HOME] = GLFW_KEY_HOME;
_glfw.wl.keycodes[KEY_END] = GLFW_KEY_END;
_glfw.wl.keycodes[KEY_PAGEUP] = GLFW_KEY_PAGE_UP;
_glfw.wl.keycodes[KEY_PAGEDOWN] = GLFW_KEY_PAGE_DOWN;
_glfw.wl.keycodes[KEY_INSERT] = GLFW_KEY_INSERT;
_glfw.wl.keycodes[KEY_LEFT] = GLFW_KEY_LEFT;
_glfw.wl.keycodes[KEY_RIGHT] = GLFW_KEY_RIGHT;
_glfw.wl.keycodes[KEY_DOWN] = GLFW_KEY_DOWN;
_glfw.wl.keycodes[KEY_UP] = GLFW_KEY_UP;
_glfw.wl.keycodes[KEY_F1] = GLFW_KEY_F1;
_glfw.wl.keycodes[KEY_F2] = GLFW_KEY_F2;
_glfw.wl.keycodes[KEY_F3] = GLFW_KEY_F3;
_glfw.wl.keycodes[KEY_F4] = GLFW_KEY_F4;
_glfw.wl.keycodes[KEY_F5] = GLFW_KEY_F5;
_glfw.wl.keycodes[KEY_F6] = GLFW_KEY_F6;
_glfw.wl.keycodes[KEY_F7] = GLFW_KEY_F7;
_glfw.wl.keycodes[KEY_F8] = GLFW_KEY_F8;
_glfw.wl.keycodes[KEY_F9] = GLFW_KEY_F9;
_glfw.wl.keycodes[KEY_F10] = GLFW_KEY_F10;
_glfw.wl.keycodes[KEY_F11] = GLFW_KEY_F11;
_glfw.wl.keycodes[KEY_F12] = GLFW_KEY_F12;
_glfw.wl.keycodes[KEY_F13] = GLFW_KEY_F13;
_glfw.wl.keycodes[KEY_F14] = GLFW_KEY_F14;
_glfw.wl.keycodes[KEY_F15] = GLFW_KEY_F15;
_glfw.wl.keycodes[KEY_F16] = GLFW_KEY_F16;
_glfw.wl.keycodes[KEY_F17] = GLFW_KEY_F17;
_glfw.wl.keycodes[KEY_F18] = GLFW_KEY_F18;
_glfw.wl.keycodes[KEY_F19] = GLFW_KEY_F19;
_glfw.wl.keycodes[KEY_F20] = GLFW_KEY_F20;
_glfw.wl.keycodes[KEY_F21] = GLFW_KEY_F21;
_glfw.wl.keycodes[KEY_F22] = GLFW_KEY_F22;
_glfw.wl.keycodes[KEY_F23] = GLFW_KEY_F23;
_glfw.wl.keycodes[KEY_F24] = GLFW_KEY_F24;
_glfw.wl.keycodes[KEY_KPSLASH] = GLFW_KEY_KP_DIVIDE;
_glfw.wl.keycodes[KEY_KPDOT] = GLFW_KEY_KP_MULTIPLY;
_glfw.wl.keycodes[KEY_KPMINUS] = GLFW_KEY_KP_SUBTRACT;
_glfw.wl.keycodes[KEY_KPPLUS] = GLFW_KEY_KP_ADD;
_glfw.wl.keycodes[KEY_KP0] = GLFW_KEY_KP_0;
_glfw.wl.keycodes[KEY_KP1] = GLFW_KEY_KP_1;
_glfw.wl.keycodes[KEY_KP2] = GLFW_KEY_KP_2;
_glfw.wl.keycodes[KEY_KP3] = GLFW_KEY_KP_3;
_glfw.wl.keycodes[KEY_KP4] = GLFW_KEY_KP_4;
_glfw.wl.keycodes[KEY_KP5] = GLFW_KEY_KP_5;
_glfw.wl.keycodes[KEY_KP6] = GLFW_KEY_KP_6;
_glfw.wl.keycodes[KEY_KP7] = GLFW_KEY_KP_7;
_glfw.wl.keycodes[KEY_KP8] = GLFW_KEY_KP_8;
_glfw.wl.keycodes[KEY_KP9] = GLFW_KEY_KP_9;
_glfw.wl.keycodes[KEY_KPCOMMA] = GLFW_KEY_KP_DECIMAL;
_glfw.wl.keycodes[KEY_KPEQUAL] = GLFW_KEY_KP_EQUAL;
_glfw.wl.keycodes[KEY_KPENTER] = GLFW_KEY_KP_ENTER;
for (scancode = 0; scancode < 256; scancode++)
{
if (_glfw.wl.keycodes[scancode] > 0)
_glfw.wl.scancodes[_glfw.wl.keycodes[scancode]] = scancode;
}
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
int _glfwPlatformInit() {
const(char)* cursorTheme;
const(char)* cursorSizeStr;
const(char)* cursorSizeEnd;
c_long cursorSizeLong;
int cursorSize;
_glfw.wl.cursor.handle = _glfw_dlopen("libwayland-cursor.so.0");
if (!_glfw.wl.cursor.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-cursor");
return GLFW_FALSE;
}
_glfw.wl.cursor.theme_load = cast(PFN_wl_cursor_theme_load)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_load");
_glfw.wl.cursor.theme_destroy = cast(PFN_wl_cursor_theme_destroy)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_destroy");
_glfw.wl.cursor.theme_get_cursor = cast(PFN_wl_cursor_theme_get_cursor)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_theme_get_cursor");
_glfw.wl.cursor.image_get_buffer = cast(PFN_wl_cursor_image_get_buffer)
_glfw_dlsym(_glfw.wl.cursor.handle, "wl_cursor_image_get_buffer");
_glfw.wl.egl.handle = _glfw_dlopen("libwayland-egl.so.1");
if (!_glfw.wl.egl.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libwayland-egl");
return GLFW_FALSE;
}
_glfw.wl.egl.window_create = cast(PFN_wl_egl_window_create)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_create");
_glfw.wl.egl.window_destroy = cast(PFN_wl_egl_window_destroy)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_destroy");
_glfw.wl.egl.window_resize = cast(PFN_wl_egl_window_resize)
_glfw_dlsym(_glfw.wl.egl.handle, "wl_egl_window_resize");
_glfw.wl.xkb.handle = _glfw_dlopen("libxkbcommon.so.0");
if (!_glfw.wl.xkb.handle)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to open libxkbcommon");
return GLFW_FALSE;
}
_glfw.wl.xkb.context_new = cast(PFN_xkb_context_new)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_new");
_glfw.wl.xkb.context_unref = cast(PFN_xkb_context_unref)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_context_unref");
_glfw.wl.xkb.keymap_new_from_string = cast(PFN_xkb_keymap_new_from_string)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_new_from_string");
_glfw.wl.xkb.keymap_unref = cast(PFN_xkb_keymap_unref)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_unref");
_glfw.wl.xkb.keymap_mod_get_index = cast(PFN_xkb_keymap_mod_get_index)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_mod_get_index");
_glfw.wl.xkb.keymap_key_repeats = cast(PFN_xkb_keymap_key_repeats)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_keymap_key_repeats");
_glfw.wl.xkb.state_new = cast(PFN_xkb_state_new)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_new");
_glfw.wl.xkb.state_unref = cast(PFN_xkb_state_unref)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_unref");
_glfw.wl.xkb.state_key_get_syms = cast(PFN_xkb_state_key_get_syms)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_key_get_syms");
_glfw.wl.xkb.state_update_mask = cast(PFN_xkb_state_update_mask)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_update_mask");
_glfw.wl.xkb.state_serialize_mods = cast(PFN_xkb_state_serialize_mods)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_state_serialize_mods");
version (HAVE_XKBCOMMON_COMPOSE_H) {
_glfw.wl.xkb.compose_table_new_from_locale = cast(PFN_xkb_compose_table_new_from_locale)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_new_from_locale");
_glfw.wl.xkb.compose_table_unref = cast(PFN_xkb_compose_table_unref)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_table_unref");
_glfw.wl.xkb.compose_state_new = cast(PFN_xkb_compose_state_new)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_new");
_glfw.wl.xkb.compose_state_unref = cast(PFN_xkb_compose_state_unref)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_unref");
_glfw.wl.xkb.compose_state_feed = cast(PFN_xkb_compose_state_feed)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_feed");
_glfw.wl.xkb.compose_state_get_status = cast(PFN_xkb_compose_state_get_status)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_status");
_glfw.wl.xkb.compose_state_get_one_sym = cast(PFN_xkb_compose_state_get_one_sym)
_glfw_dlsym(_glfw.wl.xkb.handle, "xkb_compose_state_get_one_sym");
}
_glfw.wl.display = wl_display_connect(null);
if (!_glfw.wl.display)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to connect to display");
return GLFW_FALSE;
}
_glfw.wl.registry = wl_display_get_registry(_glfw.wl.display);
wl_registry_add_listener(_glfw.wl.registry, ®istryListener, null);
createKeyTables();
_glfw.wl.xkb.context = _glfw.wl.xkb.context_new(0);
if (!_glfw.wl.xkb.context)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Failed to initialize xkb context");
return GLFW_FALSE;
}
// Sync so we got all registry objects
wl_display_roundtrip(_glfw.wl.display);
// Sync so we got all initial output events
wl_display_roundtrip(_glfw.wl.display);
version (linux) {
if (!_glfwInitJoysticksLinux())
return GLFW_FALSE;
}
_glfwInitTimerPOSIX();
_glfw.wl.timerfd = -1;
if (_glfw.wl.seatVersion >= 4)
_glfw.wl.timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
if (_glfw.wl.pointer && _glfw.wl.shm)
{
cursorTheme = getenv("XCURSOR_THEME");
cursorSizeStr = getenv("XCURSOR_SIZE");
cursorSize = 32;
if (cursorSizeStr)
{
errno = 0;
cursorSizeLong = strtol(cursorSizeStr, &cursorSizeEnd, 10);
if (!*cursorSizeEnd && !errno && cursorSizeLong > 0 && cursorSizeLong <= INT_MAX)
cursorSize = cast(int)cursorSizeLong;
}
_glfw.wl.cursorTheme =
_glfw.wl.cursor.theme_load(cursorTheme, cursorSize, _glfw.wl.shm);
if (!_glfw.wl.cursorTheme)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to load default cursor theme");
return GLFW_FALSE;
}
// If this happens to be NULL, we just fallback to the scale=1 version.
_glfw.wl.cursorThemeHiDPI =
_glfw.wl.cursor.theme_load(cursorTheme, 2 * cursorSize, _glfw.wl.shm);
_glfw.wl.cursorSurface =
wl_compositor_create_surface(_glfw.wl.compositor);
_glfw.wl.cursorTimerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
}
if (_glfw.wl.seat && _glfw.wl.dataDeviceManager)
{
_glfw.wl.dataDevice =
wl_data_device_manager_get_data_device(_glfw.wl.dataDeviceManager,
_glfw.wl.seat);
wl_data_device_add_listener(_glfw.wl.dataDevice, &dataDeviceListener, null);
_glfw.wl.clipboardString = cast(char*) malloc(4096);
if (!_glfw.wl.clipboardString)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Wayland: Unable to allocate clipboard memory");
return GLFW_FALSE;
}
_glfw.wl.clipboardSize = 4096;
}
return GLFW_TRUE;
}
void _glfwPlatformTerminate() {
version (linux) {
_glfwTerminateJoysticksLinux();
}
_glfwTerminateEGL();
if (_glfw.wl.egl.handle)
{
_glfw_dlclose(_glfw.wl.egl.handle);
_glfw.wl.egl.handle = null;
}
version (HAVE_XKBCOMMON_COMPOSE_H) {
if (_glfw.wl.xkb.composeState)
xkb_compose_state_unref(_glfw.wl.xkb.composeState);
}
if (_glfw.wl.xkb.keymap)
_glfw.wl.xkb.keymap_unref(_glfw.wl.xkb.keymap);
if (_glfw.wl.xkb.state)
_glfw.wl.xkb.state_unref(_glfw.wl.xkb.state);
if (_glfw.wl.xkb.context)
_glfw.wl.xkb.context_unref(_glfw.wl.xkb.context);
if (_glfw.wl.xkb.handle)
{
_glfw_dlclose(_glfw.wl.xkb.handle);
_glfw.wl.xkb.handle = null;
}
if (_glfw.wl.cursorTheme)
_glfw.wl.cursor.theme_destroy(_glfw.wl.cursorTheme);
if (_glfw.wl.cursorThemeHiDPI)
_glfw.wl.cursor.theme_destroy(_glfw.wl.cursorThemeHiDPI);
if (_glfw.wl.cursor.handle)
{
_glfw_dlclose(_glfw.wl.cursor.handle);
_glfw.wl.cursor.handle = null;
}
if (_glfw.wl.cursorSurface)
wl_surface_destroy(_glfw.wl.cursorSurface);
if (_glfw.wl.subcompositor)
wl_subcompositor_destroy(_glfw.wl.subcompositor);
if (_glfw.wl.compositor)
wl_compositor_destroy(_glfw.wl.compositor);
if (_glfw.wl.shm)
wl_shm_destroy(_glfw.wl.shm);
if (_glfw.wl.shell)
wl_shell_destroy(_glfw.wl.shell);
if (_glfw.wl.viewporter)
wp_viewporter_destroy(_glfw.wl.viewporter);
if (_glfw.wl.decorationManager)
zxdg_decoration_manager_v1_destroy(_glfw.wl.decorationManager);
if (_glfw.wl.wmBase)
xdg_wm_base_destroy(_glfw.wl.wmBase);
if (_glfw.wl.dataSource)
wl_data_source_destroy(_glfw.wl.dataSource);
if (_glfw.wl.dataDevice)
wl_data_device_destroy(_glfw.wl.dataDevice);
if (_glfw.wl.dataOffer)
wl_data_offer_destroy(_glfw.wl.dataOffer);
if (_glfw.wl.dataDeviceManager)
wl_data_device_manager_destroy(_glfw.wl.dataDeviceManager);
if (_glfw.wl.pointer)
wl_pointer_destroy(_glfw.wl.pointer);
if (_glfw.wl.keyboard)
wl_keyboard_destroy(_glfw.wl.keyboard);
if (_glfw.wl.seat)
wl_seat_destroy(_glfw.wl.seat);
if (_glfw.wl.relativePointerManager)
zwp_relative_pointer_manager_v1_destroy(_glfw.wl.relativePointerManager);
if (_glfw.wl.pointerConstraints)
zwp_pointer_constraints_v1_destroy(_glfw.wl.pointerConstraints);
if (_glfw.wl.idleInhibitManager)
zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager);
if (_glfw.wl.registry)
wl_registry_destroy(_glfw.wl.registry);
if (_glfw.wl.display)
{
wl_display_flush(_glfw.wl.display);
wl_display_disconnect(_glfw.wl.display);
}
if (_glfw.wl.timerfd >= 0)
close(_glfw.wl.timerfd);
if (_glfw.wl.cursorTimerfd >= 0)
close(_glfw.wl.cursorTimerfd);
if (_glfw.wl.clipboardString)
free(_glfw.wl.clipboardString);
if (_glfw.wl.clipboardSendString)
free(_glfw.wl.clipboardSendString);
}
const(char)* _glfwPlatformGetVersionString() {
version (_POSIX_TIMERS) {
enum timeStr = " clock_gettime";
} else version (_POSIX_MONOTONIC_CLOCK) {
enum timeStr = " gettimeofday";
} else {
enum timeStr = " gettimeofday";
}
version (_GLFW_BUILD_DLL) {
enum dllStr = " shared";
} else {
enum dllStr = "";
}
return _GLFW_VERSION_NUMBER ~ " Wayland EGL OSMesa" ~ timeStr ~ " evdev" ~ dllStr;
}
|
D
|
module eventcore.internal.utils;
import taggedalgebraic;
void print(ARGS...)(string str, ARGS args)
@trusted @nogc nothrow {
import std.format : formattedWrite;
StdoutRange r;
scope cb = () {
scope (failure) assert(false);
(&r).formattedWrite(str, args);
};
(cast(void delegate() @nogc @safe nothrow)cb)();
r.put('\n');
}
struct StdoutRange {
@safe: @nogc: nothrow:
import core.stdc.stdio;
void put(string str)
{
() @trusted { fwrite(str.ptr, str.length, 1, stdout); } ();
}
void put(char ch)
{
() @trusted { fputc(ch, stdout); } ();
}
}
struct ChoppedVector(T, size_t CHUNK_SIZE = 16*64*1024/nextPOT(T.sizeof)) {
import core.memory : GC;
static assert(nextPOT(CHUNK_SIZE) == CHUNK_SIZE,
"CHUNK_SIZE must be a power of two for performance reasons.");
@safe: nothrow:
import core.stdc.stdlib : calloc, free, malloc, realloc;
import std.traits : hasElaborateDestructor;
static assert(!hasElaborateDestructor!T, "Cannot store element with elaborate destructor in ChoppedVector.");
alias chunkSize = CHUNK_SIZE;
private {
alias Chunk = T[chunkSize];
alias ChunkPtr = Chunk*;
ChunkPtr[] m_chunks;
size_t m_chunkCount;
size_t m_length;
}
@disable this(this);
~this()
@nogc {
clear();
}
@property size_t length() const @nogc { return m_length; }
void clear()
@nogc {
() @trusted {
foreach (i; 0 .. m_chunkCount) {
GC.removeRange(m_chunks[i]);
free(m_chunks[i]);
}
free(m_chunks.ptr);
} ();
m_chunkCount = 0;
m_length = 0;
}
ref T opIndex(size_t index)
@nogc {
auto chunk = index / chunkSize;
auto subidx = index % chunkSize;
if (index >= m_length) m_length = index+1;
reserveChunk(chunk);
return (*m_chunks[chunk])[subidx];
}
int opApply(scope int delegate(size_t idx, ref T) @safe nothrow del)
{
size_t idx = 0;
foreach (c; m_chunks) {
if (c) {
foreach (i, ref t; *c)
if (auto ret = del(idx+i, t))
return ret;
}
idx += chunkSize;
}
return 0;
}
int opApply(scope int delegate(size_t idx, ref const(T)) @safe nothrow del)
const {
size_t idx = 0;
foreach (c; m_chunks) {
if (c) {
foreach (i, ref t; *c)
if (auto ret = del(idx+i, t))
return ret;
}
idx += chunkSize;
}
return 0;
}
private void reserveChunk(size_t chunkidx)
@nogc {
if (m_chunks.length <= chunkidx) {
auto l = m_chunks.length == 0 ? 64 : m_chunks.length;
while (l <= chunkidx) l *= 2;
() @trusted {
auto newptr = cast(ChunkPtr*)realloc(m_chunks.ptr, l * ChunkPtr.length);
m_chunks = newptr[0 .. l];
} ();
}
while (m_chunkCount <= chunkidx) {
() @trusted {
auto ptr = cast(ChunkPtr)calloc(chunkSize, T.sizeof);
GC.addRange(ptr, chunkSize * T.sizeof);
m_chunks[m_chunkCount++] = ptr;
} ();
}
}
}
struct AlgebraicChoppedVector(TCommon, TSpecific...)
{
import std.conv : to;
import std.meta : AliasSeq;
union U {
typeof(null) none;
mixin fields!0;
}
alias FieldType = TaggedAlgebraic!U;
static struct FullField {
TCommon common;
FieldType specific;
mixin(accessors());
}
ChoppedVector!(FullField) items;
alias items this;
private static string accessors()
{
import std.format : format;
string ret;
foreach (i, U; TSpecific)
ret ~= "@property ref TSpecific[%s] %s() nothrow @safe { return this.specific.get!(TSpecific[%s]); }\n"
.format(i, U.Handle.name, i);
return ret;
}
private mixin template fields(size_t i) {
static if (i < TSpecific.length) {
mixin("TSpecific["~i.to!string~"] "~TSpecific[i].Handle.name~";");
mixin fields!(i+1);
}
}
}
/** Efficient bit set of dynamic size.
*/
struct SmallIntegerSet(V : uint)
{
private {
uint[][4] m_bits;
}
void insert(V i)
{
foreach (j; 0 .. m_bits.length) {
uint b = 1u << (i%32);
i /= 32;
if (i >= m_bits[j].length)
m_bits[j].length = nextPOT(i);
m_bits[j][i] |= b;
}
}
void remove(V i)
{
foreach (j; 0 .. m_bits.length) {
uint b = 1u << (i%32);
i /= 32;
if (!m_bits[j][i]) break;
m_bits[j][i] &= ~b;
if (m_bits[j][i]) break;
}
}
bool contains(V i) const { return i/32 < m_bits[0].length && m_bits[0][i/32] & (1u<<(i%32)); }
int opApply(scope int delegate(V) @safe nothrow del)
const @safe {
int rec(size_t depth, uint bi)
{
auto b = m_bits[depth][bi];
foreach (i; 0 .. 32)
if (b & (1u << i)) {
uint sbi = bi*32 + i;
if (depth == 0) {
if (auto ret = del(V(sbi)))
return ret;
} else rec(depth-1, sbi);
}
return 0;
}
foreach (i, b; m_bits[$-1])
if (b) {
if (auto ret = rec(m_bits.length-1, cast(uint)i))
return ret;
}
return 0;
}
}
@safe nothrow unittest {
SmallIntegerSet!uint s;
void testIter(scope uint[] seq...) nothrow {
size_t cnt = 0;
foreach (v; s) {
assert(v == seq[cnt]);
cnt++;
}
assert(cnt == seq.length);
}
testIter();
s.insert(1);
assert(s.contains(1));
assert(!s.contains(2));
testIter(1);
s.insert(3467);
assert(s.contains(3467));
assert(!s.contains(300));
testIter(1, 3467);
s.insert(2);
testIter(1, 2, 3467);
s.remove(1);
testIter(2, 3467);
s.remove(2);
testIter(3467);
s.remove(3467);
testIter();
}
private size_t nextPOT(size_t n) @safe nothrow @nogc
{
foreach_reverse (i; 0 .. size_t.sizeof*8) {
size_t ni = cast(size_t)1 << i;
if (n & ni) {
return n & (ni-1) ? ni << 1 : ni;
}
}
return 1;
}
unittest {
assert(nextPOT(1) == 1);
assert(nextPOT(2) == 2);
assert(nextPOT(3) == 4);
assert(nextPOT(4) == 4);
assert(nextPOT(5) == 8);
}
|
D
|
/Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/Objects-normal/x86_64/IQUIScrollView+Additions.o : /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQTextView/IQTextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIWindow+Hierarchy.swift /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/zaidtayyab/Desktop/Template/Pods/Target\ Support\ Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-umbrella.h /Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/unextended-module.modulemap
/Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/Objects-normal/x86_64/IQUIScrollView+Additions~partial.swiftmodule : /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQTextView/IQTextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIWindow+Hierarchy.swift /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/zaidtayyab/Desktop/Template/Pods/Target\ Support\ Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-umbrella.h /Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/unextended-module.modulemap
/Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/Objects-normal/x86_64/IQUIScrollView+Additions~partial.swiftdoc : /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstantsInternal.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQTitleBarButtonItem.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQUIView+IQKeyboardToolbar.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardReturnKeyHandler.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIViewController+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUITextFieldView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIScrollView+Additions.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Constants/IQKeyboardManagerConstants.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQNSArray+Sort.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQToolbar/IQPreviousNextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQTextView/IQTextView.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIView+Hierarchy.swift /Users/zaidtayyab/Desktop/Template/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/Categories/IQUIWindow+Hierarchy.swift /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreText.apinotesc /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/QuartzCore.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Users/zaidtayyab/Desktop/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/SwiftOnoneSupport.swiftmodule /Users/zaidtayyab/Desktop/Template/Pods/Target\ Support\ Files/IQKeyboardManagerSwift/IQKeyboardManagerSwift-umbrella.h /Users/zaidtayyab/Desktop/Template/Build/Template/Build/Intermediates/Pods.build/Debug-iphonesimulator/IQKeyboardManagerSwift.build/unextended-module.modulemap
|
D
|
FUNC VOID GruenErzbrocken5_S1 ()
{
var C_NPC her; her = Hlp_GetNpc(PC_Hero);
if (Hlp_GetInstanceID(self)==Hlp_GetInstanceID(her))
{
if (Npc_HasItems(hero, ItMw_2H_Axe_L_01) == 0)
{
Print ("Ohne Spitzhacke geht das nicht!");
AI_UseMob (hero, "ORE", -1);
return;
};
B_SetAivar(self, AIV_INVINCIBLE, TRUE);
PLAYER_MOBSI_PRODUCTION = MOBSI_GruenErzbrocken5;
Ai_ProcessInfos (her);
};
};
INSTANCE PC_GruenErzbrocken5_Addon_Hour (C_Info)
{
npc = PC_Hero;
nr = 2;
condition = PC_GruenErzbrocken5_Addon_Hour_Condition;
information = PC_GruenErzbrocken5_Addon_Hour_Info;
permanent = 0;
description = "Einfach mal hacken. ";
};
FUNC INT PC_GruenErzbrocken5_Addon_Hour_Condition ()
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_GruenErzbrocken5)
{
return TRUE;
};
};
FUNC VOID PC_GruenErzbrocken5_Addon_Hour_Info()
{
CreateInvItems (hero, ItMi_GreenNugget, 2);
PrintScreen ("2 grüne Erzbrocken gehackt!", -1, -1, FONT_ScreenSmall, 2);
};
INSTANCE PC_GruenErzbrocken5_End (C_Info)
{
npc = PC_Hero;
nr = 999;
condition = PC_GruenErzbrocken5_End_Condition;
information = PC_GruenErzbrocken5_End_Info;
permanent = TRUE;
description = DIALOG_ENDE;
};
FUNC INT PC_GruenErzbrocken5_End_Condition ()
{
if (PLAYER_MOBSI_PRODUCTION == MOBSI_GruenErzbrocken5)
{
return TRUE;
};
};
FUNC VOID PC_GruenErzbrocken5_End_Info()
{
B_ENDPRODUCTIONDIALOG ();
};
|
D
|
instance PAL_7518_RITTER(Npc_Default)
{
name[0] = NAME_Ritter;
guild = GIL_PAL;
id = 7518;
voice = 9;
flags = 0;
npcType = npctype_main;
aivar[96] = TRUE;
B_SetAttributesToChapter(self,6);
fight_tactic = FAI_HUMAN_MASTER;
EquipItem(self,ItMw_1H_Blessed_02);
EquipItem(self,ItRw_PAL_Crossbow);
CreateInvItems(self,ItRw_Bolt,10);
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Fighter",Face_N_Normal08,BodyTex_N,ItAr_PAL_M_NPC);
Mdl_SetModelFatness(self,1);
Mdl_ApplyOverlayMds(self,"Humans_Militia.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,80);
daily_routine = rtn_start_7518;
};
func void rtn_start_7518()
{
TA_Stand_Guarding(10,0,23,0,"WP_COAST_CAMP_01_ORCTEAM");
TA_Stand_Guarding(23,0,10,0,"WP_COAST_CAMP_01_ORCTEAM");
};
func void rtn_follow_7518()
{
TA_Follow_Player(8,0,22,0,"WP_COAST_CAMP_01_ORCTEAM");
TA_Follow_Player(22,0,8,0,"WP_COAST_CAMP_01_ORCTEAM");
};
func void rtn_afterbattle_7518()
{
TA_Stand_Guarding(10,0,23,0,"WP_COAST_FOREST_24_999_02");
TA_Stand_Guarding(23,0,10,0,"WP_COAST_FOREST_24_999_02");
};
func void rtn_palout_7518()
{
TA_Stand_Guarding(8,0,23,0,"OC_PALADIN_OUT_03");
TA_Stand_Guarding(23,0,8,0,"OC_PALADIN_OUT_03");
};
func void rtn_followex_7518()
{
TA_Follow_Player(8,0,22,0,"OC_EBR_HALL_THRONE");
TA_Follow_Player(22,0,8,0,"OC_EBR_HALL_THRONE");
};
func void rtn_castle_7518()
{
TA_Stand_Guarding(8,0,23,0,"OC_TO_GUARD");
TA_Stand_Guarding(23,0,8,0,"OC_TO_GUARD");
};
func void rtn_palexit_7518()
{
TA_Stand_Guarding(8,0,23,0,"OW_PATH_1_15");
TA_Stand_Guarding(23,0,8,0,"OW_PATH_1_15");
};
func void rtn_tot_7518()
{
TA_Stand_WP(8,0,20,0,"TOT");
TA_Stand_WP(20,0,8,0,"TOT");
};
|
D
|
/*
* Copyright 2002-2018 the original author or authors.
*
* 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.stomp.simp.broker.AbstractSubscriptionRegistry;
import hunt.stomp.simp.broker.SubscriptionRegistry;
import hunt.stomp.Message;
import hunt.stomp.MessageHeaders;
import hunt.stomp.simp.SimpMessageHeaderAccessor;
import hunt.stomp.simp.SimpMessageType;
import hunt.collection;
import hunt.Exceptions;
import hunt.logging;
import std.conv;
// import hunt.framework.util.CollectionUtils;
// import hunt.framework.util.LinkedMultiValueMap;
// import hunt.framework.util.MultiValueMap;
/**
* Abstract base class for implementations of {@link SubscriptionRegistry} that
* looks up information in messages but delegates to abstract methods for the
* actual storage and retrieval.
*
* @author Rossen Stoyanchev
* @since 4.0
*/
abstract class AbstractSubscriptionRegistry : SubscriptionRegistry {
private __gshared MultiValueMap!(string, string) EMPTY_MAP;
shared static this() {
EMPTY_MAP = new LinkedMultiValueMap!(string, string)();
}
override
final void registerSubscription(MessageBase message) {
MessageHeaders headers = message.getHeaders();
SimpMessageType messageType =
cast(SimpMessageType)SimpMessageHeaderAccessor.getMessageType(headers);
if (SimpMessageType.SUBSCRIBE != messageType) {
throw new IllegalArgumentException("Expected SUBSCRIBE: " ~ (cast(Object)message).toString());
}
string sessionId = SimpMessageHeaderAccessor.getSessionId(headers);
if (sessionId is null) {
version(HUNT_DEBUG) {
error("No sessionId in " ~ (cast(Object)message).toString());
}
return;
}
string subscriptionId = SimpMessageHeaderAccessor.getSubscriptionId(headers);
if (subscriptionId is null) {
version(HUNT_DEBUG) {
error("No subscriptionId in " ~ (cast(Object)message).toString());
}
return;
}
string destination = SimpMessageHeaderAccessor.getDestination(headers);
if (destination is null) {
version(HUNT_DEBUG) {
error("No destination in " ~ (cast(Object)message).toString());
}
return;
}
addSubscriptionInternal(sessionId, subscriptionId, destination, message);
}
override
final void unregisterSubscription(MessageBase message) {
MessageHeaders headers = message.getHeaders();
SimpMessageType messageType =
cast(SimpMessageType)SimpMessageHeaderAccessor.getMessageType(headers);
if (!SimpMessageType.UNSUBSCRIBE == messageType) {
throw new IllegalArgumentException("Expected UNSUBSCRIBE: " ~ (cast(Object)message).toString());
}
string sessionId = SimpMessageHeaderAccessor.getSessionId(headers);
if (sessionId is null) {
version(HUNT_DEBUG) {
error("No sessionId in " ~ (cast(Object)message).toString());
}
return;
}
string subscriptionId = SimpMessageHeaderAccessor.getSubscriptionId(headers);
if (subscriptionId is null) {
version(HUNT_DEBUG) {
error("No subscriptionId " ~ (cast(Object)message).toString());
}
return;
}
removeSubscriptionInternal(sessionId, subscriptionId, message);
}
override
final MultiValueMap!(string, string) findSubscriptions(MessageBase message) {
MessageHeaders headers = message.getHeaders();
SimpMessageType type =
cast(SimpMessageType)SimpMessageHeaderAccessor.getMessageType(headers);
if (SimpMessageType.MESSAGE != type) {
throw new IllegalArgumentException("Unexpected message type: " ~ type.to!string());
}
string destination = SimpMessageHeaderAccessor.getDestination(headers);
if (destination is null) {
version(HUNT_DEBUG) {
error("No destination in " ~ message.to!string());
}
return EMPTY_MAP;
}
return findSubscriptionsInternal(destination, message);
}
protected abstract void addSubscriptionInternal(
string sessionId, string subscriptionId, string destination, MessageBase message);
protected abstract void removeSubscriptionInternal(
string sessionId, string subscriptionId, MessageBase message);
protected abstract MultiValueMap!(string, string) findSubscriptionsInternal(
string destination, MessageBase message);
}
|
D
|
sha1init.c /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/lib/extensions/digest/ext/digest.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby/ruby.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/android/ruby/config.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby/defines.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby/missing.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby/intern.h /Users/user/.rvm/gems/ruby-1.9.3-p392/gems/rhodes-3.5.1.13/platform/shared/ruby/include/ruby/st.h sha1.h defs.h
|
D
|
module mysvc;
import std.stdio;
import core.thread;
import win32.winbase;
import win32.winnt;
import winsvc.svcbase;
class MyService : ServiceBase
{
private:
HANDLE _stopServiceEvent = null;
bool _stopping;
public:
this(string serviceName,
string displayName,
bool canStop = true,
bool canShutdown = true,
bool canPauseContinue = false)
{
super(serviceName, displayName, canStop, canShutdown, canPauseContinue);
}
protected:
// Executes when a Start command is sent to the service by the SCM or
// when the operating system starts (for a service that starts automatically).
// Specifies actions to take when the service starts.
override void OnStart(string[] args)
{
debug logIt("OnStart called");
// do initialisation here
_stopServiceEvent = CreateEvent(null, FALSE, FALSE, null);
if (!_stopServiceEvent)
{
debug logIt("CreateEvent failed.");
}
//worker thread - normally some other class
auto web = new Thread(
{
Sleep(3000);
debug logItWt("worker pid: ", getpid());
while (!_stopping)
{
Sleep(5000);
logItWt("worker thread");
}
SetEvent(cast (HANDLE) _stopServiceEvent);
});
web.isDaemon = true;
web.start();
}
// Executes when a Stop command is sent to the service by the SCM.
// Specifies actions to take when a service stops running.
override void OnStop()
{
debug logIt("OnStop called");
_stopping = true; //tell worker thread to stop
//wait for signal
if (WaitForSingleObject(_stopServiceEvent, INFINITE) != WAIT_OBJECT_0)
{
auto err = GetLastError();
throw new Exception("Error: %s", to!string(err));
}
// service was stopped signaled and SERVICE_STOP_PENDING set already - so clean up
CloseHandle(_stopServiceEvent);
_stopServiceEvent = null;
}
override void OnPause() {}
override void OnContinue() {}
override void OnShutdown() {}
private:
void logIt(T...)(T args)
{
try
{
File f = File(r"c:\temp\inc.log", "a");
auto tid = GetCurrentThreadId();
if (tid)
f.writeln(args, ", tid: ", tid);
else
f.writeln(args);
}
catch
{
}
}
void logItWt(T...)(T args)
{
try
{
File f = File(r"c:\temp\incwt.log", "a");
auto tid = GetCurrentThreadId();
if (tid)
f.writeln(args, ", tid: ", tid);
else
f.writeln(args);
}
catch
{
}
}
}
|
D
|
// Copyright 2019, University of Freiburg.
// Chair of Algorithms and Data Structures.
// Markus Näther <naetherm@informatik.uni-freiburg.de>
module devaluator.evaluator;
import devaluator.alignment.alignment_linker;
import devaluator.utils.language: Language;
import devaluator.utils.results;
import devaluator.utils.helper: PredictionRepr, GroundtruthRepr, RawRepr, SourceRepr;
import devaluator.utils.data_reader: DataReader, Result;
import std.stdio;
import std.conv;
import std.typecons: tuple, Tuple;
import std.container;
import std.string;
import std.variant;
import std.file;
import vibe.d;
/**
* @class
* Evaluator
*
* @brief
* TODO(naetherm): Write me!
*/
class Evaluator {
/**
* @brief
* Constructor.
*/
this() {
writeln("Starting Evaluator instance!");
writeln("Initializing all data readers");
this.dataReader = new DataReader();
writeln("\ndone.");
}
/**
* @brief
*
* @param [in]prediction
* @param [in]groundtruth
* @param [in]source
*
* @return
*/
dstring evaluate(dstring langCode, dstring path_to_files) {
// First check if the language package is already loaded
if (!this.containsLanguage(langCode)) {
// No,let's try to load it!
this.loadLanguage(langCode);
}
//auto links = File(to!string(path_to_files) ~ "groundtruth/links.txt", "r");
//logInfo("Processing " ~ to!string(path_to_files) ~ "groundtruth/links.txt");
//dstring raw;
dstring prediction;
dstring source;
dstring groundtruth;
// Create the cross linkage builder
//DEPRECATED: auto linkage = new CrossLinkage(this.getLanguageByLangCode(langCode));
auto linker = new AlignmentLinker(this.getLanguageByLangCode(langCode));
//foreach (line; links.byLine) {
//string buffer = to!string(line);
//buffer = buffer.replace("\n", "");
auto existence = to!string(path_to_files) ~ "prediction.json";
if (existence.exists) {
writeln("Working with file: " ~ existence);
// Read in all raw data
//raw = to!dstring(readText(to!string(path_to_files) ~ "raw.txt"));
prediction = to!dstring(readText(to!string(path_to_files) ~ "prediction.json"));
source = to!dstring(readText(to!string(path_to_files) ~ "source.json"));
groundtruth = to!dstring(readText(to!string(path_to_files) ~ "groundtruth.json"));
/*
// Build the internal representation
auto rRepr = new RawRepr(raw);
auto pRepr = new PredictionRepr(prediction, rRepr);
auto sRepr = new SourceRepr(source, rRepr);
auto gRepr = new GroundtruthRepr(groundtruth, sRepr);
*/
//RawRepr rRepr = new RawRepr(raw);
Result result = this.dataReader.parse(source, groundtruth, prediction);
SourceRepr sRepr = result[0];
GroundtruthRepr gRepr = result[1];
PredictionRepr pRepr = result[2];
// Initialize the cross linker
//DEPRECATED: linkage.initialize(rRepr, sRepr, gRepr, pRepr);
linker.initialize(sRepr, gRepr, pRepr);
// Build and initialize the internal structures
//DEPRECATED: linkage.build();
linker.build();
// Evaluate the alignment between source, prediction and groundtruth
//DEPRECATED: linkage.evaluate();
linker.evaluate();
//DEPRECATED: linkage.serializeAlignmentTo(path_to_files);
linker.serializeAlignmentTo(path_to_files);
}
//}
//links.close();
logInfo(">> Fully evaluated prediction!");
//DEPRECATED: return linkage.getResults();
return linker.getResults();
}
void populateLanguageDictionaries() {
}
ref Language getLanguageByLangCode(dstring langCode) {
return this.languages[langCode];
}
bool containsLanguage(dstring langCode) {
if (langCode in this.languages) {
return true;
}
return false;
}
void loadLanguage(dstring langCode) {
write("The Language Dictionaries for ", langCode, " are not cached, will do this now ... ");
this.languages[langCode] = new Language("/data/data/", to!string(langCode));
writeln(" done.");
}
/**
* Array containing all language dictionaries.
*/
Language[dstring] languages;
DataReader dataReader;
}
|
D
|
/Users/mac/Desktop/诵诗/诵诗/DerivedData/诵诗/Build/Intermediates/诵诗.build/Debug-iphonesimulator/诵诗.build/Objects-normal/x86_64/GuideViewController.o : /Users/mac/Desktop/诵诗/诵诗/诵诗/explainViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/LevelsViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/singleViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/ViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/AppDelegate.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/GuideViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/mac/Desktop/诵诗/诵诗/SQLiteBridge.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/usr/include/SQLite3.h /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/SwiftOnoneSupport.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/Foundation.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/QuartzCore.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/mac/Desktop/诵诗/诵诗/DerivedData/诵诗/Build/Intermediates/诵诗.build/Debug-iphonesimulator/诵诗.build/Objects-normal/x86_64/GuideViewController~partial.swiftmodule : /Users/mac/Desktop/诵诗/诵诗/诵诗/explainViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/LevelsViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/singleViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/ViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/AppDelegate.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/GuideViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/mac/Desktop/诵诗/诵诗/SQLiteBridge.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/usr/include/SQLite3.h /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/SwiftOnoneSupport.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/Foundation.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/QuartzCore.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/mac/Desktop/诵诗/诵诗/DerivedData/诵诗/Build/Intermediates/诵诗.build/Debug-iphonesimulator/诵诗.build/Objects-normal/x86_64/GuideViewController~partial.swiftdoc : /Users/mac/Desktop/诵诗/诵诗/诵诗/explainViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/LevelsViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/singleViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/ViewController.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/AppDelegate.swift /Users/mac/Desktop/诵诗/诵诗/诵诗/GuideViewController.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/mac/Desktop/诵诗/诵诗/SQLiteBridge.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/usr/include/SQLite3.h /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/SwiftOnoneSupport.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/Foundation.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/QuartzCore.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
|
D
|
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/SQL/PostgreSQLAlterTable.swift.o : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+0.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+UUID.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/ChannelPipeline+PostgreSQL.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Data.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BackendKeyData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLGeneric.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLDataTypeCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+FormatCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+PasswordMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+StartupMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TableNameCache.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDataTypeStaticRepresentable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLDataConvertible.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery+DataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabase.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+NotificationResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ErrorResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Close.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Date.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Authenticate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabaseConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TransportConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+String.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Bool.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+NotifyAndListen.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLColumn.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Polygon.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+RowDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLProvider.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLDataDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLRowDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLValueEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+FixedWidthInteger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLLogger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Utilities.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+ServerAddress.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterStatus.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLResultFormat.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Connect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDefault.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+BinaryFloatingPoint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLUpsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BindRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DescribeRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParseRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ExecuteRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+AuthenticationRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DataRow.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+SimpleQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ReadyForQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/SQL/PostgreSQLAlterTable~partial.swiftmodule : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+0.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+UUID.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/ChannelPipeline+PostgreSQL.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Data.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BackendKeyData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLGeneric.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLDataTypeCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+FormatCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+PasswordMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+StartupMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TableNameCache.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDataTypeStaticRepresentable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLDataConvertible.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery+DataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabase.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+NotificationResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ErrorResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Close.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Date.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Authenticate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabaseConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TransportConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+String.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Bool.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+NotifyAndListen.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLColumn.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Polygon.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+RowDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLProvider.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLDataDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLRowDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLValueEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+FixedWidthInteger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLLogger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Utilities.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+ServerAddress.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterStatus.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLResultFormat.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Connect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDefault.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+BinaryFloatingPoint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLUpsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BindRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DescribeRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParseRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ExecuteRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+AuthenticationRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DataRow.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+SimpleQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ReadyForQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/SQL/PostgreSQLAlterTable~partial.swiftdoc : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+0.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+UUID.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/ChannelPipeline+PostgreSQL.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Data.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BackendKeyData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLGeneric.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLDataTypeCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+FormatCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+PasswordMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+StartupMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TableNameCache.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDataTypeStaticRepresentable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLDataConvertible.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery+DataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabase.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+NotificationResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ErrorResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Close.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Date.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Authenticate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabaseConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TransportConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+String.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Bool.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+NotifyAndListen.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLColumn.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Polygon.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+RowDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLProvider.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLDataDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLRowDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLValueEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+FixedWidthInteger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLLogger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Utilities.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+ServerAddress.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterStatus.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLResultFormat.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Connect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDefault.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+BinaryFloatingPoint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLUpsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BindRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DescribeRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParseRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ExecuteRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+AuthenticationRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DataRow.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+SimpleQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ReadyForQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/SQL/PostgreSQLAlterTable~partial.swiftsourceinfo : /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+0.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+UUID.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/ChannelPipeline+PostgreSQL.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Data.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BackendKeyData.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLGeneric.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBind.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLDataTypeCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+FormatCode.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+PasswordMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+StartupMessage.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TableNameCache.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLAlterTable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDataTypeStaticRepresentable.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLDataConvertible.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery+DataType.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabase.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+NotificationResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ErrorResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportResponse.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Close.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Date.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Authenticate.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLDatabaseConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+TransportConfig.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+String.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBoolLiteral.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Bool.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+NotifyAndListen.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Column/PostgreSQLColumn.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Polygon.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLCollation.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLFunction.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+RowDescription.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLProvider.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLDataDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLRowDecoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Pipeline/PostgreSQLMessageEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Codable/PostgreSQLValueEncoder.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+FixedWidthInteger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Database/PostgreSQLLogger.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/PostgreSQLError.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLBinaryOperator.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Utilities.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+ServerAddress.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Utilities/Exports.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParameterStatus.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLResultFormat.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Connect.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDefault.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+Point.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Data/PostgreSQLData+BinaryFloatingPoint.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLInsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLUpsert.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+BindRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DescribeRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ParseRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ExecuteRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+AuthenticationRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+SSLSupportRequest.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+DataRow.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLDropIndex.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLPrimaryKey.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+Query.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/SQL/PostgreSQLQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Connection/PostgreSQLConnection+SimpleQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/postgresql/Sources/PostgreSQL/Message/PostgreSQLMessage+ReadyForQuery.swift /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/XPC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Combine.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/Swift.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/IOKit.swiftmodule/x86_64-apple-macos.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-macos.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.swiftmodule /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.swiftmodule /usr/local/Cellar/libressl/3.0.2/include/openssl/asn1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/tls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dtls1.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs12.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem2.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl23.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509v3.h /usr/local/Cellar/libressl/3.0.2/include/openssl/md5.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pkcs7.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509.h /usr/local/Cellar/libressl/3.0.2/include/openssl/sha.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rsa.h /usr/local/Cellar/libressl/3.0.2/include/openssl/obj_mac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/hmac.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ec.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/cpp_magic.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/ifaddrs-android.h /usr/local/Cellar/libressl/3.0.2/include/openssl/rand.h /usr/local/Cellar/libressl/3.0.2/include/openssl/conf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslconf.h /usr/local/Cellar/libressl/3.0.2/include/openssl/dh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ecdh.h /usr/local/Cellar/libressl/3.0.2/include/openssl/lhash.h /usr/local/Cellar/libressl/3.0.2/include/openssl/stack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/safestack.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl/Sources/CNIOOpenSSL/include/c_nio_openssl.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CCryptoOpenSSL/include/c_crypto_openssl.h /usr/local/Cellar/libressl/3.0.2/include/openssl/pem.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bn.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIODarwin/include/CNIODarwin.h /usr/local/Cellar/libressl/3.0.2/include/openssl/bio.h /usr/local/Cellar/libressl/3.0.2/include/openssl/crypto.h /usr/local/Cellar/libressl/3.0.2/include/openssl/srtp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/evp.h /usr/local/Cellar/libressl/3.0.2/include/openssl/ossl_typ.h /usr/local/Cellar/libressl/3.0.2/include/openssl/buffer.h /usr/local/Cellar/libressl/3.0.2/include/openssl/err.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOAtomics/include/CNIOAtomics.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslfeatures.h /usr/local/Cellar/libressl/3.0.2/include/openssl/objects.h /usr/local/Cellar/libressl/3.0.2/include/openssl/opensslv.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio/Sources/CNIOLinux/include/CNIOLinux.h /usr/local/Cellar/libressl/3.0.2/include/openssl/x509_vfy.h /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOSHA1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOHTTP1.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/PostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentPostgreSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CCryptoOpenSSL.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIO.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/HTTP.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOTLS.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOZlib.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Async.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Command.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Service.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Console.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Core.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentSQLite.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOPriorityQueue.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Logging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Debugging.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Routing.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/SQLBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/FluentBenchmark.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/COperatingSystem.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Random.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/URLEncodedForm.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIODarwin.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Authentication.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Validation.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Crypto.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/App.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOHTTPParser.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Vapor.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOAtomics.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Redis.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOConcurrencyHelpers.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Bits.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOFoundationCompat.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/WebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/NIOWebSocket.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/DatabaseKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/TemplateKit.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Fluent.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/Multipart.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/x86_64-apple-macosx/debug/CNIOLinux.build/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBase32/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/crypto/Sources/CBcrypt/include/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-zlib-support/module.modulemap /Users/panartem/Developer/Study/Microservices-vapor/TILAppUsers/.build/checkouts/swift-nio-ssl-support/module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/xpc/XPC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/**
This is the `collectPileUps` command of DENTIST.
Command_Summary:
---
Build and collect pile ups of reads that are candidates for gap closing.
---
Copyright: © 2018 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 dentist.commands.collectPileUps;
package(dentist) enum summary = "
Build and collect pile ups of reads that are candidates for gap closing.
";
import dentist.commandline : OptionsFor;
import dentist.commands.collectPileUps.filter :
AmbiguousAlignmentChainsFilter,
ContainedAlignmentChainsFilter,
ImproperAlignmentChainsFilter,
LQAlignmentChainsFilter,
RedundantAlignmentChainsFilter,
WeaklyAnchoredAlignmentChainsFilter;
import dentist.common :
DentistException,
ReferenceInterval,
ReferenceRegion;
import dentist.common.alignments :
AlignmentChain,
getType,
PileUp;
import dentist.common.commands : DentistCommand;
import dentist.common.binio : writePileUpsDb;
import dentist.dazzler :
GapSegment,
getAlignments,
getNumContigs,
getScaffoldStructure,
readMask;
import dentist.util.log;
import dentist.util.math : NaturalNumberSet;
import std.algorithm :
canFind,
count,
filter,
map,
sum;
import std.array : array;
import std.conv : to;
import std.exception : enforce;
import std.typecons : tuple, Yes;
import vibe.data.json : toJson = serializeToJson;
/// Options for the `collectPileUps` command.
alias Options = OptionsFor!(DentistCommand.collectPileUps);
/// Execute the `collectPileUps` command with `options`.
void execute(in Options options)
{
auto collector = new PileUpCollector(options);
collector.run();
}
/// This class comprises the `collectPileUps` step of the DENTIST algorithm
class PileUpCollector
{
protected const Options options;
protected size_t numReferenceContigs;
protected size_t numReads;
protected AlignmentChain[] readsAlignment;
protected ReferenceRegion repetitiveRegions;
protected GapSegment[] inputGaps;
protected NaturalNumberSet unusedReads;
this(in ref Options options)
{
this.options = options;
}
void run()
{
mixin(traceExecution);
readInputs();
filterAlignments();
auto pileUps = buildPileUps();
writePileUps(pileUps);
}
protected void readInputs()
{
mixin(traceExecution);
numReferenceContigs = getNumContigs(options.refDb);
numReads = getNumContigs(options.readsDb);
unusedReads = NaturalNumberSet(numReads, Yes.addAll);
inputGaps = getScaffoldStructure(options.refDb)
.filter!(part => part.peek!GapSegment !is null)
.map!(gapPart => gapPart.get!GapSegment)
.array;
logJsonInfo(
"numReferenceContigs", numReferenceContigs,
"numReads", numReads,
);
readsAlignment = getAlignments(
options.refDb,
options.readsDb,
options.readsAlignmentFile,
Yes.includeTracePoints,
);
foreach (mask; options.repeatMasks)
repetitiveRegions |= ReferenceRegion(readMask!ReferenceInterval(
options.refDb,
mask,
));
enforce!DentistException(readsAlignment.length > 0, "empty ref vs. reads alignment");
}
protected void filterAlignments()
{
mixin(traceExecution);
auto filters = tuple(
new LQAlignmentChainsFilter(options.maxAlignmentError),
new ImproperAlignmentChainsFilter(options.properAlignmentAllowance),
new WeaklyAnchoredAlignmentChainsFilter(repetitiveRegions, options.minAnchorLength),
new ContainedAlignmentChainsFilter(),
new AmbiguousAlignmentChainsFilter(&unusedReads),
new RedundantAlignmentChainsFilter(&unusedReads),
);
logJsonDiagnostic(
"filterStage", "Input",
"readsAlignment", shouldLog(LogLevel.debug_)
? readsAlignment.toJson
: toJson(null),
"numAlignmentChains", readsAlignment.count!"!a.flags.disabled",
);
foreach (filter; filters)
applyFilter!(typeof(filter))(filter);
enforce!DentistException(
readsAlignment.canFind!"!a.flags.disabled",
"no alignment chains left after filtering",
);
}
protected void applyFilter(alias Filter)(Filter filter)
{
mixin(traceExecution);
readsAlignment = filter(readsAlignment);
logJsonDiagnostic(
"filterStage", typeof(filter).stringof,
"readsAlignment", shouldLog(LogLevel.debug_)
? readsAlignment.toJson
: toJson(null),
"numAlignmentChains", readsAlignment.count!"!a.flags.disabled",
);
}
protected PileUp[] buildPileUps()
{
mixin(traceExecution);
import dentist.commands.collectPileUps.pileups : build;
auto pileUps = build(
numReferenceContigs,
readsAlignment,
inputGaps,
options,
);
logJsonDebug("pileUps", pileUps
.map!(pileUp => toJson([
"type": toJson(pileUp.getType.to!string),
"readAlignments": pileUp.map!"a[]".array.toJson,
]))
.array
.toJson);
logJsonInfo(
"numPileUps", pileUps.length,
"numAlignmentChains", pileUps.map!"a[].length".sum,
);
return pileUps;
}
protected void writePileUps(PileUp[] pileUps)
{
mixin(traceExecution);
writePileUpsDb(pileUps, options.pileUpsFile);
}
}
|
D
|
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (C) 1984-1998 by Symantec
* Copyright (C) 2000-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/backend/cod1.d, backend/cod1.d)
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/cod1.d
*/
module dmd.backend.cod1;
version (SCPP)
version = COMPILE;
version (MARS)
version = COMPILE;
version (COMPILE)
{
import core.stdc.stdio;
import core.stdc.stdlib;
import core.stdc.string;
import dmd.backend.backend;
import dmd.backend.cc;
import dmd.backend.cdef;
import dmd.backend.code;
import dmd.backend.code_x86;
import dmd.backend.codebuilder;
import dmd.backend.mem;
import dmd.backend.el;
import dmd.backend.exh;
import dmd.backend.global;
import dmd.backend.obj;
import dmd.backend.oper;
import dmd.backend.rtlsym;
import dmd.backend.ty;
import dmd.backend.type;
import dmd.backend.xmm;
extern (C++):
nothrow:
int REGSIZE();
extern __gshared CGstate cgstate;
extern __gshared ubyte[FLMAX] segfl;
extern __gshared bool[FLMAX] stackfl;
private extern (D) uint mask(uint m) { return 1 << m; }
private void genorreg(ref CodeBuilder c, uint t, uint f) { genregs(c, 0x09, f, t); }
/* array to convert from index register to r/m field */
/* AX CX DX BX SP BP SI DI */
private __gshared const byte[8] regtorm32 = [ 0, 1, 2, 3,-1, 5, 6, 7 ];
__gshared const byte[8] regtorm = [ -1,-1,-1, 7,-1, 6, 4, 5 ];
targ_size_t paramsize(elem *e, tym_t tyf);
//void funccall(ref CodeBuilder cdb,elem *e,uint numpara,uint numalign,
// regm_t *pretregs,regm_t keepmsk, bool usefuncarg);
/*********************************
* Determine if we should leave parameter `s` in the register it
* came in, or allocate a register it using the register
* allocator.
* Params:
* s = parameter Symbol
* Returns:
* `true` if `s` is a register parameter and leave it in the register it came in
*/
bool regParamInPreg(Symbol* s)
{
//printf("regPAramInPreg %s\n", s.Sident.ptr);
return (s.Sclass == SCfastpar || s.Sclass == SCshadowreg) &&
(!(config.flags4 & CFG4optimized) || !(s.Sflags & GTregcand));
}
/**************************
* Determine if e is a 32 bit scaled index addressing mode.
* Returns:
* 0 not a scaled index addressing mode
* !=0 the value for ss in the SIB byte
*/
int isscaledindex(elem *e)
{
targ_uns ss;
assert(!I16);
while (e.Eoper == OPcomma)
e = e.EV.E2;
if (!(e.Eoper == OPshl && !e.Ecount &&
e.EV.E2.Eoper == OPconst &&
(ss = e.EV.E2.EV.Vuns) <= 3
)
)
ss = 0;
return ss;
}
/*********************************************
* Generate code for which isscaledindex(e) returned a non-zero result.
*/
/*private*/ void cdisscaledindex(ref CodeBuilder cdb,elem *e,regm_t *pidxregs,regm_t keepmsk)
{
// Load index register with result of e.EV.E1
while (e.Eoper == OPcomma)
{
regm_t r = 0;
scodelem(cdb, e.EV.E1, &r, keepmsk, true);
freenode(e);
e = e.EV.E2;
}
assert(e.Eoper == OPshl);
scodelem(cdb, e.EV.E1, pidxregs, keepmsk, true);
freenode(e.EV.E2);
freenode(e);
}
/***********************************
* Determine index if we can do two LEA instructions as a multiply.
* Returns:
* 0 can't do it
*/
enum
{
SSFLnobp = 1, /// can't have EBP in relconst
SSFLnobase1 = 2, /// no base register for first LEA
SSFLnobase = 4, /// no base register
SSFLlea = 8, /// can do it in one LEA
}
struct Ssindex
{
targ_uns product;
ubyte ss1;
ubyte ss2;
ubyte ssflags; /// SSFLxxxx
}
private __gshared const Ssindex[21] ssindex_array =
[
{ 0, 0, 0 }, // [0] is a place holder
{ 3, 1, 0, SSFLnobp | SSFLlea },
{ 5, 2, 0, SSFLnobp | SSFLlea },
{ 9, 3, 0, SSFLnobp | SSFLlea },
{ 6, 1, 1, SSFLnobase },
{ 12, 1, 2, SSFLnobase },
{ 24, 1, 3, SSFLnobase },
{ 10, 2, 1, SSFLnobase },
{ 20, 2, 2, SSFLnobase },
{ 40, 2, 3, SSFLnobase },
{ 18, 3, 1, SSFLnobase },
{ 36, 3, 2, SSFLnobase },
{ 72, 3, 3, SSFLnobase },
{ 15, 2, 1, SSFLnobp },
{ 25, 2, 2, SSFLnobp },
{ 27, 3, 1, SSFLnobp },
{ 45, 3, 2, SSFLnobp },
{ 81, 3, 3, SSFLnobp },
{ 16, 3, 1, SSFLnobase1 | SSFLnobase },
{ 32, 3, 2, SSFLnobase1 | SSFLnobase },
{ 64, 3, 3, SSFLnobase1 | SSFLnobase },
];
int ssindex(OPER op,targ_uns product)
{
if (op == OPshl)
product = 1 << product;
for (size_t i = 1; i < ssindex_array.length; i++)
{
if (ssindex_array[i].product == product)
return cast(int)i;
}
return 0;
}
/***************************************
* Build an EA of the form disp[base][index*scale].
* Input:
* c struct to fill in
* base base register (-1 if none)
* index index register (-1 if none)
* scale scale factor - 1,2,4,8
* disp displacement
*/
void buildEA(code *c,int base,int index,int scale,targ_size_t disp)
{
ubyte rm;
ubyte sib;
ubyte rex = 0;
sib = 0;
if (!I16)
{ uint ss;
assert(index != SP);
switch (scale)
{ case 1: ss = 0; break;
case 2: ss = 1; break;
case 4: ss = 2; break;
case 8: ss = 3; break;
default: assert(0);
}
if (base == -1)
{
if (index == -1)
rm = modregrm(0,0,5);
else
{
rm = modregrm(0,0,4);
sib = modregrm(ss,index & 7,5);
if (index & 8)
rex |= REX_X;
}
}
else if (index == -1)
{
if (base == SP)
{
rm = modregrm(2, 0, 4);
sib = modregrm(0, 4, SP);
}
else
{ rm = modregrm(2, 0, base & 7);
if (base & 8)
{ rex |= REX_B;
if (base == R12)
{
rm = modregrm(2, 0, 4);
sib = modregrm(0, 4, 4);
}
}
}
}
else
{
rm = modregrm(2, 0, 4);
sib = modregrm(ss,index & 7,base & 7);
if (index & 8)
rex |= REX_X;
if (base & 8)
rex |= REX_B;
}
}
else
{
// -1 AX CX DX BX SP BP SI DI
static immutable ubyte[9][9] EA16rm =
[
[ 0x06,0x09,0x09,0x09,0x87,0x09,0x86,0x84,0x85, ], // -1
[ 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, ], // AX
[ 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, ], // CX
[ 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, ], // DX
[ 0x87,0x09,0x09,0x09,0x09,0x09,0x09,0x80,0x81, ], // BX
[ 0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09,0x09, ], // SP
[ 0x86,0x09,0x09,0x09,0x09,0x09,0x09,0x82,0x83, ], // BP
[ 0x84,0x09,0x09,0x09,0x80,0x09,0x82,0x09,0x09, ], // SI
[ 0x85,0x09,0x09,0x09,0x81,0x09,0x83,0x09,0x09, ] // DI
];
assert(scale == 1);
rm = EA16rm[base + 1][index + 1];
assert(rm != 9);
}
c.Irm = rm;
c.Isib = sib;
c.Irex = rex;
c.IFL1 = FLconst;
c.IEV1.Vuns = cast(targ_uns)disp;
}
/*********************************************
* Build REX, modregrm and sib bytes
*/
uint buildModregrm(int mod, int reg, int rm)
{
uint m;
if (I16)
m = modregrm(mod, reg, rm);
else
{
if ((rm & 7) == SP && mod != 3)
m = (modregrm(0,4,SP) << 8) | modregrm(mod,reg & 7,4);
else
m = modregrm(mod,reg & 7,rm & 7);
if (reg & 8)
m |= REX_R << 16;
if (rm & 8)
m |= REX_B << 16;
}
return m;
}
/****************************************
* Generate code for eecontext
*/
void genEEcode()
{
CodeBuilder cdb;
cdb.ctor();
eecontext.EEin++;
regcon.immed.mval = 0;
regm_t retregs = 0; //regmask(eecontext.EEelem.Ety);
assert(EEStack.offset >= REGSIZE);
cod3_stackadj(cdb, cast(int)(EEStack.offset - REGSIZE));
cdb.gen1(0x50 + SI); // PUSH ESI
cdb.genadjesp(cast(int)EEStack.offset);
gencodelem(cdb, eecontext.EEelem, &retregs, false);
code *c = cdb.finish();
assignaddrc(c);
pinholeopt(c,null);
jmpaddr(c);
eecontext.EEcode = gen1(c, 0xCC); // INT 3
eecontext.EEin--;
}
/********************************************
* Gen a save/restore sequence for mask of registers.
* Params:
* regm = mask of registers to save
* cdbsave = save code appended here
* cdbrestore = restore code appended here
* Returns:
* amount of stack consumed
*/
uint gensaverestore(regm_t regm,ref CodeBuilder cdbsave,ref CodeBuilder cdbrestore)
{
//printf("gensaverestore2(%s)\n", regm_str(regm));
regm &= mBP | mES | ALLREGS | XMMREGS | mST0 | mST01;
if (!regm)
return 0;
uint stackused = 0;
code *[regm.sizeof * 8] restore;
reg_t i;
for (i = 0; regm; i++)
{
if (regm & 1)
{
code *cs2;
if (i == ES && I16)
{
stackused += REGSIZE;
cdbsave.gen1(0x06); // PUSH ES
cs2 = gen1(null, 0x07); // POP ES
}
else if (i == ST0 || i == ST01)
{
CodeBuilder cdb;
cdb.ctor();
gensaverestore87(1 << i, cdbsave, cdb);
cs2 = cdb.finish();
}
else if (i >= XMM0 || I64 || cgstate.funcarg.size)
{ uint idx;
regsave.save(cdbsave, i, &idx);
CodeBuilder cdb;
cdb.ctor();
regsave.restore(cdb, i, idx);
cs2 = cdb.finish();
}
else
{
stackused += REGSIZE;
cdbsave.gen1(0x50 + (i & 7)); // PUSH i
cs2 = gen1(null, 0x58 + (i & 7)); // POP i
if (i & 8)
{ code_orrex(cdbsave.last(), REX_B);
code_orrex(cs2, REX_B);
}
}
restore[i] = cs2;
}
else
restore[i] = null;
regm >>= 1;
}
while (i)
{
code *c = restore[--i];
if (c)
{
cdbrestore.append(c);
}
}
return stackused;
}
/****************************************
* Clean parameters off stack.
* Input:
* numpara amount to adjust stack pointer
* keepmsk mask of registers to not destroy
*/
void genstackclean(ref CodeBuilder cdb,uint numpara,regm_t keepmsk)
{
//dbg_printf("genstackclean(numpara = %d, stackclean = %d)\n",numpara,cgstate.stackclean);
if (numpara && (cgstate.stackclean || STACKALIGN >= 16))
{
/+
if (0 && // won't work if operand of scodelem
numpara == stackpush && // if this is all those pushed
needframe && // and there will be a BP
!config.windows &&
!(regcon.mvar & fregsaved) // and no registers will be pushed
)
genregs(cdb,0x89,BP,SP); // MOV SP,BP
else
+/
{
regm_t scratchm = 0;
if (numpara == REGSIZE && config.flags4 & CFG4space)
{
scratchm = ALLREGS & ~keepmsk & regcon.used & ~regcon.mvar;
}
if (scratchm)
{
reg_t r;
allocreg(cdb, &scratchm, &r, TYint);
cdb.gen1(0x58 + r); // POP r
}
else
cod3_stackadj(cdb, -numpara);
}
stackpush -= numpara;
cdb.genadjesp(-numpara);
}
}
/*********************************
* Generate code for a logical expression.
* Input:
* e elem
* jcond
* bit 1 if true then goto jump address if e
* if false then goto jump address if !e
* 2 don't call save87()
* fltarg FLcode or FLblock, flavor of target if e evaluates to jcond
* targ either code or block pointer to destination
*/
void logexp(ref CodeBuilder cdb, elem *e, int jcond, uint fltarg, code *targ)
{
//printf("logexp(e = %p, jcond = %d)\n", e, jcond);
int no87 = (jcond & 2) == 0;
docommas(cdb, &e); // scan down commas
cgstate.stackclean++;
code* c, ce;
if (!OTleaf(e.Eoper) && !e.Ecount) // if operator and not common sub
{
switch (e.Eoper)
{
case OPoror:
{
con_t regconsave;
if (jcond & 1)
{
logexp(cdb, e.EV.E1, jcond, fltarg, targ);
regconsave = regcon;
logexp(cdb, e.EV.E2, jcond, fltarg, targ);
}
else
{
code *cnop = gennop(null);
logexp(cdb, e.EV.E1, jcond | 1, FLcode, cnop);
regconsave = regcon;
logexp(cdb, e.EV.E2, jcond, fltarg, targ);
cdb.append(cnop);
}
andregcon(®consave);
freenode(e);
cgstate.stackclean--;
return;
}
case OPandand:
{
con_t regconsave;
if (jcond & 1)
{
code *cnop = gennop(null); // a dummy target address
logexp(cdb, e.EV.E1, jcond & ~1, FLcode, cnop);
regconsave = regcon;
logexp(cdb, e.EV.E2, jcond, fltarg, targ);
cdb.append(cnop);
}
else
{
logexp(cdb, e.EV.E1, jcond, fltarg, targ);
regconsave = regcon;
logexp(cdb, e.EV.E2, jcond, fltarg, targ);
}
andregcon(®consave);
freenode(e);
cgstate.stackclean--;
return;
}
case OPnot:
jcond ^= 1;
goto case OPbool;
case OPbool:
case OPs8_16:
case OPu8_16:
case OPs16_32:
case OPu16_32:
case OPs32_64:
case OPu32_64:
case OPu32_d:
case OPd_ld:
logexp(cdb, e.EV.E1, jcond, fltarg, targ);
freenode(e);
cgstate.stackclean--;
return;
case OPcond:
{
code *cnop2 = gennop(null); // addresses of start of leaves
code *cnop = gennop(null);
logexp(cdb, e.EV.E1, false, FLcode, cnop2); // eval condition
con_t regconold = regcon;
logexp(cdb, e.EV.E2.EV.E1, jcond, fltarg, targ);
genjmp(cdb, JMP, FLcode, cast(block *) cnop); // skip second leaf
con_t regconsave = regcon;
regcon = regconold;
cdb.append(cnop2);
logexp(cdb, e.EV.E2.EV.E2, jcond, fltarg, targ);
andregcon(®conold);
andregcon(®consave);
freenode(e.EV.E2);
freenode(e);
cdb.append(cnop);
cgstate.stackclean--;
return;
}
default:
break;
}
}
/* Special code for signed long compare.
* Not necessary for I64 until we do cents.
*/
if (OTrel2(e.Eoper) && // if < <= >= >
!e.Ecount &&
( (I16 && tybasic(e.EV.E1.Ety) == TYlong && tybasic(e.EV.E2.Ety) == TYlong) ||
(I32 && tybasic(e.EV.E1.Ety) == TYllong && tybasic(e.EV.E2.Ety) == TYllong))
)
{
longcmp(cdb, e, jcond != 0, fltarg, targ);
cgstate.stackclean--;
return;
}
regm_t retregs = mPSW; // return result in flags
opcode_t op = jmpopcode(e); // get jump opcode
if (!(jcond & 1))
op ^= 0x101; // toggle jump condition(s)
codelem(cdb, e, &retregs, true); // evaluate elem
if (no87)
cse_flush(cdb,no87); // flush CSE's to memory
genjmp(cdb, op, fltarg, cast(block *) targ); // generate jmp instruction
cgstate.stackclean--;
}
/******************************
* Routine to aid in setting things up for gen().
* Look for common subexpression.
* Can handle indirection operators, but not if they're common subs.
* Input:
* e -> elem where we get some of the data from
* cs -> partially filled code to add
* op = opcode
* reg = reg field of (mod reg r/m)
* offset = data to be added to Voffset field
* keepmsk = mask of registers we must not destroy
* desmsk = mask of registers destroyed by executing the instruction
* Returns:
* pointer to code generated
*/
void loadea(ref CodeBuilder cdb,elem *e,code *cs,uint op,uint reg,targ_size_t offset,
regm_t keepmsk,regm_t desmsk)
{
code* c, cg, cd;
debug
if (debugw)
printf("loadea: e=%p cs=%p op=x%x reg=%s offset=%lld keepmsk=%s desmsk=%s\n",
e, cs, op, regstring[reg], cast(ulong)offset, regm_str(keepmsk), regm_str(desmsk));
assert(e);
cs.Iflags = 0;
cs.Irex = 0;
cs.Iop = op;
tym_t tym = e.Ety;
int sz = tysize(tym);
/* Determine if location we want to get is in a register. If so, */
/* substitute the register for the EA. */
/* Note that operators don't go through this. CSE'd operators are */
/* picked up by comsub(). */
if (e.Ecount && /* if cse */
e.Ecount != e.Ecomsub && /* and cse was generated */
op != LEA && op != 0xC4 && /* and not an LEA or LES */
(op != 0xFF || reg != 3) && /* and not CALLF MEM16 */
(op & 0xFFF8) != 0xD8) // and not 8087 opcode
{
assert(OTleaf(e.Eoper)); /* can't handle this */
regm_t rm = regcon.cse.mval & ~regcon.cse.mops & ~regcon.mvar; // possible regs
if (op == 0xFF && reg == 6)
rm &= ~XMMREGS; // can't PUSH an XMM register
if (sz > REGSIZE) // value is in 2 or 4 registers
{
if (I16 && sz == 8) // value is in 4 registers
{
static immutable regm_t[4] rmask = [ mDX,mCX,mBX,mAX ];
rm &= rmask[cast(size_t)(offset >> 1)];
}
else if (offset)
rm &= mMSW; /* only high words */
else
rm &= mLSW; /* only low words */
}
for (uint i = 0; rm; i++)
{
if (mask(i) & rm)
{
if (regcon.cse.value[i] == e && // if register has elem
/* watch out for a CWD destroying DX */
!(i == DX && op == 0xF7 && desmsk & mDX))
{
/* if ES, then it can only be a load */
if (i == ES)
{
if (op != 0x8B)
break; // not a load
cs.Iop = 0x8C; /* MOV reg,ES */
cs.Irm = modregrm(3, 0, reg & 7);
if (reg & 8)
code_orrex(cs, REX_B);
}
else // XXX reg,i
{
cs.Irm = modregrm(3, reg & 7, i & 7);
if (reg & 8)
cs.Irex |= REX_R;
if (i & 8)
cs.Irex |= REX_B;
if (sz == 1 && I64 && (i >= 4 || reg >= 4))
cs.Irex |= REX;
if (I64 && (sz == 8 || sz == 16))
cs.Irex |= REX_W;
}
goto L2;
}
rm &= ~mask(i);
}
}
}
getlvalue(cdb, cs, e, keepmsk);
if (offset == REGSIZE)
getlvalue_msw(cs);
else
cs.IEV1.Voffset += offset;
if (I64)
{
if (reg >= 4 && sz == 1) // if byte register
// Can only address those 8 bit registers if a REX byte is present
cs.Irex |= REX;
if ((op & 0xFFFFFFF8) == 0xD8)
cs.Irex &= ~REX_W; // not needed for x87 ops
if (mask(reg) & XMMREGS &&
(op == LODSD || op == STOSD))
cs.Irex &= ~REX_W; // not needed for xmm ops
}
code_newreg(cs, reg); // OR in reg field
if (!I16)
{
if (reg == 6 && op == 0xFF || /* don't PUSH a word */
op == MOVZXw || op == MOVSXw || /* MOVZX/MOVSX */
(op & 0xFFF8) == 0xD8 || /* 8087 instructions */
op == LEA) /* LEA */
{
cs.Iflags &= ~CFopsize;
if (reg == 6 && op == 0xFF) // if PUSH
cs.Irex &= ~REX_W; // REX is ignored for PUSH anyway
}
}
else if ((op & 0xFFF8) == 0xD8 && ADDFWAIT())
cs.Iflags |= CFwait;
L2:
getregs(cdb, desmsk); // save any regs we destroy
/* KLUDGE! fix up DX for divide instructions */
if (op == 0xF7 && desmsk == (mAX|mDX)) /* if we need to fix DX */
{
if (reg == 7) /* if IDIV */
{
cdb.gen1(0x99); // CWD
if (I64 && sz == 8)
code_orrex(cdb.last(), REX_W);
}
else if (reg == 6) // if DIV
genregs(cdb, 0x33, DX, DX); // XOR DX,DX
}
// Eliminate MOV reg,reg
if ((cs.Iop & ~3) == 0x88 &&
(cs.Irm & 0xC7) == modregrm(3,0,reg & 7))
{
uint r = cs.Irm & 7;
if (cs.Irex & REX_B)
r |= 8;
if (r == reg)
cs.Iop = NOP;
}
// Eliminate MOV xmmreg,xmmreg
if ((cs.Iop & ~(LODSD ^ STOSS)) == LODSD && // detect LODSD, LODSS, STOSD, STOSS
(cs.Irm & 0xC7) == modregrm(3,0,reg & 7))
{
reg_t r = cs.Irm & 7;
if (cs.Irex & REX_B)
r |= 8;
if (r == (reg - XMM0))
cs.Iop = NOP;
}
cdb.gen(cs);
}
/**************************
* Get addressing mode.
*/
uint getaddrmode(regm_t idxregs)
{
uint mode;
if (I16)
{
static ubyte error() { assert(0); }
mode = (idxregs & mBX) ? modregrm(2,0,7) : /* [BX] */
(idxregs & mDI) ? modregrm(2,0,5): /* [DI] */
(idxregs & mSI) ? modregrm(2,0,4): /* [SI] */
error();
}
else
{
const reg = findreg(idxregs & (ALLREGS | mBP));
if (reg == R12)
mode = (REX_B << 16) | (modregrm(0,4,4) << 8) | modregrm(2,0,4);
else
mode = modregrmx(2,0,reg);
}
return mode;
}
void setaddrmode(code *c, regm_t idxregs)
{
uint mode = getaddrmode(idxregs);
c.Irm = mode & 0xFF;
c.Isib = (mode >> 8) & 0xFF;
c.Irex &= ~REX_B;
c.Irex |= mode >> 16;
}
/**********************************************
*/
void getlvalue_msw(code *c)
{
if (c.IFL1 == FLreg)
{
const regmsw = c.IEV1.Vsym.Sregmsw;
c.Irm = (c.Irm & ~7) | (regmsw & 7);
if (regmsw & 8)
c.Irex |= REX_B;
else
c.Irex &= ~REX_B;
}
else
c.IEV1.Voffset += REGSIZE;
}
/**********************************************
*/
void getlvalue_lsw(code *c)
{
if (c.IFL1 == FLreg)
{
const reglsw = c.IEV1.Vsym.Sreglsw;
c.Irm = (c.Irm & ~7) | (reglsw & 7);
if (reglsw & 8)
c.Irex |= REX_B;
else
c.Irex &= ~REX_B;
}
else
c.IEV1.Voffset -= REGSIZE;
}
/******************
* Compute addressing mode.
* Generate & return sequence of code (if any).
* Return in cs the info on it.
* Input:
* pcs -> where to store data about addressing mode
* e -> the lvalue elem
* keepmsk mask of registers we must not destroy or use
* if (keepmsk & RMstore), this will be only a store operation
* into the lvalue
* if (keepmsk & RMload), this will be a read operation only
*/
void getlvalue(ref CodeBuilder cdb,code *pcs,elem *e,regm_t keepmsk)
{
uint fl, f, opsave;
elem* e1, e11, e12;
bool e1isadd, e1free;
reg_t reg;
tym_t e1ty;
Symbol* s;
//printf("getlvalue(e = %p, keepmsk = %s)\n", e, regm_str(keepmsk));
//elem_print(e);
assert(e);
elem_debug(e);
if (e.Eoper == OPvar || e.Eoper == OPrelconst)
{
s = e.EV.Vsym;
fl = s.Sfl;
if (tyfloating(s.ty()))
objmod.fltused();
}
else
fl = FLoper;
pcs.IFL1 = cast(ubyte)fl;
pcs.Iflags = CFoff; /* only want offsets */
pcs.Irex = 0;
pcs.IEV1.Voffset = 0;
tym_t ty = e.Ety;
uint sz = tysize(ty);
if (tyfloating(ty))
objmod.fltused();
if (I64 && (sz == 8 || sz == 16) && !tyvector(ty))
pcs.Irex |= REX_W;
if (!I16 && sz == SHORTSIZE)
pcs.Iflags |= CFopsize;
if (ty & mTYvolatile)
pcs.Iflags |= CFvolatile;
switch (fl)
{
case FLoper:
debug
if (debugw) printf("getlvalue(e = %p, keepmsk = %s)\n", e, regm_str(keepmsk));
switch (e.Eoper)
{
case OPadd: // this way when we want to do LEA
e1 = e;
e1free = false;
e1isadd = true;
break;
case OPind:
case OPpostinc: // when doing (*p++ = ...)
case OPpostdec: // when doing (*p-- = ...)
case OPbt:
case OPbtc:
case OPbtr:
case OPbts:
case OPvecfill:
e1 = e.EV.E1;
e1free = true;
e1isadd = e1.Eoper == OPadd;
break;
default:
printf("function: %s\n", funcsym_p.Sident.ptr);
elem_print(e);
assert(0);
}
e1ty = tybasic(e1.Ety);
if (e1isadd)
{
e12 = e1.EV.E2;
e11 = e1.EV.E1;
}
/* First see if we can replace *(e+&v) with
* MOV idxreg,e
* EA = [ES:] &v+idxreg
*/
f = FLconst;
/* Is address of `s` relative to RIP ?
*/
static bool relativeToRIP(Symbol* s)
{
if (!I64)
return false;
if (config.exe == EX_WIN64)
return true;
if (config.flags3 & CFG3pie)
{
if (s.Sfl == FLtlsdata || s.ty() & mTYthread)
{
if (s.Sclass == SCglobal || s.Sclass == SCstatic || s.Sclass == SClocstat)
return false;
}
return true;
}
else
return (config.flags3 & CFG3pic) != 0;
}
if (e1isadd &&
((e12.Eoper == OPrelconst &&
!relativeToRIP(e12.EV.Vsym) &&
(f = el_fl(e12)) != FLfardata
) ||
(e12.Eoper == OPconst && !I16 && !e1.Ecount && (!I64 || el_signx32(e12)))) &&
e1.Ecount == e1.Ecomsub &&
(!e1.Ecount || (~keepmsk & ALLREGS & mMSW) || (e1ty != TYfptr && e1ty != TYhptr)) &&
tysize(e11.Ety) == REGSIZE
)
{
uint t; /* component of r/m field */
int ss;
int ssi;
if (e12.Eoper == OPrelconst)
f = el_fl(e12);
/*assert(datafl[f]);*/ /* what if addr of func? */
if (!I16)
{ /* Any register can be an index register */
regm_t idxregs = allregs & ~keepmsk;
assert(idxregs);
/* See if e1.EV.E1 can be a scaled index */
ss = isscaledindex(e11);
if (ss)
{
/* Load index register with result of e11.EV.E1 */
cdisscaledindex(cdb, e11, &idxregs, keepmsk);
reg = findreg(idxregs);
{
t = stackfl[f] ? 2 : 0;
pcs.Irm = modregrm(t, 0, 4);
pcs.Isib = modregrm(ss, reg & 7, 5);
if (reg & 8)
pcs.Irex |= REX_X;
}
}
else if ((e11.Eoper == OPmul || e11.Eoper == OPshl) &&
!e11.Ecount &&
e11.EV.E2.Eoper == OPconst &&
(ssi = ssindex(e11.Eoper, e11.EV.E2.EV.Vuns)) != 0
)
{
regm_t scratchm;
char ssflags = ssindex_array[ssi].ssflags;
if (ssflags & SSFLnobp && stackfl[f])
goto L6;
// Load index register with result of e11.EV.E1
scodelem(cdb, e11.EV.E1, &idxregs, keepmsk, true);
reg = findreg(idxregs);
int ss1 = ssindex_array[ssi].ss1;
if (ssflags & SSFLlea)
{
assert(!stackfl[f]);
pcs.Irm = modregrm(2,0,4);
pcs.Isib = modregrm(ss1, reg & 7, reg & 7);
if (reg & 8)
pcs.Irex |= REX_X | REX_B;
}
else
{
int rbase;
reg_t r;
scratchm = ALLREGS & ~keepmsk;
allocreg(cdb, &scratchm, &r, TYint);
if (ssflags & SSFLnobase1)
{
t = 0;
rbase = 5;
}
else
{
t = 0;
rbase = reg;
if (rbase == BP || rbase == R13)
{
static immutable uint[4] imm32 = [1+1,2+1,4+1,8+1];
// IMUL r,BP,imm32
cdb.genc2(0x69, modregxrmx(3, r, rbase), imm32[ss1]);
goto L7;
}
}
cdb.gen2sib(LEA, modregxrm(t, r, 4), modregrm(ss1, reg & 7 ,rbase & 7));
if (reg & 8)
code_orrex(cdb.last(), REX_X);
if (rbase & 8)
code_orrex(cdb.last(), REX_B);
if (I64)
code_orrex(cdb.last(), REX_W);
if (ssflags & SSFLnobase1)
{
cdb.last().IFL1 = FLconst;
cdb.last().IEV1.Vuns = 0;
}
L7:
if (ssflags & SSFLnobase)
{
t = stackfl[f] ? 2 : 0;
rbase = 5;
}
else
{
t = 2;
rbase = r;
assert(rbase != BP);
}
pcs.Irm = modregrm(t, 0, 4);
pcs.Isib = modregrm(ssindex_array[ssi].ss2, r & 7, rbase & 7);
if (r & 8)
pcs.Irex |= REX_X;
if (rbase & 8)
pcs.Irex |= REX_B;
}
freenode(e11.EV.E2);
freenode(e11);
}
else
{
L6:
/* Load index register with result of e11 */
scodelem(cdb, e11, &idxregs, keepmsk, true);
setaddrmode(pcs, idxregs);
if (stackfl[f]) /* if we need [EBP] too */
{
uint idx = pcs.Irm & 7;
if (pcs.Irex & REX_B)
pcs.Irex = (pcs.Irex & ~REX_B) | REX_X;
pcs.Isib = modregrm(0, idx, BP);
pcs.Irm = modregrm(2, 0, 4);
}
}
}
else
{
regm_t idxregs = IDXREGS & ~keepmsk; /* only these can be index regs */
assert(idxregs);
if (stackfl[f]) /* if stack data type */
{
idxregs &= mSI | mDI; /* BX can't index off stack */
if (!idxregs) goto L1; /* index regs aren't avail */
t = 6; /* [BP+SI+disp] */
}
else
t = 0; /* [SI + disp] */
scodelem(cdb, e11, &idxregs, keepmsk, true); // load idx reg
pcs.Irm = cast(ubyte)(getaddrmode(idxregs) ^ t);
}
if (f == FLpara)
refparam = true;
else if (f == FLauto || f == FLbprel || f == FLfltreg || f == FLfast)
reflocal = true;
else if (f == FLcsdata || tybasic(e12.Ety) == TYcptr)
pcs.Iflags |= CFcs;
else
assert(f != FLreg);
pcs.IFL1 = cast(ubyte)f;
if (f != FLconst)
pcs.IEV1.Vsym = e12.EV.Vsym;
pcs.IEV1.Voffset = e12.EV.Voffset; /* += ??? */
/* If e1 is a CSE, we must generate an addressing mode */
/* but also leave EA in registers so others can use it */
if (e1.Ecount)
{
uint flagsave;
regm_t idxregs = IDXREGS & ~keepmsk;
allocreg(cdb, &idxregs, ®, TYoffset);
/* If desired result is a far pointer, we'll have */
/* to load another register with the segment of v */
if (e1ty == TYfptr)
{
reg_t msreg;
idxregs |= mMSW & ALLREGS & ~keepmsk;
allocreg(cdb, &idxregs, &msreg, TYfptr);
msreg = findregmsw(idxregs);
/* MOV msreg,segreg */
genregs(cdb, 0x8C, segfl[f], msreg);
}
opsave = pcs.Iop;
flagsave = pcs.Iflags;
ubyte rexsave = pcs.Irex;
pcs.Iop = LEA;
code_newreg(pcs, reg);
if (!I16)
pcs.Iflags &= ~CFopsize;
if (I64)
pcs.Irex |= REX_W;
cdb.gen(pcs); // LEA idxreg,EA
cssave(e1,idxregs,true);
if (!I16)
{
pcs.Iflags = flagsave;
pcs.Irex = rexsave;
}
if (stackfl[f] && (config.wflags & WFssneds)) // if pointer into stack
pcs.Iflags |= CFss; // add SS: override
pcs.Iop = opsave;
pcs.IFL1 = FLoffset;
pcs.IEV1.Vuns = 0;
setaddrmode(pcs, idxregs);
}
freenode(e12);
if (e1free)
freenode(e1);
goto Lptr;
}
L1:
/* The rest of the cases could be a far pointer */
regm_t idxregs;
idxregs = (I16 ? IDXREGS : allregs) & ~keepmsk; // only these can be index regs
assert(idxregs);
if (!I16 &&
(sz == REGSIZE || (I64 && sz == 4)) &&
keepmsk & RMstore)
idxregs |= regcon.mvar;
switch (e1ty)
{
case TYfptr: /* if far pointer */
case TYhptr:
idxregs = (mES | IDXREGS) & ~keepmsk; // need segment too
assert(idxregs & mES);
pcs.Iflags |= CFes; /* ES segment override */
break;
case TYsptr: /* if pointer to stack */
if (config.wflags & WFssneds) // if SS != DS
pcs.Iflags |= CFss; /* then need SS: override */
break;
case TYfgPtr:
if (I32)
pcs.Iflags |= CFgs;
else if (I64)
pcs.Iflags |= CFfs;
else
assert(0);
break;
case TYcptr: /* if pointer to code */
pcs.Iflags |= CFcs; /* then need CS: override */
break;
default:
break;
}
pcs.IFL1 = FLoffset;
pcs.IEV1.Vuns = 0;
/* see if we can replace *(e+c) with
* MOV idxreg,e
* [MOV ES,segment]
* EA = [ES:]c[idxreg]
*/
if (e1isadd && e12.Eoper == OPconst &&
(!I64 || el_signx32(e12)) &&
(tysize(e12.Ety) == REGSIZE || (I64 && tysize(e12.Ety) == 4)) &&
(!e1.Ecount || !e1free)
)
{
int ss;
pcs.IEV1.Vuns = e12.EV.Vuns;
freenode(e12);
if (e1free) freenode(e1);
if (!I16 && e11.Eoper == OPadd && !e11.Ecount &&
tysize(e11.Ety) == REGSIZE)
{
e12 = e11.EV.E2;
e11 = e11.EV.E1;
e1 = e1.EV.E1;
e1free = true;
goto L4;
}
if (!I16 && (ss = isscaledindex(e11)) != 0)
{ // (v * scale) + const
cdisscaledindex(cdb, e11, &idxregs, keepmsk);
reg = findreg(idxregs);
pcs.Irm = modregrm(0, 0, 4);
pcs.Isib = modregrm(ss, reg & 7, 5);
if (reg & 8)
pcs.Irex |= REX_X;
}
else
{
scodelem(cdb, e11, &idxregs, keepmsk, true); // load index reg
setaddrmode(pcs, idxregs);
}
goto Lptr;
}
/* Look for *(v1 + v2)
* EA = [v1][v2]
*/
if (!I16 && e1isadd && (!e1.Ecount || !e1free) &&
(_tysize[e1ty] == REGSIZE || (I64 && _tysize[e1ty] == 4)))
{
L4:
regm_t idxregs2;
uint base, index;
// Look for *(v1 + v2 << scale)
int ss = isscaledindex(e12);
if (ss)
{
scodelem(cdb, e11, &idxregs, keepmsk, true);
idxregs2 = allregs & ~(idxregs | keepmsk);
cdisscaledindex(cdb, e12, &idxregs2, keepmsk | idxregs);
}
// Look for *(v1 << scale + v2)
else if ((ss = isscaledindex(e11)) != 0)
{
idxregs2 = idxregs;
cdisscaledindex(cdb, e11, &idxregs2, keepmsk);
idxregs = allregs & ~(idxregs2 | keepmsk);
scodelem(cdb, e12, &idxregs, keepmsk | idxregs2, true);
}
// Look for *(((v1 << scale) + c1) + v2)
else if (e11.Eoper == OPadd && !e11.Ecount &&
e11.EV.E2.Eoper == OPconst &&
(ss = isscaledindex(e11.EV.E1)) != 0
)
{
pcs.IEV1.Vuns = e11.EV.E2.EV.Vuns;
idxregs2 = idxregs;
cdisscaledindex(cdb, e11.EV.E1, &idxregs2, keepmsk);
idxregs = allregs & ~(idxregs2 | keepmsk);
scodelem(cdb, e12, &idxregs, keepmsk | idxregs2, true);
freenode(e11.EV.E2);
freenode(e11);
}
else
{
scodelem(cdb, e11, &idxregs, keepmsk, true);
idxregs2 = allregs & ~(idxregs | keepmsk);
scodelem(cdb, e12, &idxregs2, keepmsk | idxregs, true);
}
base = findreg(idxregs);
index = findreg(idxregs2);
pcs.Irm = modregrm(2, 0, 4);
pcs.Isib = modregrm(ss, index & 7, base & 7);
if (index & 8)
pcs.Irex |= REX_X;
if (base & 8)
pcs.Irex |= REX_B;
if (e1free)
freenode(e1);
goto Lptr;
}
/* give up and replace *e1 with
* MOV idxreg,e
* EA = 0[idxreg]
* pinholeopt() will usually correct the 0, we need it in case
* we have a pointer to a long and need an offset to the second
* word.
*/
assert(e1free);
scodelem(cdb, e1, &idxregs, keepmsk, true); // load index register
setaddrmode(pcs, idxregs);
Lptr:
if (config.flags3 & CFG3ptrchk)
cod3_ptrchk(cdb, pcs, keepmsk); // validate pointer code
break;
case FLdatseg:
assert(0);
static if (0)
{
pcs.Irm = modregrm(0, 0, BPRM);
pcs.IEVpointer1 = e.EVpointer;
break;
}
case FLfltreg:
reflocal = true;
pcs.Irm = modregrm(2, 0, BPRM);
pcs.IEV1.Vint = 0;
break;
case FLreg:
goto L2;
case FLpara:
if (s.Sclass == SCshadowreg)
goto case FLfast;
Lpara:
refparam = true;
pcs.Irm = modregrm(2, 0, BPRM);
goto L2;
case FLauto:
case FLfast:
if (regParamInPreg(s))
{
regm_t pregm = s.Spregm();
/* See if the parameter is still hanging about in a register,
* and so can we load from that register instead.
*/
if (regcon.params & pregm /*&& s.Spreg2 == NOREG && !(pregm & XMMREGS)*/)
{
if (keepmsk & RMload && !anyiasm)
{
auto voffset = e.EV.Voffset;
if (sz <= REGSIZE)
{
const reg_t preg = (voffset >= REGSIZE) ? s.Spreg2 : s.Spreg;
if (voffset >= REGSIZE)
voffset -= REGSIZE;
/* preg could be NOREG if it's a variadic function and we're
* in Win64 shadow regs and we're offsetting to get to the start
* of the variadic args.
*/
if (preg != NOREG && regcon.params & mask(preg))
{
//printf("sz %d, preg %s, Voffset %d\n", cast(int)sz, regm_str(mask(preg)), cast(int)voffset);
if (mask(preg) & XMMREGS && sz != REGSIZE)
{
/* The following fails with this from std.math on Linux64:
void main()
{
alias T = float;
T x = T.infinity;
T e = T.infinity;
int eptr;
T v = frexp(x, eptr);
assert(isIdentical(e, v));
}
*/
}
else if (voffset == 0)
{
pcs.Irm = modregrm(3, 0, preg & 7);
if (preg & 8)
pcs.Irex |= REX_B;
if (I64 && sz == 1 && preg >= 4)
pcs.Irex |= REX;
regcon.used |= mask(preg);
break;
}
else if (voffset == 1 && sz == 1 && preg < 4)
{
pcs.Irm = modregrm(3, 0, 4 | preg); // use H register
regcon.used |= mask(preg);
break;
}
}
}
}
else
regcon.params &= ~pregm;
}
}
if (s.Sclass == SCshadowreg)
goto Lpara;
goto case FLbprel;
case FLbprel:
reflocal = true;
pcs.Irm = modregrm(2, 0, BPRM);
goto L2;
case FLextern:
if (s.Sident[0] == '_' && memcmp(s.Sident.ptr + 1,"tls_array".ptr,10) == 0)
{
static if (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
{
assert(0);
}
else static if (TARGET_WINDOS)
{
if (I64)
{ // GS:[88]
pcs.Irm = modregrm(0, 0, 4);
pcs.Isib = modregrm(0, 4, 5); // don't use [RIP] addressing
pcs.IFL1 = FLconst;
pcs.IEV1.Vuns = 88;
pcs.Iflags = CFgs;
pcs.Irex |= REX_W;
break;
}
else
{
pcs.Iflags |= CFfs; // add FS: override
}
}
}
if (s.ty() & mTYcs && cast(bool) LARGECODE)
goto Lfardata;
goto L3;
case FLdata:
case FLudata:
case FLcsdata:
case FLgot:
case FLgotoff:
static if (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
{
case FLtlsdata:
}
L3:
pcs.Irm = modregrm(0, 0, BPRM);
L2:
if (fl == FLreg)
{
//printf("test: FLreg, %s %d regcon.mvar = %s\n",
// s.Sident.ptr, cast(int)e.EV.Voffset, regm_str(regcon.mvar));
if (!(s.Sregm & regcon.mvar))
symbol_print(s);
assert(s.Sregm & regcon.mvar);
/* Attempting to paint a float as an integer or an integer as a float
* will cause serious problems since the EA is loaded separatedly from
* the opcode. The only way to deal with this is to prevent enregistering
* such variables.
*/
if (tyxmmreg(ty) && !(s.Sregm & XMMREGS) ||
!tyxmmreg(ty) && (s.Sregm & XMMREGS))
cgreg_unregister(s.Sregm);
if (
s.Sclass == SCregpar ||
s.Sclass == SCparameter)
{ refparam = true;
reflocal = true; // kludge to set up prolog
}
pcs.Irm = modregrm(3, 0, s.Sreglsw & 7);
if (s.Sreglsw & 8)
pcs.Irex |= REX_B;
if (e.EV.Voffset == REGSIZE && sz == REGSIZE)
{
pcs.Irm = modregrm(3, 0, s.Sregmsw & 7);
if (s.Sregmsw & 8)
pcs.Irex |= REX_B;
else
pcs.Irex &= ~REX_B;
}
else if (e.EV.Voffset == 1 && sz == 1)
{
assert(s.Sregm & BYTEREGS);
assert(s.Sreglsw < 4);
pcs.Irm |= 4; // use 2nd byte of register
}
else
{
assert(!e.EV.Voffset);
if (I64 && sz == 1 && s.Sreglsw >= 4)
pcs.Irex |= REX;
}
}
else if (s.ty() & mTYcs && !(fl == FLextern && LARGECODE))
{
pcs.Iflags |= CFcs | CFoff;
}
if (config.flags3 & CFG3pic &&
(fl == FLtlsdata || s.ty() & mTYthread))
{
if (I32)
{
if (config.flags3 & CFG3pie)
{
pcs.Iflags |= CFgs;
}
}
else if (I64)
{
if (config.flags3 & CFG3pie &&
(s.Sclass == SCglobal || s.Sclass == SCstatic || s.Sclass == SClocstat))
{
pcs.Iflags |= CFfs;
pcs.Irm = modregrm(0, 0, 4);
pcs.Isib = modregrm(0, 4, 5); // don't use [RIP] addressing
}
else
{
pcs.Iflags |= CFopsize;
pcs.Irex = 0x48;
}
}
}
pcs.IEV1.Vsym = s;
pcs.IEV1.Voffset = e.EV.Voffset;
if (sz == 1)
{ /* Don't use SI or DI for this variable */
s.Sflags |= GTbyte;
if (I64 ? e.EV.Voffset > 0 : e.EV.Voffset > 1)
{
debug if (debugr) printf("'%s' not reg cand due to byte offset\n", s.Sident.ptr);
s.Sflags &= ~GTregcand;
}
}
else if (e.EV.Voffset || sz > tysize(s.Stype.Tty))
{
debug if (debugr) printf("'%s' not reg cand due to offset or size\n", s.Sident.ptr);
s.Sflags &= ~GTregcand;
}
if (config.fpxmmregs && tyfloating(s.ty()) && !tyfloating(ty))
{
debug if (debugr) printf("'%s' not reg cand due to mix float and int\n", s.Sident.ptr);
// Can't successfully mix XMM register variables accessed as integers
s.Sflags &= ~GTregcand;
}
if (!(keepmsk & RMstore)) // if not store only
s.Sflags |= SFLread; // assume we are doing a read
break;
case FLpseudo:
version (MARS)
{
{
getregs(cdb, mask(s.Sreglsw));
pcs.Irm = modregrm(3, 0, s.Sreglsw & 7);
if (s.Sreglsw & 8)
pcs.Irex |= REX_B;
if (e.EV.Voffset == 1 && sz == 1)
{ assert(s.Sregm & BYTEREGS);
assert(s.Sreglsw < 4);
pcs.Irm |= 4; // use 2nd byte of register
}
else
{ assert(!e.EV.Voffset);
if (I64 && sz == 1 && s.Sreglsw >= 4)
pcs.Irex |= REX;
}
break;
}
}
else
{
{
uint u = s.Sreglsw;
getregs(cdb, pseudomask[u]);
pcs.Irm = modregrm(3, 0, pseudoreg[u] & 7);
break;
}
}
case FLfardata:
case FLfunc: /* reading from code seg */
if (config.exe & EX_flat)
goto L3;
Lfardata:
{
regm_t regm = ALLREGS & ~keepmsk; // need scratch register
allocreg(cdb, ®m, ®, TYint);
getregs(cdb,mES);
// MOV mreg,seg of symbol
cdb.gencs(0xB8 + reg, 0, FLextern, s);
cdb.last().Iflags = CFseg;
cdb.gen2(0x8E, modregrmx(3, 0, reg)); // MOV ES,reg
pcs.Iflags |= CFes | CFoff; /* ES segment override */
goto L3;
}
case FLstack:
assert(!I16);
pcs.Irm = modregrm(2, 0, 4);
pcs.Isib = modregrm(0, 4, SP);
pcs.IEV1.Vsym = s;
pcs.IEV1.Voffset = e.EV.Voffset;
break;
default:
WRFL(cast(FL)fl);
symbol_print(s);
assert(0);
}
}
/*****************************
* Given an opcode and EA in cs, generate code
* for each floating register in turn.
* Input:
* tym either TYdouble or TYfloat
*/
void fltregs(ref CodeBuilder cdb, code* pcs, tym_t tym)
{
assert(!I64);
tym = tybasic(tym);
if (I32)
{
getregs(cdb,(tym == TYfloat) ? mAX : mAX | mDX);
if (tym != TYfloat)
{
pcs.IEV1.Voffset += REGSIZE;
NEWREG(pcs.Irm,DX);
cdb.gen(pcs);
pcs.IEV1.Voffset -= REGSIZE;
}
NEWREG(pcs.Irm,AX);
cdb.gen(pcs);
}
else
{
getregs(cdb,(tym == TYfloat) ? FLOATREGS_16 : DOUBLEREGS_16);
pcs.IEV1.Voffset += (tym == TYfloat) ? 2 : 6;
if (tym == TYfloat)
NEWREG(pcs.Irm, DX);
else
NEWREG(pcs.Irm, AX);
cdb.gen(pcs);
pcs.IEV1.Voffset -= 2;
if (tym == TYfloat)
NEWREG(pcs.Irm, AX);
else
NEWREG(pcs.Irm, BX);
cdb.gen(pcs);
if (tym != TYfloat)
{
pcs.IEV1.Voffset -= 2;
NEWREG(pcs.Irm, CX);
cdb.gen(pcs);
pcs.IEV1.Voffset -= 2; /* note that exit is with Voffset unaltered */
NEWREG(pcs.Irm, DX);
cdb.gen(pcs);
}
}
}
/*****************************
* Given a result in registers, test it for true or false.
* Will fail if TYfptr and the reg is ES!
* If saveflag is true, preserve the contents of the
* registers.
*/
void tstresult(ref CodeBuilder cdb, regm_t regm, tym_t tym, uint saveflag)
{
reg_t scrreg; // scratch register
regm_t scrregm;
//if (!(regm & (mBP | ALLREGS)))
//printf("tstresult(regm = %s, tym = x%x, saveflag = %d)\n",
//regm_str(regm),tym,saveflag);
assert(regm & (XMMREGS | mBP | ALLREGS));
tym = tybasic(tym);
reg_t reg = findreg(regm);
uint sz = _tysize[tym];
if (sz == 1)
{
assert(regm & BYTEREGS);
genregs(cdb, 0x84, reg, reg); // TEST regL,regL
if (I64 && reg >= 4)
code_orrex(cdb.last(), REX);
return;
}
if (regm & XMMREGS)
{
reg_t xreg;
regm_t xregs = XMMREGS & ~regm;
allocreg(cdb,&xregs, &xreg, TYdouble);
opcode_t op = 0;
if (tym == TYdouble || tym == TYidouble || tym == TYcdouble)
op = 0x660000;
cdb.gen2(op | 0x0F57, modregrm(3, xreg-XMM0, xreg-XMM0)); // XORPS xreg,xreg
cdb.gen2(op | 0x0F2E, modregrm(3, xreg-XMM0, reg-XMM0)); // UCOMISS xreg,reg
if (tym == TYcfloat || tym == TYcdouble)
{ code *cnop = gennop(null);
genjmp(cdb, JNE, FLcode, cast(block *) cnop); // JNE L1
genjmp(cdb, JP, FLcode, cast(block *) cnop); // JP L1
reg = findreg(regm & ~mask(reg));
cdb.gen2(op | 0x0F2E, modregrm(3, xreg-XMM0, reg-XMM0)); // UCOMISS xreg,reg
cdb.append(cnop);
}
return;
}
if (sz <= REGSIZE)
{
if (!I16)
{
if (tym == TYfloat)
{
if (saveflag)
{
scrregm = allregs & ~regm; // possible scratch regs
allocreg(cdb, &scrregm, &scrreg, TYoffset); // allocate scratch reg
genmovreg(cdb, scrreg, reg); // MOV scrreg,msreg
reg = scrreg;
}
getregs(cdb, mask(reg));
cdb.gen2(0xD1, modregrmx(3, 4, reg)); // SHL reg,1
return;
}
gentstreg(cdb,reg); // TEST reg,reg
if (sz == SHORTSIZE)
cdb.last().Iflags |= CFopsize; // 16 bit operands
else if (sz == 8)
code_orrex(cdb.last(), REX_W);
}
else
gentstreg(cdb, reg); // TEST reg,reg
return;
}
if (saveflag || tyfv(tym))
{
L1:
scrregm = ALLREGS & ~regm; // possible scratch regs
allocreg(cdb, &scrregm, &scrreg, TYoffset); // allocate scratch reg
if (I32 || sz == REGSIZE * 2)
{
assert(regm & mMSW && regm & mLSW);
reg = findregmsw(regm);
if (I32)
{
if (tyfv(tym))
genregs(cdb, MOVZXw, scrreg, reg); // MOVZX scrreg,msreg
else
{
genmovreg(cdb, scrreg, reg); // MOV scrreg,msreg
if (tym == TYdouble || tym == TYdouble_alias)
cdb.gen2(0xD1, modregrm(3, 4, scrreg)); // SHL scrreg,1
}
}
else
{
genmovreg(cdb, scrreg, reg); // MOV scrreg,msreg
if (tym == TYfloat)
cdb.gen2(0xD1, modregrm(3, 4, scrreg)); // SHL scrreg,1
}
reg = findreglsw(regm);
genorreg(cdb, scrreg, reg); // OR scrreg,lsreg
}
else if (sz == 8)
{
// !I32
genmovreg(cdb, scrreg, AX); // MOV scrreg,AX
if (tym == TYdouble || tym == TYdouble_alias)
cdb.gen2(0xD1 ,modregrm(3, 4, scrreg)); // SHL scrreg,1
genorreg(cdb, scrreg, BX); // OR scrreg,BX
genorreg(cdb, scrreg, CX); // OR scrreg,CX
genorreg(cdb, scrreg, DX); // OR scrreg,DX
}
else
assert(0);
}
else
{
if (I32 || sz == REGSIZE * 2)
{
// can't test ES:LSW for 0
assert(regm & mMSW & ALLREGS && regm & (mLSW | mBP));
reg = findregmsw(regm);
if (regcon.mvar & mask(reg)) // if register variable
goto L1; // don't trash it
getregs(cdb, mask(reg)); // we're going to trash reg
if (tyfloating(tym) && sz == 2 * _tysize[TYint])
cdb.gen2(0xD1, modregrm(3 ,4, reg)); // SHL reg,1
genorreg(cdb, reg, findreglsw(regm)); // OR reg,reg+1
if (I64)
code_orrex(cdb.last(), REX_W);
}
else if (sz == 8)
{ assert(regm == DOUBLEREGS_16);
getregs(cdb,mAX); // allocate AX
if (tym == TYdouble || tym == TYdouble_alias)
cdb.gen2(0xD1, modregrm(3, 4, AX)); // SHL AX,1
genorreg(cdb, AX, BX); // OR AX,BX
genorreg(cdb, AX, CX); // OR AX,CX
genorreg(cdb, AX, DX); // OR AX,DX
}
else
assert(0);
}
code_orflag(cdb.last(),CFpsw);
}
/******************************
* Given the result of an expression is in retregs,
* generate necessary code to return result in *pretregs.
*/
void fixresult(ref CodeBuilder cdb, elem *e, regm_t retregs, regm_t *pretregs)
{
//printf("fixresult(e = %p, retregs = %s, *pretregs = %s)\n",e,regm_str(retregs),regm_str(*pretregs));
if (*pretregs == 0) return; // if don't want result
assert(e && retregs); // need something to work with
regm_t forccs = *pretregs & mPSW;
regm_t forregs = *pretregs & (mST01 | mST0 | mBP | ALLREGS | mES | mSTACK | XMMREGS);
tym_t tym = tybasic(e.Ety);
if (tym == TYstruct)
{
if (e.Eoper == OPpair || e.Eoper == OPrpair)
{
if (I64)
tym = TYucent;
else
tym = TYullong;
}
else
// Hack to support cdstreq()
tym = (forregs & mMSW) ? TYfptr : TYnptr;
}
int sz = _tysize[tym];
if (sz == 1)
{
assert(retregs & BYTEREGS);
const reg = findreg(retregs);
if (e.Eoper == OPvar &&
e.EV.Voffset == 1 &&
e.EV.Vsym.Sfl == FLreg)
{
assert(reg < 4);
if (forccs)
cdb.gen2(0x84, modregrm(3, reg | 4, reg | 4)); // TEST regH,regH
forccs = 0;
}
}
reg_t reg,rreg;
if ((retregs & forregs) == retregs) // if already in right registers
*pretregs = retregs;
else if (forregs) // if return the result in registers
{
if ((forregs | retregs) & (mST01 | mST0))
{
fixresult87(cdb, e, retregs, pretregs);
return;
}
uint opsflag = false;
if (I16 && sz == 8)
{
if (forregs & mSTACK)
{
assert(retregs == DOUBLEREGS_16);
// Push floating regs
cdb.gen1(0x50 + AX);
cdb.gen1(0x50 + BX);
cdb.gen1(0x50 + CX);
cdb.gen1(0x50 + DX);
stackpush += DOUBLESIZE;
}
else if (retregs & mSTACK)
{
assert(forregs == DOUBLEREGS_16);
// Pop floating regs
getregs(cdb,forregs);
cdb.gen1(0x58 + DX);
cdb.gen1(0x58 + CX);
cdb.gen1(0x58 + BX);
cdb.gen1(0x58 + AX);
stackpush -= DOUBLESIZE;
retregs = DOUBLEREGS_16; // for tstresult() below
}
else
{
debug
printf("retregs = %s, forregs = %s\n", regm_str(retregs), regm_str(forregs)),
assert(0);
}
if (!OTleaf(e.Eoper))
opsflag = true;
}
else
{
allocreg(cdb, pretregs, &rreg, tym); // allocate return regs
if (retregs & XMMREGS)
{
reg = findreg(retregs & XMMREGS);
// MOVSD floatreg, XMM?
cdb.genxmmreg(xmmstore(tym), reg, 0, tym);
if (mask(rreg) & XMMREGS)
// MOVSD XMM?, floatreg
cdb.genxmmreg(xmmload(tym), rreg, 0, tym);
else
{
// MOV rreg,floatreg
cdb.genfltreg(0x8B,rreg,0);
if (sz == 8)
{
if (I32)
{
rreg = findregmsw(*pretregs);
cdb.genfltreg(0x8B, rreg,4);
}
else
code_orrex(cdb.last(),REX_W);
}
}
}
else if (forregs & XMMREGS)
{
reg = findreg(retregs & (mBP | ALLREGS));
switch (sz)
{
case 4:
cdb.gen2(LODD, modregxrmx(3, rreg - XMM0, reg)); // MOVD xmm,reg
break;
case 8:
if (I32)
{
cdb.genfltreg(0x89, reg, 0);
reg = findregmsw(retregs);
cdb.genfltreg(0x89, reg, 4);
cdb.genxmmreg(xmmload(tym), rreg, 0, tym); // MOVQ xmm,mem
}
else
{
cdb.gen2(LODD /* [sic!] */, modregxrmx(3, rreg - XMM0, reg));
code_orrex(cdb.last(), REX_W); // MOVQ xmm,reg
}
break;
default:
assert(false);
}
checkSetVex(cdb.last(), tym);
}
else if (sz > REGSIZE)
{
uint msreg = findregmsw(retregs);
uint lsreg = findreglsw(retregs);
uint msrreg = findregmsw(*pretregs);
uint lsrreg = findreglsw(*pretregs);
genmovreg(cdb, msrreg, msreg); // MOV msrreg,msreg
genmovreg(cdb, lsrreg, lsreg); // MOV lsrreg,lsreg
}
else
{
assert(!(retregs & XMMREGS));
assert(!(forregs & XMMREGS));
reg = findreg(retregs & (mBP | ALLREGS));
if (I64 && sz <= 4)
genregs(cdb, 0x89, reg, rreg); // only move 32 bits, and zero the top 32 bits
else
genmovreg(cdb, rreg, reg); // MOV rreg,reg
}
}
cssave(e,retregs | *pretregs,opsflag);
// Commented out due to Bugzilla 8840
//forregs = 0; // don't care about result in reg cuz real result is in rreg
retregs = *pretregs & ~mPSW;
}
if (forccs) // if return result in flags
{
if (retregs & (mST01 | mST0))
fixresult87(cdb, e, retregs, pretregs);
else
tstresult(cdb, retregs, tym, forregs);
}
}
/*******************************
* Extra information about each CLIB runtime library function.
*/
enum
{
INF32 = 1, /// if 32 bit only
INFfloat = 2, /// if this is floating point
INFwkdone = 4, /// if weak extern is already done
INF64 = 8, /// if 64 bit only
INFpushebx = 0x10, /// push EBX before load_localgot()
INFpusheabcdx = 0x20, /// pass EAX/EBX/ECX/EDX on stack, callee does ret 16
}
struct ClibInfo
{
regm_t retregs16; /* registers that 16 bit result is returned in */
regm_t retregs32; /* registers that 32 bit result is returned in */
ubyte pop; // # of bytes popped off of stack upon return
ubyte flags; /// INFxxx
byte push87; // # of pushes onto the 8087 stack
byte pop87; // # of pops off of the 8087 stack
}
__gshared int clib_inited = false; // true if initialized
Symbol* symboly(const(char)* name, regm_t desregs)
{
Symbol *s = symbol_calloc(name);
s.Stype = tsclib;
s.Sclass = SCextern;
s.Sfl = FLfunc;
s.Ssymnum = 0;
s.Sregsaved = ~desregs & (mBP | mES | ALLREGS);
return s;
}
void getClibInfo(uint clib, Symbol** ps, ClibInfo** pinfo)
{
__gshared Symbol*[CLIB.MAX] clibsyms;
__gshared ClibInfo[CLIB.MAX] clibinfo;
if (!clib_inited)
{
for (size_t i = 0; i < CLIB.MAX; ++i)
{
Symbol* s = clibsyms[i];
if (s)
{
s.Sxtrnnum = 0;
s.Stypidx = 0;
clibinfo[i].flags &= ~INFwkdone;
}
}
clib_inited = true;
}
const uint ex_unix = (EX_LINUX | EX_LINUX64 |
EX_OSX | EX_OSX64 |
EX_FREEBSD | EX_FREEBSD64 |
EX_OPENBSD | EX_OPENBSD64 |
EX_DRAGONFLYBSD64 |
EX_SOLARIS | EX_SOLARIS64);
ClibInfo* cinfo = &clibinfo[clib];
Symbol* s = clibsyms[clib];
if (!s)
{
switch (clib)
{
case CLIB.lcmp:
{
const(char)* name = (config.exe & ex_unix) ? "__LCMP__" : "_LCMP@";
s = symboly(name, 0);
}
break;
case CLIB.lmul:
{
const(char)* name = (config.exe & ex_unix) ? "__LMUL__" : "_LMUL@";
s = symboly(name, mAX|mCX|mDX);
cinfo.retregs16 = mDX|mAX;
cinfo.retregs32 = mDX|mAX;
}
break;
case CLIB.ldiv:
cinfo.retregs16 = mDX|mAX;
if (config.exe & (EX_LINUX | EX_FREEBSD))
{
s = symboly("__divdi3", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (config.exe & (EX_OPENBSD | EX_SOLARIS))
{
s = symboly("__LDIV2__", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (I32 && config.objfmt == OBJ_MSCOFF)
{
s = symboly("_alldiv", mAX|mBX|mCX|mDX);
cinfo.flags = INFpusheabcdx;
cinfo.retregs32 = mDX|mAX;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__LDIV__" : "_LDIV@";
s = symboly(name, (config.exe & ex_unix) ? mAX|mBX|mCX|mDX : ALLREGS);
cinfo.retregs32 = mDX|mAX;
}
break;
case CLIB.lmod:
cinfo.retregs16 = mCX|mBX;
if (config.exe & (EX_LINUX | EX_FREEBSD))
{
s = symboly("__moddi3", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (config.exe & (EX_OPENBSD | EX_SOLARIS))
{
s = symboly("__LDIV2__", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mCX|mBX;
}
else if (I32 && config.objfmt == OBJ_MSCOFF)
{
s = symboly("_allrem", mAX|mBX|mCX|mDX);
cinfo.flags = INFpusheabcdx;
cinfo.retregs32 = mAX|mDX;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__LDIV__" : "_LDIV@";
s = symboly(name, (config.exe & ex_unix) ? mAX|mBX|mCX|mDX : ALLREGS);
cinfo.retregs32 = mCX|mBX;
}
break;
case CLIB.uldiv:
cinfo.retregs16 = mDX|mAX;
if (config.exe & (EX_LINUX | EX_FREEBSD))
{
s = symboly("__udivdi3", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (config.exe & (EX_OPENBSD | EX_SOLARIS))
{
s = symboly("__ULDIV2__", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (I32 && config.objfmt == OBJ_MSCOFF)
{
s = symboly("_aulldiv", mAX|mBX|mCX|mDX);
cinfo.flags = INFpusheabcdx;
cinfo.retregs32 = mDX|mAX;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__ULDIV__" : "_ULDIV@";
s = symboly(name, (config.exe & ex_unix) ? mAX|mBX|mCX|mDX : ALLREGS);
cinfo.retregs32 = mDX|mAX;
}
break;
case CLIB.ulmod:
cinfo.retregs16 = mCX|mBX;
if (config.exe & (EX_LINUX | EX_FREEBSD))
{
s = symboly("__umoddi3", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mDX|mAX;
}
else if (config.exe & (EX_OPENBSD | EX_SOLARIS))
{
s = symboly("__LDIV2__", mAX|mBX|mCX|mDX);
cinfo.flags = INFpushebx;
cinfo.retregs32 = mCX|mBX;
}
else if (I32 && config.objfmt == OBJ_MSCOFF)
{
s = symboly("_aullrem", mAX|mBX|mCX|mDX);
cinfo.flags = INFpusheabcdx;
cinfo.retregs32 = mAX|mDX;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__ULDIV__" : "_ULDIV@";
s = symboly(name, (config.exe & ex_unix) ? mAX|mBX|mCX|mDX : ALLREGS);
cinfo.retregs32 = mCX|mBX;
}
break;
// This section is only for Windows and DOS (i.e. machines without the x87 FPU)
case CLIB.dmul:
s = symboly("_DMUL@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.ddiv:
s = symboly("_DDIV@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.dtst0:
s = symboly("_DTST0@",0);
cinfo.flags = INFfloat;
break;
case CLIB.dtst0exc:
s = symboly("_DTST0EXC@",0);
cinfo.flags = INFfloat;
break;
case CLIB.dcmp:
s = symboly("_DCMP@",0);
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.dcmpexc:
s = symboly("_DCMPEXC@",0);
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.dneg:
s = symboly("_DNEG@",I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
break;
case CLIB.dadd:
s = symboly("_DADD@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.dsub:
s = symboly("_DSUB@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.pop = 8;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.fmul:
s = symboly("_FMUL@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.fdiv:
s = symboly("_FDIV@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.ftst0:
s = symboly("_FTST0@",0);
cinfo.flags = INFfloat;
break;
case CLIB.ftst0exc:
s = symboly("_FTST0EXC@",0);
cinfo.flags = INFfloat;
break;
case CLIB.fcmp:
s = symboly("_FCMP@",0);
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.fcmpexc:
s = symboly("_FCMPEXC@",0);
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.fneg:
s = symboly("_FNEG@",I16 ? FLOATREGS_16 : FLOATREGS_32);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
break;
case CLIB.fadd:
s = symboly("_FADD@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.fsub:
s = symboly("_FSUB@",mAX|mBX|mCX|mDX);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
case CLIB.dbllng:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLLNG" : "_DBLLNG@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = mDX | mAX;
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.lngdbl:
{
const(char)* name = (config.exe & ex_unix) ? "__LNGDBL" : "_LNGDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dblint:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLINT" : "_DBLINT@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = mAX;
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.intdbl:
{
const(char)* name = (config.exe & ex_unix) ? "__INTDBL" : "_INTDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dbluns:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLUNS" : "_DBLUNS@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = mAX;
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.unsdbl:
// Y(DOUBLEREGS_32,"__UNSDBL"), // CLIB.unsdbl
// Y(DOUBLEREGS_16,"_UNSDBL@"),
// {DOUBLEREGS_16,DOUBLEREGS_32,0,INFfloat,1,1}, // _UNSDBL@ unsdbl
{
const(char)* name = (config.exe & ex_unix) ? "__UNSDBL" : "_UNSDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dblulng:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLULNG" : "_DBLULNG@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = mDX|mAX;
cinfo.retregs32 = mAX;
cinfo.flags = (config.exe & ex_unix) ? INFfloat | INF32 : INFfloat;
cinfo.push87 = (config.exe & ex_unix) ? 0 : 1;
cinfo.pop87 = 1;
break;
}
case CLIB.ulngdbl:
{
const(char)* name = (config.exe & ex_unix) ? "__ULNGDBL@" : "_ULNGDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dblflt:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLFLT" : "_DBLFLT@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = FLOATREGS_16;
cinfo.retregs32 = FLOATREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.fltdbl:
{
const(char)* name = (config.exe & ex_unix) ? "__FLTDBL" : "_FLTDBL@";
s = symboly(name, I16 ? ALLREGS : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dblllng:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLLLNG" : "_DBLLLNG@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = mDX|mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.llngdbl:
{
const(char)* name = (config.exe & ex_unix) ? "__LLNGDBL" : "_LLNGDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
case CLIB.dblullng:
{
if (config.exe == EX_WIN64)
{
s = symboly("__DBLULLNG", DOUBLEREGS_32);
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 2;
cinfo.pop87 = 2;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__DBLULLNG" : "_DBLULLNG@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = I64 ? mAX : mDX|mAX;
cinfo.flags = INFfloat;
cinfo.push87 = (config.exe & ex_unix) ? 2 : 1;
cinfo.pop87 = (config.exe & ex_unix) ? 2 : 1;
}
break;
}
case CLIB.ullngdbl:
{
if (config.exe == EX_WIN64)
{
s = symboly("__ULLNGDBL", DOUBLEREGS_32);
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
}
else
{
const(char)* name = (config.exe & ex_unix) ? "__ULLNGDBL" : "_ULLNGDBL@";
s = symboly(name, I16 ? DOUBLEREGS_16 : DOUBLEREGS_32);
cinfo.retregs16 = DOUBLEREGS_16;
cinfo.retregs32 = I64 ? mAX : DOUBLEREGS_32;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
}
break;
}
case CLIB.dtst:
{
const(char)* name = (config.exe & ex_unix) ? "__DTST" : "_DTST@";
s = symboly(name, 0);
cinfo.flags = INFfloat;
break;
}
case CLIB.vptrfptr:
{
const(char)* name = (config.exe & ex_unix) ? "__HTOFPTR" : "_HTOFPTR@";
s = symboly(name, mES|mBX);
cinfo.retregs16 = mES|mBX;
cinfo.retregs32 = mES|mBX;
break;
}
case CLIB.cvptrfptr:
{
const(char)* name = (config.exe & ex_unix) ? "__HCTOFPTR" : "_HCTOFPTR@";
s = symboly(name, mES|mBX);
cinfo.retregs16 = mES|mBX;
cinfo.retregs32 = mES|mBX;
break;
}
case CLIB._87topsw:
{
const(char)* name = (config.exe & ex_unix) ? "__87TOPSW" : "_87TOPSW@";
s = symboly(name, 0);
cinfo.flags = INFfloat;
break;
}
case CLIB.fltto87:
{
const(char)* name = (config.exe & ex_unix) ? "__FLTTO87" : "_FLTTO87@";
s = symboly(name, mST0);
cinfo.retregs16 = mST0;
cinfo.retregs32 = mST0;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
break;
}
case CLIB.dblto87:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLTO87" : "_DBLTO87@";
s = symboly(name, mST0);
cinfo.retregs16 = mST0;
cinfo.retregs32 = mST0;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
break;
}
case CLIB.dblint87:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLINT87" : "_DBLINT87@";
s = symboly(name, mST0|mAX);
cinfo.retregs16 = mAX;
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
break;
}
case CLIB.dbllng87:
{
const(char)* name = (config.exe & ex_unix) ? "__DBLLNG87" : "_DBLLNG87@";
s = symboly(name, mST0|mAX|mDX);
cinfo.retregs16 = mDX|mAX;
cinfo.retregs32 = mAX;
cinfo.flags = INFfloat;
break;
}
case CLIB.ftst:
{
const(char)* name = (config.exe & ex_unix) ? "__FTST" : "_FTST@";
s = symboly(name, 0);
cinfo.flags = INFfloat;
break;
}
case CLIB.fcompp:
{
const(char)* name = (config.exe & ex_unix) ? "__FCOMPP" : "_FCOMPP@";
s = symboly(name, 0);
cinfo.retregs16 = mPSW;
cinfo.retregs32 = mPSW;
cinfo.flags = INFfloat;
cinfo.pop87 = 2;
break;
}
case CLIB.ftest:
{
const(char)* name = (config.exe & ex_unix) ? "__FTEST" : "_FTEST@";
s = symboly(name, 0);
cinfo.retregs16 = mPSW;
cinfo.retregs32 = mPSW;
cinfo.flags = INFfloat;
break;
}
case CLIB.ftest0:
{
const(char)* name = (config.exe & ex_unix) ? "__FTEST0" : "_FTEST0@";
s = symboly(name, 0);
cinfo.retregs16 = mPSW;
cinfo.retregs32 = mPSW;
cinfo.flags = INFfloat;
break;
}
case CLIB.fdiv87:
{
const(char)* name = (config.exe & ex_unix) ? "__FDIVP" : "_FDIVP";
s = symboly(name, mST0|mAX|mBX|mCX|mDX);
cinfo.retregs16 = mST0;
cinfo.retregs32 = mST0;
cinfo.flags = INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 1;
break;
}
// Complex numbers
case CLIB.cmul:
{
s = symboly("_Cmul", mST0|mST01);
cinfo.retregs16 = mST01;
cinfo.retregs32 = mST01;
cinfo.flags = INF32|INFfloat;
cinfo.push87 = 3;
cinfo.pop87 = 5;
break;
}
case CLIB.cdiv:
{
s = symboly("_Cdiv", mAX|mCX|mDX|mST0|mST01);
cinfo.retregs16 = mST01;
cinfo.retregs32 = mST01;
cinfo.flags = INF32|INFfloat;
cinfo.push87 = 0;
cinfo.pop87 = 2;
break;
}
case CLIB.ccmp:
{
s = symboly("_Ccmp", mAX|mST0|mST01);
cinfo.retregs16 = mPSW;
cinfo.retregs32 = mPSW;
cinfo.flags = INF32|INFfloat;
cinfo.push87 = 0;
cinfo.pop87 = 4;
break;
}
case CLIB.u64_ldbl:
{
const(char)* name = (config.exe & ex_unix) ? "__U64_LDBL" : "_U64_LDBL";
s = symboly(name, mST0);
cinfo.retregs16 = mST0;
cinfo.retregs32 = mST0;
cinfo.flags = INF32|INF64|INFfloat;
cinfo.push87 = 2;
cinfo.pop87 = 1;
break;
}
case CLIB.ld_u64:
{
const(char)* name = (config.exe & ex_unix) ? (config.objfmt == OBJ_ELF ||
config.objfmt == OBJ_MACH ?
"__LDBLULLNG" : "___LDBLULLNG")
: "__LDBLULLNG";
s = symboly(name, mST0|mAX|mDX);
cinfo.retregs16 = 0;
cinfo.retregs32 = mDX|mAX;
cinfo.flags = INF32|INF64|INFfloat;
cinfo.push87 = 1;
cinfo.pop87 = 2;
break;
}
default:
assert(0);
}
clibsyms[clib] = s;
}
*ps = s;
*pinfo = cinfo;
}
/********************************
* Generate code sequence to call C runtime library support routine.
* clib = CLIB.xxxx
* keepmask = mask of registers not to destroy. Currently can
* handle only 1. Should use a temporary rather than
* push/pop for speed.
*/
void callclib(ref CodeBuilder cdb, elem* e, uint clib, regm_t* pretregs, regm_t keepmask)
{
//printf("callclib(e = %p, clib = %d, *pretregs = %s, keepmask = %s\n", e, clib, regm_str(*pretregs), regm_str(keepmask));
//elem_print(e);
Symbol* s;
ClibInfo* cinfo;
getClibInfo(clib, &s, &cinfo);
if (I16)
assert(!(cinfo.flags & (INF32 | INF64)));
getregs(cdb,(~s.Sregsaved & (mES | mBP | ALLREGS)) & ~keepmask); // mask of regs destroyed
keepmask &= ~s.Sregsaved;
int npushed = numbitsset(keepmask);
CodeBuilder cdbpop;
cdbpop.ctor();
gensaverestore(keepmask, cdb, cdbpop);
save87regs(cdb,cinfo.push87);
for (int i = 0; i < cinfo.push87; i++)
push87(cdb);
for (int i = 0; i < cinfo.pop87; i++)
pop87();
if (config.target_cpu >= TARGET_80386 && clib == CLIB.lmul && !I32)
{
static immutable ubyte[23] lmul =
[
0x66,0xc1,0xe1,0x10, // shl ECX,16
0x8b,0xcb, // mov CX,BX ;ECX = CX,BX
0x66,0xc1,0xe0,0x10, // shl EAX,16
0x66,0x0f,0xac,0xd0,0x10, // shrd EAX,EDX,16 ;EAX = DX,AX
0x66,0xf7,0xe1, // mul ECX
0x66,0x0f,0xa4,0xc2,0x10, // shld EDX,EAX,16 ;DX,AX = EAX
];
cdb.genasm(cast(char*)lmul.ptr, lmul.sizeof);
}
else
{
makeitextern(s);
int nalign = 0;
int pushebx = (cinfo.flags & INFpushebx) != 0;
int pushall = (cinfo.flags & INFpusheabcdx) != 0;
if (STACKALIGN >= 16)
{ // Align the stack (assume no args on stack)
int npush = (npushed + pushebx + 4 * pushall) * REGSIZE + stackpush;
if (npush & (STACKALIGN - 1))
{ nalign = STACKALIGN - (npush & (STACKALIGN - 1));
cod3_stackadj(cdb, nalign);
}
}
if (pushebx)
{
if (config.exe & (EX_LINUX | EX_LINUX64 | EX_FREEBSD | EX_FREEBSD64 | EX_DRAGONFLYBSD64))
{
cdb.gen1(0x50 + CX); // PUSH ECX
cdb.gen1(0x50 + BX); // PUSH EBX
cdb.gen1(0x50 + DX); // PUSH EDX
cdb.gen1(0x50 + AX); // PUSH EAX
nalign += 4 * REGSIZE;
}
else
{
cdb.gen1(0x50 + BX); // PUSH EBX
nalign += REGSIZE;
}
}
if (pushall)
{
cdb.gen1(0x50 + CX); // PUSH ECX
cdb.gen1(0x50 + BX); // PUSH EBX
cdb.gen1(0x50 + DX); // PUSH EDX
cdb.gen1(0x50 + AX); // PUSH EAX
}
if (config.exe & (EX_LINUX | EX_FREEBSD | EX_OPENBSD | EX_SOLARIS))
{
// Note: not for OSX
/* Pass EBX on the stack instead, this is because EBX is used
* for shared library function calls
*/
if (config.flags3 & CFG3pic)
{
load_localgot(cdb); // EBX gets set to this value
}
}
cdb.gencs(LARGECODE ? 0x9A : 0xE8,0,FLfunc,s); // CALL s
if (nalign)
cod3_stackadj(cdb, -nalign);
calledafunc = 1;
version (SCPP)
{
if (I16 && // bug in Optlink for weak references
config.flags3 & CFG3wkfloat &&
(cinfo.flags & (INFfloat | INFwkdone)) == INFfloat)
{
cinfo.flags |= INFwkdone;
makeitextern(getRtlsym(RTLSYM_INTONLY));
objmod.wkext(s, getRtlsym(RTLSYM_INTONLY));
}
}
}
if (I16)
stackpush -= cinfo.pop;
regm_t retregs = I16 ? cinfo.retregs16 : cinfo.retregs32;
cdb.append(cdbpop);
fixresult(cdb, e, retregs, pretregs);
}
/*************************************************
* Helper function for converting OPparam's into array of Parameters.
*/
struct Parameter { elem* e; reg_t reg; reg_t reg2; uint numalign; }
//void fillParameters(elem* e, Parameter* parameters, int* pi);
void fillParameters(elem* e, Parameter* parameters, int* pi)
{
if (e.Eoper == OPparam)
{
fillParameters(e.EV.E1, parameters, pi);
fillParameters(e.EV.E2, parameters, pi);
freenode(e);
}
else
{
parameters[*pi].e = e;
(*pi)++;
}
}
/***********************************
* tyf: type of the function
*/
FuncParamRegs FuncParamRegs_create(tym_t tyf)
{
FuncParamRegs result;
result.tyf = tyf;
if (I16)
{
result.numintegerregs = 0;
result.numfloatregs = 0;
}
else if (I32)
{
if (tyf == TYjfunc)
{
static immutable ubyte[1] reglist1 = [ AX ];
result.argregs = ®list1[0];
result.numintegerregs = reglist1.length;
}
else if (tyf == TYmfunc)
{
static immutable ubyte[1] reglist2 = [ CX ];
result.argregs = ®list2[0];
result.numintegerregs = reglist2.length;
}
else
result.numintegerregs = 0;
result.numfloatregs = 0;
}
else if (I64 && config.exe == EX_WIN64)
{
static immutable ubyte[4] reglist3 = [ CX,DX,R8,R9 ];
result.argregs = ®list3[0];
result.numintegerregs = reglist3.length;
static immutable ubyte[4] freglist3 = [ XMM0, XMM1, XMM2, XMM3 ];
result.floatregs = &freglist3[0];
result.numfloatregs = freglist3.length;
}
else if (I64)
{
static immutable ubyte[6] reglist4 = [ DI,SI,DX,CX,R8,R9 ];
result.argregs = ®list4[0];
result.numintegerregs = reglist4.length;
static immutable ubyte[8] freglist4 = [ XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 ];
result.floatregs = &freglist4[0];
result.numfloatregs = freglist4.length;
}
else
assert(0);
return result;
}
/*****************************************
* Allocate parameter of type t and ty to registers *preg1 and *preg2.
* Params:
* t = type, valid only if ty is TYstruct or TYarray
* Returns:
* false not allocated to any register
* true *preg1, *preg2 set to allocated register pair
*/
//bool type_jparam2(type* t, tym_t ty);
private bool type_jparam2(type* t, tym_t ty)
{
ty = tybasic(ty);
if (tyfloating(ty))
return false;
else if (ty == TYstruct || ty == TYarray)
{
type_debug(t);
targ_size_t sz = type_size(t);
return (sz <= _tysize[TYnptr]) &&
(config.exe == EX_WIN64 || sz == 1 || sz == 2 || sz == 4 || sz == 8);
}
else if (tysize(ty) <= _tysize[TYnptr])
return true;
return false;
}
int FuncParamRegs_alloc(ref FuncParamRegs fpr, type* t, tym_t ty, reg_t* preg1, reg_t* preg2)
{
//printf("FuncParamRegs::alloc(ty: TY%sm t: %p)\n", tystring[tybasic(ty)], t);
//if (t) type_print(t);
*preg1 = NOREG;
*preg2 = NOREG;
type* t2 = null;
tym_t ty2 = TYMAX;
// SROA with mixed registers
if (ty & mTYxmmgpr)
{
ty = TYdouble;
ty2 = TYllong;
}
else if (ty & mTYgprxmm)
{
ty = TYllong;
ty2 = TYdouble;
}
// Treat array of 1 the same as its element type
// (Don't put volatile parameters in registers)
if (tybasic(ty) == TYarray && tybasic(t.Tty) == TYarray && t.Tdim == 1 && !(t.Tty & mTYvolatile)
&& type_size(t.Tnext) > 1)
{
t = t.Tnext;
ty = t.Tty;
}
if (tybasic(ty) == TYstruct && type_zeroSize(t, fpr.tyf))
return 0; // don't allocate into registers
++fpr.i;
// If struct or array
if (tyaggregate(ty))
{
assert(t);
if (config.exe == EX_WIN64)
{
/* Structs occupy a general purpose register, regardless of the struct
* size or the number & types of its fields.
*/
t = null;
ty = TYnptr;
}
else
{
type* targ1, targ2;
if (tybasic(t.Tty) == TYstruct)
{
targ1 = t.Ttag.Sstruct.Sarg1type;
targ2 = t.Ttag.Sstruct.Sarg2type;
}
else if (tybasic(t.Tty) == TYarray)
{
if (I64)
argtypes(t, targ1, targ2);
}
else
assert(0);
if (targ1)
{
t = targ1;
ty = t.Tty;
if (targ2)
{
t2 = targ2;
ty2 = t2.Tty;
}
}
else if (I64 && !targ2)
return 0;
}
}
reg_t* preg = preg1;
int regcntsave = fpr.regcnt;
int xmmcntsave = fpr.xmmcnt;
if (config.exe == EX_WIN64)
{
if (tybasic(ty) == TYcfloat)
{
ty = TYnptr; // treat like a struct
}
}
else if (I64)
{
if ((tybasic(ty) == TYcent || tybasic(ty) == TYucent) &&
fpr.numintegerregs - fpr.regcnt >= 2)
{
// Allocate to register pair
*preg1 = fpr.argregs[fpr.regcnt];
*preg2 = fpr.argregs[fpr.regcnt + 1];
fpr.regcnt += 2;
return 1;
}
if (tybasic(ty) == TYcdouble &&
fpr.numfloatregs - fpr.xmmcnt >= 2)
{
// Allocate to register pair
*preg1 = fpr.floatregs[fpr.xmmcnt];
*preg2 = fpr.floatregs[fpr.xmmcnt + 1];
fpr.xmmcnt += 2;
return 1;
}
if (tybasic(ty) == TYcfloat
&& fpr.numfloatregs - fpr.xmmcnt >= 1)
{
// Allocate XMM register
*preg1 = fpr.floatregs[fpr.xmmcnt++];
return 1;
}
}
foreach (j; 0 .. 2)
{
if (fpr.regcnt < fpr.numintegerregs)
{
if ((I64 || (fpr.i == 1 && (fpr.tyf == TYjfunc || fpr.tyf == TYmfunc))) &&
type_jparam2(t, ty))
{
*preg = fpr.argregs[fpr.regcnt];
++fpr.regcnt;
if (config.exe == EX_WIN64)
++fpr.xmmcnt;
goto Lnext;
}
}
if (fpr.xmmcnt < fpr.numfloatregs)
{
if (tyxmmreg(ty))
{
*preg = fpr.floatregs[fpr.xmmcnt];
if (config.exe == EX_WIN64)
++fpr.regcnt;
++fpr.xmmcnt;
goto Lnext;
}
}
// Failed to allocate to a register
if (j == 1)
{ /* Unwind first preg1 assignment, because it's both or nothing
*/
*preg1 = NOREG;
fpr.regcnt = regcntsave;
fpr.xmmcnt = xmmcntsave;
}
return 0;
Lnext:
if (tybasic(ty2) == TYMAX)
break;
preg = preg2;
t = t2;
ty = ty2;
}
return 1;
}
/***************************************
* Finds replacemnt types for register passing of aggregates.
*/
void argtypes(type* t, ref type* arg1type, ref type* arg2type)
{
if (!t) return;
tym_t ty = t.Tty;
if (!tyaggregate(ty))
return;
arg1type = arg2type = null;
if (tybasic(ty) == TYarray)
{
size_t sz = cast(size_t) type_size(t);
if (sz == 0)
return;
if ((I32 || config.exe == EX_WIN64) && (sz & (sz - 1))) // power of 2
return;
if (config.exe == EX_WIN64 && sz > REGSIZE)
return;
if (sz <= 2 * REGSIZE)
{
type** argtype = &arg1type;
size_t argsz = sz < REGSIZE ? sz : REGSIZE;
foreach (v; 0 .. (sz > REGSIZE) + 1)
{
*argtype = argsz == 1 ? tstypes[TYchar]
: argsz == 2 ? tstypes[TYshort]
: argsz <= 4 ? tstypes[TYlong]
: tstypes[TYllong];
argtype = &arg2type;
argsz = sz - REGSIZE;
}
}
if (I64 && config.exe != EX_WIN64)
{
type* tn = t.Tnext;
tym_t tyn = tn.Tty;
while (tyn == TYarray)
{
tn = tn.Tnext;
assert(tn);
tyn = tybasic(tn.Tty);
}
if (tybasic(tyn) == TYstruct)
{
if (type_size(tn) == sz) // array(s) of size 1
{
arg1type = tn.Ttag.Sstruct.Sarg1type;
arg2type = tn.Ttag.Sstruct.Sarg2type;
return;
}
type* t1 = tn.Ttag.Sstruct.Sarg1type;
if (t1)
{
tn = t1;
tyn = tn.Tty;
}
}
if (sz == tysize(tyn))
{
if (tysimd(tyn))
{
type* ts = type_fake(tybasic(tyn));
ts.Tcount = 1;
arg1type = ts;
return;
}
else if (tybasic(tyn) == TYldouble || tybasic(tyn) == TYildouble)
{
arg1type = tstypes[tybasic(tyn)];
return;
}
}
if (sz <= 16)
{
if (tyfloating(tyn))
{
arg1type = sz <= 4 ? tstypes[TYfloat] : tstypes[TYdouble];
if (sz > 8)
arg2type = (sz - 8) <= 4 ? tstypes[TYfloat] : tstypes[TYdouble];
}
}
}
}
else if (tybasic(ty) == TYstruct)
{
// TODO: Move code from `cgelem.d:elstruct()` here
}
}
/*******************************
* Generate code sequence for function call.
*/
void cdfunc(ref CodeBuilder cdb, elem* e, regm_t* pretregs)
{
//printf("cdfunc()\n"); elem_print(e);
assert(e);
uint numpara = 0; // bytes of parameters
uint numalign = 0; // bytes to align stack before pushing parameters
uint stackpushsave = stackpush; // so we can compute # of parameters
cgstate.stackclean++;
regm_t keepmsk = 0;
int xmmcnt = 0;
tym_t tyf = tybasic(e.EV.E1.Ety); // the function type
// Easier to deal with parameters as an array: parameters[0..np]
int np = OTbinary(e.Eoper) ? el_nparams(e.EV.E2) : 0;
Parameter *parameters = cast(Parameter *)alloca(np * Parameter.sizeof);
if (np)
{
int n = 0;
fillParameters(e.EV.E2, parameters, &n);
assert(n == np);
}
Symbol *sf = null; // symbol of the function being called
if (e.EV.E1.Eoper == OPvar)
sf = e.EV.E1.EV.Vsym;
/* Assume called function access statics
*/
if (config.exe & (EX_LINUX | EX_LINUX64 | EX_OSX | EX_FREEBSD | EX_FREEBSD64) &&
config.flags3 & CFG3pic)
cgstate.accessedTLS = true;
/* Special handling for call to __tls_get_addr, we must save registers
* before evaluating the parameter, so that the parameter load and call
* are adjacent.
*/
if (np == 1 && sf)
{
if (sf == tls_get_addr_sym)
getregs(cdb, ~sf.Sregsaved & (mBP | ALLREGS | mES | XMMREGS));
}
uint stackalign = REGSIZE;
if (tyf == TYf16func)
stackalign = 2;
// Figure out which parameters go in registers.
// Compute numpara, the total bytes pushed on the stack
FuncParamRegs fpr = FuncParamRegs_create(tyf);
for (int i = np; --i >= 0;)
{
elem *ep = parameters[i].e;
uint psize = cast(uint)_align(stackalign, paramsize(ep, tyf)); // align on stack boundary
if (config.exe == EX_WIN64)
{
//printf("[%d] size = %u, numpara = %d ep = %p ", i, psize, numpara, ep); WRTYxx(ep.Ety); printf("\n");
debug
if (psize > REGSIZE) elem_print(e);
assert(psize <= REGSIZE);
psize = REGSIZE;
}
//printf("[%d] size = %u, numpara = %d ", i, psize, numpara); WRTYxx(ep.Ety); printf("\n");
if (FuncParamRegs_alloc(fpr, ep.ET, ep.Ety, ¶meters[i].reg, ¶meters[i].reg2))
{
if (config.exe == EX_WIN64)
numpara += REGSIZE; // allocate stack space for it anyway
continue; // goes in register, not stack
}
// Parameter i goes on the stack
parameters[i].reg = NOREG;
uint alignsize = el_alignsize(ep);
parameters[i].numalign = 0;
if (alignsize > stackalign &&
(I64 || (alignsize >= 16 &&
(config.exe & (EX_OSX | EX_LINUX) && (tyaggregate(ep.Ety) || tyvector(ep.Ety))))))
{
if (alignsize > STACKALIGN)
{
STACKALIGN = alignsize;
enforcealign = true;
}
uint newnumpara = (numpara + (alignsize - 1)) & ~(alignsize - 1);
parameters[i].numalign = newnumpara - numpara;
numpara = newnumpara;
assert(config.exe != EX_WIN64);
}
numpara += psize;
}
if (config.exe == EX_WIN64)
{
if (numpara < 4 * REGSIZE)
numpara = 4 * REGSIZE;
}
//printf("numpara = %d, stackpush = %d\n", numpara, stackpush);
assert((numpara & (REGSIZE - 1)) == 0);
assert((stackpush & (REGSIZE - 1)) == 0);
/* Should consider reordering the order of evaluation of the parameters
* so that args that go into registers are evaluated after args that get
* pushed. We can reorder args that are constants or relconst's.
*/
/* Determine if we should use cgstate.funcarg for the parameters or push them
*/
bool usefuncarg = false;
static if (0)
{
printf("test1 %d %d %d %d %d %d %d %d\n", (config.flags4 & CFG4speed)!=0, !Alloca.size,
!(usednteh & (NTEH_try | NTEH_except | NTEHcpp | EHcleanup | EHtry | NTEHpassthru)),
cast(int)numpara, !stackpush,
(cgstate.funcargtos == ~0 || numpara < cgstate.funcargtos),
(!typfunc(tyf) || sf && sf.Sflags & SFLexit), !I16);
}
if (config.flags4 & CFG4speed &&
!Alloca.size &&
/* The cleanup code calls a local function, leaving the return address on
* the top of the stack. If parameters are placed there, the return address
* is stepped on.
* A better solution is turn this off only inside the cleanup code.
*/
!usednteh &&
!calledFinally &&
(numpara || config.exe == EX_WIN64) &&
stackpush == 0 && // cgstate.funcarg needs to be at top of stack
(cgstate.funcargtos == ~0 || numpara < cgstate.funcargtos) &&
(!(typfunc(tyf) || tyf == TYhfunc) || sf && sf.Sflags & SFLexit) &&
!anyiasm && !I16
)
{
for (int i = 0; i < np; i++)
{
elem* ep = parameters[i].e;
int preg = parameters[i].reg;
//printf("parameter[%d] = %d, np = %d\n", i, preg, np);
if (preg == NOREG)
{
switch (ep.Eoper)
{
case OPstrctor:
case OPstrthis:
case OPstrpar:
case OPnp_fp:
goto Lno;
default:
break;
}
}
}
if (numpara > cgstate.funcarg.size)
{ // New high water mark
//printf("increasing size from %d to %d\n", (int)cgstate.funcarg.size, (int)numpara);
cgstate.funcarg.size = numpara;
}
usefuncarg = true;
}
Lno:
/* Adjust start of the stack so after all args are pushed,
* the stack will be aligned.
*/
if (!usefuncarg && STACKALIGN >= 16 && (numpara + stackpush) & (STACKALIGN - 1))
{
numalign = STACKALIGN - ((numpara + stackpush) & (STACKALIGN - 1));
cod3_stackadj(cdb, numalign);
cdb.genadjesp(numalign);
stackpush += numalign;
stackpushsave += numalign;
}
assert(stackpush == stackpushsave);
if (config.exe == EX_WIN64)
{
//printf("np = %d, numpara = %d, stackpush = %d\n", np, numpara, stackpush);
assert(numpara == ((np < 4) ? 4 * REGSIZE : np * REGSIZE));
// Allocate stack space for four entries anyway
// http://msdn.microsoft.com/en-US/library/ew5tede7(v=vs.80)
}
int[XMM7 + 1] regsaved = void;
memset(regsaved.ptr, -1, regsaved.sizeof);
CodeBuilder cdbrestore;
cdbrestore.ctor();
regm_t saved = 0;
targ_size_t funcargtossave = cgstate.funcargtos;
targ_size_t funcargtos = numpara;
//printf("funcargtos1 = %d\n", cast(int)funcargtos);
/* Parameters go into the registers RDI,RSI,RDX,RCX,R8,R9
* float and double parameters go into XMM0..XMM7
* For variadic functions, count of XMM registers used goes in AL
*/
for (int i = 0; i < np; i++)
{
elem* ep = parameters[i].e;
int preg = parameters[i].reg;
//printf("parameter[%d] = %d, np = %d\n", i, preg, np);
if (preg == NOREG)
{
/* Push parameter on stack, but keep track of registers used
* in the process. If they interfere with keepmsk, we'll have
* to save/restore them.
*/
CodeBuilder cdbsave;
cdbsave.ctor();
regm_t overlap = msavereg & keepmsk;
msavereg |= keepmsk;
CodeBuilder cdbparams;
cdbparams.ctor();
if (usefuncarg)
movParams(cdbparams, ep, stackalign, cast(uint)funcargtos, tyf);
else
pushParams(cdbparams,ep,stackalign, tyf);
regm_t tosave = keepmsk & ~msavereg;
msavereg &= ~keepmsk | overlap;
// tosave is the mask to save and restore
for (reg_t j = 0; tosave; j++)
{
regm_t mi = mask(j);
assert(j <= XMM7);
if (mi & tosave)
{
uint idx;
regsave.save(cdbsave, j, &idx);
regsave.restore(cdbrestore, j, idx);
saved |= mi;
keepmsk &= ~mi; // don't need to keep these for rest of params
tosave &= ~mi;
}
}
cdb.append(cdbsave);
cdb.append(cdbparams);
// Alignment for parameter comes after it got pushed
const uint numalignx = parameters[i].numalign;
if (usefuncarg)
{
funcargtos -= _align(stackalign, paramsize(ep, tyf)) + numalignx;
cgstate.funcargtos = funcargtos;
}
else if (numalignx)
{
cod3_stackadj(cdb, numalignx);
cdb.genadjesp(numalignx);
stackpush += numalignx;
}
}
else
{
// Goes in register preg, not stack
regm_t retregs = mask(preg);
if (retregs & XMMREGS)
++xmmcnt;
int preg2 = parameters[i].reg2;
reg_t mreg,lreg;
if (preg2 != NOREG || tybasic(ep.Ety) == TYcfloat)
{
assert(ep.Eoper != OPstrthis);
if (mask(preg2) & XMMREGS)
++xmmcnt;
if (tybasic(ep.Ety) == TYcfloat)
{
lreg = ST01;
mreg = NOREG;
}
else if (tyrelax(ep.Ety) == TYcent)
{
lreg = mask(preg ) & mLSW ? cast(reg_t)preg : AX;
mreg = mask(preg2) & mMSW ? cast(reg_t)preg2 : DX;
}
else
{
lreg = XMM0;
mreg = XMM1;
}
retregs = (mask(mreg) | mask(lreg)) & ~mask(NOREG);
CodeBuilder cdbsave;
cdbsave.ctor();
if (keepmsk & retregs)
{
regm_t tosave = keepmsk & retregs;
// tosave is the mask to save and restore
for (reg_t j = 0; tosave; j++)
{
regm_t mi = mask(j);
assert(j <= XMM7);
if (mi & tosave)
{
uint idx;
regsave.save(cdbsave, j, &idx);
regsave.restore(cdbrestore, j, idx);
saved |= mi;
keepmsk &= ~mi; // don't need to keep these for rest of params
tosave &= ~mi;
}
}
}
cdb.append(cdbsave);
scodelem(cdb, ep, &retregs, keepmsk, false);
// Move result [mreg,lreg] into parameter registers from [preg2,preg]
retregs = 0;
if (preg != lreg)
retregs |= mask(preg);
if (preg2 != mreg)
retregs |= mask(preg2);
retregs &= ~mask(NOREG);
getregs(cdb,retregs);
tym_t ty1 = tybasic(ep.Ety);
tym_t ty2 = ty1;
if (ep.Ety & mTYgprxmm)
{
ty1 = TYllong;
ty2 = TYdouble;
}
else if (ep.Ety & mTYxmmgpr)
{
ty1 = TYdouble;
ty2 = TYllong;
}
else if (ty1 == TYstruct)
{
type* targ1 = ep.ET.Ttag.Sstruct.Sarg1type;
type* targ2 = ep.ET.Ttag.Sstruct.Sarg2type;
if (targ1)
ty1 = targ1.Tty;
if (targ2)
ty2 = targ2.Tty;
}
else if (tyrelax(ty1) == TYcent)
ty1 = ty2 = TYllong;
else if (tybasic(ty1) == TYcdouble)
ty1 = ty2 = TYdouble;
if (tybasic(ep.Ety) == TYcfloat)
{
assert(I64);
assert(lreg == ST01 && mreg == NOREG);
// spill
pop87();
pop87();
cdb.genfltreg(0xD9, 3, tysize(TYfloat));
genfwait(cdb);
cdb.genfltreg(0xD9, 3, 0);
genfwait(cdb);
// reload
if (config.exe == EX_WIN64)
{
cdb.genfltreg(LOD, preg, 0);
code_orrex(cdb.last(), REX_W);
}
else
{
assert(mask(preg) & XMMREGS);
cdb.genxmmreg(xmmload(TYdouble), cast(reg_t) preg, 0, TYdouble);
}
}
else foreach (v; 0 .. 2)
{
if (v ^ (preg != mreg))
genmovreg(cdb, preg, lreg, ty1);
else
genmovreg(cdb, preg2, mreg, ty2);
}
retregs = (mask(preg) | mask(preg2)) & ~mask(NOREG);
}
else if (ep.Eoper == OPstrthis)
{
getregs(cdb,retregs);
// LEA preg,np[RSP]
uint delta = stackpush - ep.EV.Vuns; // stack delta to parameter
cdb.genc1(LEA,
(modregrm(0,4,SP) << 8) | modregxrm(2,preg,4), FLconst,delta);
if (I64)
code_orrex(cdb.last(), REX_W);
}
else if (ep.Eoper == OPstrpar && config.exe == EX_WIN64 && type_size(ep.ET) == 0)
{
}
else
{
scodelem(cdb, ep, &retregs, keepmsk, false);
}
keepmsk |= retregs; // don't change preg when evaluating func address
}
}
if (config.exe == EX_WIN64)
{ // Allocate stack space for four entries anyway
// http://msdn.microsoft.com/en-US/library/ew5tede7(v=vs.80)
{ uint sz = 4 * REGSIZE;
if (usefuncarg)
{
funcargtos -= sz;
cgstate.funcargtos = funcargtos;
}
else
{
cod3_stackadj(cdb, sz);
cdb.genadjesp(sz);
stackpush += sz;
}
}
/* Variadic functions store XMM parameters into their corresponding GP registers
*/
for (int i = 0; i < np; i++)
{
int preg = parameters[i].reg;
regm_t retregs = mask(preg);
if (retregs & XMMREGS)
{
reg_t reg;
switch (preg)
{
case XMM0: reg = CX; break;
case XMM1: reg = DX; break;
case XMM2: reg = R8; break;
case XMM3: reg = R9; break;
default: assert(0);
}
getregs(cdb,mask(reg));
cdb.gen2(STOD,(REX_W << 16) | modregxrmx(3,preg-XMM0,reg)); // MOVD reg,preg
}
}
}
// Restore any register parameters we saved
getregs(cdb,saved);
cdb.append(cdbrestore);
keepmsk |= saved;
// Variadic functions store the number of XMM registers used in AL
if (I64 && config.exe != EX_WIN64 && e.Eflags & EFLAGS_variadic)
{
getregs(cdb,mAX);
movregconst(cdb,AX,xmmcnt,1);
keepmsk |= mAX;
}
//printf("funcargtos2 = %d\n", (int)funcargtos);
assert(!usefuncarg || (funcargtos == 0 && cgstate.funcargtos == 0));
cgstate.stackclean--;
debug
if (!usefuncarg && numpara != stackpush - stackpushsave)
{
printf("function %s\n", funcsym_p.Sident.ptr);
printf("numpara = %d, stackpush = %d, stackpushsave = %d\n", numpara, stackpush, stackpushsave);
elem_print(e);
}
assert(usefuncarg || numpara == stackpush - stackpushsave);
funccall(cdb,e,numpara,numalign,pretregs,keepmsk,usefuncarg);
cgstate.funcargtos = funcargtossave;
}
/***********************************
*/
void cdstrthis(ref CodeBuilder cdb, elem* e, regm_t* pretregs)
{
assert(tysize(e.Ety) == REGSIZE);
const reg = findreg(*pretregs & allregs);
getregs(cdb,mask(reg));
// LEA reg,np[ESP]
uint np = stackpush - e.EV.Vuns; // stack delta to parameter
cdb.genc1(LEA,(modregrm(0,4,SP) << 8) | modregxrm(2,reg,4),FLconst,np);
if (I64)
code_orrex(cdb.last(), REX_W);
fixresult(cdb, e, mask(reg), pretregs);
}
/******************************
* Call function. All parameters have already been pushed onto the stack.
* Params:
* e = function call
* numpara = size in bytes of all the parameters
* numalign = amount the stack was aligned by before the parameters were pushed
* pretregs = where return value goes
* keepmsk = registers to not change when evaluating the function address
* usefuncarg = using cgstate.funcarg, so no need to adjust stack after func return
*/
private void funccall(ref CodeBuilder cdb, elem* e, uint numpara, uint numalign,
regm_t* pretregs,regm_t keepmsk, bool usefuncarg)
{
//printf("%s ", funcsym_p.Sident.ptr);
//printf("funccall(e = %p, *pretregs = %s, numpara = %d, numalign = %d, usefuncarg=%d)\n",e,regm_str(*pretregs),numpara,numalign,usefuncarg);
calledafunc = 1;
// Determine if we need frame for function prolog/epilog
static if (TARGET_WINDOS)
{
if (config.memmodel == Vmodel)
{
if (tyfarfunc(funcsym_p.ty()))
needframe = true;
}
}
code cs;
regm_t retregs;
Symbol* s;
elem* e1 = e.EV.E1;
tym_t tym1 = tybasic(e1.Ety);
char farfunc = tyfarfunc(tym1) || tym1 == TYifunc;
CodeBuilder cdbe;
cdbe.ctor();
if (e1.Eoper == OPvar)
{ // Call function directly
if (!tyfunc(tym1))
WRTYxx(tym1);
assert(tyfunc(tym1));
s = e1.EV.Vsym;
if (s.Sflags & SFLexit)
{ }
else if (s != tls_get_addr_sym)
save87(cdb); // assume 8087 regs are all trashed
// Function calls may throw Errors, unless marked that they don't
if (s == funcsym_p || !s.Sfunc || !(s.Sfunc.Fflags3 & Fnothrow))
funcsym_p.Sfunc.Fflags3 &= ~Fnothrow;
if (s.Sflags & SFLexit)
{
// Function doesn't return, so don't worry about registers
// it may use
}
else if (!tyfunc(s.ty()) || !(config.flags4 & CFG4optimized))
// so we can replace func at runtime
getregs(cdbe,~fregsaved & (mBP | ALLREGS | mES | XMMREGS));
else
getregs(cdbe,~s.Sregsaved & (mBP | ALLREGS | mES | XMMREGS));
if (strcmp(s.Sident.ptr, "alloca") == 0)
{
s = getRtlsym(RTLSYM_ALLOCA);
makeitextern(s);
int areg = CX;
if (config.exe == EX_WIN64)
areg = DX;
getregs(cdbe, mask(areg));
cdbe.genc(LEA, modregrm(2, areg, BPRM), FLallocatmp, 0, 0, 0); // LEA areg,&localsize[BP]
if (I64)
code_orrex(cdbe.last(), REX_W);
Alloca.size = REGSIZE;
}
if (sytab[s.Sclass] & SCSS) // if function is on stack (!)
{
retregs = allregs & ~keepmsk;
s.Sflags &= ~GTregcand;
s.Sflags |= SFLread;
cdrelconst(cdbe,e1,&retregs);
if (farfunc)
{
const reg = findregmsw(retregs);
const lsreg = findreglsw(retregs);
floatreg = true; // use float register
reflocal = true;
cdbe.genc1(0x89, // MOV floatreg+2,reg
modregrm(2, reg, BPRM), FLfltreg, REGSIZE);
cdbe.genc1(0x89, // MOV floatreg,lsreg
modregrm(2, lsreg, BPRM), FLfltreg, 0);
if (tym1 == TYifunc)
cdbe.gen1(0x9C); // PUSHF
cdbe.genc1(0xFF, // CALL [floatreg]
modregrm(2, 3, BPRM), FLfltreg, 0);
}
else
{
const reg = findreg(retregs);
cdbe.gen2(0xFF, modregrmx(3, 2, reg)); // CALL reg
if (I64)
code_orrex(cdbe.last(), REX_W);
}
}
else
{
int fl = FLfunc;
if (!tyfunc(s.ty()))
fl = el_fl(e1);
if (tym1 == TYifunc)
cdbe.gen1(0x9C); // PUSHF
static if (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
{
assert(!farfunc);
if (s != tls_get_addr_sym)
{
//printf("call %s\n", s.Sident.ptr);
load_localgot(cdb);
cdbe.gencs(0xE8, 0, fl, s); // CALL extern
}
else if (I64)
{
/* Prepend 66 66 48 so GNU linker has patch room
*/
assert(!farfunc);
cdbe.gen1(0x66);
cdbe.gen1(0x66);
cdbe.gencs(0xE8, 0, fl, s); // CALL extern
cdbe.last().Irex = REX | REX_W;
}
else
cdbe.gencs(0xE8, 0, fl, s); // CALL extern
}
else
{
cdbe.gencs(farfunc ? 0x9A : 0xE8,0,fl,s); // CALL extern
}
code_orflag(cdbe.last(), farfunc ? (CFseg | CFoff) : (CFselfrel | CFoff));
}
}
else
{ // Call function via pointer
// Function calls may throw Errors
funcsym_p.Sfunc.Fflags3 &= ~Fnothrow;
if (e1.Eoper != OPind) { WRFL(cast(FL)el_fl(e1)); WROP(e1.Eoper); }
save87(cdb); // assume 8087 regs are all trashed
assert(e1.Eoper == OPind);
elem *e11 = e1.EV.E1;
tym_t e11ty = tybasic(e11.Ety);
assert(!I16 || (e11ty == (farfunc ? TYfptr : TYnptr)));
load_localgot(cdb);
static if (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_DRAGONFLYBSD || TARGET_SOLARIS)
{
if (config.flags3 & CFG3pic && I32)
keepmsk |= mBX;
}
/* Mask of registers destroyed by the function call
*/
regm_t desmsk = (mBP | ALLREGS | mES | XMMREGS) & ~fregsaved;
// if we can't use loadea()
if ((!OTleaf(e11.Eoper) || e11.Eoper == OPconst) &&
(e11.Eoper != OPind || e11.Ecount))
{
retregs = allregs & ~keepmsk;
cgstate.stackclean++;
scodelem(cdbe,e11,&retregs,keepmsk,true);
cgstate.stackclean--;
// Kill registers destroyed by an arbitrary function call
getregs(cdbe,desmsk);
if (e11ty == TYfptr)
{
const reg = findregmsw(retregs);
const lsreg = findreglsw(retregs);
floatreg = true; // use float register
reflocal = true;
cdbe.genc1(0x89, // MOV floatreg+2,reg
modregrm(2, reg, BPRM), FLfltreg, REGSIZE);
cdbe.genc1(0x89, // MOV floatreg,lsreg
modregrm(2, lsreg, BPRM), FLfltreg, 0);
if (tym1 == TYifunc)
cdbe.gen1(0x9C); // PUSHF
cdbe.genc1(0xFF, // CALL [floatreg]
modregrm(2, 3, BPRM), FLfltreg, 0);
}
else
{
const reg = findreg(retregs);
cdbe.gen2(0xFF, modregrmx(3, 2, reg)); // CALL reg
if (I64)
code_orrex(cdbe.last(), REX_W);
}
}
else
{
if (tym1 == TYifunc)
cdb.gen1(0x9C); // PUSHF
// CALL [function]
cs.Iflags = 0;
cgstate.stackclean++;
loadea(cdbe, e11, &cs, 0xFF, farfunc ? 3 : 2, 0, keepmsk, desmsk);
cgstate.stackclean--;
freenode(e11);
}
s = null;
}
cdb.append(cdbe);
freenode(e1);
/* See if we will need the frame pointer.
Calculate it here so we can possibly use BP to fix the stack.
*/
static if (0)
{
if (!needframe)
{
// If there is a register available for this basic block
if (config.flags4 & CFG4optimized && (ALLREGS & ~regcon.used))
{ }
else
{
for (SYMIDX si = 0; si < globsym.top; si++)
{
Symbol* s = globsym.tab[si];
if (s.Sflags & GTregcand && type_size(s.Stype) != 0)
{
if (config.flags4 & CFG4optimized)
{ // If symbol is live in this basic block and
// isn't already in a register
if (s.Srange && vec_testbit(dfoidx, s.Srange) &&
s.Sfl != FLreg)
{ // Then symbol must be allocated on stack
needframe = true;
break;
}
}
else
{ if (mfuncreg == 0) // if no registers left
{ needframe = true;
break;
}
}
}
}
}
}
}
reg_t reg1 = NOREG, reg2 = NOREG;
if (config.exe == EX_WIN64) // Win64 is currently broken
retregs = regmask(e.Ety, tym1);
else
retregs = allocretregs(e.Ety, e.ET, tym1, ®1, ®2);
assert(retregs || !*pretregs);
if (!usefuncarg)
{
// If stack needs cleanup
if (s && s.Sflags & SFLexit)
{
if (config.fulltypes && TARGET_WINDOS)
{
// the stack walker evaluates the return address, not a byte of the
// call instruction, so ensure there is an instruction byte after
// the call that still has the same line number information
cdb.gen1(config.target_cpu >= TARGET_80286 ? UD2 : INT3);
}
/* Function never returns, so don't need to generate stack
* cleanup code. But still need to log the stack cleanup
* as if it did return.
*/
cdb.genadjesp(-(numpara + numalign));
stackpush -= numpara + numalign;
}
else if ((OTbinary(e.Eoper) || config.exe == EX_WIN64) &&
(!typfunc(tym1) || config.exe == EX_WIN64))
{
if (tym1 == TYhfunc)
{ // Hidden parameter is popped off by the callee
cdb.genadjesp(-REGSIZE);
stackpush -= REGSIZE;
if (numpara + numalign > REGSIZE)
genstackclean(cdb, numpara + numalign - REGSIZE, retregs);
}
else
genstackclean(cdb, numpara + numalign, retregs);
}
else
{
cdb.genadjesp(-numpara); // popped off by the callee's 'RET numpara'
stackpush -= numpara;
if (numalign) // callee doesn't know about alignment adjustment
genstackclean(cdb,numalign,retregs);
}
}
/* Special handling for functions which return a floating point
value in the top of the 8087 stack.
*/
if (retregs & mST0)
{
cdb.genadjfpu(1);
if (*pretregs) // if we want the result
{
//assert(global87.stackused == 0);
push87(cdb); // one item on 8087 stack
fixresult87(cdb,e,retregs,pretregs);
return;
}
else
// Pop unused result off 8087 stack
cdb.gen2(0xDD, modregrm(3, 3, 0)); // FPOP
}
else if (retregs & mST01)
{
cdb.genadjfpu(2);
if (*pretregs) // if we want the result
{
assert(global87.stackused == 0);
push87(cdb);
push87(cdb); // two items on 8087 stack
fixresult_complex87(cdb, e, retregs, pretregs);
return;
}
else
{
// Pop unused result off 8087 stack
cdb.gen2(0xDD, modregrm(3, 3, 0)); // FPOP
cdb.gen2(0xDD, modregrm(3, 3, 0)); // FPOP
}
}
/* Special handling for functions that return one part
in XMM0 and the other part in AX
*/
if (*pretregs && retregs)
{
if (reg1 == NOREG || reg2 == NOREG)
{}
else if ((0 == (mask(reg1) & XMMREGS)) ^ (0 == (mask(reg2) & XMMREGS)))
{
reg_t lreg, mreg;
if (mask(reg1) & XMMREGS)
{
lreg = XMM0;
mreg = XMM1;
}
else
{
lreg = mask(reg1) & mLSW ? reg1 : AX;
mreg = mask(reg2) & mMSW ? reg2 : DX;
}
for (int v = 0; v < 2; v++)
{
if (v ^ (reg2 != lreg))
genmovreg(cdb,lreg,reg1);
else
genmovreg(cdb,mreg,reg2);
}
retregs = mask(lreg) | mask(mreg);
}
}
/* Special handling for functions which return complex float in XMM0 or RAX. */
if (I64
&& config.exe != EX_WIN64 // broken
&& *pretregs && tybasic(e.Ety) == TYcfloat)
{
assert(reg2 == NOREG);
// spill
if (config.exe == EX_WIN64)
{
assert(reg1 == AX);
cdb.genfltreg(STO, reg1, 0);
code_orrex(cdb.last(), REX_W);
}
else
{
assert(reg1 == XMM0);
cdb.genxmmreg(xmmstore(TYdouble), reg1, 0, TYdouble);
}
// reload real
push87(cdb);
cdb.genfltreg(0xD9, 0, 0);
genfwait(cdb);
// reload imaginary
push87(cdb);
cdb.genfltreg(0xD9, 0, tysize(TYfloat));
genfwait(cdb);
retregs = mST01;
}
fixresult(cdb, e, retregs, pretregs);
}
/***************************
* Determine size of argument e that will be pushed.
*/
targ_size_t paramsize(elem* e, tym_t tyf)
{
assert(e.Eoper != OPparam);
targ_size_t szb;
tym_t tym = tybasic(e.Ety);
if (tyscalar(tym))
szb = size(tym);
else if (tym == TYstruct || tym == TYarray)
szb = type_parameterSize(e.ET, tyf);
else
{
WRTYxx(tym);
assert(0);
}
return szb;
}
/***************************
* Generate code to move argument e on the stack.
*/
private void movParams(ref CodeBuilder cdb, elem* e, uint stackalign, uint funcargtos, tym_t tyf)
{
//printf("movParams(e = %p, stackalign = %d, funcargtos = %d)\n", e, stackalign, funcargtos);
//printf("movParams()\n"); elem_print(e);
assert(!I16);
assert(e && e.Eoper != OPparam);
tym_t tym = tybasic(e.Ety);
if (tyfloating(tym))
objmod.fltused();
int grex = I64 ? REX_W << 16 : 0;
targ_size_t szb = paramsize(e, tyf); // size before alignment
targ_size_t sz = _align(stackalign, szb); // size after alignment
assert((sz & (stackalign - 1)) == 0); // ensure that alignment worked
assert((sz & (REGSIZE - 1)) == 0);
//printf("szb = %d sz = %d\n", (int)szb, (int)sz);
code cs;
cs.Iflags = 0;
cs.Irex = 0;
switch (e.Eoper)
{
case OPstrctor:
case OPstrthis:
case OPstrpar:
case OPnp_fp:
assert(0);
case OPrelconst:
{
int fl;
if (!evalinregister(e) &&
!(I64 && (config.flags3 & CFG3pic || config.exe == EX_WIN64)) &&
((fl = el_fl(e)) == FLdata || fl == FLudata || fl == FLextern)
)
{
// MOV -stackoffset[EBP],&variable
cs.Iop = 0xC7;
cs.Irm = modregrm(2,0,BPRM);
if (I64 && sz == 8)
cs.Irex |= REX_W;
cs.IFL1 = FLfuncarg;
cs.IEV1.Voffset = funcargtos - REGSIZE;
cs.IEV2.Voffset = e.EV.Voffset;
cs.IFL2 = cast(ubyte)fl;
cs.IEV2.Vsym = e.EV.Vsym;
cs.Iflags |= CFoff;
cdb.gen(&cs);
return;
}
break;
}
case OPconst:
if (!evalinregister(e))
{
cs.Iop = (sz == 1) ? 0xC6 : 0xC7;
cs.Irm = modregrm(2,0,BPRM);
cs.IFL1 = FLfuncarg;
cs.IEV1.Voffset = funcargtos - sz;
cs.IFL2 = FLconst;
targ_size_t *p = cast(targ_size_t *) &(e.EV);
cs.IEV2.Vsize_t = *p;
if (I64 && tym == TYcldouble)
// The alignment of EV.Vcldouble is not the same on the compiler
// as on the target
goto Lbreak;
if (I64 && sz >= 8)
{
int i = cast(int)sz;
do
{
if (*p >= 0x80000000)
{ // Use 64 bit register MOV, as the 32 bit one gets sign extended
// MOV reg,imm64
// MOV EA,reg
goto Lbreak;
}
p = cast(targ_size_t *)(cast(char *) p + REGSIZE);
i -= REGSIZE;
} while (i > 0);
p = cast(targ_size_t *) &(e.EV);
}
int i = cast(int)sz;
do
{ int regsize = REGSIZE;
regm_t retregs = (sz == 1) ? BYTEREGS : allregs;
reg_t reg;
if (reghasvalue(retregs,*p,®))
{
cs.Iop = (cs.Iop & 1) | 0x88;
cs.Irm |= modregrm(0, reg & 7, 0); // MOV EA,reg
if (reg & 8)
cs.Irex |= REX_R;
if (I64 && sz == 1 && reg >= 4)
cs.Irex |= REX;
}
if (I64 && sz >= 8)
cs.Irex |= REX_W;
cdb.gen(&cs); // MOV EA,const
p = cast(targ_size_t *)(cast(char *) p + regsize);
cs.Iop = 0xC7;
cs.Irm &= cast(ubyte)~cast(int)modregrm(0, 7, 0);
cs.Irex &= ~REX_R;
cs.IEV1.Voffset += regsize;
cs.IEV2.Vint = cast(targ_int)*p;
i -= regsize;
} while (i > 0);
return;
}
Lbreak:
break;
default:
break;
}
regm_t retregs = tybyte(tym) ? BYTEREGS : allregs;
if (tyvector(tym))
{
retregs = XMMREGS;
codelem(cdb, e, &retregs, false);
const op = xmmstore(tym);
const r = findreg(retregs);
cdb.genc1(op, modregxrm(2, r - XMM0, BPRM), FLfuncarg, funcargtos - 16); // MOV funcarg[EBP],r
checkSetVex(cdb.last(),tym);
return;
}
else if (tyfloating(tym))
{
if (config.inline8087)
{
retregs = tycomplex(tym) ? mST01 : mST0;
codelem(cdb, e, &retregs, false);
opcode_t op;
uint r;
switch (tym)
{
case TYfloat:
case TYifloat:
case TYcfloat:
op = 0xD9;
r = 3;
break;
case TYdouble:
case TYidouble:
case TYdouble_alias:
case TYcdouble:
op = 0xDD;
r = 3;
break;
case TYldouble:
case TYildouble:
case TYcldouble:
op = 0xDB;
r = 7;
break;
default:
assert(0);
}
if (tycomplex(tym))
{
// FSTP sz/2[ESP]
cdb.genc1(op, modregxrm(2, r, BPRM), FLfuncarg, funcargtos - sz/2);
pop87();
}
pop87();
cdb.genc1(op, modregxrm(2, r, BPRM), FLfuncarg, funcargtos - sz); // FSTP -sz[EBP]
return;
}
}
scodelem(cdb, e, &retregs, 0, true);
if (sz <= REGSIZE)
{
uint r = findreg(retregs);
cdb.genc1(0x89, modregxrm(2, r, BPRM), FLfuncarg, funcargtos - REGSIZE); // MOV -REGSIZE[EBP],r
if (sz == 8)
code_orrex(cdb.last(), REX_W);
}
else if (sz == REGSIZE * 2)
{
uint r = findregmsw(retregs);
cdb.genc1(0x89, grex | modregxrm(2, r, BPRM), FLfuncarg, funcargtos - REGSIZE); // MOV -REGSIZE[EBP],r
r = findreglsw(retregs);
cdb.genc1(0x89, grex | modregxrm(2, r, BPRM), FLfuncarg, funcargtos - REGSIZE * 2); // MOV -2*REGSIZE[EBP],r
}
else
assert(0);
}
/***************************
* Generate code to push argument e on the stack.
* stackpush is incremented by stackalign for each PUSH.
*/
void pushParams(ref CodeBuilder cdb, elem* e, uint stackalign, tym_t tyf)
{
//printf("params(e = %p, stackalign = %d)\n", e, stackalign);
//printf("params()\n"); elem_print(e);
stackchanged = 1;
assert(e && e.Eoper != OPparam);
tym_t tym = tybasic(e.Ety);
if (tyfloating(tym))
objmod.fltused();
int grex = I64 ? REX_W << 16 : 0;
targ_size_t szb = paramsize(e, tyf); // size before alignment
targ_size_t sz = _align(stackalign,szb); // size after alignment
assert((sz & (stackalign - 1)) == 0); // ensure that alignment worked
assert((sz & (REGSIZE - 1)) == 0);
switch (e.Eoper)
{
version (SCPP)
{
case OPstrctor:
{
elem* e1 = e.EV.E1;
docommas(cdb,&e1); // skip over any comma expressions
cod3_stackadj(cdb, sz);
stackpush += sz;
cdb.genadjesp(sz);
// Find OPstrthis and set it to stackpush
exp2_setstrthis(e1, null, stackpush, null);
regm_t retregs = 0;
codelem(cdb, e1, &retregs, true);
freenode(e);
return;
}
case OPstrthis:
// This is the parameter for the 'this' pointer corresponding to
// OPstrctor. We push a pointer to an object that was already
// allocated on the stack by OPstrctor.
{
regm_t retregs = allregs;
reg_t reg;
allocreg(cdb, &retregs, ®, TYoffset);
genregs(cdb, 0x89, SP, reg); // MOV reg,SP
if (I64)
code_orrex(cdb.last(), REX_W);
uint np = stackpush - e.EV.Vuns; // stack delta to parameter
cdb.genc2(0x81, grex | modregrmx(3, 0, reg), np); // ADD reg,np
if (sz > REGSIZE)
{
cdb.gen1(0x16); // PUSH SS
stackpush += REGSIZE;
}
cdb.gen1(0x50 + (reg & 7)); // PUSH reg
if (reg & 8)
code_orrex(cdb.last(), REX_B);
stackpush += REGSIZE;
cdb.genadjesp(sz);
freenode(e);
return;
}
}
case OPstrpar:
{
uint rm;
elem* e1 = e.EV.E1;
if (sz == 0)
{
docommas(cdb, &e1); // skip over any commas
freenode(e);
return;
}
if ((sz & 3) == 0 && (sz / REGSIZE) <= 4 && e1.Eoper == OPvar)
{
freenode(e);
e = e1;
goto L1;
}
docommas(cdb,&e1); // skip over any commas
code_flags_t seg = 0; // assume no seg override
regm_t retregs = sz ? IDXREGS : 0;
bool doneoff = false;
uint pushsize = REGSIZE;
uint op16 = 0;
if (!I16 && sz & 2) // if odd number of words to push
{
pushsize = 2;
op16 = 1;
}
else if (I16 && config.target_cpu >= TARGET_80386 && (sz & 3) == 0)
{
pushsize = 4; // push DWORDs at a time
op16 = 1;
}
uint npushes = cast(uint)(sz / pushsize);
switch (e1.Eoper)
{
case OPind:
if (sz)
{
switch (tybasic(e1.EV.E1.Ety))
{
case TYfptr:
case TYhptr:
seg = CFes;
retregs |= mES;
break;
case TYsptr:
if (config.wflags & WFssneds)
seg = CFss;
break;
case TYfgPtr:
if (I32)
seg = CFgs;
else if (I64)
seg = CFfs;
else
assert(0);
break;
case TYcptr:
seg = CFcs;
break;
default:
break;
}
}
codelem(cdb, e1.EV.E1, &retregs, false);
freenode(e1);
break;
case OPvar:
/* Symbol is no longer a candidate for a register */
e1.EV.Vsym.Sflags &= ~GTregcand;
if (!e1.Ecount && npushes > 4)
{
/* Kludge to point at last word in struct. */
/* Don't screw up CSEs. */
e1.EV.Voffset += sz - pushsize;
doneoff = true;
}
//if (LARGEDATA) /* if default isn't DS */
{
static immutable uint[4] segtocf = [ CFes,CFcs,CFss,0 ];
int fl = el_fl(e1);
if (fl == FLfardata)
{
seg = CFes;
retregs |= mES;
}
else
{
uint s = segfl[fl];
assert(s < 4);
seg = segtocf[s];
if (seg == CFss && !(config.wflags & WFssneds))
seg = 0;
}
}
if (e1.Ety & mTYfar)
{
seg = CFes;
retregs |= mES;
}
cdrelconst(cdb, e1, &retregs);
// Reverse the effect of the previous add
if (doneoff)
e1.EV.Voffset -= sz - pushsize;
freenode(e1);
break;
case OPstreq:
//case OPcond:
if (!(config.exe & EX_flat))
{
seg = CFes;
retregs |= mES;
}
codelem(cdb, e1, &retregs, false);
break;
case OPpair:
case OPrpair:
pushParams(cdb, e1, stackalign, tyf);
freenode(e);
return;
default:
elem_print(e1);
assert(0);
}
reg_t reg = findreglsw(retregs);
rm = I16 ? regtorm[reg] : regtorm32[reg];
if (op16)
seg |= CFopsize; // operand size
if (npushes <= 4)
{
assert(!doneoff);
for (; npushes > 1; --npushes)
{
cdb.genc1(0xFF, buildModregrm(2, 6, rm), FLconst, pushsize * (npushes - 1)); // PUSH [reg]
code_orflag(cdb.last(),seg);
cdb.genadjesp(pushsize);
}
cdb.gen2(0xFF,buildModregrm(0, 6, rm)); // PUSH [reg]
cdb.last().Iflags |= seg;
cdb.genadjesp(pushsize);
}
else if (sz)
{
getregs_imm(cdb, mCX | retregs);
// MOV CX,sz/2
movregconst(cdb, CX, npushes, 0);
if (!doneoff)
{ // This should be done when
// reg is loaded. Fix later
// ADD reg,sz-pushsize
cdb.genc2(0x81, grex | modregrmx(3, 0, reg), sz-pushsize);
}
getregs(cdb,mCX); // the LOOP decrements it
cdb.gen2(0xFF, buildModregrm(0, 6, rm)); // PUSH [reg]
cdb.last().Iflags |= seg | CFtarg2;
code* c3 = cdb.last();
cdb.genc2(0x81,grex | buildModregrm(3, 5,reg), pushsize); // SUB reg,pushsize
if (I16 || config.flags4 & CFG4space)
genjmp(cdb,0xE2,FLcode,cast(block *)c3);// LOOP c3
else
{
if (I64)
cdb.gen2(0xFF, modregrm(3, 1, CX));// DEC CX
else
cdb.gen1(0x48 + CX); // DEC CX
genjmp(cdb, JNE, FLcode, cast(block *)c3); // JNE c3
}
regimmed_set(CX,0);
cdb.genadjesp(cast(int)sz);
}
stackpush += sz;
freenode(e);
return;
}
case OPind:
if (!e.Ecount) /* if *e1 */
{
if (sz <= REGSIZE)
{ // Watch out for single byte quantities being up
// against the end of a segment or in memory-mapped I/O
if (!(config.exe & EX_flat) && szb == 1)
break;
goto L1; // can handle it with loadea()
}
// Avoid PUSH MEM on the Pentium when optimizing for speed
if (config.flags4 & CFG4speed &&
(config.target_cpu >= TARGET_80486 &&
config.target_cpu <= TARGET_PentiumMMX) &&
sz <= 2 * REGSIZE &&
!tyfloating(tym))
break;
if (tym == TYldouble || tym == TYildouble || tycomplex(tym))
break;
code cs;
cs.Iflags = 0;
cs.Irex = 0;
if (I32)
{
assert(sz >= REGSIZE * 2);
loadea(cdb, e, &cs, 0xFF, 6, sz - REGSIZE, 0, 0); // PUSH EA+4
cdb.genadjesp(REGSIZE);
stackpush += REGSIZE;
sz -= REGSIZE;
if (sz > REGSIZE)
{
while (sz)
{
cs.IEV1.Voffset -= REGSIZE;
cdb.gen(&cs); // PUSH EA+...
cdb.genadjesp(REGSIZE);
stackpush += REGSIZE;
sz -= REGSIZE;
}
freenode(e);
return;
}
}
else
{
if (sz == DOUBLESIZE)
{
loadea(cdb, e, &cs, 0xFF, 6, DOUBLESIZE - REGSIZE, 0, 0); // PUSH EA+6
cs.IEV1.Voffset -= REGSIZE;
cdb.gen(&cs); // PUSH EA+4
cdb.genadjesp(REGSIZE);
getlvalue_lsw(&cs);
cdb.gen(&cs); // PUSH EA+2
}
else /* TYlong */
loadea(cdb, e, &cs, 0xFF, 6, REGSIZE, 0, 0); // PUSH EA+2
cdb.genadjesp(REGSIZE);
}
stackpush += sz;
getlvalue_lsw(&cs);
cdb.gen(&cs); // PUSH EA
cdb.genadjesp(REGSIZE);
freenode(e);
return;
}
break;
case OPnp_fp:
if (!e.Ecount) /* if (far *)e1 */
{
elem* e1 = e.EV.E1;
tym_t tym1 = tybasic(e1.Ety);
/* BUG: what about pointers to functions? */
int segreg;
switch (tym1)
{
case TYnptr: segreg = 3<<3; break;
case TYcptr: segreg = 1<<3; break;
default: segreg = 2<<3; break;
}
if (I32 && stackalign == 2)
cdb.gen1(0x66); // push a word
cdb.gen1(0x06 + segreg); // PUSH SEGREG
if (I32 && stackalign == 2)
code_orflag(cdb.last(), CFopsize); // push a word
cdb.genadjesp(stackalign);
stackpush += stackalign;
pushParams(cdb, e1, stackalign, tyf);
freenode(e);
return;
}
break;
case OPrelconst:
static if (TARGET_SEGMENTED)
{
/* Determine if we can just push the segment register */
/* Test size of type rather than TYfptr because of (long)(&v) */
Symbol* s = e.EV.Vsym;
//if (sytab[s.Sclass] & SCSS && !I32) // if variable is on stack
// needframe = true; // then we need stack frame
int fl;
if (_tysize[tym] == tysize(TYfptr) &&
(fl = s.Sfl) != FLfardata &&
/* not a function that CS might not be the segment of */
(!((fl == FLfunc || s.ty() & mTYcs) &&
(s.Sclass == SCcomdat || s.Sclass == SCextern || s.Sclass == SCinline || config.wflags & WFthunk)) ||
(fl == FLfunc && config.exe == EX_DOSX)
)
)
{
stackpush += sz;
cdb.gen1(0x06 + // PUSH SEGREG
(((fl == FLfunc || s.ty() & mTYcs) ? 1 : segfl[fl]) << 3));
cdb.genadjesp(REGSIZE);
if (config.target_cpu >= TARGET_80286 && !e.Ecount)
{
getoffset(cdb, e, STACK);
freenode(e);
return;
}
else
{
regm_t retregs;
offsetinreg(cdb, e, &retregs);
const reg = findreg(retregs);
genpush(cdb,reg); // PUSH reg
cdb.genadjesp(REGSIZE);
}
return;
}
if (config.target_cpu >= TARGET_80286 && !e.Ecount)
{
stackpush += sz;
if (_tysize[tym] == tysize(TYfptr))
{
// PUSH SEG e
cdb.gencs(0x68,0,FLextern,s);
cdb.last().Iflags = CFseg;
cdb.genadjesp(REGSIZE);
}
getoffset(cdb, e, STACK);
freenode(e);
return;
}
}
break; /* else must evaluate expression */
case OPvar:
L1:
if (config.flags4 & CFG4speed &&
(config.target_cpu >= TARGET_80486 &&
config.target_cpu <= TARGET_PentiumMMX) &&
sz <= 2 * REGSIZE &&
!tyfloating(tym))
{ // Avoid PUSH MEM on the Pentium when optimizing for speed
break;
}
else if (movOnly(e) || (tyxmmreg(tym) && config.fpxmmregs) || tyvector(tym))
break; // no PUSH MEM
else
{
int regsize = REGSIZE;
uint flag = 0;
if (I16 && config.target_cpu >= TARGET_80386 && sz > 2 &&
!e.Ecount)
{
regsize = 4;
flag |= CFopsize;
}
code cs;
cs.Iflags = 0;
cs.Irex = 0;
loadea(cdb, e, &cs, 0xFF, 6, sz - regsize, RMload, 0); // PUSH EA+sz-2
code_orflag(cdb.last(), flag);
cdb.genadjesp(REGSIZE);
stackpush += sz;
while (cast(targ_int)(sz -= regsize) > 0)
{
loadea(cdb, e, &cs, 0xFF, 6, sz - regsize, RMload, 0);
code_orflag(cdb.last(), flag);
cdb.genadjesp(REGSIZE);
}
freenode(e);
return;
}
case OPconst:
{
char pushi = 0;
uint flag = 0;
int regsize = REGSIZE;
if (tycomplex(tym))
break;
if (I64 && tyfloating(tym) && sz > 4 && boolres(e))
// Can't push 64 bit non-zero args directly
break;
if (I32 && szb == 10) // special case for long double constants
{
assert(sz == 12);
targ_int value = e.EV.Vushort8[4]; // pick upper 2 bytes of Vldouble
stackpush += sz;
cdb.genadjesp(cast(int)sz);
for (int i = 0; i < 3; ++i)
{
reg_t reg;
if (reghasvalue(allregs, value, ®))
cdb.gen1(0x50 + reg); // PUSH reg
else
cdb.genc2(0x68,0,value); // PUSH value
value = e.EV.Vulong4[i ^ 1]; // treat Vldouble as 2 element array of 32 bit uint
}
freenode(e);
return;
}
assert(I64 || sz <= tysize(TYldouble));
int i = cast(int)sz;
if (!I16 && i == 2)
flag = CFopsize;
if (config.target_cpu >= TARGET_80286)
// && (e.Ecount == 0 || e.Ecount != e.Ecomsub))
{
pushi = 1;
if (I16 && config.target_cpu >= TARGET_80386 && i >= 4)
{
regsize = 4;
flag = CFopsize;
}
}
else if (i == REGSIZE)
break;
stackpush += sz;
cdb.genadjesp(cast(int)sz);
targ_uns* pi = &e.EV.Vuns; // point to start of Vdouble
targ_ushort* ps = cast(targ_ushort *) pi;
targ_ullong* pl = cast(targ_ullong *)pi;
i /= regsize;
do
{
if (i) /* be careful not to go negative */
i--;
targ_size_t value;
switch (regsize)
{
case 2:
value = ps[i];
break;
case 4:
if (tym == TYldouble || tym == TYildouble)
/* The size is 10 bytes, and since we have 2 bytes left over,
* just read those 2 bytes, not 4.
* Otherwise we're reading uninitialized data.
* I.e. read 4 bytes, 4 bytes, then 2 bytes
*/
value = i == 2 ? ps[4] : pi[i]; // 80 bits
else
value = pi[i];
break;
case 8:
value = cast(targ_size_t)pl[i];
break;
default:
assert(0);
}
reg_t reg;
if (pushi)
{
if (I64 && regsize == 8 && value != cast(int)value)
{
regwithvalue(cdb,allregs,value,®,64);
goto Preg; // cannot push imm64 unless it is sign extended 32 bit value
}
if (regsize == REGSIZE && reghasvalue(allregs,value,®))
goto Preg;
cdb.genc2((szb == 1) ? 0x6A : 0x68, 0, value); // PUSH value
}
else
{
regwithvalue(cdb, allregs, value, ®, 0);
Preg:
genpush(cdb,reg); // PUSH reg
}
code_orflag(cdb.last(), flag); // operand size
} while (i);
freenode(e);
return;
}
case OPpair:
{
if (e.Ecount)
break;
const op1 = e.EV.E1.Eoper;
const op2 = e.EV.E2.Eoper;
if ((op1 == OPvar || op1 == OPconst || op1 == OPrelconst) &&
(op2 == OPvar || op2 == OPconst || op2 == OPrelconst))
{
pushParams(cdb, e.EV.E2, stackalign, tyf);
pushParams(cdb, e.EV.E1, stackalign, tyf);
freenode(e);
}
else if (tyfloating(e.EV.E1.Ety) ||
tyfloating(e.EV.E2.Ety))
{
// Need special handling because of order of evaluation of e1 and e2
break;
}
else
{
regm_t regs = allregs;
codelem(cdb, e, ®s, false);
genpush(cdb, findregmsw(regs)); // PUSH msreg
genpush(cdb, findreglsw(regs)); // PUSH lsreg
cdb.genadjesp(cast(int)sz);
stackpush += sz;
}
return;
}
case OPrpair:
{
if (e.Ecount)
break;
const op1 = e.EV.E1.Eoper;
const op2 = e.EV.E2.Eoper;
if ((op1 == OPvar || op1 == OPconst || op1 == OPrelconst) &&
(op2 == OPvar || op2 == OPconst || op2 == OPrelconst))
{
pushParams(cdb, e.EV.E1, stackalign, tyf);
pushParams(cdb, e.EV.E2, stackalign, tyf);
freenode(e);
}
else if (tyfloating(e.EV.E1.Ety) ||
tyfloating(e.EV.E2.Ety))
{
// Need special handling because of order of evaluation of e1 and e2
break;
}
else
{
regm_t regs = allregs;
codelem(cdb, e, ®s, false);
genpush(cdb, findregmsw(regs)); // PUSH msreg
genpush(cdb, findreglsw(regs)); // PUSH lsreg
cdb.genadjesp(cast(int)sz);
stackpush += sz;
}
return;
}
default:
break;
}
regm_t retregs = tybyte(tym) ? BYTEREGS : allregs;
if (tyvector(tym) || (tyxmmreg(tym) && config.fpxmmregs))
{
regm_t retxmm = XMMREGS;
codelem(cdb, e, &retxmm, false);
stackpush += sz;
cdb.genadjesp(cast(int)sz);
cod3_stackadj(cdb, cast(int)sz);
const op = xmmstore(tym);
const r = findreg(retxmm);
cdb.gen2sib(op, modregxrm(0, r - XMM0,4 ), modregrm(0, 4, SP)); // MOV [ESP],r
checkSetVex(cdb.last(),tym);
return;
}
else if (tyfloating(tym))
{
if (config.inline8087)
{
retregs = tycomplex(tym) ? mST01 : mST0;
codelem(cdb, e, &retregs, false);
stackpush += sz;
cdb.genadjesp(cast(int)sz);
cod3_stackadj(cdb, cast(int)sz);
opcode_t op;
uint r;
switch (tym)
{
case TYfloat:
case TYifloat:
case TYcfloat:
op = 0xD9;
r = 3;
break;
case TYdouble:
case TYidouble:
case TYdouble_alias:
case TYcdouble:
op = 0xDD;
r = 3;
break;
case TYldouble:
case TYildouble:
case TYcldouble:
op = 0xDB;
r = 7;
break;
default:
assert(0);
}
if (!I16)
{
if (tycomplex(tym))
{
// FSTP sz/2[ESP]
cdb.genc1(op, (modregrm(0, 4, SP) << 8) | modregxrm(2, r, 4),FLconst, sz/2);
pop87();
}
pop87();
cdb.gen2sib(op, modregrm(0, r, 4),modregrm(0, 4, SP)); // FSTP [ESP]
}
else
{
retregs = IDXREGS; // get an index reg
reg_t reg;
allocreg(cdb, &retregs, ®, TYoffset);
genregs(cdb, 0x89, SP, reg); // MOV reg,SP
pop87();
cdb.gen2(op, modregrm(0, r, regtorm[reg])); // FSTP [reg]
}
if (LARGEDATA)
cdb.last().Iflags |= CFss; // want to store into stack
genfwait(cdb); // FWAIT
return;
}
else if (I16 && (tym == TYdouble || tym == TYdouble_alias))
retregs = mSTACK;
}
else if (I16 && sz == 8) // if long long
retregs = mSTACK;
scodelem(cdb,e,&retregs,0,true);
if (retregs != mSTACK) // if stackpush not already inc'd
stackpush += sz;
if (sz <= REGSIZE)
{
genpush(cdb,findreg(retregs)); // PUSH reg
cdb.genadjesp(cast(int)REGSIZE);
}
else if (sz == REGSIZE * 2)
{
genpush(cdb,findregmsw(retregs)); // PUSH msreg
genpush(cdb,findreglsw(retregs)); // PUSH lsreg
cdb.genadjesp(cast(int)sz);
}
}
/*******************************
* Get offset portion of e, and store it in an index
* register. Return mask of index register in *pretregs.
*/
void offsetinreg(ref CodeBuilder cdb, elem* e, regm_t* pretregs)
{
reg_t reg;
regm_t retregs = mLSW; // want only offset
if (e.Ecount && e.Ecount != e.Ecomsub)
{
regm_t rm = retregs & regcon.cse.mval & ~regcon.cse.mops & ~regcon.mvar; /* possible regs */
for (uint i = 0; rm; i++)
{
if (mask(i) & rm && regcon.cse.value[i] == e)
{
*pretregs = mask(i);
getregs(cdb, *pretregs);
goto L3;
}
rm &= ~mask(i);
}
}
*pretregs = retregs;
allocreg(cdb, pretregs, ®, TYoffset);
getoffset(cdb,e,reg);
L3:
cssave(e, *pretregs,false);
freenode(e);
}
/******************************
* Generate code to load data into registers.
*/
void loaddata(ref CodeBuilder cdb, elem* e, regm_t* pretregs)
{
reg_t reg;
reg_t nreg;
reg_t sreg;
opcode_t op;
tym_t tym;
code cs;
regm_t flags, forregs, regm;
debug
{
// if (debugw)
// printf("loaddata(e = %p,*pretregs = %s)\n",e,regm_str(*pretregs));
// elem_print(e);
}
assert(e);
elem_debug(e);
if (*pretregs == 0)
return;
tym = tybasic(e.Ety);
if (tym == TYstruct)
{
cdrelconst(cdb,e,pretregs);
return;
}
if (tyfloating(tym))
{
objmod.fltused();
if (config.inline8087)
{
if (*pretregs & mST0)
{
load87(cdb, e, 0, pretregs, null, -1);
return;
}
else if (tycomplex(tym))
{
cload87(cdb, e, pretregs);
return;
}
}
}
int sz = _tysize[tym];
cs.Iflags = 0;
cs.Irex = 0;
if (*pretregs == mPSW)
{
Symbol *s;
regm = allregs;
if (e.Eoper == OPconst)
{ /* true: OR SP,SP (SP is never 0) */
/* false: CMP SP,SP (always equal) */
genregs(cdb, (boolres(e)) ? 0x09 : 0x39 , SP, SP);
if (I64)
code_orrex(cdb.last(), REX_W);
}
else if (e.Eoper == OPvar &&
(s = e.EV.Vsym).Sfl == FLreg &&
s.Sregm & XMMREGS &&
(tym == TYfloat || tym == TYifloat || tym == TYdouble || tym ==TYidouble))
{
tstresult(cdb,s.Sregm,e.Ety,true);
}
else if (sz <= REGSIZE)
{
if (!I16 && (tym == TYfloat || tym == TYifloat))
{
allocreg(cdb, ®m, ®, TYoffset); // get a register
loadea(cdb, e, &cs, 0x8B, reg, 0, 0, 0); // MOV reg,data
cdb.gen2(0xD1,modregrmx(3,4,reg)); // SHL reg,1
}
else if (I64 && (tym == TYdouble || tym ==TYidouble))
{
allocreg(cdb, ®m, ®, TYoffset); // get a register
loadea(cdb, e,&cs, 0x8B, reg, 0, 0, 0); // MOV reg,data
// remove sign bit, so that -0.0 == 0.0
cdb.gen2(0xD1, modregrmx(3, 4, reg)); // SHL reg,1
code_orrex(cdb.last(), REX_W);
}
else if (TARGET_OSX && e.Eoper == OPvar && movOnly(e))
{
allocreg(cdb, ®m, ®, TYoffset); // get a register
loadea(cdb, e, &cs, 0x8B, reg, 0, 0, 0); // MOV reg,data
fixresult(cdb, e, regm, pretregs);
}
else
{ cs.IFL2 = FLconst;
cs.IEV2.Vsize_t = 0;
op = (sz == 1) ? 0x80 : 0x81;
loadea(cdb, e, &cs, op, 7, 0, 0, 0); // CMP EA,0
// Convert to TEST instruction if EA is a register
// (to avoid register contention on Pentium)
code *c = cdb.last();
if ((c.Iop & ~1) == 0x38 &&
(c.Irm & modregrm(3, 0, 0)) == modregrm(3, 0, 0)
)
{
c.Iop = (c.Iop & 1) | 0x84;
code_newreg(c, c.Irm & 7);
if (c.Irex & REX_B)
//c.Irex = (c.Irex & ~REX_B) | REX_R;
c.Irex |= REX_R;
}
}
}
else if (sz < 8)
{
allocreg(cdb, ®m, ®, TYoffset); // get a register
if (I32) // it's a 48 bit pointer
loadea(cdb, e, &cs, MOVZXw, reg, REGSIZE, 0, 0); // MOVZX reg,data+4
else
{
loadea(cdb, e, &cs, 0x8B, reg, REGSIZE, 0, 0); // MOV reg,data+2
if (tym == TYfloat || tym == TYifloat) // dump sign bit
cdb.gen2(0xD1, modregrm(3, 4, reg)); // SHL reg,1
}
loadea(cdb,e,&cs,0x0B,reg,0,regm,0); // OR reg,data
}
else if (sz == 8 || (I64 && sz == 2 * REGSIZE && !tyfloating(tym)))
{
allocreg(cdb, ®m, ®, TYoffset); // get a register
int i = sz - REGSIZE;
loadea(cdb, e, &cs, 0x8B, reg, i, 0, 0); // MOV reg,data+6
if (tyfloating(tym)) // TYdouble or TYdouble_alias
cdb.gen2(0xD1, modregrm(3, 4, reg)); // SHL reg,1
while ((i -= REGSIZE) >= 0)
{
loadea(cdb, e, &cs, 0x0B, reg, i, regm, 0); // OR reg,data+i
code *c = cdb.last();
if (i == 0)
c.Iflags |= CFpsw; // need the flags on last OR
}
}
else if (sz == tysize(TYldouble)) // TYldouble
load87(cdb, e, 0, pretregs, null, -1);
else
{
elem_print(e);
assert(0);
}
return;
}
/* not for flags only */
flags = *pretregs & mPSW; /* save original */
forregs = *pretregs & (mBP | ALLREGS | mES | XMMREGS);
if (*pretregs & mSTACK)
forregs |= DOUBLEREGS;
if (e.Eoper == OPconst)
{
targ_size_t value = e.EV.Vint;
if (sz == 8)
value = cast(targ_size_t)e.EV.Vullong;
if (sz == REGSIZE && reghasvalue(forregs, value, ®))
forregs = mask(reg);
regm_t save = regcon.immed.mval;
allocreg(cdb, &forregs, ®, tym); // allocate registers
regcon.immed.mval = save; // KLUDGE!
if (sz <= REGSIZE)
{
if (sz == 1)
flags |= 1;
else if (!I16 && sz == SHORTSIZE &&
!(mask(reg) & regcon.mvar) &&
!(config.flags4 & CFG4speed)
)
flags |= 2;
if (sz == 8)
flags |= 64;
if (isXMMreg(reg))
{ /* This comes about because 0, 1, pi, etc., constants don't get stored
* in the data segment, because they are x87 opcodes.
* Not so efficient. We should at least do a PXOR for 0.
*/
reg_t r;
targ_size_t unsvalue = e.EV.Vuns;
if (sz == 8)
unsvalue = cast(targ_size_t)e.EV.Vullong;
regwithvalue(cdb,ALLREGS, unsvalue,&r,flags);
flags = 0; // flags are already set
cdb.genfltreg(0x89, r, 0); // MOV floatreg,r
if (sz == 8)
code_orrex(cdb.last(), REX_W);
assert(sz == 4 || sz == 8); // float or double
const opmv = xmmload(tym);
cdb.genxmmreg(opmv, reg, 0, tym); // MOVSS/MOVSD XMMreg,floatreg
}
else
{
movregconst(cdb, reg, value, flags);
flags = 0; // flags are already set
}
}
else if (sz < 8) // far pointers, longs for 16 bit targets
{
targ_int msw = I32 ? e.EV.Vseg
: (e.EV.Vulong >> 16);
targ_int lsw = e.EV.Voff;
regm_t mswflags = 0;
if (forregs & mES)
{
movregconst(cdb, reg, msw, 0); // MOV reg,segment
genregs(cdb, 0x8E, 0, reg); // MOV ES,reg
msw = lsw; // MOV reg,offset
}
else
{
sreg = findreglsw(forregs);
movregconst(cdb, sreg, lsw, 0);
reg = findregmsw(forregs);
/* Decide if we need to set flags when we load msw */
if (flags && (msw && msw|lsw || !(msw|lsw)))
{ mswflags = mPSW;
flags = 0;
}
}
movregconst(cdb, reg, msw, mswflags);
}
else if (sz == 8)
{
if (I32)
{
targ_long *p = cast(targ_long *)cast(void*)&e.EV.Vdouble;
if (isXMMreg(reg))
{ /* This comes about because 0, 1, pi, etc., constants don't get stored
* in the data segment, because they are x87 opcodes.
* Not so efficient. We should at least do a PXOR for 0.
*/
reg_t r;
regm_t rm = ALLREGS;
allocreg(cdb, &rm, &r, TYint); // allocate scratch register
movregconst(cdb, r, p[0], 0);
cdb.genfltreg(0x89, r, 0); // MOV floatreg,r
movregconst(cdb, r, p[1], 0);
cdb.genfltreg(0x89, r, 4); // MOV floatreg+4,r
const opmv = xmmload(tym);
cdb.genxmmreg(opmv, reg, 0, tym); // MOVSS/MOVSD XMMreg,floatreg
}
else
{
movregconst(cdb, findreglsw(forregs) ,p[0], 0);
movregconst(cdb, findregmsw(forregs) ,p[1], 0);
}
}
else
{ targ_short *p = &e.EV.Vshort; // point to start of Vdouble
assert(reg == AX);
movregconst(cdb, AX, p[3], 0); // MOV AX,p[3]
movregconst(cdb, DX, p[0], 0);
movregconst(cdb, CX, p[1], 0);
movregconst(cdb, BX, p[2], 0);
}
}
else if (I64 && sz == 16)
{
movregconst(cdb, findreglsw(forregs), cast(targ_size_t)e.EV.Vcent.lsw, 64);
movregconst(cdb, findregmsw(forregs), cast(targ_size_t)e.EV.Vcent.msw, 64);
}
else
assert(0);
// Flags may already be set
*pretregs &= flags | ~mPSW;
fixresult(cdb, e, forregs, pretregs);
return;
}
else
{
// See if we can use register that parameter was passed in
if (regcon.params &&
regParamInPreg(e.EV.Vsym) &&
!anyiasm && // may have written to the memory for the parameter
(regcon.params & mask(e.EV.Vsym.Spreg) && e.EV.Voffset == 0 ||
regcon.params & mask(e.EV.Vsym.Spreg2) && e.EV.Voffset == REGSIZE) &&
sz <= REGSIZE) // make sure no 'paint' to a larger size happened
{
reg = e.EV.Voffset ? e.EV.Vsym.Spreg2 : e.EV.Vsym.Spreg;
forregs = mask(reg);
if (debugr)
printf("%s.%d is fastpar and using register %s\n",
e.EV.Vsym.Sident.ptr,
cast(int)e.EV.Voffset,
regm_str(forregs));
mfuncreg &= ~forregs;
regcon.used |= forregs;
fixresult(cdb,e,forregs,pretregs);
return;
}
allocreg(cdb, &forregs, ®, tym); // allocate registers
if (sz == 1)
{ regm_t nregm;
debug
if (!(forregs & BYTEREGS))
{ elem_print(e);
printf("forregs = %s\n", regm_str(forregs));
}
opcode_t opmv = 0x8A; // byte MOV
static if (TARGET_OSX)
{
if (movOnly(e))
opmv = 0x8B;
}
assert(forregs & BYTEREGS);
if (!I16)
{
if (config.target_cpu >= TARGET_PentiumPro && config.flags4 & CFG4speed &&
// Workaround for OSX linker bug:
// ld: GOT load reloc does not point to a movq instruction in test42 for x86_64
!(config.exe & EX_OSX64 && !(sytab[e.EV.Vsym.Sclass] & SCSS))
)
{
// opmv = tyuns(tym) ? MOVZXb : MOVSXb; // MOVZX/MOVSX
}
loadea(cdb, e, &cs, opmv, reg, 0, 0, 0); // MOV regL,data
}
else
{
nregm = tyuns(tym) ? BYTEREGS : cast(regm_t) mAX;
if (*pretregs & nregm)
nreg = reg; // already allocated
else
allocreg(cdb, &nregm, &nreg, tym);
loadea(cdb, e, &cs, opmv, nreg, 0, 0, 0); // MOV nregL,data
if (reg != nreg)
{
genmovreg(cdb, reg, nreg); // MOV reg,nreg
cssave(e, mask(nreg), false);
}
}
}
else if (forregs & XMMREGS)
{
// Can't load from registers directly to XMM regs
//e.EV.Vsym.Sflags &= ~GTregcand;
opcode_t opmv = xmmload(tym, xmmIsAligned(e));
if (e.Eoper == OPvar)
{
Symbol *s = e.EV.Vsym;
if (s.Sfl == FLreg && !(mask(s.Sreglsw) & XMMREGS))
{ opmv = LODD; // MOVD/MOVQ
/* getlvalue() will unwind this and unregister s; could use a better solution */
}
}
loadea(cdb, e, &cs, opmv, reg, 0, RMload, 0); // MOVSS/MOVSD reg,data
checkSetVex(cdb.last(),tym);
}
else if (sz <= REGSIZE)
{
opcode_t opmv = 0x8B; // MOV reg,data
if (sz == 2 && !I16 && config.target_cpu >= TARGET_PentiumPro &&
// Workaround for OSX linker bug:
// ld: GOT load reloc does not point to a movq instruction in test42 for x86_64
!(config.exe & EX_OSX64 && !(sytab[e.EV.Vsym.Sclass] & SCSS))
)
{
// opmv = tyuns(tym) ? MOVZXw : MOVSXw; // MOVZX/MOVSX
}
loadea(cdb, e, &cs, opmv, reg, 0, RMload, 0);
}
else if (sz <= 2 * REGSIZE && forregs & mES)
{
loadea(cdb, e, &cs, 0xC4, reg, 0, 0, mES); // LES data
}
else if (sz <= 2 * REGSIZE)
{
if (I32 && sz == 8 &&
(*pretregs & (mSTACK | mPSW)) == mSTACK)
{
assert(0);
/+
/* Note that we allocreg(DOUBLEREGS) needlessly */
stackchanged = 1;
int i = DOUBLESIZE - REGSIZE;
do
{
loadea(cdb,e,&cs,0xFF,6,i,0,0); // PUSH EA+i
cdb.genadjesp(REGSIZE);
stackpush += REGSIZE;
i -= REGSIZE;
}
while (i >= 0);
return;
+/
}
reg = findregmsw(forregs);
loadea(cdb, e, &cs, 0x8B, reg, REGSIZE, forregs, 0); // MOV reg,data+2
if (I32 && sz == REGSIZE + 2)
cdb.last().Iflags |= CFopsize; // seg is 16 bits
reg = findreglsw(forregs);
loadea(cdb, e, &cs, 0x8B, reg, 0, forregs, 0); // MOV reg,data
}
else if (sz >= 8)
{
assert(!I32);
if ((*pretregs & (mSTACK | mPSW)) == mSTACK)
{
// Note that we allocreg(DOUBLEREGS) needlessly
stackchanged = 1;
int i = sz - REGSIZE;
do
{
loadea(cdb,e,&cs,0xFF,6,i,0,0); // PUSH EA+i
cdb.genadjesp(REGSIZE);
stackpush += REGSIZE;
i -= REGSIZE;
}
while (i >= 0);
return;
}
else
{
assert(reg == AX);
loadea(cdb, e, &cs, 0x8B, AX, 6, 0, 0); // MOV AX,data+6
loadea(cdb, e, &cs, 0x8B, BX, 4, mAX, 0); // MOV BX,data+4
loadea(cdb, e, &cs, 0x8B, CX, 2, mAX|mBX, 0); // MOV CX,data+2
loadea(cdb, e, &cs, 0x8B, DX, 0, mAX|mCX|mCX, 0); // MOV DX,data
}
}
else
assert(0);
// Flags may already be set
*pretregs &= flags | ~mPSW;
fixresult(cdb, e, forregs, pretregs);
return;
}
}
}
|
D
|
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/NIOHTTP1.build/Objects-normal/x86_64/HTTPDecoder.o : /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPDecoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPTypes.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOZlib/include/c_nio_zlib.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/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/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/NIOHTTP1.build/Objects-normal/x86_64/HTTPDecoder~partial.swiftmodule : /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPDecoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPTypes.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOZlib/include/c_nio_zlib.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/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/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes
/Users/petercernak/vapor/TILApp/Build/Intermediates.noindex/TILApp.build/Debug/NIOHTTP1.build/Objects-normal/x86_64/HTTPDecoder~partial.swiftdoc : /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPPipelineSetup.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPDecoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPEncoder.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPUpgradeHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerPipelineHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPServerProtocolErrorHandler.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPResponseCompressor.swift /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/NIOHTTP1/HTTPTypes.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIO.framework/Modules/NIO.swiftmodule/x86_64.swiftmodule /Users/petercernak/vapor/TILApp/Build/Products/Debug/NIOConcurrencyHelpers.framework/Modules/NIOConcurrencyHelpers.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/SwiftOnoneSupport.swiftmodule /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOZlib/include/c_nio_zlib.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/cpp_magic.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIODarwin/include/c_nio_darwin.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOHTTPParser/include/c_nio_http_parser.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOAtomics/include/c-atomics.h /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio.git--2128188973977302459/Sources/CNIOLinux/include/c_nio_linux.h /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOSHA1/module.modulemap /Users/petercernak/vapor/TILApp/.build/checkouts/swift-nio-zlib-support.git--6538424668019974428/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOZlib/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIODarwin/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOHTTPParser/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOAtomics/module.modulemap /Users/petercernak/vapor/ic2/ic2.xcodeproj/GeneratedModuleMap/CNIOLinux/module.modulemap /Users/petercernak/vapor/TILApp/TILApp.xcodeproj/GeneratedModuleMap/CNIOLinux/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/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/Darwin.apinotes
|
D
|
//
//------------------------------------------------------------------------------
// Copyright 2007-2011 Mentor Graphics Corporation
// Copyright 2007-2010 Cadence Design Systems, Inc.
// Copyright 2010 Synopsys, Inc.
// Copyright 2012-2015 Coverify Systems Technology
// All Rights Reserved Worldwide
//
// 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 uvm.base.uvm_object_globals;
import esdl.data.bvec;
import esdl.data.time;
import uvm.meta.misc;
//This bit marks where filtering should occur to remove uvm stuff from a
//scope
// bool uvm_start_uvm_declarations = true;
//------------------------------------------------------------------------------
//
// Section: Types and Enumerations
//
//------------------------------------------------------------------------------
//------------------------
// Group: Field automation
//------------------------
// Macro: `UVM_MAX_STREAMBITS
//
// Defines the maximum bit vector size for integral types.
enum int UVM_MAX_STREAMBITS=4096;
// Macro: `UVM_PACKER_MAX_BYTES
//
// Defines the maximum bytes to allocate for packing an object using
// the <uvm_packer>. Default is <`UVM_MAX_STREAMBITS>, in ~bytes~.
enum int UVM_STREAMBITS = UVM_MAX_STREAMBITS;
alias UVM_STREAMBITS UVM_PACKER_MAX_BYTES;
// Macro: `UVM_DEFAULT_TIMEOUT
//
// The default timeout for simulation, if not overridden by
// <uvm_root::set_timeout> or <+UVM_TIMEOUT>
//
enum Time UVM_DEFAULT_TIMEOUT = 9200.sec;
// Type: uvm_bitstream_t
//
// The bitstream type is used as a argument type for passing integral values
// in such methods as set_int_local, get_int_local, get_config_int, report,
// pack and unpack.
alias LogicVec!UVM_STREAMBITS uvm_bitstream_t;
// Enum: uvm_radix_enum
//
// Specifies the radix to print or record in.
//
// UVM_BIN - Selects binary (%b) format
// UVM_DEC - Selects decimal (%d) format
// UVM_UNSIGNED - Selects unsigned decimal (%u) format
// UVM_OCT - Selects octal (%o) format
// UVM_HEX - Selects hexidecimal (%h) format
// UVM_STRING - Selects string (%s) format
// UVM_TIME - Selects time (%t) format
// UVM_ENUM - Selects enumeration value (name) format
enum uvm_radix_enum: int
{ UVM_BIN = 0x1000000,
UVM_DEC = 0x2000000,
UVM_UNSIGNED = 0x3000000,
UVM_UNFORMAT2 = 0x4000000,
UVM_UNFORMAT4 = 0x5000000,
UVM_OCT = 0x6000000,
UVM_HEX = 0x7000000,
UVM_STRING = 0x8000000,
UVM_TIME = 0x9000000,
UVM_ENUM = 0xa000000,
UVM_REAL = 0xb000000,
UVM_REAL_DEC = 0xc000000,
UVM_REAL_EXP = 0xd000000,
UVM_NORADIX = 0x0000000
}
mixin(declareEnums!uvm_radix_enum());
enum int UVM_RADIX = 0xf000000; //4 bits setting the radix
// Function- uvm_radix_to_string
public char uvm_radix_to_string(uvm_radix_enum radix) {
switch (radix) {
case UVM_BIN: return 'b';
case UVM_OCT: return 'o';
case UVM_DEC: return 'd';
case UVM_HEX: return 'h';
case UVM_UNSIGNED: return 'u';
case UVM_UNFORMAT2: return 'u';
case UVM_UNFORMAT4: return 'z';
case UVM_STRING: return 's';
case UVM_TIME: return 't';
case UVM_ENUM: return 's';
case UVM_REAL: return 'g';
case UVM_REAL_DEC: return 'f';
case UVM_REAL_EXP: return 'e';
default: return 'x'; //hex
}
}
// Enum: uvm_recursion_policy_enum
//
// Specifies the policy for copying objects.
//
// UVM_DEEP - Objects are deep copied (object must implement copy method)
// UVM_SHALLOW - Objects are shallow copied using default SV copy.
// UVM_REFERENCE - Only object handles are copied.
enum uvm_recursion_policy_enum: int
{ UVM_DEFAULT_POLICY = 0,
UVM_DEEP = 0x400,
UVM_SHALLOW = 0x800,
UVM_REFERENCE = 0x1000
}
mixin(declareEnums!uvm_recursion_policy_enum());
// Enum: uvm_active_passive_enum
//
// Convenience value to define whether a component, usually an agent,
// is in "active" mode or "passive" mode.
enum uvm_active_passive_enum: bool
{ UVM_PASSIVE=false,
UVM_ACTIVE=true
}
mixin(declareEnums!uvm_active_passive_enum());
enum uvm_auto_enum: byte
{ UVM_NO_AUTO=0,
UVM_AUTO=1
}
mixin(declareEnums!uvm_auto_enum());
// Parameter: `uvm_field_* macro flags
//
// Defines what operations a given field should be involved in.
// Bitwise OR all that apply.
//
// UVM_DEFAULT - All field operations turned on
// UVM_COPY - Field will participate in <uvm_object::copy>
// UVM_COMPARE - Field will participate in <uvm_object::compare>
// UVM_PRINT - Field will participate in <uvm_object::print>
// UVM_RECORD - Field will participate in <uvm_object::record>
// UVM_PACK - Field will participate in <uvm_object::pack>
//
// UVM_NOCOPY - Field will not participate in <uvm_object::copy>
// UVM_NOCOMPARE - Field will not participate in <uvm_object::compare>
// UVM_NOPRINT - Field will not participate in <uvm_object::print>
// UVM_NORECORD - Field will not participate in <uvm_object::record>
// UVM_NOPACK - Field will not participate in <uvm_object::pack>
//
// UVM_DEEP - Object field will be deep copied
// UVM_SHALLOW - Object field will be shallow copied
// UVM_REFERENCE - Object field will copied by reference
//
// UVM_READONLY - Object field will NOT be automatically configured.
enum int UVM_MACRO_NUMFLAGS = 17;
//A=ABSTRACT Y=PHYSICAL
//F=REFERENCE, S=SHALLOW, D=DEEP
//K=PACK, R=RECORD, P=PRINT, M=COMPARE, C=COPY
//--------------------------- AYFSD K R P M C
enum uvm_field_auto_enum: int
{ UVM_DEFAULT = 0b000010101010101,
UVM_ALL_ON = 0b000000101010101,
UVM_FLAGS_ON = 0b000000101010101,
UVM_FLAGS_OFF = 0,
//Values are or'ed into a 32 bit value
//and externally
UVM_COPY = (1 << 0),
UVM_NOCOPY = (1 << 1),
UVM_COMPARE = (1 << 2),
UVM_NOCOMPARE = (1 << 3),
UVM_PRINT = (1 << 4),
UVM_NOPRINT = (1 << 5),
UVM_RECORD = (1 << 6),
UVM_NORECORD = (1 << 7),
UVM_PACK = (1 << 8),
UVM_NOPACK = (1 << 9),
//UVM_DEEP = (1 << 10),
//UVM_SHALLOW = (1 << 11),
//UVM_REFERENCE = (1 << 12),
UVM_PHYSICAL = (1 << 13),
UVM_ABSTRACT = (1 << 14),
UVM_READONLY = (1 << 15),
UVM_NODEFPRINT = (1 << 16),
}
mixin(declareEnums!uvm_field_auto_enum());
//Extra values that are used for extra methods
enum int UVM_MACRO_EXTRAS = (1 << UVM_MACRO_NUMFLAGS);
enum int UVM_FLAGS = UVM_MACRO_EXTRAS + 1;
enum int UVM_UNPACK = UVM_MACRO_EXTRAS + 2;
enum int UVM_CHECK_FIELDS = UVM_MACRO_EXTRAS + 3;
enum int UVM_END_DATA_EXTRA = UVM_MACRO_EXTRAS + 4;
//Get and set methods (in uvm_object). Used by the set/get* functions
//to tell the object what operation to perform on the fields.
enum int UVM_START_FUNCS = UVM_END_DATA_EXTRA + 1;
enum int UVM_SET = UVM_START_FUNCS + 1;
enum int UVM_SETINT = UVM_SET;
enum int UVM_SETOBJ = UVM_START_FUNCS + 2;
enum int UVM_SETSTR = UVM_START_FUNCS + 3;
enum int UVM_END_FUNCS = UVM_SETSTR;
//Global string variables
string uvm_aa_string_key;
//-----------------
// Group: Reporting
//-----------------
// Enum: uvm_severity
//
// Defines all possible values for report severity.
//
// UVM_INFO - Informative messsage.
// UVM_WARNING - Indicates a potential problem.
// UVM_ERROR - Indicates a real problem. Simulation continues subject
// to the configured message action.
// UVM_FATAL - Indicates a problem from which simulation can not
// recover. Simulation exits via $finish after a #0 delay.
// typedef bit [1:0] uvm_severity;
alias byte uvm_severity;
enum uvm_severity_type: uvm_severity
{ UVM_INFO,
UVM_WARNING,
UVM_ERROR,
UVM_FATAL
}
mixin(declareEnums!uvm_severity_type());
// Enum: uvm_action
//
// Defines all possible values for report actions. Each report is configured
// to execute one or more actions, determined by the bitwise OR of any or all
// of the following enumeration constants.
//
// UVM_NO_ACTION - No action is taken
// UVM_DISPLAY - Sends the report to the standard output
// UVM_LOG - Sends the report to the file(s) for this (severity,id) pair
// UVM_COUNT - Counts the number of reports with the COUNT attribute.
// When this value reaches max_quit_count, the simulation terminates
// UVM_EXIT - Terminates the simulation immediately.
// UVM_CALL_HOOK - Callback the report hook methods
// UVM_STOP - Causes ~$stop~ to be executed, putting the simulation into
// interactive mode.
alias int uvm_action;
enum uvm_action_type: byte
{ UVM_NO_ACTION = 0b000000,
UVM_DISPLAY = 0b000001,
UVM_LOG = 0b000010,
UVM_COUNT = 0b000100,
UVM_EXIT = 0b001000,
UVM_CALL_HOOK = 0b010000,
UVM_STOP = 0b100000
}
mixin(declareEnums!uvm_action_type());
// Enum: uvm_verbosity
//
// Defines standard verbosity levels for reports.
//
// UVM_NONE - Report is always printed. Verbosity level setting can not
// disable it.
// UVM_LOW - Report is issued if configured verbosity is set to UVM_LOW
// or above.
// UVM_MEDIUM - Report is issued if configured verbosity is set to UVM_MEDIUM
// or above.
// UVM_HIGH - Report is issued if configured verbosity is set to UVM_HIGH
// or above.
// UVM_FULL - Report is issued if configured verbosity is set to UVM_FULL
// or above.
enum uvm_verbosity: int
{ UVM_NONE = 0,
UVM_LOW = 100,
UVM_MEDIUM = 200,
UVM_HIGH = 300,
UVM_FULL = 400,
UVM_DEBUG = 500
}
mixin(declareEnums!uvm_verbosity());
import uvm.meta.mcd;
alias MCD UVM_FILE;
//-----------------
// Group: Port Type
//-----------------
// Enum: uvm_port_type_e
//
// Specifies the type of port
//
// UVM_PORT - The port requires the interface that is its type
// parameter.
// UVM_EXPORT - The port provides the interface that is its type
// parameter via a connection to some other export or
// implementation.
// UVM_IMPLEMENTATION - The port provides the interface that is its type
// parameter, and it is bound to the component that
// implements the interface.
enum uvm_port_type_e: byte
{ UVM_PORT ,
UVM_EXPORT ,
UVM_IMPLEMENTATION
}
mixin(declareEnums!uvm_port_type_e());
//-----------------
// Group: Sequences
//-----------------
// Enum: uvm_sequencer_arb_mode
//
// Specifies a sequencer's arbitration mode
//
// SEQ_ARB_FIFO - Requests are granted in FIFO order (default)
// SEQ_ARB_WEIGHTED - Requests are granted randomly by weight
// SEQ_ARB_RANDOM - Requests are granted randomly
// SEQ_ARB_STRICT_FIFO - Requests at highest priority granted in fifo order
// SEQ_ARB_STRICT_RANDOM - Requests at highest priority granted in randomly
// SEQ_ARB_USER - Arbitration is delegated to the user-defined
// function, user_priority_arbitration. That function
// will specify the next sequence to grant.
enum uvm_sequencer_arb_mode: byte
{ SEQ_ARB_FIFO,
SEQ_ARB_WEIGHTED,
SEQ_ARB_RANDOM,
SEQ_ARB_STRICT_FIFO,
SEQ_ARB_STRICT_RANDOM,
SEQ_ARB_USER
}
mixin(declareEnums!uvm_sequencer_arb_mode());
alias uvm_sequencer_arb_mode SEQ_ARB_TYPE; // backward compat
// Enum: uvm_sequence_state_enum
//
// Defines current sequence state
//
// CREATED - The sequence has been allocated.
// PRE_START - The sequence is started and the
// <uvm_sequence_base::pre_start()> task is
// being executed.
// PRE_FRAME - The sequence is started and the
// <uvm_sequence_base::pre_frame()> task is
// being executed.
// FRAME - The sequence is started and the
// <uvm_sequence_base::frame()> task is
// being executed.
// ENDED - The sequence has completed the execution of the
// <uvm_sequence_base::frame()> task.
// POST_FRAME - The sequence is started and the
// <uvm_sequence_base::post_frame()> task is
// being executed.
// POST_START - The sequence is started and the
// <uvm_sequence_base::post_start()> task is
// being executed.
// STOPPED - The sequence has been forcibly ended by issuing a
// <uvm_sequence_base::kill()> on the sequence.
// FINISHED - The sequence is completely finished executing.
enum uvm_sequence_state: int
{ CREATED = 1,
PRE_START = 2,
PRE_FRAME = 4,
FRAME = 8,
POST_FRAME= 16,
POST_START= 32,
ENDED = 64,
STOPPED = 128,
FINISHED = 256
}
alias uvm_sequence_state uvm_sequence_state_enum; // backward compat
mixin(declareEnums!uvm_sequence_state());
// Enum: uvm_sequence_lib_mode
//
// Specifies the random selection mode of a sequence library
//
// UVM_SEQ_LIB_RAND - Random sequence selection
// UVM_SEQ_LIB_RANDC - Random cyclic sequence selection
// UVM_SEQ_LIB_ITEM - Emit only items, no sequence execution
// UVM_SEQ_LIB_USER - Apply a user-defined random-selection algorithm
enum uvm_sequence_lib_mode: byte
{ UVM_SEQ_LIB_RAND,
UVM_SEQ_LIB_RANDC,
UVM_SEQ_LIB_ITEM,
UVM_SEQ_LIB_USER
}
mixin(declareEnums!uvm_sequence_lib_mode());
//---------------
// Group: Phasing
//---------------
// Enum: uvm_phase_type
//
// This is an attribute of a <uvm_phase> object which defines the phase
// type.
//
// UVM_PHASE_IMP - The phase object is used to traverse the component
// hierarchy and call the component phase method as
// well as the ~phase_started~ and ~phase_ended~ callbacks.
// These nodes are created by the phase macros,
// `uvm_builtin_task_phase, `uvm_builtin_topdown_phase,
// and `uvm_builtin_bottomup_phase. These nodes represent
// the phase type, i.e. uvm_run_phase, uvm_main_phase.
//
// UVM_PHASE_NODE - The object represents a simple node instance in
// the graph. These nodes will contain a reference to
// their corresponding IMP object.
//
// UVM_PHASE_SCHEDULE - The object represents a portion of the phasing graph,
// typically consisting of several NODE types, in series,
// parallel, or both.
//
// UVM_PHASE_TERMINAL - This internal object serves as the termination NODE
// for a SCHEDULE phase object.
//
// UVM_PHASE_DOMAIN - This object represents an entire graph segment that
// executes in parallel with the 'run' phase.
// Domains may define any network of NODEs and
// SCHEDULEs. The built-in domain, ~uvm~, consists
// of a single schedule of all the run-time phases,
// starting with ~pre_reset~ and ending with
// ~post_shutdown~.
//
enum uvm_phase_type: byte
{ UVM_PHASE_IMP,
UVM_PHASE_NODE,
UVM_PHASE_TERMINAL,
UVM_PHASE_SCHEDULE,
UVM_PHASE_DOMAIN,
UVM_PHASE_GLOBAL
}
mixin(declareEnums!uvm_phase_type());
// Enum: uvm_phase_state
// ---------------------
//
// The set of possible states of a phase. This is an attribute of a schedule
// node in the graph, not of a phase, to maintain independent per-domain state
//
// UVM_PHASE_DORMANT - Nothing has happened with the phase in this domain.
//
// UVM_PHASE_SCHEDULED - At least one immediate predecessor has completed.
// Scheduled phases block until all predecessors complete or
// until a jump is executed.
//
// UVM_PHASE_SYNCING - All predecessors complete, checking that all synced
// phases (e.g. across domains) are at or beyond this point
//
// UVM_PHASE_STARTED - phase ready to execute, running phase_started() callback
//
// UVM_PHASE_EXECUTING - An executing phase is one where the phase callbacks are
// being executed. It's process is tracked by the phaser.
//
// UVM_PHASE_READY_TO_END - no objections remain in this phase or in any
// predecessors of its successors or in any sync'd phases. This
// state indicates an opportunity for any phase that needs extra
// time for a clean exit to raise an objection, thereby causing a
// return to UVM_PHASE_EXECUTING. If no objection is raised, state
// will transition to UVM_PHASE_ENDED after a delta cycle.
// (An example of predecessors of successors: The successor to
// phase 'run' is 'extract', whose predecessors are 'run' and
// 'post_shutdown'. Therefore, 'run' will go to this state when
// both its objections and those of 'post_shutdown' are all dropped.
//
// UVM_PHASE_ENDED - phase completed execution, now running phase_ended() callback
//
// UVM_PHASE_CLEANUP - all processes related to phase are being killed
//
// UVM_PHASE_DONE - A phase is done after it terminated execution. Becoming
// done may enable a waiting successor phase to execute.
//
// The state transitions occur as follows:
//
//| DORMANT -> SCHED -> SYNC -> START -> EXEC -> READY -> END -> CLEAN -> DONE
//| ^ |
//| | <-- jump_to v
//| +------------------------------------------------------------+
enum uvm_phase_state: int
{ UVM_PHASE_DORMANT = 1,
UVM_PHASE_SCHEDULED = 2,
UVM_PHASE_SYNCING = 4,
UVM_PHASE_STARTED = 8,
UVM_PHASE_EXECUTING = 16,
UVM_PHASE_READY_TO_END = 32,
UVM_PHASE_ENDED = 64,
UVM_PHASE_CLEANUP = 128,
UVM_PHASE_DONE = 256,
UVM_PHASE_JUMPING = 512
}
mixin(declareEnums!uvm_phase_state());
// Enum: uvm_phase_transition
//
// These are the phase state transition for callbacks which provide
// additional information that may be useful during callbacks
//
// UVM_COMPLETED - the phase completed normally
// UVM_FORCED_STOP - the phase was forced to terminate prematurely
// UVM_SKIPPED - the phase was in the path of a forward jump
// UVM_RERUN - the phase was in the path of a backwards jump
//
enum uvm_phase_transition: byte
{ UVM_COMPLETED = 0x01,
UVM_FORCED_STOP = 0x02,
UVM_SKIPPED = 0x04,
UVM_RERUN = 0x08
}
mixin(declareEnums!uvm_phase_transition());
// Enum: uvm_wait_op
//
// Specifies the operand when using methods like <uvm_phase::wait_for_state>.
//
// UVM_EQ - equal
// UVM_NE - not equal
// UVM_LT - less than
// UVM_LTE - less than or equal to
// UVM_GT - greater than
// UVM_GTE - greater than or equal to
//
enum uvm_wait_op: byte
{ UVM_LT,
UVM_LTE,
UVM_NE,
UVM_EQ,
UVM_GT,
UVM_GTE
}
mixin(declareEnums!uvm_wait_op());
//------------------
// Group: Objections
//------------------
// Enum: uvm_objection_event
//
// Enumerated the possible objection events one could wait on. See
// <uvm_objection::wait_for>.
//
// UVM_RAISED - an objection was raised
// UVM_DROPPED - an objection was raised
// UVM_ALL_DROPPED - all objections have been dropped
//
enum uvm_objection_event: byte
{ UVM_RAISED = 0x01,
UVM_DROPPED = 0x02,
UVM_ALL_DROPPED = 0x04
}
mixin(declareEnums!uvm_objection_event());
//------------------------------
// Group: Default Policy Classes
//------------------------------
//
// Policy classes copying, comparing, packing, unpacking, and recording
// <uvm_object>-based objects.
// typedef class uvm_printer;
// typedef class uvm_table_printer;
// typedef class uvm_tree_printer;
// typedef class uvm_line_printer;
// typedef class uvm_comparer;
// typedef class uvm_packer;
// typedef class uvm_recorder;
import uvm.base.uvm_printer;
import uvm.base.uvm_packer;
import uvm.base.uvm_comparer;
import uvm.base.uvm_recorder;
import uvm.base.uvm_root;
mixin(uvm_once_sync!(uvm_once_object_globals, "uvm_object_globals"));
final class uvm_once_object_globals
{
////// shared variables from uvm_object_globals
@uvm_immutable_sync private uvm_table_printer _uvm_default_table_printer;
// Variable: uvm_default_tree_printer
//
// The tree printer is a global object that can be used with
// <uvm_object::do_print> to get multi-line tree style printing.
// uvm_tree_printer uvm_default_tree_printer = new();
@uvm_immutable_sync private uvm_tree_printer _uvm_default_tree_printer;
// Variable: uvm_default_line_printer
//
// The line printer is a global object that can be used with
// <uvm_object::do_print> to get single-line style printing.
// uvm_line_printer uvm_default_line_printer = new();
@uvm_immutable_sync private uvm_line_printer _uvm_default_line_printer;
// Variable: uvm_default_printer
//
// The default printer policy. Used when calls to <uvm_object::print>
// or <uvm_object::sprint> do not specify a printer policy.
//
// The default printer may be set to any legal <uvm_printer> derived type,
// including the global line, tree, and table printers described above.
// uvm_printer uvm_default_printer = uvm_default_table_printer;
@uvm_immutable_sync private uvm_printer _uvm_default_printer;
// Variable: uvm_default_packer
//
// The default packer policy. Used when calls to <uvm_object::pack>
// and <uvm_object::unpack> do not specify a packer policy.
// uvm_packer uvm_default_packer = new();
@uvm_immutable_sync private uvm_packer _uvm_default_packer;
// Variable: uvm_default_comparer
//
//
// The default compare policy. Used when calls to <uvm_object::compare>
// do not specify a comparer policy.
// uvm_comparer uvm_default_comparer = new(); // uvm_comparer::init();
@uvm_immutable_sync private uvm_comparer _uvm_default_comparer;
// Variable: uvm_default_recorder
//
// The default recording policy. Used when calls to <uvm_object::record>
// do not specify a recorder policy.
// uvm_recorder uvm_default_recorder = new();
@uvm_immutable_sync private uvm_recorder _uvm_default_recorder;
this() {
synchronized(this) {
////// shared variables from uvm_object_globals
_uvm_default_table_printer = new uvm_table_printer;
_uvm_default_tree_printer = new uvm_tree_printer;
_uvm_default_line_printer = new uvm_line_printer;
_uvm_default_printer = _uvm_default_table_printer;
_uvm_default_packer = new uvm_packer;
_uvm_default_comparer = new uvm_comparer;
_uvm_default_recorder = new uvm_recorder;
}
}
}
|
D
|
module i18n;
import std.path;
import std.file;
import std.algorithm;
import std.array;
import std.experimental.logger;
import std.stdio;
import std.string;
alias StrStr = string[string];
alias StrStrStr = string[string][string];
enum I18N_DEFAULT_LOCAL = "zh-cn";
class I18n
{
private{
StrStrStr _res;
__gshared I18n _instance;
}
this()
{
// Constructor code
}
static auto instance()
{
if(_instance is null)
{
_instance = new I18n();
}
return _instance;
}
///加载资源文件
bool loadLangResources(string path, lazy string ext = "res")
{
auto resfiles = std.file.dirEntries(path, "*.{res}", SpanMode.depth)
.filter!(a => a.isFile)
.map!(a => std.path.absolutePath(a.name))
.array;
if(resfiles.length == 0)
{
log("lang res file is empty");
return false;
}
foreach(r; resfiles)
{
parseResFile(r);
}
return true;
}
@property StrStrStr resources()
{
return this._res;
}
///解析文件
private bool parseResFile(string fileName)
{
auto f = File(fileName,"r");
scope(exit)
{
f.close();
}
if(!f.isOpen()) return false;
string _res_file_name = baseName(fileName, extension(fileName));
string _loc = baseName(dirName(fileName));
int line = 1;
while(!f.eof())
{
scope(exit)
line += 1;
string str = f.readln();
str = strip(str);
if(str.length == 0)
continue;
if(str[0] == '#' || str[0] == ';')
continue;
auto len = str.length -1;
auto site = str.indexOf("=");
if(site == -1)
{
import std.format;
throw new Exception(format("the format is erro in file %s, in line %d : string: %s",fileName,line, str));
}
string key = str[0..site].strip;
if(key.length == 0)
{
import std.format;
throw new Exception(format("the Key is empty in file %s, in line %d",fileName,line));
}
string value = str[site + 1..$].strip;
this._res[_loc][_res_file_name ~ "." ~ key] = value;
}
return true;
}
}
///设置本地化
private string _local;
private @property string getLocal(){
if(_local)
return _local;
return I18N_DEFAULT_LOCAL;
}
///设置本地化
@property setLocal(string _l)
{
_local = toLower(_l);
}
///key is [filename.key]
string getText(string key, lazy string default_value = string.init)
{
auto p = getLocal in I18n.instance.resources;
if(p !is null)
{
return p.get(key, default_value);
}
log("not support local ", getLocal, " change for ", I18N_DEFAULT_LOCAL);
p = I18N_DEFAULT_LOCAL in I18n.instance.resources;
if(p !is null)
{
return p.get(key, default_value);
}
log("not support local ", I18N_DEFAULT_LOCAL );
return default_value;
}
unittest{
I18n i18n = I18n.instance();
i18n.loadLangResources("./resources/lang");
writeln(i18n.resources);
///
setLocal("en-br");
assert( getText("message.hello-world", "empty") == "你好,世界");
///
setLocal("zh-cn");
assert( getText("email.subject", "empty") == "收件人");
setLocal("en-us");
assert( getText("email.subject", "empty") == "empty");
}
|
D
|
/*
TEST_OUTPUT:
---
fail_compilation/fail9414a.d(47): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(34): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(35): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter `y` in contract
fail_compilation/fail9414a.d(40): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(41): Error: variable fail9414a.C.foo.__require.bar.y cannot modify parameter `y` in contract
fail_compilation/fail9414a.d(42): Error: variable fail9414a.C.foo.__require.bar.s cannot modify result `s` in contract
fail_compilation/fail9414a.d(52): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(75): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(76): Error: variable fail9414a.C.foo.__ensure.r cannot modify result `r` in contract
fail_compilation/fail9414a.d(60): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(61): Error: variable fail9414a.C.foo.__ensure.r cannot modify result `r` in contract
fail_compilation/fail9414a.d(62): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter `y` in contract
fail_compilation/fail9414a.d(67): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(68): Error: variable fail9414a.C.foo.__ensure.r cannot modify result `r` in contract
fail_compilation/fail9414a.d(69): Error: variable fail9414a.C.foo.__ensure.baz.y cannot modify parameter `y` in contract
fail_compilation/fail9414a.d(70): Error: variable fail9414a.C.foo.__ensure.baz.s cannot modify result `s` in contract
fail_compilation/fail9414a.d(81): Error: variable fail9414a.C.foo.x cannot modify parameter `x` in contract
fail_compilation/fail9414a.d(82): Error: variable fail9414a.C.foo.__ensure.r cannot modify result `r` in contract
---
*/
class C
{
int foo(int x)
in
{
int a;
int bar(int y)
in
{
x = 10; // err
y = 10; // err
a = 1; // OK
}
out(s)
{
x = 10; // err
y = 10; // err
s = 10; // err
a = 1; // OK
}
body
{
x = 10; // err
y = 1; // OK
a = 1; // OK
return 2;
}
x = 10; // err
}
out(r)
{
int a;
int baz(int y)
in
{
x = 10; // err
r = 10; // err
y = 10; // err
a = 1; // OK
}
out(s)
{
x = 10; // err
r = 10; // err
y = 10; // err
s = 10; // err
a = 1; // OK
}
body
{
x = 10; // err
r = 10; // err
y = 1; // OK
a = 1; // OK
return 2;
}
x = 10; // err
r = 10; // err
}
body
{
return 1;
}
}
|
D
|
/Users/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/MySQL.build/Objects-normal/x86_64/Connection.o : /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind+Node.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Binds.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Connection.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Database.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Error.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field+Variant.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Fields.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/MySQL+Node.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.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/ObjectiveC.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Jay.framework/Modules/Jay.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Polymorphic.framework/Modules/Polymorphic.swiftmodule/x86_64.swiftmodule
/Users/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/MySQL.build/Objects-normal/x86_64/Connection~partial.swiftmodule : /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind+Node.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Binds.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Connection.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Database.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Error.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field+Variant.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Fields.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/MySQL+Node.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.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/ObjectiveC.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Jay.framework/Modules/Jay.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Polymorphic.framework/Modules/Polymorphic.swiftmodule/x86_64.swiftmodule
/Users/kimhyewon/Documents/Server/tennis/build/tennis.build/Debug/MySQL.build/Objects-normal/x86_64/Connection~partial.swiftdoc : /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind+Node.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Bind.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Binds.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Connection.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Database.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Error.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field+Variant.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Field.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/Fields.swift /Users/kimhyewon/Documents/Server/tennis/Packages/MySQL-1.0.2/Sources/MySQL/MySQL+Node.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Darwin.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.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/ObjectiveC.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/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Jay.framework/Modules/Jay.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/kimhyewon/Documents/Server/tennis/build/Debug/Polymorphic.framework/Modules/Polymorphic.swiftmodule/x86_64.swiftmodule
|
D
|
/**
* Inline assembler for the D programming language compiler.
*
* Specification: $(LINK2 https://dlang.org/spec/iasm.html, Inline Assembler)
*
* Copyright (C) 2018-2022 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/iasm.d, _iasm.d)
* Documentation: https://dlang.org/phobos/dmd_iasm.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/iasm.d
*/
module dmd.iasm;
import dmd.dscope;
import dmd.func;
import dmd.statement;
version (MARS)
{
import dmd.iasmdmd;
}
else version (IN_GCC)
{
import dmd.iasmgcc;
}
/************************ AsmStatement ***************************************/
extern(C++) Statement asmSemantic(AsmStatement s, Scope *sc)
{
//printf("AsmStatement.semantic()\n");
FuncDeclaration fd = sc.parent.isFuncDeclaration();
assert(fd);
if (!s.tokens)
return null;
// Assume assembler code takes care of setting the return value
sc.func.hasReturnExp |= 8;
version (MARS)
{
auto ias = new InlineAsmStatement(s.loc, s.tokens);
return inlineAsmSemantic(ias, sc);
}
else version (IN_GCC)
{
auto eas = new GccAsmStatement(s.loc, s.tokens);
return gccAsmSemantic(eas, sc);
}
else
{
s.error("D inline assembler statements are not supported");
return new ErrorStatement();
}
}
|
D
|
/**
* Windows API header module
*
* Part of the Internet Development SDK
*
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DRUNTIMESRC core/sys/windows/_ocidl.d)
*/
module core.sys.windows.ocidl;
version (Windows):
import core.sys.windows.ole2, core.sys.windows.oleidl, core.sys.windows.oaidl, core.sys.windows.objfwd,
core.sys.windows.windef, core.sys.windows.wtypes;
import core.sys.windows.objidl; // for CLIPFORMAT
import core.sys.windows.wingdi; // for TEXTMETRICW
import core.sys.windows.winuser; // for LPMSG
interface IBindHost : IUnknown {}
interface IServiceProvider : IUnknown{
HRESULT QueryService(REFGUID,REFIID,void**);
}
/*
// TODO:
//import core.sys.windows.servprov; // for IServiceProvider
// import core.sys.windows.urlmon; // for IBindHost. This is not included in MinGW.
// core.sys.windows.urlmon should contain:
interface IBindHost : IUnknown
{
HRESULT CreateMoniker(LPOLESTR szName, IBindCtx pBC, IMoniker* ppmk, DWORD);
HRESULT MonikerBindToObject(IMoniker pMk, IBindCtx pBC, IBindStatusCallback pBSC, REFIID, void** );
HRESULT MonikerBindToStorage(IMoniker pMk, IBindCtx pBC, IBindStatusCallback pBSC, REFIID, void** );
}
*/
//[Yes] #ifndef OLE2ANSI
alias TEXTMETRICW TEXTMETRICOLE;
//} else {
//alias TEXTMETRIC TEXTMETRICOLE;
//}
alias TEXTMETRICOLE* LPTEXTMETRICOLE;
alias DWORD OLE_COLOR;
alias UINT OLE_HANDLE;
alias int OLE_XPOS_HIMETRIC;
alias int OLE_YPOS_HIMETRIC;
alias int OLE_XSIZE_HIMETRIC;
alias int OLE_YSIZE_HIMETRIC;
enum READYSTATE {
READYSTATE_UNINITIALIZED = 0,
READYSTATE_LOADING = 1,
READYSTATE_LOADED = 2,
READYSTATE_INTERACTIVE = 3,
READYSTATE_COMPLETE = 4
}
enum PROPBAG2_TYPE {
PROPBAG2_TYPE_UNDEFINED,
PROPBAG2_TYPE_DATA,
PROPBAG2_TYPE_URL,
PROPBAG2_TYPE_OBJECT,
PROPBAG2_TYPE_STREAM,
PROPBAG2_TYPE_STORAGE,
PROPBAG2_TYPE_MONIKER // = 6
}
struct PROPBAG2 {
DWORD dwType;
VARTYPE vt;
CLIPFORMAT cfType;
DWORD dwHint;
LPOLESTR pstrName;
CLSID clsid;
}
enum QACONTAINERFLAGS {
QACONTAINER_SHOWHATCHING = 1,
QACONTAINER_SHOWGRABHANDLES = 2,
QACONTAINER_USERMODE = 4,
QACONTAINER_DISPLAYASDEFAULT = 8,
QACONTAINER_UIDEAD = 16,
QACONTAINER_AUTOCLIP = 32,
QACONTAINER_MESSAGEREFLECT = 64,
QACONTAINER_SUPPORTSMNEMONICS = 128
}
struct QACONTAINER {
ULONG cbSize = this.sizeof;
IOleClientSite pClientSite;
IAdviseSinkEx pAdviseSink;
IPropertyNotifySink pPropertyNotifySink;
IUnknown pUnkEventSink;
DWORD dwAmbientFlags;
OLE_COLOR colorFore;
OLE_COLOR colorBack;
IFont pFont;
IOleUndoManager pUndoMgr;
DWORD dwAppearance;
LONG lcid;
HPALETTE hpal;
IBindHost pBindHost;
IOleControlSite pOleControlSite;
IServiceProvider pServiceProvider;
}
struct QACONTROL {
ULONG cbSize = this.sizeof;
DWORD dwMiscStatus;
DWORD dwViewStatus;
DWORD dwEventCookie;
DWORD dwPropNotifyCookie;
DWORD dwPointerActivationPolicy;
}
struct POINTF {
float x;
float y;
}
alias POINTF* LPPOINTF;
struct CONTROLINFO {
ULONG cb;
HACCEL hAccel;
USHORT cAccel;
DWORD dwFlags;
}
alias CONTROLINFO* LPCONTROLINFO;
struct CONNECTDATA {
LPUNKNOWN pUnk;
DWORD dwCookie;
}
alias CONNECTDATA* LPCONNECTDATA;
struct LICINFO {
int cbLicInfo;
BOOL fRuntimeKeyAvail;
BOOL fLicVerified;
}
alias LICINFO* LPLICINFO;
struct CAUUID {
ULONG cElems;
GUID* pElems;
}
alias CAUUID* LPCAUUID;
struct CALPOLESTR {
ULONG cElems;
LPOLESTR* pElems;
}
alias CALPOLESTR* LPCALPOLESTR;
struct CADWORD {
ULONG cElems;
DWORD* pElems;
}
alias CADWORD* LPCADWORD;
struct PROPPAGEINFO {
ULONG cb;
LPOLESTR pszTitle;
SIZE size;
LPOLESTR pszDocString;
LPOLESTR pszHelpFile;
DWORD dwHelpContext;
}
alias PROPPAGEINFO* LPPROPPAGEINFO;
interface IOleControl : IUnknown {
HRESULT GetControlInfo(LPCONTROLINFO);
HRESULT OnMnemonic(LPMSG);
HRESULT OnAmbientPropertyChange(DISPID);
HRESULT FreezeEvents(BOOL);
}
interface IOleControlSite : IUnknown {
HRESULT OnControlInfoChanged();
HRESULT LockInPlaceActive(BOOL);
HRESULT GetExtendedControl(LPDISPATCH*);
HRESULT TransformCoords(POINTL*, POINTF*, DWORD);
HRESULT TranslateAccelerator(LPMSG, DWORD);
HRESULT OnFocus(BOOL);
HRESULT ShowPropertyFrame();
}
interface ISimpleFrameSite : IUnknown {
HRESULT PreMessageFilter(HWND, UINT, WPARAM, LPARAM, LRESULT*, PDWORD);
HRESULT PostMessageFilter(HWND, UINT, WPARAM, LPARAM, LRESULT*, DWORD);
}
interface IErrorLog : IUnknown {
HRESULT AddError(LPCOLESTR, LPEXCEPINFO);
}
alias IErrorLog LPERRORLOG;
interface IPropertyBag : IUnknown {
HRESULT Read(LPCOLESTR, LPVARIANT, LPERRORLOG);
HRESULT Write(LPCOLESTR, LPVARIANT);
}
alias IPropertyBag LPPROPERTYBAG;
interface IPropertyBag2 : IUnknown {
HRESULT Read(ULONG, PROPBAG2*, LPERRORLOG, VARIANT*, HRESULT*);
HRESULT Write(ULONG, PROPBAG2*, VARIANT*);
HRESULT CountProperties(ULONG*);
HRESULT GetPropertyInfo(ULONG, ULONG, PROPBAG2*, ULONG*);
HRESULT LoadObject(LPCOLESTR, DWORD, IUnknown, LPERRORLOG);
}
alias IPropertyBag2 LPPROPERTYBAG2;
interface IPersistPropertyBag : IPersist {
HRESULT InitNew();
HRESULT Load(LPPROPERTYBAG, LPERRORLOG);
HRESULT Save(LPPROPERTYBAG, BOOL, BOOL);
}
interface IPersistPropertyBag2 : IPersist {
HRESULT InitNew();
HRESULT Load(LPPROPERTYBAG2, LPERRORLOG);
HRESULT Save(LPPROPERTYBAG2, BOOL, BOOL);
HRESULT IsDirty();
}
interface IPersistStreamInit : IPersist {
HRESULT IsDirty();
HRESULT Load(LPSTREAM);
HRESULT Save(LPSTREAM, BOOL);
HRESULT GetSizeMax(PULARGE_INTEGER);
HRESULT InitNew();
}
interface IPersistMemory : IPersist {
HRESULT IsDirty();
HRESULT Load(PVOID, ULONG);
HRESULT Save(PVOID, BOOL, ULONG);
HRESULT GetSizeMax(PULONG);
HRESULT InitNew();
}
interface IPropertyNotifySink : IUnknown {
HRESULT OnChanged(DISPID);
HRESULT OnRequestEdit(DISPID);
}
interface IProvideClassInfo : IUnknown {
HRESULT GetClassInfo(LPTYPEINFO*);
}
interface IProvideClassInfo2 : IProvideClassInfo {
HRESULT GetGUID(DWORD, GUID*);
}
interface IConnectionPointContainer : IUnknown {
HRESULT EnumConnectionPoints(LPENUMCONNECTIONPOINTS*);
HRESULT FindConnectionPoint(REFIID, LPCONNECTIONPOINT*);
}
interface IEnumConnectionPoints : IUnknown {
HRESULT Next(ULONG, LPCONNECTIONPOINT*, ULONG*);
HRESULT Skip(ULONG);
HRESULT Reset();
HRESULT Clone(LPENUMCONNECTIONPOINTS*);
}
alias IEnumConnectionPoints LPENUMCONNECTIONPOINTS;
interface IConnectionPoint : IUnknown {
HRESULT GetConnectionInterface(IID*);
HRESULT GetConnectionPointContainer(IConnectionPointContainer*);
HRESULT Advise(LPUNKNOWN, PDWORD);
HRESULT Unadvise(DWORD);
HRESULT EnumConnections(LPENUMCONNECTIONS*);
}
alias IConnectionPoint LPCONNECTIONPOINT;
interface IEnumConnections : IUnknown {
HRESULT Next(ULONG, LPCONNECTDATA, PULONG);
HRESULT Skip(ULONG);
HRESULT Reset();
HRESULT Clone(LPENUMCONNECTIONS*);
}
alias IEnumConnections LPENUMCONNECTIONS;
interface IClassFactory2 : IClassFactory {
HRESULT GetLicInfo(LPLICINFO);
HRESULT RequestLicKey(DWORD, BSTR*);
HRESULT CreateInstanceLic(LPUNKNOWN, LPUNKNOWN, REFIID, BSTR, PVOID*);
}
interface ISpecifyPropertyPages : IUnknown {
HRESULT GetPages(CAUUID*);
}
interface IPerPropertyBrowsing : IUnknown {
HRESULT GetDisplayString(DISPID, BSTR*);
HRESULT MapPropertyToPage(DISPID, LPCLSID);
HRESULT GetPredefinedStrings(DISPID, CALPOLESTR*, CADWORD*);
HRESULT GetPredefinedValue(DISPID, DWORD, VARIANT*);
}
interface IPropertyPageSite : IUnknown {
HRESULT OnStatusChange(DWORD);
HRESULT GetLocaleID(LCID*);
HRESULT GetPageContainer(LPUNKNOWN*);
HRESULT TranslateAccelerator(LPMSG);
}
alias IPropertyPageSite LPPROPERTYPAGESITE;
interface IPropertyPage : IUnknown {
HRESULT SetPageSite(LPPROPERTYPAGESITE);
HRESULT Activate(HWND, LPCRECT, BOOL);
HRESULT Deactivate();
HRESULT GetPageInfo(LPPROPPAGEINFO);
HRESULT SetObjects(ULONG, LPUNKNOWN*);
HRESULT Show(UINT);
HRESULT Move(LPCRECT);
HRESULT IsPageDirty();
HRESULT Apply();
HRESULT Help(LPCOLESTR);
HRESULT TranslateAccelerator(LPMSG);
}
interface IPropertyPage2 : IPropertyPage
{ HRESULT EditProperty(DISPID);
}
interface IFont : IUnknown {
HRESULT get_Name(BSTR*);
HRESULT put_Name(BSTR);
HRESULT get_Size(CY*);
HRESULT put_Size(CY);
HRESULT get_Bold(BOOL*);
HRESULT put_Bold(BOOL);
HRESULT get_Italic(BOOL*);
HRESULT put_Italic(BOOL);
HRESULT get_Underline(BOOL*);
HRESULT put_Underline(BOOL);
HRESULT get_Strikethrough(BOOL*);
HRESULT put_Strikethrough(BOOL);
HRESULT get_Weight(short*);
HRESULT put_Weight(short);
HRESULT get_Charset(short*);
HRESULT put_Charset(short);
HRESULT get_hFont(HFONT*);
HRESULT Clone(IFont*);
HRESULT IsEqual(IFont);
HRESULT SetRatio(int, int);
HRESULT QueryTextMetrics(LPTEXTMETRICOLE);
HRESULT AddRefHfont(HFONT);
HRESULT ReleaseHfont(HFONT);
HRESULT SetHdc(HDC);
}
alias IFont LPFONT;
interface IFontDisp : IDispatch {
}
alias IFontDisp LPFONTDISP;
interface IPicture : IUnknown {
HRESULT get_Handle(OLE_HANDLE*);
HRESULT get_hPal(OLE_HANDLE*);
HRESULT get_Type(short*);
HRESULT get_Width(OLE_XSIZE_HIMETRIC*);
HRESULT get_Height(OLE_YSIZE_HIMETRIC*);
HRESULT Render(HDC, int, int, int, int, OLE_XPOS_HIMETRIC,
OLE_YPOS_HIMETRIC, OLE_XSIZE_HIMETRIC, OLE_YSIZE_HIMETRIC, LPCRECT);
HRESULT set_hPal(OLE_HANDLE);
HRESULT get_CurDC(HDC*);
HRESULT SelectPicture(HDC, HDC*, OLE_HANDLE*);
HRESULT get_KeepOriginalFormat(BOOL*);
HRESULT put_KeepOriginalFormat(BOOL);
HRESULT PictureChanged();
HRESULT SaveAsFile(LPSTREAM, BOOL, LONG*);
HRESULT get_Attributes(PDWORD);
}
interface IPictureDisp : IDispatch {
}
interface IOleInPlaceSiteEx : IOleInPlaceSite {
HRESULT OnInPlaceActivateEx(BOOL*, DWORD);
HRESULT OnInPlaceDeactivateEx(BOOL);
HRESULT RequestUIActivate();
}
interface IObjectWithSite : IUnknown {
HRESULT SetSite(IUnknown);
HRESULT GetSite(REFIID, void**);
}
interface IOleInPlaceSiteWindowless : IOleInPlaceSiteEx {
HRESULT CanWindowlessActivate();
HRESULT GetCapture();
HRESULT SetCapture(BOOL);
HRESULT GetFocus();
HRESULT SetFocus(BOOL);
HRESULT GetDC(LPCRECT, DWORD, HDC*);
HRESULT ReleaseDC(HDC);
HRESULT InvalidateRect(LPCRECT, BOOL);
HRESULT InvalidateRgn(HRGN, BOOL);
HRESULT ScrollRect(INT, INT, LPCRECT, LPCRECT);
HRESULT AdjustRect(LPCRECT);
HRESULT OnDefWindowMessage(UINT, WPARAM, LPARAM, LRESULT*);
}
interface IAdviseSinkEx : IUnknown {
void OnDataChange(FORMATETC*, STGMEDIUM*);
void OnViewChange(DWORD, LONG);
void OnRename(IMoniker);
void OnSave();
void OnClose();
HRESULT OnViewStatusChange(DWORD);
}
interface IPointerInactive : IUnknown {
HRESULT GetActivationPolicy(DWORD*);
HRESULT OnInactiveMouseMove(LPCRECT, LONG, LONG, DWORD);
HRESULT OnInactiveSetCursor(LPCRECT, LONG, LONG, DWORD, BOOL);
}
interface IOleUndoUnit : IUnknown {
HRESULT Do(LPOLEUNDOMANAGER);
HRESULT GetDescription(BSTR*);
HRESULT GetUnitType(CLSID*, LONG*);
HRESULT OnNextAdd();
}
interface IOleParentUndoUnit : IOleUndoUnit {
HRESULT Open(IOleParentUndoUnit);
HRESULT Close(IOleParentUndoUnit, BOOL);
HRESULT Add(IOleUndoUnit);
HRESULT FindUnit(IOleUndoUnit);
HRESULT GetParentState(DWORD*);
}
interface IEnumOleUndoUnits : IUnknown {
HRESULT Next(ULONG, IOleUndoUnit*, ULONG*);
HRESULT Skip(ULONG);
HRESULT Reset();
HRESULT Clone(IEnumOleUndoUnits*);
}
interface IOleUndoManager : IUnknown {
HRESULT Open(IOleParentUndoUnit);
HRESULT Close(IOleParentUndoUnit, BOOL);
HRESULT Add(IOleUndoUnit);
HRESULT GetOpenParentState(DWORD*);
HRESULT DiscardFrom(IOleUndoUnit);
HRESULT UndoTo(IOleUndoUnit);
HRESULT RedoTo(IOleUndoUnit);
HRESULT EnumUndoable(IEnumOleUndoUnits*);
HRESULT EnumRedoable(IEnumOleUndoUnits*);
HRESULT GetLastUndoDescription(BSTR*);
HRESULT GetLastRedoDescription(BSTR*);
HRESULT Enable(BOOL);
}
alias IOleUndoManager LPOLEUNDOMANAGER;
interface IQuickActivate : IUnknown {
HRESULT QuickActivate(QACONTAINER*, QACONTROL*);
HRESULT SetContentExtent(LPSIZEL);
HRESULT GetContentExtent(LPSIZEL);
}
|
D
|
module makette.actions;
import makette.source;
import std.file, std.path;
import std.xmlp.linkdom;
Action makeAction(JNode jf, Element e)
{
auto act = new Action_rmdir();
act.init(jf, e);
return act;
}
enum kPath = "path";
enum kRmdir = "rmdir";
static this()
{
registerAction(kRmdir, &makeAction);
}
void doFilePathDelete(string fpath, bool recurse)
{
// Make sure the file or directory exists and isn't write protected
if (!exists(fpath))
return;
// If it is a directory, make sure it is empty
if (isDir(fpath))
{
auto mode = (recurse ? SpanMode.depth : SpanMode.breadth);
foreach (string name; dirEntries(fpath, mode))
{
remove(name);
}
return;
}
remove(fpath);
}
class Action_rmdir : Action {
override void init(JNode jf, Element e)
{
string path = e.getAttribute(kPath);
set(kPath,path);
}
override void run(JobFile jf)
{
string path = get(kPath);
path = jf.varsub(path);
if (!isAbsolute(path))
{
path=absolutePath(path);
}
doFilePathDelete(path,true);
}
}
|
D
|
formerly a term of respect for important white Europeans in colonial India
|
D
|
//TODO for debugging
import std.stdio;
class TextEditor {
char[][] content;
int cursorx;
int cursory;
string filename;
this() {
content.length = 1;
content[0].length = 1;
content[0] = " ".dup;
}
void loadFile(string filename) {
auto file = File(filename);
this.filename = filename;
content.length = 0;
while(!file.eof()) {
string line = file.readln;
if(line.length == 0) {
break;
}
string line2 = line[0..$];
// Strip newlines
if(line[$-1] == '\n') {
line2 = line[0..$-1];
}
this.putLine(line2);
}
}
string getFilename() {
return filename;
}
char getChar(int line, int col) {
return content[line][col];
}
string getLine(int line) {
if(line < content.length) {
return cast(string) content[line];
}
return "";
}
int getLineLength(int line) {
if(line < content.length) {
return cast(int) content[line].length;
}
return 0;
}
ulong getLineAmount() {
return content.length;
}
void putLine (string str) {
char[] line = str.dup;
content.length++;
content[$-1] = line;
}
void putStr(string s, int line, int col) {
char[] add = s.dup;
char[] nline;
nline.length = content[line].length + add.length;
nline = content[line][0..col] ~ add ~ content[line][col..$];
content[line] = nline;
}
void putChar(char c, int line, int col) {
if (content.length <= line) {
content.length = line+1;
}
content[line] = content[line][0..col] ~ c ~ content[line][col..$];
}
void deleteChar(int line, int col, int direction) {
if(direction != -1 && direction != 1) {
return;
}
if(col < 1) {
return;
}
if(direction == -1) {
content[line] = content[line][0..col-1] ~ content[line][col..$];
} else if(direction == 1) {
content[line] = content[line][0..col] ~ content[line][col+1..$];
}
}
void divideLines(int line, int col) {
char[] str = content[line];
content[line] = str[0..col];
// content = content[0..line] ~ str[col..$] ~ content[line+1..$];
content = content[0..line+1] ~ str[col..$] ~ content[line + 1..$];
return;
}
}
|
D
|
/*
Copyright (c) 2019-2022 Timur Gafarov
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 dagon.resource;
public
{
import dagon.resource.asset;
import dagon.resource.binary;
import dagon.resource.boxfs;
import dagon.resource.dds;
import dagon.resource.entity;
import dagon.resource.gltf;
import dagon.resource.image;
import dagon.resource.material;
import dagon.resource.obj;
import dagon.resource.scene;
import dagon.resource.text;
import dagon.resource.texture;
}
|
D
|
instance PIR_61450_BRENDIK(Npc_Default)
{
name[0] = "Brendik";
guild = GIL_PAL;
id = 61450;
voice = 13;
flags = 0;
npcType = NPCTYPE_AMBIENT;
level = 12;
B_SetAttributesToChapter(self,5);
fight_tactic = FAI_HUMAN_MASTER;
EquipItem(self,ItMw_Piratensaebel);
B_CreateAmbientInv(self);
B_SetNpcVisual(self,MALE,"Hum_Head_Bald",Face_N_Weak_Asghan,BodyTex_N,ITAR_PIR_M_Addon);
Mdl_SetModelFatness(self,-1);
Mdl_ApplyOverlayMds(self,"Humans_Tired.mds");
B_GiveNpcTalents(self);
B_SetFightSkills(self,70);
daily_routine = rtn_start_61450;
};
func void rtn_start_61450()
{
TA_Smalltalk(9,0,23,0,"NW_BIGFARM_CAMPON_PIR_00");
TA_Smalltalk(23,0,9,0,"NW_BIGFARM_CAMPON_PIR_00");
};
func void rtn_inbattle_61450()
{
ta_bigfight(8,0,22,0,"NW_BIGFIGHT_8700");
ta_bigfight(22,0,8,0,"NW_BIGFIGHT_8700");
};
func void rtn_ship_61450()
{
TA_Stand_Guarding(8,0,23,0,"SHIP_DECK_22");
TA_Stand_Guarding(23,0,8,0,"SHIP_DECK_22");
};
|
D
|
/*******************************************************************************
Struct encapsulating the set of RequestOnConn instances in use by an
active request.
Copyright: Copyright (c) 2016-2017 sociomantic labs GmbH. All rights reserved
License:
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
*******************************************************************************/
module swarm.neo.client.RequestOnConnSet;
/*******************************************************************************
Struct encapsulating the set of RequestOnConn instances in use by an
active request.
*******************************************************************************/
public struct RequestOnConnSet
{
import swarm.neo.client.RequestOnConn;
import swarm.neo.util.TreeMap;
import swarm.neo.IPAddress;
/***************************************************************************
Definition of the tree map of RequestOnConn objects by node
address.
***************************************************************************/
private alias TreeMap!(RequestOnConn.TreeMapElement)
RequestOnConnByNode;
/***************************************************************************
The handlers and parameters specific to a single-node or all-nodes
request. `is_all_nodes` tells which field is active.
Whenever this request is inactive, the `single_node` field is active
and set to its init value; see the constructor documentaion.
***************************************************************************/
union
{
/***********************************************************************
Active while this instance is used for a single-node request;
Set by startSingleNode() and cleared by handlerFinished().
***********************************************************************/
RequestOnConn single_node;
/***********************************************************************
Active while this instance is used for an all-nodes request:
A tree map of the currently active handlers and the nodes they
are using. Each handler is added just after starting the request
fiber and removed just before the fiber terminates.
Stays the same and non-empty while `Handler.all_nodes` is active
(but the elements change).
***********************************************************************/
RequestOnConnByNode all_nodes;
}
/***************************************************************************
true if this is an all-nodes request (`all_nodes` is the active
union field) or false if this is a single-node request
(`single_node` is the active union field).
Whenever this request is inactive, this flag is false, and the
`single_node` field is active and set to its `init` value; see the
constructor documentaion.
***************************************************************************/
public bool is_all_nodes = false;
/***************************************************************************
The number of handlers of this request that are currently running,
i.e. their fiber is running. These handlers do not necessarily use
a node at all times.
TODO: if TreeMap had a .length method, this could be replaced by a
getter, rather than maintaining a count, internally
***************************************************************************/
public uint num_active;
/***************************************************************************
Sets set of active request-on-conns to the specified
RequestOnConn instance (i.e. the set contains just this single
element).
Sets this object to a single RequestOnConn.
Params:
request_on_conn = the RequestOnConn instance to set
Returns:
the just-set RequestOnConn instance
***************************************************************************/
public RequestOnConn setSingle ( RequestOnConn request_on_conn )
{
this.is_all_nodes = false;
this.single_node = request_on_conn;
this.num_active = 1;
return request_on_conn;
}
/***************************************************************************
Adds the specified RequestOnConn instance to the set of active
request-on-conns.
Params:
request_on_conn = the RequestOnConn instance to set
Returns:
the just-set RequestOnConn instance
***************************************************************************/
public RequestOnConn addMulti ( IPAddress remote_address,
RequestOnConn request_on_conn )
{
this.is_all_nodes = true;
bool added;
this.all_nodes.put(remote_address.cmp_id, added, request_on_conn);
assert(added, typeof(this).stringof ~ ".addMulti: a " ~
"request-on-connection already exists for the node");
this.num_active++;
return request_on_conn;
}
/***************************************************************************
Registers the specified RequestOnConn instance as finished. This does
not modify anything about the RequestOnConn or the set, but simply
decrements the num_active counter.
Params:
request_on_conn = the RequestOnConn instance which has finished
(passed purely for the sake of sanity checking)
***************************************************************************/
public void finished ( RequestOnConn request_on_conn )
in
{
if ( !this.is_all_nodes )
assert(this.single_node == request_on_conn);
}
out
{
if ( !this.is_all_nodes )
assert(this.num_active == 0);
}
body
{
this.num_active--;
}
/***************************************************************************
Clears this instance, including recycling all owned RequestOnConn
instances via the provided recycle() delegate.
Params:
recycle = the delegate to call to recycle each RequestOnConn in the
set
***************************************************************************/
public void reset ( void delegate ( RequestOnConn ) recycle )
in
{
assert(this.num_active == 0);
}
body
{
if ( this.is_all_nodes )
{
foreach ( request_on_conn; this.all_nodes )
{
this.all_nodes.remove(request_on_conn);
recycle(request_on_conn);
}
}
else
{
recycle(this.single_node);
}
this.is_all_nodes = false;
this.single_node = this.single_node.init;
}
}
|
D
|
/**
* Container for the graphics adapter needed for the appropriate platform
*/
module dash.graphics.graphics;
import dash.graphics.adapters, dash.graphics.shaders;
/**
* Abstract class to store the appropriate Adapter
*/
final abstract class Graphics
{
public static:
/// The active Adapter
Adapter adapter;
/// Aliases adapter to Graphics
alias adapter this;
/**
* Initialize the controllers.
*/
final void initialize()
{
version( Windows )
{
adapter = new Win32GL;
}
else version( linux )
{
adapter = new Linux;
}
else
{
adapter = new NullAdapter;
}
adapter.initialize();
adapter.initializeDeferredRendering();
Shaders.initialize();
}
/**
* Shutdown the adapter and shaders.
*/
final void shutdown()
{
Shaders.shutdown();
adapter.shutdown();
}
private:
this() { }
}
|
D
|
CSPCON (F07QUE) Example Program Data
4 :Value of N
'L' :Value of UPLO
(-0.39,-0.71)
( 5.14,-0.64) ( 8.86, 1.81)
(-7.86,-2.96) (-3.52, 0.58) (-2.83,-0.03)
( 3.80, 0.92) ( 5.32,-1.59) (-1.54,-2.86) (-0.56, 0.12) :End of matrix A
|
D
|
// Written in the D programming language.
/*
* Copyright (C) 2002-2006 by Digital Mars, www.digitalmars.com
* Written by Walter Bright
* Some parts contributed by David L. Davis
*
* 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:
*
* o 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.
* o Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
* o This notice may not be removed or altered from any source
* distribution.
*/
/***********
* Conversion building blocks. These differ from the C equivalents
* <tt>atoi()</tt> and <tt>atol()</tt> by
* checking for overflow and not allowing whitespace.
*
* For conversion to signed types, the grammar recognized is:
* <pre>
$(I Integer):
$(I Sign UnsignedInteger)
$(I UnsignedInteger)
$(I Sign):
$(B +)
$(B -)
* </pre>
* For conversion to signed types, the grammar recognized is:
* <pre>
$(I UnsignedInteger):
$(I DecimalDigit)
$(I DecimalDigit) $(I UnsignedInteger)
* </pre>
* Macros:
* WIKI=Phobos/StdConv
*/
module std.conv;
private import std.string; // for atof(), toString()
private import std.math; // for fabs(), std.c.isnan()
private import std.stdio; // for writefln() and printf()
import std.c, os.windows,std.utf;
//debug=conv; // uncomment to turn on debugging printf's
alias toInt вЦел;
alias toUint вБцел;
alias toLong вДол;
alias toUlong вБдол;
alias toShort вКрат;
alias toUshort вБкрат;
alias toByte вБайт;
alias toUbyte ВБбайт;
alias toFloat вПлав;
alias toDouble вДво;
alias toReal вРеал;
alias ConvError ОшПреобразования;
alias ConvOverflowError ОшПереполненияПриПреобр;
/* ************* Exceptions *************** */
/**
* Thrown on conversion errors, which happens on deviation from the grammar.
*/
deprecated class ConvError : Error
{
this(char[] s)
{
super("conversion " ~ s);
}
}
class ОшибкаПреобразования:Ошибка
{
this(char[] s){super("Conversion failed"~s);
wchar* soob =cast(wchar*)("Неудачное преобразование из типа ткст\n"~toUTF16(s));
ОкноСооб(null, cast(wchar*) soob, "D рантайм:ОшибкаПреобразования", СО_ОК|СО_ПИКТОШИБКА);}
}
private void conv_error(char[] s)
{
throw new ОшибкаПреобразования(s);
}
/**
* Thrown on conversion overflow errors.
*/
deprecated class ConvOverflowError : Error
{
this(char[] s)
{
super("Error: overflow " ~ s);
}
}
class ОшибкаПереполненияПриПреобразовании:Ошибка
{
this(char[] s){super("Error: overflow while converting"~s);
wchar* soob =cast(wchar*)("Переполнение стека при преобразовании из типа ткст\n"~toUTF16(s));
ОкноСооб(null, soob, "D рантайм: ОшибкаПереполненияПриПреобразовании", СО_ОК|СО_ПИКТОШИБКА);}
}
private void conv_overflow(char[] s)
{
throw new ОшибкаПереполненияПриПреобразовании(s);
}
/***************************************************************
* Convert character string to the return type.
*/
int toInt(char[] s)
{
int length = s.length;
if (!length)
goto Lerr;
int sign = 0;
int v = 0;
for (int i = 0; i < length; i++)
{
char c = s[i];
if (c >= '0' && c <= '9')
{
if (v < int.max/10 || (v == int.max/10 && c + sign <= '7'))
v = v * 10 + (c - '0');
else
goto Loverflow;
}
else if (c == '-' && i == 0)
{
sign = -1;
if (length == 1)
goto Lerr;
}
else if (c == '+' && i == 0)
{
if (length == 1)
goto Lerr;
}
else
goto Lerr;
}
if (sign == -1)
{
if (cast(uint)v > 0x80000000)
goto Loverflow;
v = -v;
}
else
{
if (cast(uint)v > 0x7FFFFFFF)
goto Loverflow;
}
return v;
Loverflow:
conv_overflow("int toInt(char[] s)");
Lerr:
conv_error("int toInt(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toInt.unittest\n");
int i;
i = toInt("0");
assert(i == 0);
i = toInt("+0");
assert(i == 0);
i = toInt("-0");
assert(i == 0);
i = toInt("6");
assert(i == 6);
i = toInt("+23");
assert(i == 23);
i = toInt("-468");
assert(i == -468);
i = toInt("2147483647");
assert(i == 0x7FFFFFFF);
i = toInt("-2147483648");
assert(i == 0x80000000);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"xx",
"123h",
"2147483648",
"-2147483649",
"5656566565",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toInt(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
uint toUint(char[] s)
{
int length = s.length;
if (!length)
goto Lerr;
uint v = 0;
for (int i = 0; i < length; i++)
{
char c = s[i];
if (c >= '0' && c <= '9')
{
if (v < uint.max/10 || (v == uint.max/10 && c <= '5'))
v = v * 10 + (c - '0');
else
goto Loverflow;
}
else
goto Lerr;
}
return v;
Loverflow:
conv_overflow("uint toUint(char[] s)");
Lerr:
conv_error("uint toUint(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toUint.unittest\n");
uint i;
i = toUint("0");
assert(i == 0);
i = toUint("6");
assert(i == 6);
i = toUint("23");
assert(i == 23);
i = toUint("468");
assert(i == 468);
i = toUint("2147483647");
assert(i == 0x7FFFFFFF);
i = toUint("4294967295");
assert(i == 0xFFFFFFFF);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"+5",
"-78",
"xx",
"123h",
"4294967296",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toUint(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
long toLong(char[] s)
{
int length = s.length;
if (!length)
goto Lerr;
int sign = 0;
long v = 0;
for (int i = 0; i < length; i++)
{
char c = s[i];
if (c >= '0' && c <= '9')
{
if (v < long.max/10 || (v == long.max/10 && c + sign <= '7'))
v = v * 10 + (c - '0');
else
goto Loverflow;
}
else if (c == '-' && i == 0)
{
sign = -1;
if (length == 1)
goto Lerr;
}
else if (c == '+' && i == 0)
{
if (length == 1)
goto Lerr;
}
else
goto Lerr;
}
if (sign == -1)
{
if (cast(ulong)v > 0x8000000000000000)
goto Loverflow;
v = -v;
}
else
{
if (cast(ulong)v > 0x7FFFFFFFFFFFFFFF)
goto Loverflow;
}
return v;
Loverflow:
conv_overflow("long toLong(char[] s)");
Lerr:
conv_error("long toLong(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toLong.unittest\n");
long i;
i = toLong("0");
assert(i == 0);
i = toLong("+0");
assert(i == 0);
i = toLong("-0");
assert(i == 0);
i = toLong("6");
assert(i == 6);
i = toLong("+23");
assert(i == 23);
i = toLong("-468");
assert(i == -468);
i = toLong("2147483647");
assert(i == 0x7FFFFFFF);
i = toLong("-2147483648");
assert(i == -0x80000000L);
i = toLong("9223372036854775807");
assert(i == 0x7FFFFFFFFFFFFFFF);
i = toLong("-9223372036854775808");
assert(i == 0x8000000000000000);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"xx",
"123h",
"9223372036854775808",
"-9223372036854775809",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toLong(errors[j]);
printf("l = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
ulong toUlong(char[] s)
{
int length = s.length;
if (!length)
goto Lerr;
ulong v = 0;
for (int i = 0; i < length; i++)
{
char c = s[i];
if (c >= '0' && c <= '9')
{
if (v < ulong.max/10 || (v == ulong.max/10 && c <= '5'))
v = v * 10 + (c - '0');
else
goto Loverflow;
}
else
goto Lerr;
}
return v;
Loverflow:
conv_overflow("ulong toUlong(char[] s)");
Lerr:
conv_error("ulong toUlong(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toUlong.unittest\n");
ulong i;
i = toUlong("0");
assert(i == 0);
i = toUlong("6");
assert(i == 6);
i = toUlong("23");
assert(i == 23);
i = toUlong("468");
assert(i == 468);
i = toUlong("2147483647");
assert(i == 0x7FFFFFFF);
i = toUlong("4294967295");
assert(i == 0xFFFFFFFF);
i = toUlong("9223372036854775807");
assert(i == 0x7FFFFFFFFFFFFFFF);
i = toUlong("18446744073709551615");
assert(i == 0xFFFFFFFFFFFFFFFF);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"+5",
"-78",
"xx",
"123h",
"18446744073709551616",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toUlong(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
short toShort(char[] s)
{
int v = toInt(s);
if (v != cast(short)v)
goto Loverflow;
return cast(short)v;
Loverflow:
conv_overflow("short toShort(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toShort.unittest\n");
short i;
i = toShort("0");
assert(i == 0);
i = toShort("+0");
assert(i == 0);
i = toShort("-0");
assert(i == 0);
i = toShort("6");
assert(i == 6);
i = toShort("+23");
assert(i == 23);
i = toShort("-468");
assert(i == -468);
i = toShort("32767");
assert(i == 0x7FFF);
i = toShort("-32768");
assert(i == cast(short)0x8000);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"xx",
"123h",
"32768",
"-32769",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toShort(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
ushort toUshort(char[] s)
{
uint v = toUint(s);
if (v != cast(ushort)v)
goto Loverflow;
return cast(ushort)v;
Loverflow:
conv_overflow("ushort toUshort(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toUshort.unittest\n");
ushort i;
i = toUshort("0");
assert(i == 0);
i = toUshort("6");
assert(i == 6);
i = toUshort("23");
assert(i == 23);
i = toUshort("468");
assert(i == 468);
i = toUshort("32767");
assert(i == 0x7FFF);
i = toUshort("65535");
assert(i == 0xFFFF);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"+5",
"-78",
"xx",
"123h",
"65536",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toUshort(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
byte toByte(char[] s)
{
int v = toInt(s);
if (v != cast(byte)v)
goto Loverflow;
return cast(byte)v;
Loverflow:
conv_overflow("byte toByte(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toByte.unittest\n");
byte i;
i = toByte("0");
assert(i == 0);
i = toByte("+0");
assert(i == 0);
i = toByte("-0");
assert(i == 0);
i = toByte("6");
assert(i == 6);
i = toByte("+23");
assert(i == 23);
i = toByte("-68");
assert(i == -68);
i = toByte("127");
assert(i == 0x7F);
i = toByte("-128");
assert(i == cast(byte)0x80);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"xx",
"123h",
"128",
"-129",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toByte(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
ubyte toUbyte(char[] s)
{
uint v = toUint(s);
if (v != cast(ubyte)v)
goto Loverflow;
return cast(ubyte)v;
Loverflow:
conv_overflow("ubyte toUbyte(char[] s)");
return 0;
}
unittest
{
debug(conv) printf("conv.toUbyte.unittest\n");
ubyte i;
i = toUbyte("0");
assert(i == 0);
i = toUbyte("6");
assert(i == 6);
i = toUbyte("23");
assert(i == 23);
i = toUbyte("68");
assert(i == 68);
i = toUbyte("127");
assert(i == 0x7F);
i = toUbyte("255");
assert(i == 0xFF);
static char[][] errors =
[
"",
"-",
"+",
"-+",
" ",
" 0",
"0 ",
"- 0",
"1-",
"+5",
"-78",
"xx",
"123h",
"256",
];
for (int j = 0; j < errors.length; j++)
{
i = 47;
try
{
i = toUbyte(errors[j]);
printf("i = %d\n", i);
}
catch (Error e)
{
debug(conv) e.print();
i = 3;
}
assert(i == 3);
}
}
/*******************************************************
* ditto
*/
float toFloat(in char[] s)
{
float f;
char* endptr;
char* sz;
//writefln("toFloat('%s')", s);
sz = toStringz(s);
if (std.ctype.isspace(*sz))
goto Lerr;
// BUG: should set __locale_decpoint to "." for DMC
setErrno(0);
f = strtof(sz, &endptr);
if (getErrno() == ERANGE)
goto Lerr;
if (endptr && (endptr == sz || *endptr != 0))
goto Lerr;
return f;
Lerr:
conv_error(s ~ " not representable as a float");
assert(0);
}
unittest
{
debug( conv ) writefln( "conv.toFloat.unittest" );
float f;
f = toFloat( "123" );
assert( f == 123f );
f = toFloat( "+123" );
assert( f == +123f );
f = toFloat( "-123" );
assert( f == -123f );
f = toFloat( "123e+2" );
assert( f == 123e+2f );
f = toFloat( "123e-2" );
assert( f == 123e-2f );
f = toFloat( "123." );
assert( f == 123.f );
f = toFloat( ".456" );
assert( f == .456f );
// min and max
f = toFloat("1.17549e-38");
assert(feq(cast(real)f, cast(real)1.17549e-38));
assert(feq(cast(real)f, cast(real)float.min));
f = toFloat("3.40282e+38");
assert(toString(f) == toString(3.40282e+38));
// nan
f = toFloat("nan");
assert(toString(f) == toString(float.nan));
bool ok = false;
try
{
toFloat("\x00");
}
catch (ОшибкаПреобразования e)
{
ok = true;
}
assert(ok);
}
/*******************************************************
* ditto
*/
double toDouble(in char[] s)
{
double f;
char* endptr;
char* sz;
//writefln("toDouble('%s')", s);
sz = toStringz(s);
if (std.ctype.isspace(*sz))
goto Lerr;
// BUG: should set __locale_decpoint to "." for DMC
setErrno(0);
f = strtod(sz, &endptr);
if (getErrno() == ERANGE)
goto Lerr;
if (endptr && (endptr == sz || *endptr != 0))
goto Lerr;
return f;
Lerr:
conv_error(s ~ " not representable as a double");
assert(0);
}
unittest
{
debug( conv ) writefln( "conv.toDouble.unittest" );
double d;
d = toDouble( "123" );
assert( d == 123 );
d = toDouble( "+123" );
assert( d == +123 );
d = toDouble( "-123" );
assert( d == -123 );
d = toDouble( "123e2" );
assert( d == 123e2);
d = toDouble( "123e-2" );
assert( d == 123e-2 );
d = toDouble( "123." );
assert( d == 123. );
d = toDouble( ".456" );
assert( d == .456 );
d = toDouble( "1.23456E+2" );
assert( d == 1.23456E+2 );
// min and max
d = toDouble("2.22508e-308");
assert(feq(cast(real)d, cast(real)2.22508e-308));
assert(feq(cast(real)d, cast(real)double.min));
d = toDouble("1.79769e+308");
assert(toString(d) == toString(1.79769e+308));
assert(toString(d) == toString(double.max));
// nan
d = toDouble("nan");
assert(toString(d) == toString(double.nan));
//assert(cast(real)d == cast(real)double.nan);
bool ok = false;
try
{
toDouble("\x00");
}
catch (ОшибкаПреобразования e)
{
ok = true;
}
assert(ok);
}
/*******************************************************
* ditto
*/
real toReal(in char[] s)
{
real f;
char* endptr;
char* sz;
//writefln("toReal('%s')", s);
sz = toStringz(s);
if (std.ctype.isspace(*sz))
goto Lerr;
// BUG: should set __locale_decpoint to "." for DMC
setErrno(0);
f = strtold(sz, &endptr);
if (getErrno() == ERANGE)
goto Lerr;
if (endptr && (endptr == sz || *endptr != 0))
goto Lerr;
return f;
Lerr:
conv_error(s ~ " not representable as a real");
assert(0);
}
unittest
{
debug(conv) writefln("conv.toReal.unittest");
real r;
r = toReal("123");
assert(r == 123L);
r = toReal("+123");
assert(r == 123L);
r = toReal("-123");
assert(r == -123L);
r = toReal("123e2");
assert(feq(r, 123e2L));
r = toReal("123e-2");
assert(feq(r, 1.23L));
r = toReal("123.");
assert(r == 123L);
r = toReal(".456");
assert(r == .456L);
r = toReal("1.23456e+2");
assert(feq(r, 1.23456e+2L));
r = toReal(toString(real.max / 2L));
assert(toString(r) == toString(real.max / 2L));
// min and max
r = toReal(toString(real.min));
assert(toString(r) == toString(real.min));
r = toReal(toString(real.max));
assert(toString(r) == toString(real.max));
// nan
r = toReal("nan");
assert(toString(r) == toString(real.nan));
//assert(r == real.nan);
r = toReal(toString(real.nan));
assert(toString(r) == toString(real.nan));
//assert(r == real.nan);
bool ok = false;
try
{
toReal("\x00");
}
catch (ОшибкаПреобразования e)
{
ok = true;
}
assert(ok);
}
version (none)
{ /* These are removed for the moment because of concern about
* what to do about the 'i' suffix. Should it be there?
* Should it not? What about 'nan', should it be 'nani'?
* 'infinity' or 'infinityi'?
* Should it match what toString(ifloat) does with the 'i' suffix?
*/
/*******************************************************
* ditto
*/
ifloat toIfloat(in char[] s)
{
return toFloat(s) * 1.0i;
}
unittest
{
debug(conv) writefln("conv.toIfloat.unittest");
ifloat ift;
ift = toIfloat(toString(123.45));
assert(toString(ift) == toString(123.45i));
ift = toIfloat(toString(456.77i));
assert(toString(ift) == toString(456.77i));
// min and max
ift = toIfloat(toString(ifloat.min));
assert(toString(ift) == toString(ifloat.min) );
assert(feq(cast(ireal)ift, cast(ireal)ifloat.min));
ift = toIfloat(toString(ifloat.max));
assert(toString(ift) == toString(ifloat.max));
assert(feq(cast(ireal)ift, cast(ireal)ifloat.max));
// nan
ift = toIfloat("nani");
assert(cast(real)ift == cast(real)ifloat.nan);
ift = toIfloat(toString(ifloat.nan));
assert(toString(ift) == toString(ifloat.nan));
assert(feq(cast(ireal)ift, cast(ireal)ifloat.nan));
}
/*******************************************************
* ditto
*/
idouble toIdouble(in char[] s)
{
return toDouble(s) * 1.0i;
}
unittest
{
debug(conv) writefln("conv.toIdouble.unittest");
idouble id;
id = toIdouble(toString("123.45"));
assert(id == 123.45i);
id = toIdouble(toString("123.45e+302i"));
assert(id == 123.45e+302i);
// min and max
id = toIdouble(toString(idouble.min));
assert(toString( id ) == toString(idouble.min));
assert(feq(cast(ireal)id.re, cast(ireal)idouble.min.re));
assert(feq(cast(ireal)id.im, cast(ireal)idouble.min.im));
id = toIdouble(toString(idouble.max));
assert(toString(id) == toString(idouble.max));
assert(feq(cast(ireal)id.re, cast(ireal)idouble.max.re));
assert(feq(cast(ireal)id.im, cast(ireal)idouble.max.im));
// nan
id = toIdouble("nani");
assert(cast(real)id == cast(real)idouble.nan);
id = toIdouble(toString(idouble.nan));
assert(toString(id) == toString(idouble.nan));
}
/*******************************************************
* ditto
*/
ireal toIreal(in char[] s)
{
return toReal(s) * 1.0i;
}
unittest
{
debug(conv) writefln("conv.toIreal.unittest");
ireal ir;
ir = toIreal(toString("123.45"));
assert(feq(cast(real)ir.re, cast(real)123.45i));
ir = toIreal(toString("123.45e+82i"));
assert(toString(ir) == toString(123.45e+82i));
//assert(ir == 123.45e+82i);
// min and max
ir = toIreal(toString(ireal.min));
assert(toString(ir) == toString(ireal.min));
assert(feq(cast(real)ir.re, cast(real)ireal.min.re));
assert(feq(cast(real)ir.im, cast(real)ireal.min.im));
ir = toIreal(toString(ireal.max));
assert(toString(ir) == toString(ireal.max));
assert(feq(cast(real)ir.re, cast(real)ireal.max.re));
//assert(feq(cast(real)ir.im, cast(real)ireal.max.im));
// nan
ir = toIreal("nani");
assert(cast(real)ir == cast(real)ireal.nan);
ir = toIreal(toString(ireal.nan));
assert(toString(ir) == toString(ireal.nan));
}
/*******************************************************
* ditto
*/
cfloat toCfloat(in char[] s)
{
char[] s1;
char[] s2;
real r1;
real r2;
cfloat cf;
bool b = 0;
char* endptr;
if (!s.length)
goto Lerr;
b = getComplexStrings(s, s1, s2);
if (!b)
goto Lerr;
// atof(s1);
endptr = &s1[s1.length - 1];
r1 = strtold(s1, &endptr);
// atof(s2);
endptr = &s2[s2.length - 1];
r2 = strtold(s2, &endptr);
cf = cast(cfloat)(r1 + (r2 * 1.0i));
//writefln( "toCfloat() r1=%g, r2=%g, cf=%g, max=%g",
// r1, r2, cf, cfloat.max);
// Currently disabled due to a posted bug where a
// complex float greater-than compare to .max compares
// incorrectly.
//if (cf > cfloat.max)
// goto Loverflow;
return cf;
Loverflow:
conv_overflow(s);
Lerr:
conv_error(s);
return cast(cfloat)0.0e-0+0i;
}
unittest
{
debug(conv) writefln("conv.toCfloat.unittest");
cfloat cf;
cf = toCfloat(toString("1.2345e-5+0i"));
assert(toString(cf) == toString(1.2345e-5+0i));
assert(feq(cf, 1.2345e-5+0i));
// min and max
cf = toCfloat(toString(cfloat.min));
assert(toString(cf) == toString(cfloat.min));
cf = toCfloat(toString(cfloat.max));
assert(toString(cf) == toString(cfloat.max));
// nan ( nan+nani )
cf = toCfloat("nani");
//writefln("toCfloat() cf=%g, cf=\"%s\", nan=%s",
// cf, toString(cf), toString(cfloat.nan));
assert(toString(cf) == toString(cfloat.nan));
cf = toCdouble("nan+nani");
assert(toString(cf) == toString(cfloat.nan));
cf = toCfloat(toString(cfloat.nan));
assert(toString(cf) == toString(cfloat.nan));
assert(feq(cast(creal)cf, cast(creal)cfloat.nan));
}
/*******************************************************
* ditto
*/
cdouble toCdouble(in char[] s)
{
char[] s1;
char[] s2;
real r1;
real r2;
cdouble cd;
bool b = 0;
char* endptr;
if (!s.length)
goto Lerr;
b = getComplexStrings(s, s1, s2);
if (!b)
goto Lerr;
// atof(s1);
endptr = &s1[s1.length - 1];
r1 = strtold(s1, &endptr);
// atof(s2);
endptr = &s2[s2.length - 1];
r2 = strtold(s2, &endptr); //atof(s2);
cd = cast(cdouble)(r1 + (r2 * 1.0i));
//Disabled, waiting on a bug fix.
//if (cd > cdouble.max) //same problem the toCfloat() having
// goto Loverflow;
return cd;
Loverflow:
conv_overflow(s);
Lerr:
conv_error(s);
return cast(cdouble)0.0e-0+0i;
}
unittest
{
debug(conv) writefln("conv.toCdouble.unittest");
cdouble cd;
cd = toCdouble(toString("1.2345e-5+0i"));
assert(toString( cd ) == toString(1.2345e-5+0i));
assert(feq(cd, 1.2345e-5+0i));
// min and max
cd = toCdouble(toString(cdouble.min));
assert(toString(cd) == toString(cdouble.min));
assert(feq(cast(creal)cd, cast(creal)cdouble.min));
cd = toCdouble(toString(cdouble.max));
assert(toString( cd ) == toString(cdouble.max));
assert(feq(cast(creal)cd, cast(creal)cdouble.max));
// nan ( nan+nani )
cd = toCdouble("nani");
assert(toString(cd) == toString(cdouble.nan));
cd = toCdouble("nan+nani");
assert(toString(cd) == toString(cdouble.nan));
cd = toCdouble(toString(cdouble.nan));
assert(toString(cd) == toString(cdouble.nan));
assert(feq(cast(creal)cd, cast(creal)cdouble.nan));
}
/*******************************************************
* ditto
*/
creal toCreal(in char[] s)
{
char[] s1;
char[] s2;
real r1;
real r2;
creal cr;
bool b = 0;
char* endptr;
if (!s.length)
goto Lerr;
b = getComplexStrings(s, s1, s2);
if (!b)
goto Lerr;
// atof(s1);
endptr = &s1[s1.length - 1];
r1 = strtold(s1, &endptr);
// atof(s2);
endptr = &s2[s2.length - 1];
r2 = strtold(s2, &endptr); //atof(s2);
//writefln("toCreal() r1=%g, r2=%g, s1=\"%s\", s2=\"%s\", nan=%g",
// r1, r2, s1, s2, creal.nan);
if (s1 =="nan" && s2 == "nani")
cr = creal.nan;
else if (r2 != 0.0)
cr = cast(creal)(r1 + (r2 * 1.0i));
else
cr = cast(creal)(r1 + 0.0i);
return cr;
Lerr:
conv_error(s);
return cast(creal)0.0e-0+0i;
}
unittest
{
debug(conv) writefln("conv.toCreal.unittest");
creal cr;
cr = toCreal(toString("1.2345e-5+0i"));
assert(toString(cr) == toString(1.2345e-5+0i));
assert(feq(cr, 1.2345e-5+0i));
cr = toCreal(toString("0.0e-0+0i"));
assert(toString(cr) == toString(0.0e-0+0i));
assert(cr == 0.0e-0+0i);
assert(feq(cr, 0.0e-0+0i));
cr = toCreal("123");
assert(cr == 123);
cr = toCreal("+5");
assert(cr == 5);
cr = toCreal("-78");
assert(cr == -78);
// min and max
cr = toCreal(toString(creal.min));
assert(toString(cr) == toString(creal.min));
assert(feq(cr, creal.min));
cr = toCreal(toString(creal.max));
assert(toString(cr) == toString(creal.max));
assert(feq(cr, creal.max));
// nan ( nan+nani )
cr = toCreal("nani");
assert(toString(cr) == toString(creal.nan));
cr = toCreal("nan+nani");
assert(toString(cr) == toString(creal.nan));
cr = toCreal(toString(cdouble.nan));
assert(toString(cr) == toString(creal.nan));
assert(feq(cr, creal.nan));
}
}
/* **************************************************************
* Splits a complex float (cfloat, cdouble, and creal) into two workable strings.
* Grammar:
* ['+'|'-'] string floating-point digit {digit}
*/
private bool getComplexStrings(in char[] s, out char[] s1, out char[] s2)
{
int len = s.length;
if (!len)
goto Lerr;
// When "nan" or "nani" just return them.
if (s == "nan" || s == "nani" || s == "nan+nani")
{
s1 = "nan";
s2 = "nani";
return 1;
}
// Split the original string out into two strings.
for (int i = 1; i < len; i++)
if ((s[i - 1] != 'e' && s[i - 1] != 'E') && s[i] == '+')
{
s1 = s[0..i];
if (i + 1 < len - 1)
s2 = s[i + 1..len - 1];
else
s2 = "0e+0i";
break;
}
// Handle the case when there's only a single value
// to work with, and set the other string to zero.
if (!s1.length)
{
s1 = s;
s2 = "0e+0i";
}
//writefln( "getComplexStrings() s=\"%s\", s1=\"%s\", s2=\"%s\", len=%d",
// s, s1, s2, len );
return 1;
Lerr:
// Display the original string in the error message.
conv_error("getComplexStrings() \"" ~ s ~ "\"" ~ " s1=\"" ~ s1 ~ "\"" ~ " s2=\"" ~ s2 ~ "\"");
return 0;
}
// feq() functions now used only in unittesting
/* ***************************************
* Main function to compare reals with given precision
*/
private bool feq(in real rx, in real ry, in real precision)
{
if (rx == ry)
return 1;
if (std.math.isnan(rx))
return cast(bool)std.math.isnan(ry);
if (std.math.isnan(ry))
return 0;
return cast(bool)(std.math.fabs(rx - ry) <= precision);
}
/* ***************************************
* (Note: Copied here from std.math's mfeq() function for unittesting)
* Simple function to compare two floating point values
* to a specified precision.
* Returns:
* 1 match
* 0 nomatch
*/
private bool feq(in real r1, in real r2)
{
if (r1 == r2)
return 1;
if (std.math.isnan(r1))
return cast(bool)std.math.isnan(r2);
if (std.math.isnan(r2))
return 0;
return cast(bool)(feq(r1, r2, 0.000001L));
}
/* ***************************************
* compare ireals with given precision
*/
private bool feq(in ireal r1, in ireal r2)
{
real rx = cast(real)r1;
real ry = cast(real)r2;
if (rx == ry)
return 1;
if (std.math.isnan(rx))
return cast(bool)std.math.isnan(ry);
if (std.math.isnan(ry))
return 0;
return feq(rx, ry, 0.000001L);
}
/* ***************************************
* compare creals with given precision
*/
private bool feq(in creal r1, in creal r2)
{
real r1a = std.math.fabs(cast(real)r1.re - cast(real)r2.re);
real r2b = std.math.fabs(cast(real)r1.im - cast(real)r2.im);
if ((cast(real)r1.re == cast(real)r2.re) &&
(cast(real)r1.im == cast(real)r2.im))
return 1;
if (std.math.isnan(r1a))
return cast(bool)std.math.isnan(r2b);
if (std.math.isnan(r2b))
return 0;
return feq(r1a, r2b, 0.000001L);
}
|
D
|
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, core.bitop;
enum P = 998244353;
void main()
{
auto ns = readln.split.to!(long[]);
auto N = ns[0];
auto S = ns[1];
auto as = readln.split.to!(long[]);
auto DP = new long[][](N, S+1);
foreach (ref dp; DP) dp[] = -1;
long solve(int i, long s) {
if (s == 0) {
return N-i+1;
} else if (s < 0 || i == N) {
return 0;
}
if (DP[i][s] == -1) {
DP[i][s] = (solve(i+1, s-as[i]) + solve(i+1, s)) % P;
}
return s == S ? 0 : DP[i][s];
}
solve(0, S);
long r;
foreach (i; 0..N) r = (r + (i+1) * DP[i][S]) % P;
writeln(r);
}
|
D
|
/home/salmansiddiqui/Documents/iot/formatted_print/target/rls/debug/deps/formatted_print-911906c9897b6225.rmeta: src/main.rs
/home/salmansiddiqui/Documents/iot/formatted_print/target/rls/debug/deps/formatted_print-911906c9897b6225.d: src/main.rs
src/main.rs:
|
D
|
import std.stdio: writeln;;;
void main() {
int[] arr;
arr ~= 1;
arr ~= [2, 3];
writeln("the sum of", arr, " is ", sum(arr));
}
// the 'in' keyword suggests you can not modify the array or its contents
// or it will be a compile error.
int sum(in int[] data) {
int total = 0;
foreach(item; data)
total += item;
return total;
}
|
D
|
/Users/bilalshahid/Developer/Qaida/build/Qaida.build/Debug-iphoneos/Qaida.build/Objects-normal/arm64/LessonsViewController.o : /Users/bilalshahid/Developer/Qaida/Qaida/AppDelegate.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/lessonsCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaCollectionViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/LessonsViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/User.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaClass.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaDatatoArray.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/bilalshahid/Developer/Qaida/build/Qaida.build/Debug-iphoneos/Qaida.build/Objects-normal/arm64/LessonsViewController~partial.swiftmodule : /Users/bilalshahid/Developer/Qaida/Qaida/AppDelegate.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/lessonsCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaCollectionViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/LessonsViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/User.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaClass.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaDatatoArray.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/bilalshahid/Developer/Qaida/build/Qaida.build/Debug-iphoneos/Qaida.build/Objects-normal/arm64/LessonsViewController~partial.swiftdoc : /Users/bilalshahid/Developer/Qaida/Qaida/AppDelegate.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/lessonsCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaCollectionViewCell.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Takhti/GridViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/Lessons/LessonsViewController.swift /Users/bilalshahid/Developer/Qaida/Qaida/User.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaClass.swift /Users/bilalshahid/Developer/Qaida/Qaida/QaidaDatatoArray.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/simd.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreImage.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/QuartzCore.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Metal.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Darwin.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Foundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreAudio.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Swift.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/UIKit.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CoreMedia.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/arm64/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/MediaToolbox.framework/Headers/MediaToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioToolbox.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
import std.random;
import verify_distribution_uniformity_naive: distCheck;
/// Generates a random number in [1, 5].
int dice5() /*pure nothrow*/ @safe {
return uniform(1, 6);
}
/// Naive, generates a random number in [1, 7] using dice5.
int fiveToSevenNaive() /*pure nothrow*/ @safe {
immutable int r = dice5() + dice5() * 5 - 6;
return (r < 21) ? (r % 7) + 1 : fiveToSevenNaive();
}
/**
Generates a random number in [1, 7] using dice5,
minimizing calls to dice5.
*/
int fiveToSevenSmart() @safe {
static int rem = 0, max = 1;
while (rem / 7 == max / 7) {
while (max < 7) {
immutable int rand5 = dice5() - 1;
max *= 5;
rem = 5 * rem + rand5;
}
immutable int groups = max / 7;
if (rem >= 7 * groups) {
rem -= 7 * groups;
max -= 7 * groups;
}
}
immutable int result = rem % 7;
rem /= 7;
max /= 7;
return result + 1;
}
void main() /*@safe*/ {
enum int N = 400_000;
distCheck(&dice5, N, 1);
distCheck(&fiveToSevenNaive, N, 1);
distCheck(&fiveToSevenSmart, N, 1);
}
|
D
|
/**
* Implement CTFE for intrinsic (builtin) functions.
*
* Currently includes functions from `std.math`, `core.math` and `core.bitop`.
*
* Copyright: Copyright (C) 1999-2021 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/builtin.d, _builtin.d)
* Documentation: https://dlang.org/phobos/dmd_builtin.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/builtin.d
*/
module dmd.builtin;
import core.stdc.math;
import core.stdc.string;
import dmd.arraytypes;
import dmd.astenums;
import dmd.dmangle;
import dmd.errors;
import dmd.expression;
import dmd.func;
import dmd.globals;
import dmd.mtype;
import dmd.root.ctfloat;
import dmd.root.stringtable;
import dmd.tokens;
import dmd.id;
static import core.bitop;
/**********************************
* Determine if function is a builtin one that we can
* evaluate at compile time.
*/
public extern (C++) BUILTIN isBuiltin(FuncDeclaration fd)
{
if (fd.builtin == BUILTIN.unknown)
{
fd.builtin = determine_builtin(fd);
}
return fd.builtin;
}
/**************************************
* Evaluate builtin function.
* Return result; NULL if cannot evaluate it.
*/
public extern (C++) Expression eval_builtin(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
if (fd.builtin == BUILTIN.unimp)
return null;
switch (fd.builtin)
{
foreach(e; __traits(allMembers, BUILTIN))
{
static if (e == "unknown")
case BUILTIN.unknown: assert(false);
else
mixin("case BUILTIN."~e~": return eval_"~e~"(loc, fd, arguments);");
}
default: assert(0);
}
}
private:
/**
* Handler for evaluating builtins during CTFE.
*
* Params:
* loc = The call location, for error reporting.
* fd = The callee declaration, e.g. to disambiguate between different overloads
* in a single handler (LDC).
* arguments = The function call arguments.
* Returns:
* An Expression containing the return value of the call.
*/
BUILTIN determine_builtin(FuncDeclaration func)
{
auto fd = func.toAliasFunc();
if (fd.isDeprecated())
return BUILTIN.unimp;
auto m = fd.getModule();
if (!m || !m.md)
return BUILTIN.unimp;
const md = m.md;
// Look for core.math, core.bitop, std.math, and std.math.<package>
const id2 = (md.packages.length == 2) ? md.packages[1] : md.id;
if (id2 != Id.math && id2 != Id.bitop)
return BUILTIN.unimp;
if (md.packages.length != 1 && !(md.packages.length == 2 && id2 == Id.math))
return BUILTIN.unimp;
const id1 = md.packages[0];
if (id1 != Id.core && id1 != Id.std)
return BUILTIN.unimp;
const id3 = fd.ident;
if (id1 == Id.core && id2 == Id.bitop)
{
if (id3 == Id.bsf) return BUILTIN.bsf;
if (id3 == Id.bsr) return BUILTIN.bsr;
if (id3 == Id.bswap) return BUILTIN.bswap;
if (id3 == Id._popcnt) return BUILTIN.popcnt;
return BUILTIN.unimp;
}
// Math
if (id3 == Id.sin) return BUILTIN.sin;
if (id3 == Id.cos) return BUILTIN.cos;
if (id3 == Id.tan) return BUILTIN.tan;
if (id3 == Id.atan2) return BUILTIN.unimp; // N.B unimplmeneted
if (id3 == Id._sqrt) return BUILTIN.sqrt;
if (id3 == Id.fabs) return BUILTIN.fabs;
if (id3 == Id.exp) return BUILTIN.exp;
if (id3 == Id.expm1) return BUILTIN.expm1;
if (id3 == Id.exp2) return BUILTIN.exp2;
if (id3 == Id.yl2x) return CTFloat.yl2x_supported ? BUILTIN.yl2x : BUILTIN.unimp;
if (id3 == Id.yl2xp1) return CTFloat.yl2xp1_supported ? BUILTIN.yl2xp1 : BUILTIN.unimp;
if (id3 == Id.log) return BUILTIN.log;
if (id3 == Id.log2) return BUILTIN.log2;
if (id3 == Id.log10) return BUILTIN.log10;
if (id3 == Id.ldexp) return BUILTIN.ldexp;
if (id3 == Id.round) return BUILTIN.round;
if (id3 == Id.floor) return BUILTIN.floor;
if (id3 == Id.ceil) return BUILTIN.ceil;
if (id3 == Id.trunc) return BUILTIN.trunc;
if (id3 == Id.fmin) return BUILTIN.fmin;
if (id3 == Id.fmax) return BUILTIN.fmax;
if (id3 == Id.fma) return BUILTIN.fma;
if (id3 == Id.copysign) return BUILTIN.copysign;
if (id3 == Id.isnan) return BUILTIN.isnan;
if (id3 == Id.isInfinity) return BUILTIN.isinfinity;
if (id3 == Id.isfinite) return BUILTIN.isfinite;
// Only match pow(fp,fp) where fp is a floating point type
if (id3 == Id._pow)
{
if ((*fd.parameters)[0].type.isfloating() &&
(*fd.parameters)[1].type.isfloating())
return BUILTIN.pow;
return BUILTIN.unimp;
}
if (id3 != Id.toPrec)
return BUILTIN.unimp;
const(char)* me = mangleExact(fd);
final switch (me["_D4core4math__T6toPrecHT".length])
{
case 'd': return BUILTIN.toPrecDouble;
case 'e': return BUILTIN.toPrecReal;
case 'f': return BUILTIN.toPrecFloat;
}
}
Expression eval_unimp(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
return null;
}
Expression eval_sin(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.sin(arg0.toReal()), arg0.type);
}
Expression eval_cos(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.cos(arg0.toReal()), arg0.type);
}
Expression eval_tan(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.tan(arg0.toReal()), arg0.type);
}
Expression eval_sqrt(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.sqrt(arg0.toReal()), arg0.type);
}
Expression eval_fabs(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.fabs(arg0.toReal()), arg0.type);
}
Expression eval_ldexp(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.int64);
return new RealExp(loc, CTFloat.ldexp(arg0.toReal(), cast(int) arg1.toInteger()), arg0.type);
}
Expression eval_log(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.log(arg0.toReal()), arg0.type);
}
Expression eval_log2(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.log2(arg0.toReal()), arg0.type);
}
Expression eval_log10(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.log10(arg0.toReal()), arg0.type);
}
Expression eval_exp(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.exp(arg0.toReal()), arg0.type);
}
Expression eval_expm1(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.expm1(arg0.toReal()), arg0.type);
}
Expression eval_exp2(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.exp2(arg0.toReal()), arg0.type);
}
Expression eval_round(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.round(arg0.toReal()), arg0.type);
}
Expression eval_floor(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.floor(arg0.toReal()), arg0.type);
}
Expression eval_ceil(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.ceil(arg0.toReal()), arg0.type);
}
Expression eval_trunc(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return new RealExp(loc, CTFloat.trunc(arg0.toReal()), arg0.type);
}
Expression eval_copysign(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
return new RealExp(loc, CTFloat.copysign(arg0.toReal(), arg1.toReal()), arg0.type);
}
Expression eval_pow(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
return new RealExp(loc, CTFloat.pow(arg0.toReal(), arg1.toReal()), arg0.type);
}
Expression eval_fmin(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
return new RealExp(loc, CTFloat.fmin(arg0.toReal(), arg1.toReal()), arg0.type);
}
Expression eval_fmax(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
return new RealExp(loc, CTFloat.fmax(arg0.toReal(), arg1.toReal()), arg0.type);
}
Expression eval_fma(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
Expression arg2 = (*arguments)[2];
assert(arg2.op == TOK.float64);
return new RealExp(loc, CTFloat.fma(arg0.toReal(), arg1.toReal(), arg2.toReal()), arg0.type);
}
Expression eval_isnan(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return IntegerExp.createBool(CTFloat.isNaN(arg0.toReal()));
}
Expression eval_isinfinity(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
return IntegerExp.createBool(CTFloat.isInfinity(arg0.toReal()));
}
Expression eval_isfinite(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
const value = !CTFloat.isNaN(arg0.toReal()) && !CTFloat.isInfinity(arg0.toReal());
return IntegerExp.createBool(value);
}
Expression eval_bsf(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.int64);
uinteger_t n = arg0.toInteger();
if (n == 0)
error(loc, "`bsf(0)` is undefined");
return new IntegerExp(loc, core.bitop.bsf(n), Type.tint32);
}
Expression eval_bsr(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.int64);
uinteger_t n = arg0.toInteger();
if (n == 0)
error(loc, "`bsr(0)` is undefined");
return new IntegerExp(loc, core.bitop.bsr(n), Type.tint32);
}
Expression eval_bswap(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.int64);
uinteger_t n = arg0.toInteger();
TY ty = arg0.type.toBasetype().ty;
if (ty == Tint64 || ty == Tuns64)
return new IntegerExp(loc, core.bitop.bswap(cast(ulong) n), arg0.type);
else
return new IntegerExp(loc, core.bitop.bswap(cast(uint) n), arg0.type);
}
Expression eval_popcnt(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.int64);
uinteger_t n = arg0.toInteger();
return new IntegerExp(loc, core.bitop.popcnt(n), Type.tint32);
}
Expression eval_yl2x(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
const x = arg0.toReal();
const y = arg1.toReal();
real_t result = CTFloat.zero;
CTFloat.yl2x(&x, &y, &result);
return new RealExp(loc, result, arg0.type);
}
Expression eval_yl2xp1(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
assert(arg0.op == TOK.float64);
Expression arg1 = (*arguments)[1];
assert(arg1.op == TOK.float64);
const x = arg0.toReal();
const y = arg1.toReal();
real_t result = CTFloat.zero;
CTFloat.yl2xp1(&x, &y, &result);
return new RealExp(loc, result, arg0.type);
}
Expression eval_toPrecFloat(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
float f = cast(real)arg0.toReal();
return new RealExp(loc, real_t(f), Type.tfloat32);
}
Expression eval_toPrecDouble(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
double d = cast(real)arg0.toReal();
return new RealExp(loc, real_t(d), Type.tfloat64);
}
Expression eval_toPrecReal(Loc loc, FuncDeclaration fd, Expressions* arguments)
{
Expression arg0 = (*arguments)[0];
return new RealExp(loc, arg0.toReal(), Type.tfloat80);
}
// These built-ins are reserved for GDC and LDC.
Expression eval_gcc(Loc, FuncDeclaration, Expressions*)
{
assert(0);
}
Expression eval_llvm(Loc, FuncDeclaration, Expressions*)
{
assert(0);
}
|
D
|
// *************
// SPL_Waterfist /k4
// *************
const int SPL_Cost_Waterfist = 13;
const int SPL_Damage_Waterfist = 125;
INSTANCE Spell_Waterfist (C_Spell_Proto)
{
time_per_mana = 0;
damage_per_level = SPL_Damage_Waterfist;
damageType = DAM_MAGIC;
};
func int Spell_Logic_Waterfist (var int manaInvested)
{
if (Npc_GetActiveSpellIsScroll(self) && (self.attribute[ATR_MANA] >= SPL_Cost_Scroll))
{
return SPL_SENDCAST;
}
else if (self.attribute[ATR_MANA] >= SPL_Cost_Waterfist)
{
return SPL_SENDCAST;
}
else //nicht genug Mana
{
return SPL_SENDSTOP;
};
};
func void Spell_Cast_Waterfist()
{
if (Npc_GetActiveSpellIsScroll(self))
{
self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Scroll;
}
else
{
self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Waterfist;
};
self.aivar[AIV_SelectSpell] += 1;
};
|
D
|
module mCOM2D;
import std.stdio, std.meta, std.traits, std.range, std.conv, std.string, std.typetuple, std.typecons, std.algorithm;
private import std.experimental.allocator, std.experimental.allocator.building_blocks.region;
private import core.sys.windows.windows, core.sys.windows.com, core.sys.windows.basetyps, core.sys.windows.oleauto, core.sys.windows.oaidl, core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes, core.sys.windows.objidl, core.sys.windows.ole2;
pragma(lib, "ole32.lib");
pragma(lib, "OleAut32.lib");
// Must be used to initialize COM, only required once.
private static void[] CoTaskMem;
private static Region!() CoTaskAlloc;
static this() { assert(SUCCEEDED(CoInitializeEx(null, 0)), "Error Initializing COM"); CoTaskMem = CoTaskMemAlloc(4*1024)[0..4*1024]; CoTaskAlloc = Region!()(CoTaskMem); }
static ~this() { CoTaskMemFree(CoTaskMem.ptr); CoUninitialize(); }
/*
Generates a D class, at compile time, for each of the interface in <Interfaces> from the module <mSName> that contains the D interfaces.
Each interface in the module <mSName> that will be wrapped must be prefixed by i. This is because the same name will be used for the
corresponding autogenerated D classes with the prefix i replaced by c. e.g., iMyCOMInterface -> cMyCOMInterface.
Each function in the interface is mapped to a function pointer/delegate in the D class. These functions can/will be changed at runtime.
<mSName> is the string name for the module that contains the interfaces(used for symbol resolution).
<Interfaces> is a string list of the interfaces(without prefix i)
*/
static auto GenerateDCOMClasses(alias mSName, alias Interfaces, bool Cache = true)()
{
mixin(`import `~mSName~";"); // Import base COM interface module to get valid symbols
mixin(`import mCOM2D;`);
enum VariantCR = GetVariantCR!string(); // Slow if not "cached"
//pragma(msg, VariantCR);
// Converts an iInterface function name to a cInterface function name. This allows COM interface methods to be delegated to their D wrapper class methods properly.
auto I2C(alias I, alias m)()
{
char[] s; s ~= m.FunctionPtrDeclaration.replace("extern (Windows) ", "").strip();
s = ""~s.replace(" function(", " delegate(").strip();
foreach(q; aliasSeqOf!I)
{
s = s.replace("i"~q~" ", "c"~q~" ");
s = s.replace("i"~q~",", "c"~q~",");
s = s.replace("i"~q~")", "c"~q~")");
}
return s;
}
auto Get(alias T)()
{
alias m = T;
auto lu = T.ReturnType[0];
if (m.ReturnType[0] in VariantCR)
lu = VariantCR[lu][0][1];
else
{
auto ptr = (repeat("*", count(m.ReturnType[0], "*"))).join();
auto pstr = ((ptr.length > 0) ? "p" : "");
auto rtnp = m.ReturnType[0][0..$-ptr.length];
// Handle compound "unknown" types(enums, interfaces, etc)
switch(rtnp.toLower())
{
case "bool": lu = "short"~ptr; break;
default: lu = "IUnknown"~ptr; break;
}
static if (m.ReturnType[1] == "enum")
lu = "int";
lu = VariantCR[lu~ptr][0][1];
}
return lu;
}
char[] s;
char[] f;
char[] invokeType, _body, _bodyRT, fnc; bool addFunc; bool hasGetter = false;
string lastMethod; int lastPropertyType = -1; int overloadsCount = 0; string MethodSuffix = "";
int Icount = 0;
char[] MainInterfaceName;
foreach(i; aliasSeqOf!Interfaces)
{
Icount++;
f.length = 0; lastPropertyType = -1; lastMethod = ""; overloadsCount = 0; MethodSuffix = "";
mixin(`enum methods = Methods!(i`~i~`);`); // Get COM interface methods
// Create D COM Wrapper class with all the same methods as the specified interface i
s ~="public class c"~i~"\n{\n";
s ~= "\t"; mixin(`s ~= "import "~moduleName!(i`~i~`)~", ";`);
s ~= "std.conv, mCOM2D, core.sys.windows.windows, core.sys.windows.com, core.sys.windows.wtypes, core.sys.windows.basetyps, core.sys.windows.unknwn, core.sys.windows.oaidl;\n";
s ~= "\tpublic IDispatch iDispatch = null;\n\tpublic IDispatch iDispatchParent = null;\n\tpublic IDispatch iDispatchQuery = null;\n\tpublic GUID iID = IID.init;\n\tpublic GUID clsID = IID.init;\n";
static if (Cache)
{
s ~= "\tpublic static bool Cache = true;\n"; // Specifies class instance caching. This reuses class instances(since they generally are just a collection of methods, no real allocation need take place)
s ~= "\tpublic static bool FastCache = true;\n"; // Fast caching only gets COM objects once and assumes they are valid throughout all calls. This may not be justified depending on what those COM interfaces actually do behind the scenes.
if (Icount == 1)
{
s ~= "\tpublic static object.Object[string] CachedInterfaces;\n";
MainInterfaceName ~= to!string(i);
}
}
// Setup variables
f ~= "\n\t\tiDispatchQuery = _Query;";
f ~= "\n\t\tiDispatchParent = _Parent;";
// Get dynamic COM Interface methods/ID's
f ~= "\n\t\tauto COMInterface = GetDynamicCOMInterface!("~mSName~`.i`~i~", void, c"~i~")(this, null, _query);";
// Add each delegate wrapper to the class for each method in the COM interface specified by the D interface i in Interfaces.
foreach(m; aliasSeqOf!methods)
{
addFunc = true; invokeType.length = 0; fnc.length = 0; _body.length = 0; _bodyRT.length = 0;
auto methodName = m.Name;
if (lastMethod == methodName) overloadsCount++; else overloadsCount = 0;
if (overloadsCount == 0) hasGetter = false;
if (lastPropertyType != m.PropertyType) overloadsCount = 0; lastPropertyType = m.PropertyType;
MethodSuffix = (overloadsCount > 1) ? "__"~to!string(overloadsCount) : "";
lastMethod = methodName;
switch(m.PropertyType)
{
case -1: if (m.ParamsType.length <= 0) invokeType ~= "DISPATCH_PROPERTYGET"; else invokeType ~= "DISPATCH_METHOD"; break;
case 0: invokeType ~= "DISPATCH_PROPERTYGET"; if (methodName[0..3] == "get") methodName = methodName[3..$]; break;
case 1,2,3: invokeType ~= "DISPATCH_PROPERTYPUT"; if (methodName[0..3] == "set") methodName = methodName[3..$]; break;
default: assert(0, "Invalid Invoke Property Type!");
}
// Determines if the return time is one of the interfaces that are being wrapped by a class
bool RTasClass = false;
foreach(j; aliasSeqOf!Interfaces)
if (m.ReturnType[0][1..$] == j) RTasClass = true;
// Add interface method to class if it is extern (Windows) (which all COM interfaces are)
static if (m.FunctionPtrDeclaration.canFind("extern (Windows)")) // Required if Methods uses exact function signature rather than generated.
{
//pragma(msg, "Name = ", m.Name, ", RT = ", m.ReturnType, ", PT = ", m.ParamsType, ", FD = ", m.FunctionDeclaration, ", FPD = ", m.FunctionPtrDeclaration, " Property Type = ", m.PropertyType);
auto fd = I2C!(AliasSeq!Interfaces, m);
if (fd[0..8] == "VARIANT ")
fd = "SafeVariantPtr "~fd[8..$]; // Use a safer return type than Variant that cleans itself up.
s ~= "\n\tpublic "~fd~" "~m.Name~MethodSuffix~";";
// overload getters
if (m.PropertyType == 0) // If getter, add property
{
lastPropertyType = 0;
overloadsCount++;
if (m.ReturnType[0] == "VARIANT")
s ~= "\n\tSafeVariantPtr "~(I2C!(AliasSeq!Interfaces, m).replace("delegate(", methodName~"("))[8..$];
else
s ~= "\n\t"~I2C!(AliasSeq!Interfaces, m).replace("delegate(", methodName~"(")~"";
s ~= " { ";
s ~= "return "~m.Name~MethodSuffix~"();";
s ~= " } ";
hasGetter = true;
}
// overload setters
if (m.PropertyType > 0) // If getter, add property
{
overloadsCount++;
if (m.ReturnType[0] == "void")
s ~= "\n\tauto"~(I2C!(AliasSeq!Interfaces, m).replace("delegate(", methodName~"("))[4..$];
else if (m.ReturnType[0] == "VARIANT")
s ~= "\n\tSafeVariantPtr "~(I2C!(AliasSeq!Interfaces, m).replace("delegate(", methodName~"("))[8..$];
else
s ~= "\n\t"~I2C!(AliasSeq!Interfaces, m).replace("delegate(", methodName~"(");
//TODO: Only return getter if it exists(else return return time if it is not void, else void)
// Some getters do not exist to much check for it and not return if it exists.
s ~= " { ";
auto qqq2342 = "";
for(auto k = 0; k < m.ParamsType.length; k++)
qqq2342 ~= m.ParamsType[k][2]~", ";
if (m.ReturnType[0] == "void")
{
s ~= ""~m.Name~MethodSuffix~"("~qqq2342[0..$-2]~");";
if (hasGetter)
s ~= " return get"~methodName~"();";
}
else
{
s ~= "return "~m.Name~MethodSuffix~"("~qqq2342[0..$-2]~");";
}
s ~= " }";
}
//----------------------------------
// Add wrappable COM functions
// Fast caching
static if (Cache)
{
static if (m.ReturnType[0] != "void")
{
static if (m.ReturnType[1] == "interface")
{
_body ~= "\tauto key = `"~i~"."~m.ReturnType[0][1..$]~"`;\n";
if (RTasClass)
{
_body ~= "\tif (auto v = key in c"~MainInterfaceName~".CachedInterfaces)\n";
_body ~= "\t{\n";
_body ~= "\t\treturn cast(c"~m.ReturnType[0][1..$]~")*v;\n";
_body ~= "\t}\n";
}
}
}
}
//"assert(0, `Function c"~i~"."~m.Name~" not Implemented`);\n";
_body ~= "\n\tEXCEPINFO exception;\n\tuint argErr = 0;\n\tauto iidNULL = IID_NULL;\n";
_body ~= "\tauto RT = new SafeVariantPtr();\n";
static if (m.ParamsType.length > 0)
_body ~= "\tVARIANT["~to!string(to!int(m.ParamsType.length))~"] paramVars;\n";
_body ~= "\tDISPPARAMS params = {rgvarg: "~((m.ParamsType.length > 0) ? "paramVars.ptr" : "null")~", cArgs: "~to!string(to!int(m.ParamsType.length))~", cNamedArgs: 0};\n";
_body ~= "\tauto ID = COMInterface[`"~methodName~"`].ID;\n";
// Handle Params
int pindx = cast(int)m.ParamsType.length;
//static if (m.ParamsType.length > 0) { pragma(msg, m.ParamsType); }
foreach(p; m.ParamsType)
{
pindx--;
//Need to map D params to variant params.. may have to allocate
if (p[0] == "VARIANT")
{
_body ~= "\tparamVars["~to!string(pindx)~"] = "~to!string(p[2])~";\n";
}
else
{
_body ~= "\tparamVars["~to!string(pindx)~"].vt = "~to!string(VariantCR[p[1]][0][2])~";\n";
_body ~= "\tparamVars["~to!string(pindx)~"]."~to!string(VariantCR[p[1]][0][1])~" = "~p[2]~";\n";
_body ~= "\tscope(exit) VariantClear(¶mVars["~to!string(pindx)~"]);\n";
}
// TODO: Get param value in to Variant value. (requires a bit of hackery/parsing/mapping and possibly allocating/freeing)
// Works so far but need to check robustness. Pass interfaces, and Variants, etc. works with simple built in primitives like double, etc.
}
// HRESULT Invoke(DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*);
_body ~= "\tauto res = c"~i~".iDispatch.Invoke(cast(int)ID, &iidNULL, 0, "~invokeType~", ¶ms, cast(VARIANT*)RT, &exception, &argErr);\n";
_body ~= "\tassert(res == S_OK, `Could not invoke COM Function c"~i~"."~m.Name~". Error `~to!string(res, 16));\n";
static if (m.ReturnType[0] != "void")
{
auto lu = Get!(m)();
//pragma(msg, m.ReturnType[0], " - ", m.ReturnType[1], " - ", m.FunctionPtrDeclaration);
static if (m.ReturnType[1] == "interface")
{
if (!RTasClass)
_bodyRT ~= "\treturn cast("~m.ReturnType[0]~")(RT."~lu~");\n";
else
{
static if (Cache)
{
_bodyRT ~= "\tif (c"~MainInterfaceName~".Cache)\n\t{\n";
_bodyRT ~= "\t\tif (auto v = key in c"~MainInterfaceName~".CachedInterfaces)\n\t\t{\n";
_bodyRT ~= "\t\t\t(cast(c"~m.ReturnType[0][1..$]~")v).iDispatch = cast(IDispatch)RT.punkVal;\n";
_bodyRT ~= "\t\t\treturn cast(c"~m.ReturnType[0][1..$]~")*v;\n";
_bodyRT ~= "\t\t}\n\t}\n";
_bodyRT ~= "\tauto _class = new c"~m.ReturnType[0][1..$]~"(true, cast(IDispatch)(RT."~lu~"), this.iDispatch);\n";
_bodyRT ~= "\tc"~MainInterfaceName~".CachedInterfaces[key] = _class;\n";
_bodyRT ~= "\treturn _class;\n";
} else
{
_bodyRT ~= "\tauto _class = new c"~m.ReturnType[0][1..$]~"(true, cast(IDispatch)(RT."~lu~"), this.iDispatch);\n";
_bodyRT ~= "\treturn _class;\n";
}
}
} else static if(m.ReturnType[1] == "class")
{
_bodyRT ~= "\treturn cast("~m.ReturnType[0]~")(RT."~lu~");\n";
} else static if (m.ReturnType[0] == "VARIANT")
{
_bodyRT ~= "\treturn RT;\n";
}
else
{
_bodyRT ~= "\treturn cast("~m.ReturnType[0]~")(RT."~lu~");\n";
}
_body ~= _bodyRT;
}
string plist;
foreach(p; m.ParamsType)
{
plist ~= p[0]~" "~p[2]~", ";
}
if (m.ParamsType.length > 0)
plist = plist[0..$-2];
fnc ~= "\n// "~m.FunctionDeclaration~"\n"~m.Name~MethodSuffix~" = cast(typeof(this."~m.Name~MethodSuffix~")) ("~plist~") \n{\n "~_body~"\n};\n";
if (addFunc)
f ~= "\n"~fnc.replace("\n", "\n\t\t");
else
f ~= "\n\t\t"~m.Name~MethodSuffix~" = cast(typeof("~m.Name~MethodSuffix~")) { assert(0, `Function c"~i~"."~m.Name~"{"~MethodSuffix~"} not Implemented`); }; // "~m.FunctionDeclaration~"\n";
}
}
// Setup default constructor to initialize all delegate members with COM invoking mechanisms
s ~= "\n\n\t// i"~i;
s ~= "\n\tpublic this(bool _query = false, IDispatch _Query = null, IDispatch _Parent = null)\n\t{\n"~f~"\n\t}";
// Release the COM interface on destruction
s ~= "\n\t~this(){ if (iDispatch) iDispatch.Release(); }";
s ~= "\n}\n\n";
}
return s;
}
/*
Initializes, at runtime, the D COM class/interface <I>. Creates the COM instance(using CoCreateInstance or QueryInterface) of <I> and gets the
runtime COM "function pointer" for each member of <I>(Using the method names in I that correspond to the COM interface).
These function pointers returned along with the pointer to the COM interface.
Usage: This function is called at runtime to setup the connection of a COM object to it's D COM Wrapper.
Interface: The COM D Interface with the methods, iID, and clsID to be used to generated a D COM Wrapper from.
_this: The D COM Wrapper class instance to setup.
(optional)
methods: the type tuple array of methods of the interface, used only for optimization, pass void to recache.
query: To use Query interface. Pass COM interface to query in Parent.
Parent: The parent aggregate COM interface or the COM interface to query, if query is set to true
Return: Returns a list of tuples indexed by the method names found in <Interface>. The first element is the COM ID(GetIDsOfNames) and the second is the Method info as returned by Methods!().
*/
static auto GetDynamicCOMInterface(Interface, methods = void, T)(T _this, IUnknown Parent = null, bool query = false)
{
import mCOM2D;
static if (is(methods == void))
enum methods = Methods!(Interface);
Tuple!(int, "ID", typeof(Methods!(_NULL, string)[0]), "Method")[string] COMMethods;
_this.iID = Interface.iID;
static if (hasMember!(Interface, "clsID")) _this.clsID = Interface.clsID;
HRESULT res;
if (!query)
{
res = CoCreateInstance(&_this.clsID, Parent, CLSCTX_ALL, &_this.iID, cast(void**)&_this.iDispatch);
assert(SUCCEEDED(res), "Error("~to!string(res, 16)~") Cannot Create COM Instance: " ~ Interface.stringof);
} else
{
res = ((Parent is null) ? _this.iDispatchQuery : Parent).QueryInterface(&_this.iID, cast(void**)&_this.iDispatch);
assert(SUCCEEDED(res), "Error("~to!string(res, 16)~") Cannot Query COM Instance: " ~ Interface.stringof);
}
// Get the IDs of all the methods in the interface. Iterate one at a time for convenience
auto methodID = DISPID_UNKNOWN;
auto iid2 = IID_NULL;
auto methodNamePtr = cast(wchar**)CoTaskAlloc.allocate((void*).sizeof);
// Get method name size(for preallocation)
size_t size = 0; foreach(m; aliasSeqOf!methods) { size = max(size, m.Name.length); }
auto methodName = cast(wchar[])CoTaskAlloc.allocate(size*2+10);
*methodNamePtr = cast(wchar*)methodName.ptr;
// Get each methodID for each method.
foreach(m; methods)
{
// Copy name to buffer
auto mName = m.Name;
switch(m.PropertyType)
{
case -1: break;
case 0: if (mName[0..3] == "get") mName = mName[3..$]; break;
case 1,2,3: if (mName[0..3] == "set") mName = mName[3..$]; break;
default: assert(0, "Invalid Invoke Property Type!");
}
assert(mName.length < 512, "GetDynamicCOMInterface: Method name too long!");
for(int i = 0; i < mName.length; i++)
methodName[i] = mName[i];
methodName[mName.length] = '\0';
// Get COM method ID
methodID = DISPID_UNKNOWN;
res = _this.iDispatch.GetIDsOfNames(&_this.iID, methodNamePtr, 1u, 0u, &methodID); // MethodNamePtr is of type wchar
//assert(SUCCEEDED(res), "Error("~to!string(res, 16)~") Cannot Get COM Method `"~to!string(m.Name)~"` ID: ");
if (SUCCEEDED(res))
COMMethods[mName] = tuple!("ID", "Method")(methodID, m);
}
CoTaskAlloc.deallocate(methodName);
CoTaskAlloc.deallocate(methodNamePtr[0..(void*).sizeof]);
return COMMethods;
}
// ------------------------------ Helper Functions
version(all)
{
// Creates a 3-way lookup that maps a variant vt val to a field name and it's type and vice versa versa.
auto GetVariantCR(S = string)()
{
// VARIANT & VARENUM structures
enum data = [["0x00", "VT_EMPTY", "None"],["0x01", "VT_NULL", "None"],["0x02", "VT_I2", "iVal"],["0x03", "VT_I4", "lVal"],["0x04", "VT_R2", "fltVal"],["0x05", "VT_R4", "dblVal"],["0x06", "VT_CY", "cyVal"],["0x07", "VT_DATE", "date"],["0x08", "VT_BSTR", "bstrVal"],["0x09", "VT_DISPATCH", "pdispVal"],["0x0a", "VT_ERROR", "scode"],["0x0b", "VT_BOOL", "boolVal"],["0x0c", "VT_VARIANT", "pvarVal"],["0x0d", "VT_UNKNOWN", "punkVal"],["0x0e", "VT_DECIMAL", "decVal"],["0x10", "VT_I1", "cVal"],["0x11", "VT_UI1", "bVal"],["0x12", "VT_UI2", "uiVal"],["0x13", "VT_UI4", "ulVal"],["0x14", "VT_I8", "hVal"],["0x15", "VT_UI8", "uhVal"],["0x16", "VT_INT", "intVal"],["0x17", "VT_UINT", "uintVal"],["0x18", "VT_VOID", "void"],["0x19", "VT_HRESULT", "Missing3"],["0x1a", "VT_PTR", "ptr"],["0x1b", "VT_SAFEARRAY", "parray"],["0x1c", "VT_CARRAY", "carray"],["0x1d", "VT_USERDEFINED", "userdefined"],["0x1e", "VT_LPSTR", "pszVal"],["0x1f", "VT_LPWSTR", "pwszVal"],["0x24", "VT_RECORD", "record"],["0x25", "VT_INT_PTR", "pintVal"],["0x26", "VT_UINT_PTR", "puintVal"],["0x2000", "VT_ARRAY", "parray"]];
import std.traits, std.meta, std.string, std.algorithm, std.typetuple, std.typecons, std.conv;
Tuple!(S, S, S, S)[][S] s;
// Iterate over all fields of VARIANT
foreach (name; aliasSeqOf!((VARIANT.tupleof.stringof)[6..$-1].split(",").map!(n => strip(n))))
{
static if (name.among("vt", "pvRecord", "pRecInfo", "wReserved1", "wReserved2", "wReserved3")) { }
else
{
mixin("alias type = typeof(VARIANT."~name~"); // "~name);
//pragma(msg, "alias type = typeof(VARIANT."~name~"); // "~name~" -- "~type.stringof);
S val; S n;
foreach(x; data)
{
if (x[2] == name)
{
auto q = x[0][2..$];
int v = parse!int(q, 16);
val = to!S(v);
n = to!S(x[1]);
break;
}
}
if (!(val == "" || n == ""))
{
auto v = tuple(to!S(type.stringof)~"", to!S(name)~"", val~"", n~"");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
}
}
}
// Add D maps
auto v = tuple("interface", "punkVal", "13", "VT_UNKNOWN");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("class", "punkVal", "13", "VT_UNKNOWN");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("interface*", "ppunkVal", "13", "VT_PTR");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("class*", "ppunkVal", "13", "VT_PTR");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("enum", "intVal", "22", "VT_INT");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("enum", "intVal", "22", "VT_INT");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
v = tuple("bool", "intVal", "11", "VT_BOOL");
s[v[0]] ~= v; s[v[1]] ~= v; s[v[2]] ~= v; s[v[3]] ~= v;
return s;
}
// Wraps a VARIANT to provide automatic initialization and cleanup.
class SafeVariantPtr
{
VARIANT* v;
alias v this;
bool allocated = false;
this()
{
v = cast(VARIANT*)CoTaskMemAlloc(VARIANT.sizeof);
allocated = true;
VariantInit(v);
}
this(ref VARIANT v)
{
this.v = &v;
}
~this()
{
import std.conv;
auto res = VariantClear(v);
assert((res == S_OK), "Cannot clear COM Variant: "~to!string(res, 16));
if (allocated)
CoTaskMemFree(v);
}
}
// Creates a guid from a guid hex string. e.g., "B3C35001-B625-48D7-9D3B-C9D66D9CF5F1" -> {0xC09F153E, 0xDFF7, 0x4EFF, [0xA5, 0x70, 0xAF, 0x82, 0xC1, 0xA5, 0xA2, 0xA8]}
GUID Guid(string str)()
{
static assert(str.length==36, "Guid string must be 36 chars long");
enum GUIDstring = "GUID(0x" ~ str[0..8] ~ ", 0x" ~ str[9..13] ~ ", 0x" ~ str[14..18] ~
", [0x" ~ str[19..21] ~ ", 0x" ~ str[21..23] ~ ", 0x" ~ str[24..26] ~ ", 0x" ~ str[26..28]
~ ", 0x" ~ str[28..30] ~ ", 0x" ~ str[30..32] ~ ", 0x" ~ str[32..34] ~ ", 0x" ~ str[34..36] ~ "])";
return mixin(GUIDstring);
}
import std.algorithm;
enum isElementOfObject(alias T) = (staticIndexOf!(T, AliasSeq!("this", __traits(allMembers, Object))) >= 0) ? true : false;
enum isElementOfIDispatch(alias T) = (staticIndexOf!(T, __traits(allMembers, IDispatch)) >= 0) ? true : false;
enum isConstructor(alias T) = (T.stringof.canFind("Ctor")) ? true : false;
class _NULL { }
// Returns a D primitive type string
S dType(T, S = string)() {
static if(is(T == enum)) return "enum";
else static if(is(T == class)) return "class";
else static if(is(T == struct)) return "struct";
else static if(is(T == interface)) return "interface";
else return T.stringof;
}
// Returns only the methods for a class or interface by Name, Parameters(specified type, D type), Return(specified type, D type), Function Declaration, then Function Ptr Declaration
auto Methods(alias T, S = string)() if ((is(T == class) || is(T == interface)) && (is(S == string) || is(S == wstring))) // returns method name, params + return type. Params is array of types(specified as a (s)string)
{
import std.traits, std.typetuple, std.typecons, std.array, std.string, std.conv, std.meta;
alias RT = Tuple!(S, "Name", Tuple!(S,S,S)[], "ParamsType", Tuple!(S,S), "ReturnType", S, "FunctionDeclaration", S, "FunctionPtrDeclaration", int, "PropertyType"); // PropertyType = [not a property: -1, get:0, set:1, setref:2, set/setref:3,]
RT[] methods;
mixin("import "~moduleName!(T)~";");
static if (is(T == _NULL)) return methods;
// Get only useful members(not this, IDispatch, Object, etc)
enum membersList = Filter!(templateNot!isConstructor, Filter!(templateNot!isElementOfIDispatch, Filter!(templateNot!isElementOfObject, __traits(allMembers, T))));
foreach(f; membersList)
{
alias overloads = AliasSeq!(__traits(getOverloads, T, f));
foreach (member; overloads)
{
enum member_name = (to!S(__traits(identifier, member)) ~ to!S("\0"))[0..$-1]; // Append null terminator for c usage, should add no harm but if we unslice it and it may be lost in rare cases and cause issues when used in c.
static if (is(typeof(member) == function) || is(typeof(*member) == function))
{
typeof(methods[0].ParamsType) params;
enum p = split(Parameters!(member).stringof[1..$-1], ",").map!(n => strip(n));
static if (ParameterIdentifierTuple!(member).length == 0)
enum pns = [];
else
mixin("enum pns = ["~to!S(ParameterIdentifierTuple!(member).stringof[6..$-1])~"];");
auto k = 0;
foreach(a; aliasSeqOf!(p))
{
mixin("enum x = dType!("~to!S(removechars(strip(a), "*"))~")~repeat(`*`, count(a, `*`)).join();");
params ~= tuple(to!S(strip(a))~"", to!S(x)~"", to!S(pns[k++])~"");
}
string prefix = ""; int ptype = -1;
if (overloads.length == 2)
{
prefix = (p.length == 0) ? "get" : "set";
ptype = (p.length == 0) ? 0 : 1;
}
// TODO: Handle get/set/setref (I think the IDL to D converts all sets to setrefs)
// Store method data
mixin(`typeof(&member) memptr;`);
mixin(`alias md = typeof(member);`);
enum rt = ReturnType!(member).stringof~"";
mixin("enum rtv = dType!("~to!S(removechars(strip(rt), "*"))~")~repeat(`*`, count(rt, `*`)).join();");
methods ~= typeof(methods[0])(prefix~member_name~"", params, tuple(to!S(rt)~"", to!S(rtv)~""), to!S(md.stringof)~"", to!S(typeof(memptr).stringof)~"", ptype);
}
}
}
return methods;
}
}
/* Notes/Issues
1.1 When setting the property of a COM object via IDispatch::Invoke() using DISPATCH_PROPERTYPUT, it is important to ensure the following :
DISPPARAMS.rgdispidNamedArgs must point to a DISPID whose value is
DISPID_PROPERTYPUT (-3).
DISPPARAMS.cNamedArgs must be equal to 1.
1.2 If the above settings are not done, IDispatch::Invoke() will return DISP_E_PARAMNOTFOUND.
If Invoke was successful, then result.vt will be VT_DISPATCH and result.dispVal will be a valid IDispatch pointer.
*/
|
D
|
//Written in the D programming language
/*
* Some extra constraints.
*
* Copyright 2016 Jaypha
*
* Distributed under the Boost Software License, Version 1.0.
* (See http://www.boost.org/LICENSE_1_0.txt)
*
* Authors: Jason den Dulk
*/
module jaypha.traits;
import std.traits;
import std.functional;
import std.range.primitives;
enum isByteRange(R) = (isInputRange!R && is(Unqual!(ElementType!R) : ubyte));
enum isComparable(T1,T2, alias pred = "a == b") = __traits(compiles,binaryFun!pred(T1.init,T2.init));
unittest
{
struct R1 { bool x; }
struct R2 { uint y; }
static assert(isComparable!(int, long));
static assert(!isComparable!(R1,R2));
}
|
D
|
//https://www.reddit.com/r/dailyprogrammer/comments/nucsik/20210607_challenge_393_easy_making_change/
import std.stdio : writeln;
import std.algorithm : sum;
void main()
{
}
int change(int input)
{
return input.calculateChange.values.sum;
}
unittest
{
static assert(468.change == 11);
static assert(1034.change == 8);
static assert(0.change == 0);
}
int[int] calculateChange(int input)
{
int[] order = [500, 100, 25, 10, 5, 1];
int[int] coins = [
500: 0,
100: 0,
25: 0,
10: 0,
5: 0,
1: 0
];
foreach(coin; order)
{
coins[coin] = input / coin;
input %= coin;
}
return coins;
}
unittest
{
static assert(468.calculateChange == [
500: 0,
100: 4,
25: 2,
10: 1,
5: 1,
1: 3
]);
static assert(1034.calculateChange == [
500: 2,
100: 0,
25: 1,
10: 0,
5: 1,
1: 4
]);
static assert(0.calculateChange == [
500: 0,
100: 0,
25: 0,
10: 0,
5: 0,
1: 0
]);
}
|
D
|
// Written in the D programming language.
/**
This module contains generic _iteration algorithms.
$(SCRIPT inhibitQuickIndex = 1;)
$(BOOKTABLE $(H2 Function),
$(TR $(TH Function Name) $(TH Description))
$(T2 all, Checks if all elements satisfy to a predicate.)
$(T2 any, Checks if at least one element satisfy to a predicate.)
$(T2 cmp, Compares two slices.)
$(T2 count, Counts elements in a slices according to a predicate.)
$(T2 each, Iterates elements.)
$(T2 eachLower, Iterates lower triangle of matrix.)
$(T2 eachOnBorder, Iterates elementes on tensors borders and corners.)
$(T2 eachUploPair, Iterates upper and lower pairs of elements in square matrix.)
$(T2 eachUpper, Iterates upper triangle of matrix.)
$(T2 equal, Compares two slices for equality.)
$(T2 filter, Filters elements in a range or an ndslice.)
$(T2 find, Finds backward index.)
$(T2 findIndex, Finds index.)
$(T2 fold, Accumulates all elements (different parameter order than `reduce`).)
$(T2 isSymmetric, Checks if the matrix is symmetric.)
$(T2 maxIndex, Finds index of the maximum.)
$(T2 maxPos, Finds backward index of the maximum.)
$(T2 minIndex, Finds index of the minimum.)
$(T2 minmaxIndex, Finds indices of the minimum and the maximum.)
$(T2 minmaxPos, Finds backward indices of the minimum and the maximum.)
$(T2 minPos, Finds backward index of the minimum.)
$(T2 nBitsToCount, Сount bits until set bit count is reached.)
$(T2 reduce, Accumulates all elements.)
$(T2 Chequer, Chequer color selector to work with $(LREF each) .)
$(T2 uniq, Iterates over the unique elements in a range or an ndslice, which is assumed sorted.)
)
Transform function is represented by $(NDSLICEREF topology, map).
All operators are suitable to change slices using `ref` argument qualification in a function declaration.
Note, that string lambdas in Mir are `auto ref` functions.
License: $(HTTP www.apache.org/licenses/LICENSE-2.0, Apache-2.0)
Copyright: 2020 Ilia Ki, Kaleidic Associates Advisory Limited, Symmetry Investments
Authors: Ilia Ki, John Michael Hall, Andrei Alexandrescu (original Phobos code)
License: $(HTTP www.apache.org/licenses/LICENSE-2.0, Apache-2.0)
Copyright: 2020 Ilia Ki, Kaleidic Associates Advisory Limited, Symmetry Investments
Authors: , Ilia Ki (Mir & BetterC rework).
Source: $(PHOBOSSRC std/algorithm/_iteration.d)
Macros:
NDSLICEREF = $(REF_ALTTEXT $(TT $2), $2, mir, ndslice, $1)$(NBSP)
T2=$(TR $(TDNW $(LREF $1)) $(TD $+))
*/
module mir.algorithm.iteration;
import mir.functional: naryFun;
import mir.internal.utility;
import mir.math.common: optmath;
import mir.ndslice.field: BitField;
import mir.ndslice.internal;
import mir.ndslice.iterator: FieldIterator, RetroIterator;
import mir.ndslice.slice;
import mir.primitives;
import mir.qualifier;
import std.meta;
import std.traits;
/++
Chequer color selector to work with $(LREF each)
+/
enum Chequer : bool
{
/// Main diagonal color
black,
/// First sub-diagonal color
red,
}
///
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
auto s = [5, 4].slice!int;
Chequer.black.each!"a = 1"(s);
assert(s == [
[1, 0, 1, 0],
[0, 1, 0, 1],
[1, 0, 1, 0],
[0, 1, 0, 1],
[1, 0, 1, 0],
]);
Chequer.red.each!((ref b) => b = 2)(s);
assert(s == [
[1, 2, 1, 2],
[2, 1, 2, 1],
[1, 2, 1, 2],
[2, 1, 2, 1],
[1, 2, 1, 2],
]);
}
@optmath:
/+
Bitslice representation for accelerated bitwise algorithm.
1-dimensional contiguousitslice can be split into three chunks: head bits, body chunks, and tail bits.
Bitslice can have head bits because it has slicing and the zero bit may not be aligned to the zero of a body chunk.
+/
private struct BitSliceAccelerator(Field, I = typeof(Field.init[size_t.init]))
if (__traits(isUnsigned, I))
{
import mir.bitop;
import mir.qualifier: lightConst;
import mir.ndslice.traits: isIterator;
import mir.ndslice.iterator: FieldIterator;
import mir.ndslice.field: BitField;
///
alias U = typeof(I + 1u);
/// body bits chunks
static if (isIterator!Field)
Slice!Field bodyChunks;
else
Slice!(FieldIterator!Field) bodyChunks;
/// head length
int headLength;
/// tail length
int tailLength;
@optmath:
this(Slice!(FieldIterator!(BitField!(Field, I))) slice)
{
enum mask = bitShiftMask!I;
enum shift = bitElemShift!I;
size_t length = slice.length;
size_t index = slice._iterator._index;
if (auto hlen = index & mask)
{
auto l = I.sizeof * 8 - hlen;
if (l > length)
{
// central problem
headLength = -cast(int) length;
tailLength = cast(int) hlen;
goto F;
}
else
{
headLength = cast(uint) l;
length -= l;
index += l;
}
}
tailLength = cast(int) (length & mask);
F:
length >>= shift;
index >>= shift;
bodyChunks._lengths[0] = length;
static if (isIterator!Field)
{
bodyChunks._iterator = slice._iterator._field._field;
bodyChunks._iterator += index;
}
else
{
bodyChunks._iterator._index = index;
bodyChunks._iterator._field = slice._iterator._field._field;
}
}
scope const:
bool isCentralProblem()
{
return headLength < 0;
}
U centralBits()
{
assert(isCentralProblem);
return *bodyChunks._iterator.lightConst >>> tailLength;
}
uint centralLength()
{
assert(isCentralProblem);
return -headLength;
}
/// head bits (last `headLength` bits are valid).
U headBits()
{
assert(!isCentralProblem);
if (headLength == 0)
return U.init;
static if (isIterator!Field)
return bodyChunks._iterator.lightConst[-1];
else
return bodyChunks._iterator._field.lightConst[bodyChunks._iterator._index - 1];
}
/// tail bits (first `tailLength` bits are valid).
U tailBits()
{
assert(!isCentralProblem);
if (tailLength == 0)
return U.init;
static if (isIterator!Field)
return bodyChunks._iterator.lightConst[bodyChunks.length];
else
return bodyChunks._iterator._field.lightConst[bodyChunks._iterator._index + bodyChunks.length];
}
U negCentralMask()
{
return U.max << centralLength;
}
U negHeadMask()
{
return U.max << headLength;
}
U negTailMask()
{
return U.max << tailLength;
}
U negCentralMaskS()
{
return U.max >> centralLength;
}
U negHeadMaskS()
{
return U.max >> headLength;
}
U negTailMaskS()
{
return U.max >> tailLength;
}
U centralBitsWithRemainingZeros()
{
return centralBits & ~negCentralMask;
}
U centralBitsWithRemainingZerosS()
{
return centralBits << (U.sizeof * 8 - centralLength);
}
U headBitsWithRemainingZeros()
{
return headBits >>> (I.sizeof * 8 - headLength);
}
U headBitsWithRemainingZerosS()
{
static if (U.sizeof > I.sizeof)
return (headBits << (U.sizeof - I.sizeof) * 8) & ~negTailMaskS;
else
return headBits & ~negTailMaskS;
}
U tailBitsWithRemainingZeros()
{
return tailBits & ~negTailMask;
}
U tailBitsWithRemainingZerosS()
{
return tailBits << (U.sizeof * 8 - tailLength);
}
U centralBitsWithRemainingOnes()
{
return centralBits | negCentralMask;
}
U centralBitsWithRemainingOnesS()
{
return centralBitsWithRemainingZerosS | negCentralMaskS;
}
U headBitsWithRemainingOnes()
{
return headBitsWithRemainingZeros | negHeadMask;
}
U headBitsWithRemainingOnesS()
{
return headBitsWithRemainingZerosS | negHeadMaskS;
}
U tailBitsWithRemainingOnes()
{
return tailBits | negTailMask;
}
U tailBitsWithRemainingOnesS()
{
return tailBitsWithRemainingZerosS | negTailMaskS;
}
size_t ctpop()
{
import mir.bitop: ctpop;
if (isCentralProblem)
return centralBitsWithRemainingZeros.ctpop;
size_t ret;
if (headLength)
ret = cast(size_t) headBitsWithRemainingZeros.ctpop;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
ret += cast(size_t) bc.front.ctpop;
bc.popFront;
}
while(bc.length);
}
if (tailBits)
ret += cast(size_t) tailBitsWithRemainingZeros.ctpop;
return ret;
}
bool any()
{
if (isCentralProblem)
return centralBitsWithRemainingZeros != 0;
if (headBitsWithRemainingZeros != 0)
return true;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
if (bc.front != 0)
return true;
bc.popFront;
}
while(bc.length);
}
if (tailBitsWithRemainingZeros != 0)
return true;
return false;
}
bool all()
{
if (isCentralProblem)
return centralBitsWithRemainingOnes != U.max;
size_t ret;
if (headBitsWithRemainingOnes != U.max)
return false;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
if (bc.front != I.max)
return false;
bc.popFront;
}
while(bc.length);
}
if (tailBitsWithRemainingOnes != U.max)
return false;
return true;
}
size_t cttz()
{
U v;
size_t ret;
if (isCentralProblem)
{
v = centralBitsWithRemainingOnes;
if (v)
goto R;
ret = centralLength;
goto L;
}
v = headBitsWithRemainingOnes;
if (v)
goto R;
ret = headLength;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
v = bc.front;
if (v)
goto R;
ret += I.sizeof * 8;
bc.popFront;
}
while(bc.length);
}
v = tailBitsWithRemainingOnes;
if (v)
goto R;
ret += tailLength;
goto L;
R:
ret += v.cttz;
L:
return ret;
}
size_t ctlz()
{
U v;
size_t ret;
if (isCentralProblem)
{
v = centralBitsWithRemainingOnes;
if (v)
goto R;
ret = centralLength;
goto L;
}
v = tailBitsWithRemainingOnesS;
if (v)
goto R;
ret = tailLength;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
v = bc.back;
if (v)
goto R;
ret += I.sizeof * 8;
bc.popBack;
}
while(bc.length);
}
v = headBitsWithRemainingOnesS;
if (v)
goto R;
ret += headLength;
goto L;
R:
ret += v.ctlz;
L:
return ret;
}
sizediff_t nBitsToCount(size_t count)
{
size_t ret;
if (count == 0)
return count;
U v, cnt;
if (isCentralProblem)
{
v = centralBitsWithRemainingZeros;
goto E;
}
v = headBitsWithRemainingZeros;
cnt = v.ctpop;
if (cnt >= count)
goto R;
ret += headLength;
count -= cast(size_t) cnt;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
v = bc.front;
cnt = v.ctpop;
if (cnt >= count)
goto R;
ret += I.sizeof * 8;
count -= cast(size_t) cnt;
bc.popFront;
}
while(bc.length);
}
v = tailBitsWithRemainingZeros;
E:
cnt = v.ctpop;
if (cnt >= count)
goto R;
return -1;
R:
return ret + v.nTrailingBitsToCount(count);
}
sizediff_t retroNBitsToCount(size_t count)
{
if (count == 0)
return count;
size_t ret;
U v, cnt;
if (isCentralProblem)
{
v = centralBitsWithRemainingZerosS;
goto E;
}
v = tailBitsWithRemainingZerosS;
cnt = v.ctpop;
if (cnt >= count)
goto R;
ret += tailLength;
count -= cast(size_t) cnt;
if (bodyChunks.length)
{
auto bc = bodyChunks.lightConst;
do
{
v = bc.back;
cnt = v.ctpop;
if (cnt >= count)
goto R;
ret += I.sizeof * 8;
count -= cast(size_t) cnt;
bc.popBack;
}
while(bc.length);
}
v = headBitsWithRemainingZerosS;
E:
cnt = v.ctpop;
if (cnt >= count)
goto R;
return -1;
R:
return ret + v.nLeadingBitsToCount(count);
}
}
/++
Сount bits until set bit count is reached. Works with ndslices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
Returns: bit count if set bit count is reached or `-1` otherwise.
+/
sizediff_t nBitsToCount(Field, I)(Slice!(FieldIterator!(BitField!(Field, I))) bitSlice, size_t count)
{
return BitSliceAccelerator!(Field, I)(bitSlice).nBitsToCount(count);
}
///ditto
sizediff_t nBitsToCount(Field, I)(Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))) bitSlice, size_t count)
{
import mir.ndslice.topology: retro;
return BitSliceAccelerator!(Field, I)(bitSlice.retro).retroNBitsToCount(count);
}
///
version(mir_test)
pure unittest
{
import mir.ndslice.allocation: bitSlice;
import mir.ndslice.topology: retro;
auto s = bitSlice(1000);
s[50] = true;
s[100] = true;
s[200] = true;
s[300] = true;
s[400] = true;
assert(s.nBitsToCount(4) == 301);
assert(s.retro.nBitsToCount(4) == 900);
}
private void checkShapesMatch(
string fun = __FUNCTION__,
string pfun = __PRETTY_FUNCTION__,
Slices...)
(Slices slices)
if (Slices.length > 1)
{
enum msgShape = "all slices must have the same shape" ~ tailErrorMessage!(fun, pfun);
enum N = slices[0].shape.length;
foreach (i, Slice; Slices)
{
static if (i == 0)
continue;
else
static if (slices[i].shape.length == N)
assert(slices[i].shape == slices[0].shape, msgShape);
else
{
import mir.ndslice.fuse: fuseShape;
static assert(slices[i].fuseShape.length >= N);
assert(cast(size_t[N])slices[i].fuseShape[0 .. N] == slices[0].shape, msgShape);
}
}
}
package(mir) template allFlattened(args...)
{
static if (args.length)
{
alias arg = args[0];
@optmath @property allFlattenedMod()()
{
import mir.ndslice.topology: flattened;
return flattened(arg);
}
alias allFlattened = AliasSeq!(allFlattenedMod, allFlattened!(args[1..$]));
}
else
alias allFlattened = AliasSeq!();
}
private template areAllContiguousSlices(Slices...)
{
import mir.ndslice.traits: isContiguousSlice;
static if (allSatisfy!(isContiguousSlice, Slices))
enum areAllContiguousSlices = Slices[0].N > 1 && areAllContiguousSlicesImpl!(Slices[0].N, Slices[1 .. $]);
else
enum areAllContiguousSlices = false;
}
private template areAllContiguousSlicesImpl(size_t N, Slices...)
{
static if (Slices.length == 0)
enum areAllContiguousSlicesImpl = true;
else
enum areAllContiguousSlicesImpl = Slices[0].N == N && areAllContiguousSlicesImpl!(N, Slices[1 .. $]);
}
version(LDC) {}
else version(GNU) {}
else version (Windows) {}
else version (X86_64)
{
//Compiling with DMD for x86-64 for Linux & OS X with optimizations enabled,
//"Tensor mutation on-the-fly" unittest was failing. Disabling inlining
//caused it to succeed.
//TODO: Rework so this is unnecessary!
version = Mir_disable_inlining_in_reduce;
}
version(Mir_disable_inlining_in_reduce)
{
private enum Mir_disable_inlining_in_reduce = true;
private template _naryAliases(size_t n)
{
static if (n == 0)
enum _naryAliases = "";
else
{
enum i = n - 1;
enum _naryAliases = _naryAliases!i ~ "alias " ~ cast(char)('a' + i) ~ " = args[" ~ i.stringof ~ "];\n";
}
}
private template nonInlinedNaryFun(alias fun)
{
import mir.math.common : optmath;
static if (is(typeof(fun) : string))
{
/// Specialization for string lambdas
@optmath auto ref nonInlinedNaryFun(Args...)(auto ref Args args)
if (args.length <= 26)
{
pragma(inline,false);
mixin(_naryAliases!(Args.length));
return mixin(fun);
}
}
else static if (is(typeof(fun.opCall) == function))
{
@optmath auto ref nonInlinedNaryFun(Args...)(auto ref Args args)
if (is(typeof(fun.opCall(args))))
{
pragma(inline,false);
return fun.opCall(args);
}
}
else
{
@optmath auto ref nonInlinedNaryFun(Args...)(auto ref Args args)
if (is(typeof(fun(args))))
{
pragma(inline,false);
return fun(args);
}
}
}
}
else
{
private enum Mir_disable_inlining_in_reduce = false;
}
S reduceImpl(alias fun, S, Slices...)(S seed, Slices slices)
{
do
{
static if (DimensionCount!(Slices[0]) == 1)
mixin(`seed = fun(seed,` ~ frontOf!(Slices.length) ~ `);`);
else
mixin(`seed = .reduceImpl!fun(seed,` ~ frontOf!(Slices.length) ~ `);`);
foreach_reverse(ref slice; slices)
slice.popFront;
}
while(!slices[0].empty);
return seed;
}
/++
Implements the homonym function (also known as `accumulate`,
`compress`, `inject`, or `fold`) present in various programming
languages of functional flavor. The call `reduce!(fun)(seed, slice1, ..., sliceN)`
first assigns `seed` to an internal variable `result`,
also called the accumulator. Then, for each set of element `x1, ..., xN` in
`slice1, ..., sliceN`, `result = fun(result, x1, ..., xN)` gets evaluated. Finally,
`result` is returned.
`reduce` allows to iterate multiple slices in the lockstep.
Note:
$(NDSLICEREF topology, pack) can be used to specify dimensions.
Params:
fun = A function.
See_Also:
$(HTTP llvm.org/docs/LangRef.html#fast-math-flags, LLVM IR: Fast Math Flags)
$(HTTP en.wikipedia.org/wiki/Fold_(higher-order_function), Fold (higher-order function))
+/
template reduce(alias fun)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun)
&& !Mir_disable_inlining_in_reduce)
/++
Params:
seed = An initial accumulation value.
slices = One or more slices, range, and arrays.
Returns:
the accumulated `result`
+/
@optmath auto reduce(S, Slices...)(S seed, Slices slices)
if (Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
return .reduce!fun(seed, allFlattened!(allLightScope!slices));
}
else
{
if (slices[0].anyEmpty)
return cast(Unqual!S) seed;
static if (is(S : Unqual!S))
alias UT = Unqual!S;
else
alias UT = S;
return reduceImpl!(fun, UT, Slices)(seed, allLightScope!slices);
}
}
else version(Mir_disable_inlining_in_reduce)
//As above, but with inlining disabled.
@optmath auto reduce(S, Slices...)(S seed, Slices slices)
if (Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
return .reduce!fun(seed, allFlattened!(allLightScope!slices));
}
else
{
if (slices[0].anyEmpty)
return cast(Unqual!S) seed;
static if (is(S : Unqual!S))
alias UT = Unqual!S;
else
alias UT = S;
return reduceImpl!(nonInlinedNaryFun!fun, UT, Slices)(seed, allLightScope!slices);
}
}
else
alias reduce = .reduce!(naryFun!fun);
}
/// Ranges and arrays
version(mir_test)
unittest
{
auto ar = [1, 2, 3];
auto s = 0.reduce!"a + b"(ar);
assert (s == 6);
}
/// Single slice
version(mir_test)
unittest
{
import mir.ndslice.topology : iota;
//| 0 1 2 | => 3 |
//| 3 4 5 | => 12 | => 15
auto sl = iota(2, 3);
// sum of all element in the slice
auto res = size_t(0).reduce!"a + b"(sl);
assert(res == 15);
}
/// Multiple slices, dot product
version(mir_test)
unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
//| 0 1 2 |
//| 3 4 5 |
auto a = iota([2, 3], 0).as!double.slice;
//| 1 2 3 |
//| 4 5 6 |
auto b = iota([2, 3], 1).as!double.slice;
alias dot = reduce!"a + b * c";
auto res = dot(0.0, a, b);
// check the result:
import mir.ndslice.topology : flattened;
import std.numeric : dotProduct;
assert(res == dotProduct(a.flattened, b.flattened));
}
/// Zipped slices, dot product
pure
version(mir_test) unittest
{
import std.typecons : Yes;
import std.numeric : dotProduct;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota, zip, universal;
import mir.math.common : optmath;
static @optmath T fmuladd(T, Z)(const T a, Z z)
{
return a + z.a * z.b;
}
// 0 1 2
// 3 4 5
auto sl1 = iota(2, 3).as!double.slice.universal;
// 1 2 3
// 4 5 6
auto sl2 = iota([2, 3], 1).as!double.slice;
// slices must have the same strides for `zip!true`.
assert(sl1.strides == sl2.strides);
auto z = zip!true(sl1, sl2);
auto dot = reduce!fmuladd(0.0, z);
assert(dot == dotProduct(iota(6), iota([6], 1)));
}
/// Tensor mutation on-the-fly
version(mir_test)
unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
import mir.math.common : optmath;
static @optmath T fun(T)(const T a, ref T b)
{
return a + b++;
}
//| 0 1 2 |
//| 3 4 5 |
auto sl = iota(2, 3).as!double.slice;
auto res = reduce!fun(double(0), sl);
assert(res == 15);
//| 1 2 3 |
//| 4 5 6 |
assert(sl == iota([2, 3], 1));
}
/++
Packed slices.
Computes minimum value of maximum values for each row.
+/
version(mir_test)
unittest
{
import mir.math.common;
import mir.ndslice.allocation : slice;
import mir.ndslice.dynamic : transposed;
import mir.ndslice.topology : as, iota, pack, map, universal;
alias maxVal = (a) => reduce!fmax(-double.infinity, a);
alias minVal = (a) => reduce!fmin(double.infinity, a);
alias minimaxVal = (a) => minVal(a.pack!1.map!maxVal);
auto sl = iota(2, 3).as!double.slice;
// Vectorized computation: row stride equals 1.
//| 0 1 2 | => | 2 |
//| 3 4 5 | => | 5 | => 2
auto res = minimaxVal(sl);
assert(res == 2);
// Common computation: row stride does not equal 1.
//| 0 1 2 | | 0 3 | => | 3 |
//| 3 4 5 | => | 1 4 | => | 4 |
// | 2 5 | => | 5 | => 3
auto resT = minimaxVal(sl.universal.transposed);
assert(resT == 3);
}
/// Dlang Range API support.
version(mir_test)
unittest
{
import mir.algorithm.iteration: each;
import std.range: phobos_iota = iota;
int s;
// 0 1 2 3
4.phobos_iota.each!(i => s += i);
assert(s == 6);
}
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
auto a = reduce!"a + b"(size_t(7), iota([0, 1], 1));
assert(a == 7);
}
void eachImpl(alias fun, Slices...)(Slices slices)
{
foreach(ref slice; slices)
assert(!slice.empty);
do
{
static if (DimensionCount!(Slices[0]) == 1)
mixin(`fun(`~ frontOf!(Slices.length) ~ `);`);
else
.eachImpl!fun(frontOf2!slices);
foreach_reverse(i; Iota!(Slices.length))
slices[i].popFront;
}
while(!slices[0].empty);
}
void chequerEachImpl(alias fun, Slices...)(Chequer color, Slices slices)
{
foreach(ref slice; slices)
assert(!slice.empty);
static if (DimensionCount!(Slices[0]) == 1)
{
if (color)
{
foreach_reverse(i; Iota!(Slices.length))
slices[i].popFront;
if (slices[0].empty)
return;
}
eachImpl!fun(strideOf!slices);
}
else
{
do
{
mixin(`.chequerEachImpl!fun(color,` ~ frontOf!(Slices.length) ~ `);`);
color = cast(Chequer)!color;
foreach_reverse(i; Iota!(Slices.length))
slices[i].popFront;
}
while(!slices[0].empty);
}
}
/++
The call `each!(fun)(slice1, ..., sliceN)`
evaluates `fun` for each set of elements `x1, ..., xN` in
the borders of `slice1, ..., sliceN` respectively.
`each` allows to iterate multiple slices in the lockstep.
Params:
fun = A function.
Note:
$(NDSLICEREF dynamic, transposed) and
$(NDSLICEREF topology, pack) can be used to specify dimensions.
+/
template eachOnBorder(alias fun)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
/++
Params:
slices = One or more slices.
+/
@optmath void eachOnBorder(Slices...)(Slices slices)
if (allSatisfy!(isSlice, Slices))
{
import mir.ndslice.traits: isContiguousSlice;
static if (Slices.length > 1)
slices.checkShapesMatch;
if (!slices[0].anyEmpty)
{
alias N = DimensionCount!(Slices[0]);
static if (N == 1)
{
mixin(`fun(`~ frontOf!(Slices.length) ~ `);`);
if (slices[0].length > 1)
fun(backOf!slices);
}
else
static if (anySatisfy!(isContiguousSlice, Slices))
{
import mir.ndslice.topology: canonical;
template f(size_t i)
{
static if (isContiguousSlice!(Slices[i]))
auto f () { return canonical(slices[i]); }
else
alias f = slices[i];
}
eachOnBorder(staticMap!(f, Iota!(Slices.length)));
}
else
{
foreach (dimension; Iota!N)
{
eachImpl!fun(frontOfD!(dimension, slices));
foreach_reverse(ref slice; slices)
slice.popFront!dimension;
if (slices[0].empty!dimension)
return;
eachImpl!fun(backOfD!(dimension, slices));
foreach_reverse(ref slice; slices)
slice.popBack!dimension;
if (slices[0].empty!dimension)
return;
}
}
}
}
else
alias eachOnBorder = .eachOnBorder!(naryFun!fun);
}
///
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : repeat, iota;
auto sl = [3, 4].iota.slice;
auto zeros = repeat(0, [3, 4]);
sl.eachOnBorder!"a = b"(zeros);
assert(sl ==
[[0, 0, 0 ,0],
[0, 5, 6, 0],
[0, 0, 0 ,0]]);
sl.eachOnBorder!"a = 1";
sl[0].eachOnBorder!"a = 2";
assert(sl ==
[[2, 1, 1, 2],
[1, 5, 6, 1],
[1, 1, 1 ,1]]);
}
/++
The call `each!(fun)(slice1, ..., sliceN)`
evaluates `fun` for each set of elements `x1, ..., xN` in
`slice1, ..., sliceN` respectively.
`each` allows to iterate multiple slices in the lockstep.
Params:
fun = A function.
Note:
$(NDSLICEREF dynamic, transposed) and
$(NDSLICEREF topology, pack) can be used to specify dimensions.
See_Also:
This is functionally similar to $(LREF reduce) but has not seed.
+/
template each(alias fun)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
{
/++
Params:
slices = One or more slices, ranges, and arrays.
+/
@optmath auto each(Slices...)(Slices slices)
if (Slices.length && !is(Slices[0] : Chequer))
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
.each!fun(allFlattened!(allLightScope!slices));
}
else
{
if (slices[0].anyEmpty)
return;
eachImpl!fun(allLightScope!slices);
}
}
/++
Iterates elements of selected $(LREF Chequer) color.
Params:
color = $(LREF Chequer).
slices = One or more slices.
+/
@optmath auto each(Slices...)(Chequer color, Slices slices)
if (Slices.length && allSatisfy!(isSlice, Slices))
{
static if (Slices.length > 1)
slices.checkShapesMatch;
if (slices[0].anyEmpty)
return;
chequerEachImpl!fun(color, allLightScope!slices);
}
}
else
alias each = .each!(naryFun!fun);
}
/// Ranges and arrays
version(mir_test)
unittest
{
auto ar = [1, 2, 3];
ar.each!"a *= 2";
assert (ar == [2, 4, 6]);
}
/// Single slice, multiply-add
version(mir_test)
unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
//| 0 1 2 |
//| 3 4 5 |
auto sl = iota(2, 3).as!double.slice;
sl.each!((ref a) { a = a * 10 + 5; });
assert(sl ==
[[ 5, 15, 25],
[35, 45, 55]]);
}
/// Swap two slices
version(mir_test)
unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
//| 0 1 2 |
//| 3 4 5 |
auto a = iota([2, 3], 0).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
auto b = iota([2, 3], 10).as!double.slice;
each!swap(a, b);
assert(a == iota([2, 3], 10));
assert(b == iota([2, 3], 0));
}
/// Swap two zipped slices
version(mir_test)
unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, zip, iota;
//| 0 1 2 |
//| 3 4 5 |
auto a = iota([2, 3], 0).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
auto b = iota([2, 3], 10).as!double.slice;
auto z = zip(a, b);
z.each!(z => swap(z.a, z.b));
assert(a == iota([2, 3], 10));
assert(b == iota([2, 3], 0));
}
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
size_t i;
iota(0, 2).each!((a){i++;});
assert(i == 0);
}
/++
The call `eachUploPair!(fun)(matrix)`
evaluates `fun` for each pair (`matrix[j, i]`, `matrix[i, j]`),
for i <= j (default) or i < j (if includeDiagonal is false).
Params:
fun = A function.
includeDiagonal = true if applying function to diagonal,
false (default) otherwise.
+/
template eachUploPair(alias fun, bool includeDiagonal = false)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
{
/++
Params:
matrix = Square matrix.
+/
auto eachUploPair(Iterator, SliceKind kind)(Slice!(Iterator, 2, kind) matrix)
in
{
assert(matrix.length!0 == matrix.length!1, "matrix must be square.");
}
do
{
static if (kind == Contiguous)
{
import mir.ndslice.topology: canonical;
.eachUploPair!(fun, includeDiagonal)(matrix.canonical);
}
else
{
static if (includeDiagonal == true)
{
if (matrix.length) do
{
eachImpl!fun(matrix.lightScope.front!0, matrix.lightScope.front!1);
matrix.popFront!1;
matrix.popFront!0;
// hint for optimizer
matrix._lengths[1] = matrix._lengths[0];
}
while (matrix.length);
}
else
{
if (matrix.length) for(;;)
{
assert(!matrix.empty!0);
assert(!matrix.empty!1);
auto l = matrix.lightScope.front!1;
auto u = matrix.lightScope.front!0;
matrix.popFront!1;
matrix.popFront!0;
l.popFront;
u.popFront;
// hint for optimizer
matrix._lengths[1] = matrix._lengths[0] = l._lengths[0] = u._lengths[0];
if (u.length == 0)
break;
eachImpl!fun(u, l);
}
}
}
}
}
else
{
alias eachUploPair = .eachUploPair!(naryFun!fun, includeDiagonal);
}
}
/// Transpose matrix in place.
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota, universal;
import mir.ndslice.dynamic: transposed;
import mir.utility: swap;
auto m = iota(4, 4).slice;
m.eachUploPair!swap;
assert(m == iota(4, 4).universal.transposed);
}
/// Reflect Upper matrix part to lower part.
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota, universal;
import mir.ndslice.dynamic: transposed;
import mir.utility: swap;
// 0 1 2
// 3 4 5
// 6 7 8
auto m = iota(3, 3).slice;
m.eachUploPair!((u, ref l) { l = u; });
assert(m == [
[0, 1, 2],
[1, 4, 5],
[2, 5, 8]]);
}
/// Fill lower triangle and diagonal with zeroes.
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
// 1 2 3
// 4 5 6
// 7 8 9
auto m = iota([3, 3], 1).slice;
m.eachUploPair!((u, ref l) { l = 0; }, true);
assert(m == [
[0, 2, 3],
[0, 0, 6],
[0, 0, 0]]);
}
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
// 0 1 2
// 3 4 5
// 6 7 8
auto m = iota(3, 3).slice;
m.eachUploPair!((u, ref l) { l = l + 1; }, true);
assert(m == [
[1, 1, 2],
[4, 5, 5],
[7, 8, 9]]);
}
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
// 0 1 2
// 3 4 5
// 6 7 8
auto m = iota(3, 3).slice;
m.eachUploPair!((u, ref l) { l = l + 1; }, false);
assert(m == [
[0, 1, 2],
[4, 4, 5],
[7, 8, 8]]);
}
/++
Checks if the matrix is symmetric.
+/
template isSymmetric(alias fun = "a == b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
/++
Params:
matrix = 2D ndslice.
+/
bool isSymmetric(Iterator, SliceKind kind)(Slice!(Iterator, 2, kind) matrix)
{
static if (kind == Contiguous)
{
import mir.ndslice.topology: canonical;
return .isSymmetric!fun(matrix.canonical);
}
else
{
if (matrix.length!0 != matrix.length!1)
return false;
if (matrix.length) do
{
if (!allImpl!fun(matrix.lightScope.front!0, matrix.lightScope.front!1))
{
return false;
}
matrix.popFront!1;
matrix.popFront!0;
matrix._lengths[1] = matrix._lengths[0];
}
while (matrix.length);
return true;
}
}
else
alias isSymmetric = .isSymmetric!(naryFun!fun);
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
import mir.ndslice.topology: iota;
assert(iota(2, 2).isSymmetric == false);
assert(
[1, 2,
2, 3].sliced(2, 2).isSymmetric == true);
}
bool minPosImpl(alias fun, Iterator, size_t N, SliceKind kind)(scope ref size_t[N] backwardIndex, scope ref Iterator iterator, Slice!(Iterator, N, kind) slice)
{
bool found;
do
{
static if (slice.shape.length == 1)
{
if (fun(*slice._iterator, *iterator))
{
backwardIndex[0] = slice.length;
iterator = slice._iterator;
found = true;
}
}
else
{
if (minPosImpl!(fun, LightScopeOf!Iterator, N - 1, kind)(backwardIndex[1 .. $], iterator, lightScope(slice).front))
{
backwardIndex[0] = slice.length;
found = true;
}
}
slice.popFront;
}
while(!slice.empty);
return found;
}
bool[2] minmaxPosImpl(alias fun, Iterator, size_t N, SliceKind kind)(scope ref size_t[2][N] backwardIndex, scope ref Iterator[2] iterator, Slice!(Iterator, N, kind) slice)
{
bool[2] found;
do
{
static if (slice.shape.length == 1)
{
if (fun(*slice._iterator, *iterator[0]))
{
backwardIndex[0][0] = slice.length;
iterator[0] = slice._iterator;
found[0] = true;
}
else
if (fun(*iterator[1], *slice._iterator))
{
backwardIndex[0][1] = slice.length;
iterator[1] = slice._iterator;
found[1] = true;
}
}
else
{
auto r = minmaxPosImpl!(fun, LightScopeOf!Iterator, N - 1, kind)(backwardIndex[1 .. $], iterator, lightScope(slice).front);
if (r[0])
{
backwardIndex[0][0] = slice.length;
}
if (r[1])
{
backwardIndex[0][1] = slice.length;
}
}
slice.popFront;
}
while(!slice.empty);
return found;
}
/++
Finds a positions (ndslices) such that
`position[0].first` is minimal and `position[1].first` is maximal elements in the slice.
Position is sub-ndslice of the same dimension in the right-$(RPAREN)down-$(RPAREN)etc$(LPAREN)$(LPAREN) corner.
Params:
pred = A predicate.
See_also:
$(LREF minmaxIndex),
$(LREF minPos),
$(LREF maxPos),
$(NDSLICEREF slice, Slice.backward).
+/
template minmaxPos(alias pred = "a < b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slice = ndslice.
Returns:
2 subslices with minimal and maximal `first` elements.
+/
@optmath Slice!(Iterator, N, kind == Contiguous && N > 1 ? Canonical : kind)[2]
minmaxPos(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
typeof(return) pret;
if (!slice.anyEmpty)
{
size_t[2][N] ret;
auto scopeSlice = lightScope(slice);
auto it = scopeSlice._iterator;
LightScopeOf!Iterator[2] iterator = [it, it];
minmaxPosImpl!(pred, LightScopeOf!Iterator, N, kind)(ret, iterator, scopeSlice);
foreach (i; Iota!N)
{
pret[0]._lengths[i] = ret[i][0];
pret[1]._lengths[i] = ret[i][1];
}
pret[0]._iterator = slice._iterator + (iterator[0] - scopeSlice._iterator);
pret[1]._iterator = slice._iterator + (iterator[1] - scopeSlice._iterator);
}
auto strides = slice.strides;
foreach(i; Iota!(0, pret[0].S))
{
pret[0]._strides[i] = strides[i];
pret[1]._strides[i] = strides[i];
}
return pret;
}
else
alias minmaxPos = .minmaxPos!(naryFun!pred);
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
2, 6, 4, -3,
0, -4, -3, 3,
-3, -2, 7, 2,
].sliced(3, 4);
auto pos = s.minmaxPos;
assert(pos[0] == s[$ - 2 .. $, $ - 3 .. $]);
assert(pos[1] == s[$ - 1 .. $, $ - 2 .. $]);
assert(pos[0].first == -4);
assert(s.backward(pos[0].shape) == -4);
assert(pos[1].first == 7);
assert(s.backward(pos[1].shape) == 7);
}
/++
Finds a backward indices such that
`slice[indices[0]]` is minimal and `slice[indices[1]]` is maximal elements in the slice.
Params:
pred = A predicate.
See_also:
$(LREF minmaxIndex),
$(LREF minPos),
$(LREF maxPos),
$(REF Slice.backward, mir,ndslice,slice).
+/
template minmaxIndex(alias pred = "a < b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slice = ndslice.
Returns:
Subslice with minimal (maximal) `first` element.
+/
@optmath size_t[N][2] minmaxIndex(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
typeof(return) pret = size_t.max;
if (!slice.anyEmpty)
{
auto shape = slice.shape;
size_t[2][N] ret;
foreach (i; Iota!N)
{
ret[i][1] = ret[i][0] = shape[i];
}
auto scopeSlice = lightScope(slice);
auto it = scopeSlice._iterator;
LightScopeOf!Iterator[2] iterator = [it, it];
minmaxPosImpl!(pred, LightScopeOf!Iterator, N, kind)(ret, iterator, scopeSlice);
foreach (i; Iota!N)
{
pret[0][i] = slice._lengths[i] - ret[i][0];
pret[1][i] = slice._lengths[i] - ret[i][1];
}
}
return pret;
}
else
alias minmaxIndex = .minmaxIndex!(naryFun!pred);
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
2, 6, 4, -3,
0, -4, -3, 3,
-3, -2, 7, 8,
].sliced(3, 4);
auto indices = s.minmaxIndex;
assert(indices == [[1, 1], [2, 3]]);
assert(s[indices[0]] == -4);
assert(s[indices[1]] == 8);
}
/++
Finds a backward index such that
`slice.backward(index)` is minimal(maximal).
Params:
pred = A predicate.
See_also:
$(LREF minIndex),
$(LREF maxPos),
$(LREF maxIndex),
$(REF Slice.backward, mir,ndslice,slice).
+/
template minPos(alias pred = "a < b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slice = ndslice.
Returns:
Multidimensional backward index such that element is minimal(maximal).
Backward index equals zeros, if slice is empty.
+/
@optmath Slice!(Iterator, N, kind == Contiguous && N > 1 ? Canonical : kind)
minPos(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
typeof(return) ret;
auto iterator = slice.lightScope._iterator;
if (!slice.anyEmpty)
{
minPosImpl!(pred, LightScopeOf!Iterator, N, kind)(ret._lengths, iterator, lightScope(slice));
ret._iterator = slice._iterator + (iterator - slice.lightScope._iterator);
}
auto strides = slice.strides;
foreach(i; Iota!(0, ret.S))
{
ret._strides[i] = strides[i];
}
return ret;
}
else
alias minPos = .minPos!(naryFun!pred);
}
/// ditto
template maxPos(alias pred = "a < b")
{
import mir.functional: naryFun, reverseArgs;
alias maxPos = minPos!(reverseArgs!(naryFun!pred));
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
2, 6, 4, -3,
0, -4, -3, 3,
-3, -2, 7, 2,
].sliced(3, 4);
auto pos = s.minPos;
assert(pos == s[$ - 2 .. $, $ - 3 .. $]);
assert(pos.first == -4);
assert(s.backward(pos.shape) == -4);
pos = s.maxPos;
assert(pos == s[$ - 1 .. $, $ - 2 .. $]);
assert(pos.first == 7);
assert(s.backward(pos.shape) == 7);
}
/++
Finds an index such that
`slice[index]` is minimal(maximal).
Params:
pred = A predicate.
See_also:
$(LREF minIndex),
$(LREF maxPos),
$(LREF maxIndex).
+/
template minIndex(alias pred = "a < b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slice = ndslice.
Returns:
Multidimensional index such that element is minimal(maximal).
Index elements equal to `size_t.max`, if slice is empty.
+/
@optmath size_t[N] minIndex(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
size_t[N] ret = size_t.max;
if (!slice.anyEmpty)
{
ret = slice.shape;
auto scopeSlice = lightScope(slice);
auto iterator = scopeSlice._iterator;
minPosImpl!(pred, LightScopeOf!Iterator, N, kind)(ret, iterator, scopeSlice);
foreach (i; Iota!N)
ret[i] = slice._lengths[i] - ret[i];
}
return ret;
}
else
alias minIndex = .minIndex!(naryFun!pred);
}
/// ditto
template maxIndex(alias pred = "a < b")
{
import mir.functional: naryFun, reverseArgs;
alias maxIndex = minIndex!(reverseArgs!(naryFun!pred));
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
2, 6, 4, -3,
0, -4, -3, 3,
-3, -2, 7, 8,
].sliced(3, 4);
auto index = s.minIndex;
assert(index == [1, 1]);
assert(s[index] == -4);
index = s.maxIndex;
assert(index == [2, 3]);
assert(s[index] == 8);
}
///
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
-8, 6, 4, -3,
0, -4, -3, 3,
-3, -2, 7, 8,
].sliced(3, 4);
auto index = s.minIndex;
assert(index == [0, 0]);
assert(s[index] == -8);
}
version(mir_test)
unittest
{
import mir.ndslice.slice: sliced;
auto s = [
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11
].sliced(3, 4);
auto index = s.minIndex;
assert(index == [0, 0]);
assert(s[index] == 0);
index = s.maxIndex;
assert(index == [2, 3]);
assert(s[index] == 11);
}
bool findImpl(alias fun, size_t N, Slices...)(scope ref size_t[N] backwardIndex, Slices slices)
if (Slices.length)
{
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(FieldIterator!(BitField!(Field, I))), Field, I))
{
auto cnt = BitSliceAccelerator!(Field, I)(slices[0]).cttz;
if (cnt = -1)
return false;
backwardIndex[0] = slices[0].length - cnt;
}
else
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))), Field, I))
{
import mir.ndslice.topology: retro;
auto cnt = BitSliceAccelerator!(Field, I)(slices[0].retro).ctlz;
if (cnt = -1)
return false;
backwardIndex[0] = slices[0].length - cnt;
}
else
{
do
{
static if (DimensionCount!(Slices[0]) == 1)
{
if (mixin(`fun(`~ frontOf!(Slices.length) ~ `)`))
{
backwardIndex[0] = slices[0].length;
return true;
}
}
else
{
if (mixin(`findImpl!fun(backwardIndex[1 .. $],` ~ frontOf!(Slices.length) ~ `)`))
{
backwardIndex[0] = slices[0].length;
return true;
}
}
foreach_reverse(ref slice; slices)
slice.popFront;
}
while(!slices[0].empty);
return false;
}
}
/++
Finds an index such that
`pred(slices[0][index], ..., slices[$-1][index])` is `true`.
Params:
pred = A predicate.
See_also:
$(LREF find),
$(LREF any).
Optimization:
`findIndex!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
+/
template findIndex(alias pred)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slices = One or more slices.
Returns:
Multidimensional index such that the predicate is true.
Index equals `size_t.max`, if the predicate evaluates `false` for all indices.
Constraints:
All slices must have the same shape.
+/
@optmath Select!(DimensionCount!(Slices[0]) > 1, size_t[DimensionCount!(Slices[0])], size_t) findIndex(Slices...)(Slices slices)
if (Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
size_t[DimensionCount!(Slices[0])] ret = -1;
auto lengths = slices[0].shape;
if (!slices[0].anyEmpty && findImpl!pred(ret, allLightScope!slices))
foreach (i; Iota!(DimensionCount!(Slices[0])))
ret[i] = lengths[i] - ret[i];
static if (DimensionCount!(Slices[0]) > 1)
return ret;
else
return ret[0];
}
else
alias findIndex = .findIndex!(naryFun!pred);
}
/// Ranges and arrays
version(mir_test)
unittest
{
import std.range : iota;
// 0 1 2 3 4 5
auto sl = iota(5);
size_t index = sl.findIndex!"a == 3";
assert(index == 3);
assert(sl[index] == 3);
assert(sl.findIndex!(a => a == 8) == size_t.max);
}
///
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
size_t[2] index = sl.findIndex!(a => a == 3);
assert(sl[index] == 3);
index = sl.findIndex!"a == 6";
assert(index[0] == size_t.max);
assert(index[1] == size_t.max);
}
/++
Finds a backward index such that
`pred(slices[0].backward(index), ..., slices[$-1].backward(index))` is `true`.
Params:
pred = A predicate.
Optimization:
To check if any element was found
use the last dimension (row index).
This will slightly optimize the code.
--------
if (backwardIndex)
{
auto elem1 = slice1.backward(backwardIndex);
//...
auto elemK = sliceK.backward(backwardIndex);
}
else
{
// not found
}
--------
See_also:
$(LREF findIndex),
$(LREF any),
$(REF Slice.backward, mir,ndslice,slice).
Optimization:
`find!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
+/
template find(alias pred)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slices = One or more slices.
Returns:
Multidimensional backward index such that the predicate is true.
Backward index equals zeros, if the predicate evaluates `false` for all indices.
Constraints:
All slices must have the same shape.
+/
@optmath Select!(DimensionCount!(Slices[0]) > 1, size_t[DimensionCount!(Slices[0])], size_t) find(Slices...)(Slices slices)
if (Slices.length && allSatisfy!(hasShape, Slices))
{
static if (Slices.length > 1)
slices.checkShapesMatch;
size_t[DimensionCount!(Slices[0])] ret;
if (!slices[0].anyEmpty)
findImpl!pred(ret, allLightScope!slices);
static if (DimensionCount!(Slices[0]) > 1)
return ret;
else
return ret[0];
}
else
alias find = .find!(naryFun!pred);
}
/// Ranges and arrays
version(mir_test)
unittest
{
import std.range : iota;
auto sl = iota(10);
size_t index = sl.find!"a == 3";
assert(sl[$ - index] == 3);
}
///
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
size_t[2] bi = sl.find!"a == 3";
assert(sl.backward(bi) == 3);
assert(sl[$ - bi[0], $ - bi[1]] == 3);
bi = sl.find!"a == 6";
assert(bi[0] == 0);
assert(bi[1] == 0);
}
/// Multiple slices
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto a = iota(2, 3);
// 10 11 12
// 13 14 15
auto b = iota([2, 3], 10);
size_t[2] bi = find!((a, b) => a * b == 39)(a, b);
assert(a.backward(bi) == 3);
assert(b.backward(bi) == 13);
}
/// Zipped slices
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota, zip;
// 0 1 2
// 3 4 5
auto a = iota(2, 3);
// 10 11 12
// 13 14 15
auto b = iota([2, 3], 10);
size_t[2] bi = zip!true(a, b).find!"a.a * a.b == 39";
assert(a.backward(bi) == 3);
assert(b.backward(bi) == 13);
}
/// Mutation on-the-fly
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3).as!double.slice;
static bool pred(T)(ref T a)
{
if (a == 5)
return true;
a = 8;
return false;
}
size_t[2] bi = sl.find!pred;
assert(bi == [1, 1]);
assert(sl.backward(bi) == 5);
import mir.test;
// sl was changed
sl.should == [[8, 8, 8],
[8, 8, 5]];
}
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
size_t i;
size_t[2] bi = iota(2, 0).find!((elem){i++; return true;});
assert(i == 0);
assert(bi == [0, 0]);
}
size_t anyImpl(alias fun, Slices...)(Slices slices)
if (Slices.length)
{
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(FieldIterator!(BitField!(Field, I))), Field, I))
{
return BitSliceAccelerator!(Field, I)(slices[0]).any;
}
else
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))), Field, I))
{
// pragma(msg, S);
import mir.ndslice.topology: retro;
return .anyImpl!fun(lightScope(slices[0]).retro);
}
else
{
do
{
static if (DimensionCount!(Slices[0]) == 1)
{
if (mixin(`fun(`~ frontOf!(Slices.length) ~ `)`))
return true;
}
else
{
if (anyImpl!fun(frontOf2!slices))
return true;
}
foreach_reverse(ref slice; slices)
slice.popFront;
}
while(!slices[0].empty);
return false;
}
}
/++
Like $(LREF find), but only returns whether or not the search was successful.
Params:
pred = The predicate.
Optimization:
`any!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
+/
template any(alias pred = "a")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slices = One or more slices, ranges, and arrays.
Returns:
`true` if the search was successful and `false` otherwise.
Constraints:
All slices must have the same shape.
+/
@optmath bool any(Slices...)(Slices slices)
if ((Slices.length == 1 || !__traits(isSame, pred, "a")) && Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
return .any!pred(allFlattened!(allLightScope!slices));
}
else
{
return !slices[0].anyEmpty && anyImpl!pred(allLightScope!slices);
}
}
else
alias any = .any!(naryFun!pred);
}
/// Ranges and arrays
@safe pure nothrow @nogc
version(mir_test) unittest
{
import std.range : iota;
// 0 1 2 3 4 5
auto r = iota(6);
assert(r.any!"a == 3");
assert(!r.any!"a == 6");
}
///
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
assert(sl.any!"a == 3");
assert(!sl.any!"a == 6");
}
/// Multiple slices
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto a = iota(2, 3);
// 10 11 12
// 13 14 15
auto b = iota([2, 3], 10);
assert(any!((a, b) => a * b == 39)(a, b));
}
/// Zipped slices
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota, zip;
// 0 1 2
// 3 4 5
auto a = iota(2, 3);
// 10 11 12
// 13 14 15
auto b = iota([2, 3], 10);
// slices must have the same strides
assert(zip!true(a, b).any!"a.a * a.b == 39");
}
/// Mutation on-the-fly
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3).as!double.slice;
static bool pred(T)(ref T a)
{
if (a == 5)
return true;
a = 8;
return false;
}
assert(sl.any!pred);
// sl was changed
assert(sl == [[8, 8, 8],
[8, 8, 5]]);
}
size_t allImpl(alias fun, Slices...)(Slices slices)
if (Slices.length)
{
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(FieldIterator!(BitField!(Field, I))), Field, I))
{
return BitSliceAccelerator!(LightScopeOf!Field, I)(lightScope(slices[0])).all;
}
else
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))), Field, I))
{
// pragma(msg, S);
import mir.ndslice.topology: retro;
return .allImpl!fun(lightScope(slices[0]).retro);
}
else
{
do
{
static if (DimensionCount!(Slices[0]) == 1)
{
if (!mixin(`fun(`~ frontOf!(Slices.length) ~ `)`))
return false;
}
else
{
if (!allImpl!fun(frontOf2!slices))
return false;
}
foreach_reverse(ref slice; slices)
slice.popFront;
}
while(!slices[0].empty);
return true;
}
}
/++
Checks if all of the elements verify `pred`.
Params:
pred = The predicate.
Optimization:
`all!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
+/
template all(alias pred = "a")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
slices = One or more slices.
Returns:
`true` all of the elements verify `pred` and `false` otherwise.
Constraints:
All slices must have the same shape.
+/
@optmath bool all(Slices...)(Slices slices)
if ((Slices.length == 1 || !__traits(isSame, pred, "a")) && Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
return .all!pred(allFlattened!(allLightScope!slices));
}
else
{
return slices[0].anyEmpty || allImpl!pred(allLightScope!slices);
}
}
else
alias all = .all!(naryFun!pred);
}
/// Ranges and arrays
@safe pure nothrow @nogc
version(mir_test) unittest
{
import std.range : iota;
// 0 1 2 3 4 5
auto r = iota(6);
assert(r.all!"a < 6");
assert(!r.all!"a < 5");
}
///
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
assert(sl.all!"a < 6");
assert(!sl.all!"a < 5");
}
/// Multiple slices
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
assert(all!"a - b == 0"(sl, sl));
}
/// Zipped slices
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota, zip;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3);
assert(zip!true(sl, sl).all!"a.a - a.b == 0");
}
/// Mutation on-the-fly
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
// 0 1 2
// 3 4 5
auto sl = iota(2, 3).as!double.slice;
static bool pred(T)(ref T a)
{
if (a < 4)
{
a = 8;
return true;
}
return false;
}
assert(!sl.all!pred);
// sl was changed
assert(sl == [[8, 8, 8],
[8, 4, 5]]);
}
@safe pure nothrow
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
size_t i;
assert(iota(2, 0).all!((elem){i++; return true;}));
assert(i == 0);
}
/++
Counts elements in slices according to the `fun`.
Params:
fun = A predicate.
Optimization:
`count!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation).
+/
template count(alias fun)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
/++
Params:
slices = One or more slices, ranges, and arrays.
Returns: The number elements according to the `fun`.
Constraints:
All slices must have the same shape.
+/
@optmath size_t count(Slices...)(Slices slices)
if (Slices.length)
{
static if (Slices.length > 1)
slices.checkShapesMatch;
static if (__traits(isSame, fun, naryFun!"true"))
{
return slices[0].elementCount;
}
else
static if (areAllContiguousSlices!Slices)
{
import mir.ndslice.topology: flattened;
return .count!fun(allFlattened!(allLightScope!slices));
}
else
{
if (slices[0].anyEmpty)
return 0;
return countImpl!(fun)(allLightScope!slices);
}
}
else
alias count = .count!(naryFun!fun);
}
/// Ranges and arrays
@safe pure nothrow @nogc
version(mir_test) unittest
{
import std.range : iota;
// 0 1 2 3 4 5
auto r = iota(6);
assert(r.count!"true" == 6);
assert(r.count!"a" == 5);
assert(r.count!"a % 2" == 3);
}
/// Single slice
version(mir_test)
unittest
{
import mir.ndslice.topology : iota;
//| 0 1 2 |
//| 3 4 5 |
auto sl = iota(2, 3);
assert(sl.count!"true" == 6);
assert(sl.count!"a" == 5);
assert(sl.count!"a % 2" == 3);
}
/// Accelerated set bit count
version(mir_test)
unittest
{
import mir.ndslice.topology: retro, iota, bitwise;
import mir.ndslice.allocation: slice;
//| 0 1 2 |
//| 3 4 5 |
auto sl = iota!size_t(2, 3).bitwise;
assert(sl.count!"true" == 6 * size_t.sizeof * 8);
assert(sl.slice.count!"a" == 7);
// accelerated
assert(sl.count!"a" == 7);
assert(sl.retro.count!"a" == 7);
auto sl2 = iota!ubyte([6], 128).bitwise;
// accelerated
assert(sl2.count!"a" == 13);
assert(sl2[4 .. $].count!"a" == 13);
assert(sl2[4 .. $ - 1].count!"a" == 12);
assert(sl2[4 .. $ - 1].count!"a" == 12);
assert(sl2[41 .. $ - 1].count!"a" == 1);
}
version(mir_test)
unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: bitwise, assumeFieldsHaveZeroShift;
auto sl = slice!uint([6]).bitwise;
auto slb = slice!ubyte([6]).bitwise;
slb[4] = true;
auto d = slb[4];
auto c = assumeFieldsHaveZeroShift(slb & ~slb);
// pragma(msg, typeof(c));
assert(!sl.any);
assert((~sl).all);
// pragma(msg, typeof(~slb));
// pragma(msg, typeof(~slb));
// assert(sl.findIndex);
}
/++
Compares two or more slices for equality, as defined by predicate `pred`.
See_also: $(NDSLICEREF slice, Slice.opEquals)
Params:
pred = The predicate.
+/
template equal(alias pred = "a == b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
{
/++
Params:
slices = Two or more ndslices, ranges, and arrays.
Returns:
`true` any of the elements verify `pred` and `false` otherwise.
+/
bool equal(Slices...)(Slices slices)
if (Slices.length >= 2)
{
import mir.internal.utility;
static if (allSatisfy!(hasShape, Slices))
{
auto shape0 = slices[0].shape;
enum N = DimensionCount!(Slices[0]);
foreach (ref slice; slices[1 .. $])
{
if (slice.shape != shape0)
goto False;
}
return all!pred(allLightScope!slices);
}
else
{
for(;;)
{
auto empty = slices[0].empty;
foreach (ref slice; slices[1 .. $])
{
if (slice.empty != empty)
goto False;
}
if (empty)
return true;
if (!mixin(`pred(`~ frontOf!(Slices.length) ~ `)`))
goto False;
foreach (ref slice; slices)
slice.popFront;
}
}
False: return false;
}
}
else
alias equal = .equal!(naryFun!pred);
}
/// Ranges and arrays
@safe pure nothrow
version(mir_test) unittest
{
import std.range : iota;
auto r = iota(6);
assert(r.equal([0, 1, 2, 3, 4, 5]));
}
///
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl1 = iota(2, 3);
// 1 2 3
// 4 5 6
auto sl2 = iota([2, 3], 1);
assert(equal(sl1, sl1));
assert(sl1 == sl1); //can also use opEquals for two Slices
assert(equal!"2 * a == b + c"(sl1, sl1, sl1));
assert(equal!"a < b"(sl1, sl2));
assert(!equal(sl1[0 .. $ - 1], sl1));
assert(!equal(sl1[0 .. $, 0 .. $ - 1], sl1));
}
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.math.common: approxEqual;
import mir.ndslice.allocation: rcslice;
import mir.ndslice.topology: as, iota;
auto x = 5.iota.as!double.rcslice;
auto y = x.rcslice;
assert(equal(x, y));
assert(equal!approxEqual(x, y));
}
ptrdiff_t cmpImpl(alias pred, A, B)
(scope A sl1, scope B sl2)
if (DimensionCount!A == DimensionCount!B)
{
for (;;)
{
static if (DimensionCount!A == 1)
{
import mir.functional : naryFun;
if (naryFun!pred(sl1.front, sl2.front))
return -1;
if (naryFun!pred(sl2.front, sl1.front))
return 1;
}
else
{
if (auto res = .cmpImpl!pred(sl1.front, sl2.front))
return res;
}
sl1.popFront;
if (sl1.empty)
return -cast(ptrdiff_t)(sl2.length > 1);
sl2.popFront;
if (sl2.empty)
return 1;
}
}
/++
Performs three-way recursive lexicographical comparison on two slices according to predicate `pred`.
Iterating `sl1` and `sl2` in lockstep, `cmp` compares each `N-1` dimensional element `e1` of `sl1`
with the corresponding element `e2` in `sl2` recursively.
If one of the slices has been finished,`cmp` returns a negative value if `sl1` has fewer elements than `sl2`,
a positive value if `sl1` has more elements than `sl2`,
and `0` if the ranges have the same number of elements.
Params:
pred = The predicate.
+/
template cmp(alias pred = "a < b")
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!pred, pred))
/++
Params:
sl1 = First slice, range, or array.
sl2 = Second slice, range, or array.
Returns:
`0` if both ranges compare equal.
Negative value if the first differing element of `sl1` is less than the corresponding
element of `sl2` according to `pred`.
Positive value if the first differing element of `sl2` is less than the corresponding
element of `sl1` according to `pred`.
+/
auto cmp(A, B)
(scope A sl1, scope B sl2)
if (DimensionCount!A == DimensionCount!B)
{
auto b = sl2.anyEmpty;
if (sl1.anyEmpty)
{
if (!b)
return -1;
auto sh1 = sl1.shape;
auto sh2 = sl2.shape;
foreach (i; Iota!(DimensionCount!A))
if (sh1[i] != sh2[i])
return sh1[i] > sh2[i] ? 1 : -1;
return 0;
}
if (b)
return 1;
return cmpImpl!pred(lightScope(sl1), lightScope(sl2));
}
else
alias cmp = .cmp!(naryFun!pred);
}
/// Ranges and arrays
@safe pure nothrow
version(mir_test) unittest
{
import std.range : iota;
// 0 1 2 3 4 5
auto r1 = iota(0, 6);
// 1 2 3 4 5 6
auto r2 = iota(1, 7);
assert(cmp(r1, r1) == 0);
assert(cmp(r1, r2) < 0);
assert(cmp!"a >= b"(r1, r2) > 0);
}
///
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
// 0 1 2
// 3 4 5
auto sl1 = iota(2, 3);
// 1 2 3
// 4 5 6
auto sl2 = iota([2, 3], 1);
assert(cmp(sl1, sl1) == 0);
assert(cmp(sl1, sl2) < 0);
assert(cmp!"a >= b"(sl1, sl2) > 0);
}
@safe pure nothrow @nogc
version(mir_test) unittest
{
import mir.ndslice.topology : iota;
auto sl1 = iota(2, 3);
auto sl2 = iota([2, 3], 1);
assert(cmp(sl1[0 .. $ - 1], sl1) < 0);
assert(cmp(sl1, sl1[0 .. $, 0 .. $ - 1]) > 0);
assert(cmp(sl1[0 .. $ - 2], sl1) < 0);
assert(cmp(sl1, sl1[0 .. $, 0 .. $ - 3]) > 0);
assert(cmp(sl1[0 .. $, 0 .. $ - 3], sl1[0 .. $, 0 .. $ - 3]) == 0);
assert(cmp(sl1[0 .. $, 0 .. $ - 3], sl1[0 .. $ - 1, 0 .. $ - 3]) > 0);
assert(cmp(sl1[0 .. $ - 1, 0 .. $ - 3], sl1[0 .. $, 0 .. $ - 3]) < 0);
}
size_t countImpl(alias fun, Slices...)(Slices slices)
{
size_t ret;
alias S = Slices[0];
import mir.functional: naryFun;
import mir.ndslice.iterator: FieldIterator, RetroIterator;
import mir.ndslice.field: BitField;
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(FieldIterator!(BitField!(Field, I))), Field, I))
{
ret = BitSliceAccelerator!(Field, I)(slices[0]).ctpop;
}
else
static if (__traits(isSame, fun, naryFun!"a") && is(S : Slice!(RetroIterator!(FieldIterator!(BitField!(Field, I)))), Field, I))
{
// pragma(msg, S);
import mir.ndslice.topology: retro;
ret = .countImpl!fun(lightScope(slices[0]).retro);
}
else
do
{
static if (DimensionCount!(Slices[0]) == 1)
{
if(mixin(`fun(`~ frontOf!(Slices.length) ~ `)`))
ret++;
}
else
ret += .countImpl!fun(frontOf2!slices);
foreach_reverse(ref slice; slices)
slice.popFront;
}
while(!slices[0].empty);
return ret;
}
/++
Returns: max length across all dimensions.
+/
size_t maxLength(S)(auto ref scope S s)
if (hasShape!S)
{
auto shape = s.shape;
size_t length = 0;
foreach(i; Iota!(shape.length))
if (shape[i] > length)
length = shape[i];
return length;
}
/++
The call `eachLower!(fun)(slice1, ..., sliceN)` evaluates `fun` on the lower
triangle in `slice1, ..., sliceN` respectively.
`eachLower` allows iterating multiple slices in the lockstep.
Params:
fun = A function
See_Also:
This is functionally similar to $(LREF each).
+/
template eachLower(alias fun)
{
import mir.functional : naryFun;
static if (__traits(isSame, naryFun!fun, fun))
{
/++
Params:
inputs = One or more two-dimensional slices and an optional
integer, `k`.
The value `k` determines which diagonals will have the function
applied:
For k = 0, the function is also applied to the main diagonal
For k = 1 (default), only the non-main diagonals below the main
diagonal will have the function applied.
For k > 1, fewer diagonals below the main diagonal will have the
function applied.
For k < 0, more diagonals above the main diagonal will have the
function applied.
+/
void eachLower(Inputs...)(scope Inputs inputs)
if (((Inputs.length > 1) &&
(isIntegral!(Inputs[$ - 1]))) ||
(Inputs.length))
{
import mir.ndslice.traits : isMatrix;
size_t val;
static if ((Inputs.length > 1) && (isIntegral!(Inputs[$ - 1])))
{
immutable(sizediff_t) k = inputs[$ - 1];
alias Slices = Inputs[0..($ - 1)];
alias slices = inputs[0..($ - 1)];
}
else
{
enum sizediff_t k = 1;
alias Slices = Inputs;
alias slices = inputs;
}
static assert (allSatisfy!(isMatrix, Slices),
"eachLower: Every slice input must be a two-dimensional slice");
static if (Slices.length > 1)
slices.checkShapesMatch;
if (slices[0].anyEmpty)
return;
foreach(ref slice; slices)
assert(!slice.empty);
immutable(size_t) m = slices[0].length!0;
immutable(size_t) n = slices[0].length!1;
if ((n + k) < m)
{
val = m - (n + k);
.eachImpl!fun(selectBackOf!(val, slices));
}
size_t i;
if (k > 0)
{
foreach(ref slice; slices)
slice.popFrontExactly!0(k);
i = k;
}
do
{
val = i - k + 1;
.eachImpl!fun(frontSelectFrontOf!(val, slices));
foreach(ref slice; slices)
slice.popFront!0;
i++;
} while ((i < (n + k)) && (i < m));
}
}
else
{
alias eachLower = .eachLower!(naryFun!fun);
}
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota, canonical, universal;
alias AliasSeq(T...) = T;
pure nothrow
void test(alias func)()
{
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = func(iota([3, 3], 1).slice);
m.eachLower!"a = 0"(0);
assert(m == [
[0, 2, 3],
[0, 0, 6],
[0, 0, 0]]);
}
@safe pure nothrow @nogc
T identity(T)(T x)
{
return x;
}
alias kinds = AliasSeq!(identity, canonical, universal);
test!(kinds[0]);
test!(kinds[1]);
test!(kinds[2]);
}
///
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachLower!"a = 0";
assert(m == [
[1, 2, 3],
[0, 5, 6],
[0, 0, 9]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachLower!"a = 0"(-1);
assert(m == [
[0, 0, 3],
[0, 0, 0],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachLower!"a = 0"(2);
assert(m == [
[1, 2, 3],
[4, 5, 6],
[0, 8, 9]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachLower!"a = 0"(-2);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachLower!"a = 0"(0);
assert(m == [
[0, 2, 3, 4],
[0, 0, 7, 8],
[0, 0, 0, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachLower!"a = 0";
assert(m == [
[1, 2, 3, 4],
[0, 6, 7, 8],
[0, 0, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachLower!"a = 0"(-1);
assert(m == [
[0, 0, 3, 4],
[0, 0, 0, 8],
[0, 0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachLower!"a = 0"(2);
assert(m == [
[1, 2, 3, 4],
[5, 6, 7, 8],
[0, 10, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachLower!"a = 0"(-2);
assert(m == [
[0, 0, 0, 4],
[0, 0, 0, 0],
[0, 0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachLower!"a = 0"(0);
assert(m == [
[0, 2, 3],
[0, 0, 6],
[0, 0, 0],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachLower!"a = 0";
assert(m == [
[1, 2, 3],
[0, 5, 6],
[0, 0, 9],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachLower!"a = 0"(-1);
assert(m == [
[0, 0, 3],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachLower!"a = 0"(2);
assert(m == [
[1, 2, 3],
[4, 5, 6],
[0, 8, 9],
[0, 0, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachLower!"a = 0"(-2);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]);
}
/// Swap two slices
pure nothrow
version(mir_test) unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
//| 0 1 2 |
//| 3 4 5 |
//| 6 7 8 |
auto a = iota([3, 3]).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
//| 16 17 18 |
auto b = iota([3, 3], 10).as!double.slice;
eachLower!swap(a, b);
assert(a == [
[ 0, 1, 2],
[13, 4, 5],
[16, 17, 8]]);
assert(b == [
[10, 11, 12],
[ 3, 14, 15],
[ 6, 7, 18]]);
}
/// Swap two zipped slices
pure nothrow
version(mir_test) unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, zip, iota;
//| 0 1 2 |
//| 3 4 5 |
//| 6 7 8 |
auto a = iota([3, 3]).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
//| 16 17 18 |
auto b = iota([3, 3], 10).as!double.slice;
auto z = zip(a, b);
z.eachLower!(z => swap(z.a, z.b));
assert(a == [
[ 0, 1, 2],
[13, 4, 5],
[16, 17, 8]]);
assert(b == [
[10, 11, 12],
[ 3, 14, 15],
[ 6, 7, 18]]);
}
/++
The call `eachUpper!(fun)(slice1, ..., sliceN)` evaluates `fun` on the upper
triangle in `slice1, ..., sliceN`, respectively.
`eachUpper` allows iterating multiple slices in the lockstep.
Params:
fun = A function
See_Also:
This is functionally similar to $(LREF each).
+/
template eachUpper(alias fun)
{
import mir.functional: naryFun;
static if (__traits(isSame, naryFun!fun, fun))
{
/++
Params:
inputs = One or more two-dimensional slices and an optional
integer, `k`.
The value `k` determines which diagonals will have the function
applied:
For k = 0, the function is also applied to the main diagonal
For k = 1 (default), only the non-main diagonals above the main
diagonal will have the function applied.
For k > 1, fewer diagonals below the main diagonal will have the
function applied.
For k < 0, more diagonals above the main diagonal will have the
function applied.
+/
void eachUpper(Inputs...)(scope Inputs inputs)
if (((Inputs.length > 1) &&
(isIntegral!(Inputs[$ - 1]))) ||
(Inputs.length))
{
import mir.ndslice.traits : isMatrix;
size_t val;
static if ((Inputs.length > 1) && (isIntegral!(Inputs[$ - 1])))
{
immutable(sizediff_t) k = inputs[$ - 1];
alias Slices = Inputs[0..($ - 1)];
alias slices = inputs[0..($ - 1)];
}
else
{
enum sizediff_t k = 1;
alias Slices = Inputs;
alias slices = inputs;
}
static assert (allSatisfy!(isMatrix, Slices),
"eachUpper: Every slice input must be a two-dimensional slice");
static if (Slices.length > 1)
slices.checkShapesMatch;
if (slices[0].anyEmpty)
return;
foreach(ref slice; slices)
assert(!slice.empty);
immutable(size_t) m = slices[0].length!0;
immutable(size_t) n = slices[0].length!1;
size_t i;
if (k < 0)
{
val = -k;
.eachImpl!fun(selectFrontOf!(val, slices));
foreach(ref slice; slices)
slice.popFrontExactly!0(-k);
i = -k;
}
do
{
val = (n - k) - i;
.eachImpl!fun(frontSelectBackOf!(val, slices));
foreach(ref slice; slices)
slice.popFront;
i++;
} while ((i < (n - k)) && (i < m));
}
}
else
{
alias eachUpper = .eachUpper!(naryFun!fun);
}
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota, canonical, universal;
pure nothrow
void test(alias func)()
{
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = func(iota([3, 3], 1).slice);
m.eachUpper!"a = 0"(0);
assert(m == [
[0, 0, 0],
[4, 0, 0],
[7, 8, 0]]);
}
@safe pure nothrow @nogc
T identity(T)(T x)
{
return x;
}
alias kinds = AliasSeq!(identity, canonical, universal);
test!(kinds[0]);
test!(kinds[1]);
test!(kinds[2]);
}
///
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachUpper!"a = 0";
assert(m == [
[1, 0, 0],
[4, 5, 0],
[7, 8, 9]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachUpper!"a = 0"(-1);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[7, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachUpper!"a = 0"(2);
assert(m == [
[1, 2, 0],
[4, 5, 6],
[7, 8, 9]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
auto m = iota([3, 3], 1).slice;
m.eachUpper!"a = 0"(-2);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachUpper!"a = 0"(0);
assert(m == [
[0, 0, 0, 0],
[5, 0, 0, 0],
[9, 10, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachUpper!"a = 0";
assert(m == [
[1, 0, 0, 0],
[5, 6, 0, 0],
[9, 10, 11, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachUpper!"a = 0"(-1);
assert(m == [
[0, 0, 0, 0],
[0, 0, 0, 0],
[9, 0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachUpper!"a = 0"(2);
assert(m == [
[1, 2, 0, 0],
[5, 6, 7, 0],
[9, 10, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 4 |
//| 5 6 7 8 |
//| 9 10 11 12 |
auto m = iota([3, 4], 1).slice;
m.eachUpper!"a = 0"(-2);
assert(m == [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachUpper!"a = 0"(0);
assert(m == [
[0, 0, 0],
[4, 0, 0],
[7, 8, 0],
[10, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachUpper!"a = 0";
assert(m == [
[1, 0, 0],
[4, 5, 0],
[7, 8, 9],
[10, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachUpper!"a = 0"(-1);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[7, 0, 0],
[10, 11, 0]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachUpper!"a = 0"(2);
assert(m == [
[1, 2, 0],
[4, 5, 6],
[7, 8, 9],
[10, 11, 12]]);
}
pure nothrow
version(mir_test) unittest
{
import mir.ndslice.allocation: slice;
import mir.ndslice.topology: iota;
//| 1 2 3 |
//| 4 5 6 |
//| 7 8 9 |
//| 10 11 12 |
auto m = iota([4, 3], 1).slice;
m.eachUpper!"a = 0"(-2);
assert(m == [
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[10, 0, 0]]);
}
/// Swap two slices
pure nothrow
version(mir_test) unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, iota;
//| 0 1 2 |
//| 3 4 5 |
//| 6 7 8 |
auto a = iota([3, 3]).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
//| 16 17 18 |
auto b = iota([3, 3], 10).as!double.slice;
eachUpper!swap(a, b);
assert(a == [
[0, 11, 12],
[3, 4, 15],
[6, 7, 8]]);
assert(b == [
[10, 1, 2],
[13, 14, 5],
[16, 17, 18]]);
}
/// Swap two zipped slices
pure nothrow
version(mir_test) unittest
{
import mir.utility : swap;
import mir.ndslice.allocation : slice;
import mir.ndslice.topology : as, zip, iota;
//| 0 1 2 |
//| 3 4 5 |
//| 6 7 8 |
auto a = iota([3, 3]).as!double.slice;
//| 10 11 12 |
//| 13 14 15 |
//| 16 17 18 |
auto b = iota([3, 3], 10).as!double.slice;
auto z = zip(a, b);
z.eachUpper!(z => swap(z.a, z.b));
assert(a == [
[0, 11, 12],
[3, 4, 15],
[6, 7, 8]]);
assert(b == [
[10, 1, 2],
[13, 14, 5],
[16, 17, 18]]);
}
// uniq
/**
Lazily iterates unique consecutive elements of the given range (functionality
akin to the $(HTTP wikipedia.org/wiki/_Uniq, _uniq) system
utility). Equivalence of elements is assessed by using the predicate
$(D pred), by default $(D "a == b"). The predicate is passed to
$(REF nary, mir,functional), and can either accept a string, or any callable
that can be executed via $(D pred(element, element)). If the given range is
bidirectional, $(D uniq) also yields a
`std,range,primitives`.
Params:
pred = Predicate for determining equivalence between range elements.
*/
template uniq(alias pred = "a == b")
{
static if (__traits(isSame, naryFun!pred, pred))
{
/++
Params:
r = An input range of elements to filter.
Returns:
An input range of
consecutively unique elements in the original range. If `r` is also a
forward range or bidirectional range, the returned range will be likewise.
+/
Uniq!(naryFun!pred, Range) uniq(Range)(Range r)
if (isInputRange!Range && !isSlice!Range)
{
import core.lifetime: move;
return typeof(return)(r.move);
}
/// ditto
auto uniq(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
import mir.ndslice.topology: flattened;
import core.lifetime: move;
auto r = slice.move.flattened;
return Uniq!(pred, typeof(r))(move(r));
}
}
else
alias uniq = .uniq!(naryFun!pred);
}
///
@safe version(mir_test) unittest
{
int[] arr = [ 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 ];
assert(equal(uniq(arr), [ 1, 2, 3, 4, 5 ]));
import std.algorithm.mutation : copy;
// Filter duplicates in-place using copy
arr.length -= arr.uniq.copy(arr).length;
assert(arr == [ 1, 2, 3, 4, 5 ]);
// Note that uniqueness is only determined consecutively; duplicated
// elements separated by an intervening different element will not be
// eliminated:
assert(equal(uniq([ 1, 1, 2, 1, 1, 3, 1]), [1, 2, 1, 3, 1]));
}
/// N-dimensional case
version(mir_test)
@safe pure unittest
{
import mir.ndslice.fuse;
import mir.ndslice.topology: byDim, map, iota;
auto matrix = [ [1, 2, 2], [2, 2, 3], [4, 4, 4] ].fuse;
assert(matrix.uniq.equal([ 1, 2, 3, 4 ]));
// unique elements for each row
assert(matrix.byDim!0.map!uniq.equal!equal([ [1, 2], [2, 3], [4] ]));
}
/++
Authros: $(HTTP erdani.com, Andrei Alexandrescu) (original Phobos code), Ilia Ki (betterC rework)
+/
struct Uniq(alias pred, Range)
{
Range _input;
ref opSlice() inout
{
return this;
}
void popFront() scope
{
assert(!empty, "Attempting to popFront an empty uniq.");
auto last = _input.front;
do
{
_input.popFront();
}
while (!_input.empty && pred(last, _input.front));
}
auto ref front() @property
{
assert(!empty, "Attempting to fetch the front of an empty uniq.");
return _input.front;
}
import std.range.primitives: isBidirectionalRange;
static if (isBidirectionalRange!Range)
{
void popBack() scope
{
assert(!empty, "Attempting to popBack an empty uniq.");
auto last = _input.back;
do
{
_input.popBack();
}
while (!_input.empty && pred(last, _input.back));
}
auto ref back() return scope @property
{
assert(!empty, "Attempting to fetch the back of an empty uniq.");
return _input.back;
}
}
static if (isInfinite!Range)
{
enum bool empty = false; // Propagate infiniteness.
}
else
{
@property bool empty() const { return _input.empty; }
}
import std.range.primitives: isForwardRange;
static if (isForwardRange!Range)
{
@property typeof(this) save() return scope
{
return typeof(this)(_input.save);
}
}
}
version(none)
@safe version(mir_test) unittest
{
import std.internal.test.dummyrange;
import std.range;
int[] arr = [ 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 ];
auto r = uniq(arr);
static assert(isForwardRange!(typeof(r)));
assert(equal(r, [ 1, 2, 3, 4, 5 ][]));
assert(equal(retro(r), retro([ 1, 2, 3, 4, 5 ][])));
foreach (DummyType; AllDummyRanges)
{
DummyType d;
auto u = uniq(d);
assert(equal(u, [1,2,3,4,5,6,7,8,9,10]));
static assert(d.rt == RangeType.Input || isForwardRange!(typeof(u)));
static if (d.rt >= RangeType.Bidirectional)
{
assert(equal(retro(u), [10,9,8,7,6,5,4,3,2,1]));
}
}
}
@safe version(mir_test) unittest // https://issues.dlang.org/show_bug.cgi?id=17264
{
const(int)[] var = [0, 1, 1, 2];
assert(var.uniq.equal([0, 1, 2]));
}
@safe version(mir_test) unittest {
import mir.ndslice.allocation;
import mir.math.common: approxEqual;
auto x = rcslice!double(2);
auto y = rcslice!double(2);
x[] = [2, 3];
y[] = [2, 3];
assert(equal!approxEqual(x,y));
}
/++
Implements the higher order filter function. The predicate is passed to
`mir.functional.naryFun`, and can either accept a string, or any callable
that can be executed via `pred(element)`.
Params:
pred = Function to apply to each element of range
Returns:
`filter!(pred)(range)` returns a new range containing only elements `x` in `range` for
which `pred(x)` returns `true`.
See_Also:
$(HTTP en.wikipedia.org/wiki/Filter_(higher-order_function), Filter (higher-order function))
Note:
$(RED User and library code MUST call `empty` method ahead each call of pair or one of `front` and `popFront` methods.)
+/
template filter(alias pred = "a")
{
static if (__traits(isSame, naryFun!pred, pred))
{
/++
Params:
r = An input range of elements to filter.
Returns:
A new range containing only elements `x` in `range` for which `predicate(x)` returns `true`.
+/
Filter!(naryFun!pred, Range) filter(Range)(Range r)
if (isInputRange!Range && !isSlice!Range)
{
import core.lifetime: move;
return typeof(return)(r.move);
}
/// ditto
auto filter(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
{
import mir.ndslice.topology: flattened;
import core.lifetime: move;
auto r = slice.move.flattened;
return Filter!(pred, typeof(r))(move(r));
}
}
else
alias filter = .filter!(naryFun!pred);
}
/// ditto
struct Filter(alias pred, Range)
{
Range _input;
version(assert) bool _freshEmpty;
ref opSlice() inout
{
return this;
}
void popFront() scope
{
assert(!_input.empty, "Attempting to popFront an empty Filter.");
version(assert) assert(_freshEmpty, "Attempting to pop the front of a Filter without calling '.empty' method ahead.");
version(assert) _freshEmpty = false;
_input.popFront;
}
auto ref front() @property
{
assert(!_input.empty, "Attempting to fetch the front of an empty Filter.");
version(assert) assert(_freshEmpty, "Attempting to fetch the front of a Filter without calling '.empty' method ahead.");
return _input.front;
}
bool empty() @property
{
version(assert) _freshEmpty = true;
for (;;)
{
if (auto r = _input.empty)
return true;
if (pred(_input.front))
return false;
_input.popFront;
}
}
import std.range.primitives: isForwardRange;
static if (isForwardRange!Range)
{
@property typeof(this) save() return scope
{
return typeof(this)(_input.save);
}
}
}
///
version(mir_test)
@safe pure nothrow unittest
{
int[] arr = [ 0, 1, 2, 3, 4, 5 ];
// Filter below 3
auto small = filter!(a => a < 3)(arr);
assert(equal(small, [ 0, 1, 2 ]));
// Filter again, but with Uniform Function Call Syntax (UFCS)
auto sum = arr.filter!(a => a < 3);
assert(equal(sum, [ 0, 1, 2 ]));
// Filter with the default predicate
auto nonZeros = arr.filter;
assert(equal(nonZeros, [ 1, 2, 3, 4, 5 ]));
// In combination with concatenation() to span multiple ranges
import mir.ndslice.concatenation;
int[] a = [ 3, -2, 400 ];
int[] b = [ 100, -101, 102 ];
auto r = concatenation(a, b).filter!(a => a > 0);
assert(equal(r, [ 3, 400, 100, 102 ]));
// Mixing convertible types is fair game, too
double[] c = [ 2.5, 3.0 ];
auto r1 = concatenation(c, a, b).filter!(a => cast(int) a != a);
assert(equal(r1, [ 2.5 ]));
}
/// N-dimensional filtering
version(mir_test)
@safe pure unittest
{
import mir.ndslice.fuse;
import mir.ndslice.topology: byDim, map;
auto matrix =
[[ 3, -2, 400 ],
[ 100, -101, 102 ]].fuse;
alias filterPositive = filter!"a > 0";
// filter all elements in the matrix
auto r = filterPositive(matrix);
assert(equal(r, [ 3, 400, 100, 102 ]));
// filter all elements for each row
auto rr = matrix.byDim!0.map!filterPositive;
assert(equal!equal(rr, [ [3, 400], [100, 102] ]));
// filter all elements for each column
auto rc = matrix.byDim!1.map!filterPositive;
assert(equal!equal(rc, [ [3, 100], [], [400, 102] ]));
}
/// N-dimensional filtering based on value in specific row/column
version(mir_test)
@safe pure
unittest
{
import mir.ndslice.fuse;
import mir.ndslice.topology: byDim;
auto matrix =
[[ 3, 2, 400 ],
[ 100, -101, 102 ]].fuse;
// filter row based on value in index 1
auto r1 = matrix.byDim!0.filter!("a[1] > 0");
assert(equal!equal(r1, [ [3, 2, 400] ]));
// filter column based on value in index 1
auto r2 = matrix.byDim!1.filter!("a[1] > 0");
assert(equal!equal(r2, [ [3, 100], [400, 102] ]));
}
/// Filter out NaNs
version(mir_test)
@safe pure nothrow
unittest {
import mir.algorithm.iteration: equal, filter;
import mir.ndslice.slice: sliced;
import std.math.traits: isNaN;
static immutable result1 = [1.0, 2];
double x;
auto y = [1.0, 2, x].sliced;
auto z = y.filter!(a => !isNaN(a));
assert(z.equal(result1));
}
/// Filter out NaNs by row and by column
version(mir_test)
@safe pure
unittest {
import mir.algorithm.iteration: equal, filter;
import mir.ndslice.fuse: fuse;
import mir.ndslice.topology: byDim, map;
import std.math.traits: isNaN;
static immutable result1 = [[1.0, 2], [3.0, 4, 5]];
static immutable result2 = [[1.0, 3], [2.0, 4], [5.0]];
double x;
auto y = [[1.0, 2, x], [3.0, 4, 5]].fuse;
// by row
auto z1 = y.byDim!0.map!(filter!(a => !isNaN(a)));
assert(z1.equal!equal(result1));
// by column
auto z2 = y.byDim!1.map!(filter!(a => !isNaN(a)));
assert(z2.equal!equal(result2));
}
/// Filter entire rows/columns that have NaNs
version(mir_test)
@safe pure
unittest {
import mir.algorithm.iteration: equal, filter;
import mir.ndslice.fuse: fuse;
import mir.ndslice.topology: byDim, map;
import std.math.traits: isNaN;
static immutable result1 = [[3.0, 4, 5]];
static immutable result2 = [[1.0, 3], [2.0, 4]];
double x;
auto y = [[1.0, 2, x], [3.0, 4, 5]].fuse;
// by row
auto z1 = y.byDim!0.filter!(a => a.all!(b => !isNaN(b)));
assert(z1.equal!equal(result1));
// by column
auto z2 = y.byDim!1.filter!(a => a.all!(b => !isNaN(b)));
assert(z2.equal!equal(result2));
}
/++
Implements the higher order filter and map function. The predicate and map functions are passed to
`mir.functional.naryFun`, and can either accept a string, or any callable
that can be executed via `pred(element)` and `map(element)`.
Params:
pred = Filter function to apply to each element of range (optional)
map = Map function to apply to each element of range
Returns:
`rcfilter!(pred)(range)` returns a new RCArray containing only elements `map(x)` in `range` for
which `pred(x)` returns `true`.
See_Also:
$(HTTP en.wikipedia.org/wiki/Filter_(higher-order_function), Filter (higher-order function))
+/
template rcfilter(alias pred = "a", alias map = "a")
{
static if (__traits(isSame, naryFun!pred, pred) && __traits(isSame, naryFun!map, map))
{
/++
Params:
r = An input range of elements to filter.
Returns:
A new range containing only elements `x` in `range` for which `predicate(x)` returns `true`.
+/
auto rcfilter(Range)(Range r)
if (isIterable!Range && (!isSlice!Range || DimensionCount!Range == 1))
{
import core.lifetime: forward;
import mir.appender: scopedBuffer;
import mir.primitives: isInputRange;
import mir.rc.array: RCArray;
alias T = typeof(map(r.front));
auto buffer = scopedBuffer!T;
foreach (ref e; r)
{
if (pred(e))
{
static if (__traits(isSame, naryFun!"a", map))
buffer.put(forward!e);
else
buffer.put(map(forward!e));
}
}
return () @trusted
{
auto ret = RCArray!T(buffer.length);
buffer.moveDataAndEmplaceTo(ret[]);
return ret;
} ();
}
/// ditto
auto rcfilter(Iterator, size_t N, SliceKind kind)(Slice!(Iterator, N, kind) slice)
if (N > 1)
{
import mir.ndslice.topology: flattened;
import core.lifetime: move;
return rcfilter(slice.move.flattened);
}
}
else
alias rcfilter = .rcfilter!(naryFun!pred, naryFun!map);
}
///
version(mir_test)
@safe pure nothrow @nogc unittest
{
import mir.ndslice.topology: iota;
auto val = 3;
auto factor = 5;
// Filter iota 2x3 matrix below 3
assert(iota(2, 3).rcfilter!(a => a < val).moveToSlice.equal(val.iota));
// Filter and map below 3
assert(6.iota.rcfilter!(a => a < val, a => a * factor).moveToSlice.equal(val.iota * factor));
}
version(mir_test)
@safe pure nothrow @nogc unittest
{
import mir.ndslice.topology: iota, as;
auto val = 3;
auto factor = 5;
// Filter iota 2x3 matrix below 3
assert(iota(2, 3).as!(const int).rcfilter!(a => a < val).moveToSlice.equal(val.iota));
// Filter and map below 3
assert(6.iota.as!(immutable int).rcfilter!(a => a < val, a => a * factor).moveToSlice.equal(val.iota * factor));
}
/++
Implements the homonym function (also known as `accumulate`, $(D
compress), `inject`, or `foldl`) present in various programming
languages of functional flavor. The call `fold!(fun)(slice, seed)`
first assigns `seed` to an internal variable `result`,
also called the accumulator. Then, for each element `x` in $(D
slice), `result = fun(result, x)` gets evaluated. Finally, $(D
result) is returned.
Params:
fun = the predicate function to apply to the elements
See_Also:
$(HTTP en.wikipedia.org/wiki/Fold_(higher-order_function), Fold (higher-order function))
$(LREF sum) is similar to `fold!((a, b) => a + b)` that offers
precise summing of floating point numbers.
This is functionally equivalent to $(LREF reduce) with the argument order
reversed.
+/
template fold(alias fun)
{
/++
Params:
slice = A slice, range, and array.
seed = An initial accumulation value.
Returns:
the accumulated result
+/
@optmath auto fold(Slice, S)(scope Slice slice, S seed)
{
import core.lifetime: move;
return reduce!fun(seed, slice.move);
}
}
///
version(mir_test)
@safe pure nothrow
unittest
{
import mir.ndslice.slice: sliced;
import mir.ndslice.topology: map;
auto arr = [1, 2, 3, 4, 5].sliced;
// Sum all elements
assert(arr.fold!((a, b) => a + b)(0) == 15);
assert(arr.fold!((a, b) => a + b)(6) == 21);
// Can be used in a UFCS chain
assert(arr.map!(a => a + 1).fold!((a, b) => a + b)(0) == 20);
// Return the last element of any range
assert(arr.fold!((a, b) => b)(0) == 5);
}
/// Works for matrices
version(mir_test)
@safe pure
unittest
{
import mir.ndslice.fuse: fuse;
auto arr = [
[1, 2, 3],
[4, 5, 6]
].fuse;
assert(arr.fold!((a, b) => a + b)(0) == 21);
}
version(mir_test)
@safe pure nothrow
unittest
{
import mir.ndslice.topology: map;
int[] arr = [1, 2, 3, 4, 5];
// Sum all elements
assert(arr.fold!((a, b) => a + b)(0) == 15);
assert(arr.fold!((a, b) => a + b)(6) == 21);
// Can be used in a UFCS chain
assert(arr.map!(a => a + 1).fold!((a, b) => a + b)(0) == 20);
// Return the last element of any range
assert(arr.fold!((a, b) => b)(0) == 5);
}
version(mir_test)
@safe pure nothrow
unittest
{
int[] arr = [1];
static assert(!is(typeof(arr.fold!()(0))));
static assert(!is(typeof(arr.fold!(a => a)(0))));
static assert(is(typeof(arr.fold!((a, b) => a)(0))));
assert(arr.length == 1);
}
version(mir_test)
unittest
{
import mir.rc.array: RCArray;
import mir.algorithm.iteration: minmaxPos, minPos, maxPos, minmaxIndex, minIndex, maxIndex;
static immutable a = [0.0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
auto x = RCArray!double(12);
foreach(i, ref e; x)
e = a[i];
auto y = x.asSlice;
auto z0 = y.minmaxPos;
auto z1 = y.minPos;
auto z2 = y.maxPos;
auto z3 = y.minmaxIndex;
auto z4 = y.minIndex;
auto z5 = y.maxIndex;
}
|
D
|
// 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 dscanner.analysis.imports_sortedness;
import dscanner.analysis.base;
import dparse.lexer;
import dparse.ast;
import std.stdio;
/**
* Checks the sortedness of module imports
*/
final class ImportSortednessCheck : BaseAnalyzer
{
enum string KEY = "dscanner.style.imports_sortedness";
enum string MESSAGE = "The imports are not sorted in alphabetical order";
mixin AnalyzerInfo!"imports_sortedness";
///
this(string fileName, bool skipTests = false)
{
super(fileName, null, skipTests);
}
mixin ScopedVisit!Module;
mixin ScopedVisit!Statement;
mixin ScopedVisit!BlockStatement;
mixin ScopedVisit!StructBody;
mixin ScopedVisit!IfStatement;
mixin ScopedVisit!TemplateDeclaration;
mixin ScopedVisit!ConditionalDeclaration;
override void visit(const VariableDeclaration id)
{
imports[level] = [];
}
override void visit(const ImportDeclaration id)
{
import std.algorithm.iteration : map;
import std.array : join;
import std.string : strip;
if (id.importBindings is null || id.importBindings.importBinds.length == 0)
{
foreach (singleImport; id.singleImports)
{
string importModuleName = singleImport.identifierChain.identifiers.map!`a.text`.join(".");
addImport(importModuleName, singleImport);
}
}
else
{
string importModuleName = id.importBindings.singleImport.identifierChain.identifiers.map!`a.text`.join(".");
foreach (importBind; id.importBindings.importBinds)
{
addImport(importModuleName ~ "-" ~ importBind.left.text, id.importBindings.singleImport);
}
}
}
alias visit = BaseAnalyzer.visit;
private:
int level;
string[][int] imports;
template ScopedVisit(NodeType)
{
override void visit(const NodeType n)
{
imports[++level] = [];
n.accept(this);
level--;
}
}
void addImport(string importModuleName, const SingleImport singleImport)
{
import std.uni : sicmp;
if (imports[level].length > 0 && imports[level][$ -1].sicmp(importModuleName) > 0)
{
addErrorMessage(singleImport.identifierChain.identifiers[0].line,
singleImport.identifierChain.identifiers[0].column, KEY, MESSAGE);
}
else
{
imports[level] ~= importModuleName;
}
}
}
unittest
{
import std.stdio : stderr;
import std.format : format;
import dscanner.analysis.config : StaticAnalysisConfig, Check, disabledConfig;
import dscanner.analysis.helpers : assertAnalyzerWarnings;
StaticAnalysisConfig sac = disabledConfig();
sac.imports_sortedness = Check.enabled;
assertAnalyzerWarnings(q{
import bar.foo;
import foo.bar;
}c, sac);
assertAnalyzerWarnings(q{
import foo.bar;
import bar.foo; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import c;
import c.b;
import c.a; // [warn]: %s
import d.a;
import d; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import a.b, a.c, a.d;
import a.b, a.d, a.c; // [warn]: %s
import a.c, a.b, a.c; // [warn]: %s
import foo.bar, bar.foo; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// multiple items out of order
assertAnalyzerWarnings(q{
import foo.bar;
import bar.foo; // [warn]: %s
import bar.bar.foo; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import test : bar;
import test : foo;
}c, sac);
// selective imports
assertAnalyzerWarnings(q{
import test : foo;
import test : bar; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
), sac);
// selective imports
assertAnalyzerWarnings(q{
import test : foo, bar; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import b;
import c : foo;
import c : bar; // [warn]: %s
import a; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import c;
import c : bar;
import d : bar;
import d; // [warn]: %s
import a : bar; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
assertAnalyzerWarnings(q{
import t0;
import t1 : a, b = foo;
import t2;
}c, sac);
assertAnalyzerWarnings(q{
import t1 : a, b = foo;
import t1 : b, a = foo; // [warn]: %s
import t0 : a, b = foo; // [warn]: %s
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// local imports in functions
assertAnalyzerWarnings(q{
import t2;
import t1; // [warn]: %s
void foo()
{
import f2;
import f1; // [warn]: %s
import f3;
}
void bar()
{
import f1;
import f2;
}
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// local imports in scopes
assertAnalyzerWarnings(q{
import t2;
import t1; // [warn]: %s
void foo()
{
import f2;
import f1; // [warn]: %s
import f3;
{
import f2;
import f1; // [warn]: %s
import f3;
}
{
import f1;
import f2;
import f3;
}
}
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// local imports in functions
assertAnalyzerWarnings(q{
import t2;
import t1; // [warn]: %s
void foo()
{
import f2;
import f1; // [warn]: %s
import f3;
while (true) {
import f2;
import f1; // [warn]: %s
import f3;
}
for (;;) {
import f1;
import f2;
import f3;
}
foreach (el; arr) {
import f2;
import f1; // [warn]: %s
import f3;
}
}
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// nested scopes
assertAnalyzerWarnings(q{
import t2;
import t1; // [warn]: %s
void foo()
{
import f2;
import f1; // [warn]: %s
import f3;
{
import f2;
import f1; // [warn]: %s
import f3;
{
import f2;
import f1; // [warn]: %s
import f3;
{
import f2;
import f1; // [warn]: %s
import f3;
}
}
}
}
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// local imports in functions
assertAnalyzerWarnings(q{
import t2;
import t1; // [warn]: %s
struct foo()
{
import f2;
import f1; // [warn]: %s
import f3;
}
class bar()
{
import f1;
import f2;
}
}c.format(
ImportSortednessCheck.MESSAGE,
ImportSortednessCheck.MESSAGE,
), sac);
// issue 422 - sorted imports with :
assertAnalyzerWarnings(q{
import foo.bar : bar;
import foo.barbar;
}, sac);
// issue 422 - sorted imports with :
assertAnalyzerWarnings(q{
import foo;
import foo.bar;
import fooa;
import std.range : Take;
import std.range.primitives : isInputRange, walkLength;
}, sac);
// condition declaration
assertAnalyzerWarnings(q{
import t2;
version(unittest)
{
import t1;
}
}, sac);
// if statements
assertAnalyzerWarnings(q{
unittest
{
import t2;
if (true)
{
import t1;
}
}
}, sac);
// intermediate imports
assertAnalyzerWarnings(q{
unittest
{
import t2;
int a = 1;
import t1;
}
}, sac);
stderr.writeln("Unittest for ImportSortednessCheck passed.");
}
|
D
|
/Users/stephreaves/Desktop/honeybees/honeybees/Build/Intermediates/honeybees.build/Debug-iphonesimulator/honeybees.build/Objects-normal/x86_64/AddGeotificationViewController.o : /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/GeotificationsViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Geotification.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AddGeotificationViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AppDelegate.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Utilities.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stephreaves/Desktop/honeybees/honeybees/honeybees-Bridging-Header.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSDictionary+Pebble.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSNumber+stdint.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBErrors.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDataLoggingService.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/gtypes.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBBitmap.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+DefaultCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBResourceMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareVersion.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBVersionInfo.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Version.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Sports.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Ping.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Golf.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+AppMessages.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDefines.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBLogConfig.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PebbleKit.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule ./CoreLocation.framework/Headers/CLGeocoder.h ./CoreLocation.framework/Headers/CLPlacemark.h ./CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h ./CoreLocation.framework/Headers/CLVisit.h ./CoreLocation.framework/Headers/CLLocationManagerDelegate.h ./CoreLocation.framework/Headers/CLLocationManager.h ./CoreLocation.framework/Headers/CLHeading.h ./CoreLocation.framework/Headers/CLBeaconRegion.h ./CoreLocation.framework/Headers/CLCircularRegion.h ./CoreLocation.framework/Headers/CLLocation.h ./CoreLocation.framework/Headers/CLRegion.h ./CoreLocation.framework/Headers/CLError.h ./CoreLocation.framework/Headers/CLErrorDomain.h ./CoreLocation.framework/Headers/CLAvailability.h ./CoreLocation.framework/Headers/CoreLocation.h ./CoreLocation.framework/Modules/module.modulemap /Users/stephreaves/Desktop/honeybees/honeybees/CoreLocation.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule
/Users/stephreaves/Desktop/honeybees/honeybees/Build/Intermediates/honeybees.build/Debug-iphonesimulator/honeybees.build/Objects-normal/x86_64/AddGeotificationViewController~partial.swiftmodule : /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/GeotificationsViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Geotification.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AddGeotificationViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AppDelegate.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Utilities.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stephreaves/Desktop/honeybees/honeybees/honeybees-Bridging-Header.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSDictionary+Pebble.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSNumber+stdint.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBErrors.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDataLoggingService.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/gtypes.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBBitmap.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+DefaultCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBResourceMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareVersion.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBVersionInfo.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Version.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Sports.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Ping.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Golf.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+AppMessages.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDefines.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBLogConfig.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PebbleKit.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule ./CoreLocation.framework/Headers/CLGeocoder.h ./CoreLocation.framework/Headers/CLPlacemark.h ./CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h ./CoreLocation.framework/Headers/CLVisit.h ./CoreLocation.framework/Headers/CLLocationManagerDelegate.h ./CoreLocation.framework/Headers/CLLocationManager.h ./CoreLocation.framework/Headers/CLHeading.h ./CoreLocation.framework/Headers/CLBeaconRegion.h ./CoreLocation.framework/Headers/CLCircularRegion.h ./CoreLocation.framework/Headers/CLLocation.h ./CoreLocation.framework/Headers/CLRegion.h ./CoreLocation.framework/Headers/CLError.h ./CoreLocation.framework/Headers/CLErrorDomain.h ./CoreLocation.framework/Headers/CLAvailability.h ./CoreLocation.framework/Headers/CoreLocation.h ./CoreLocation.framework/Modules/module.modulemap /Users/stephreaves/Desktop/honeybees/honeybees/CoreLocation.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule
/Users/stephreaves/Desktop/honeybees/honeybees/Build/Intermediates/honeybees.build/Debug-iphonesimulator/honeybees.build/Objects-normal/x86_64/AddGeotificationViewController~partial.swiftdoc : /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/GeotificationsViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Geotification.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AddGeotificationViewController.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/AppDelegate.swift /Users/stephreaves/Desktop/honeybees/honeybees/honeybees/Utilities.swift /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Swift.swiftmodule /Users/stephreaves/Desktop/honeybees/honeybees/honeybees-Bridging-Header.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSDictionary+Pebble.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/NSNumber+stdint.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBErrors.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDataLoggingService.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/gtypes.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBBitmap.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral+DefaultCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBPebbleCentral.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBResourceMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareMetadata.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBFirmwareVersion.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBVersionInfo.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Version.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Sports.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Ping.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Legacy.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+Golf.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch+AppMessages.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBWatch.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBDefines.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PBLogConfig.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Headers/PebbleKit.h /Users/stephreaves/Desktop/honeybees/honeybees/Pods/PebbleKit/PebbleKit.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Foundation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Darwin.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/Dispatch.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/ObjectiveC.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreGraphics.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/UIKit.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreImage.swiftmodule ./CoreLocation.framework/Headers/CLGeocoder.h ./CoreLocation.framework/Headers/CLPlacemark.h ./CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h ./CoreLocation.framework/Headers/CLVisit.h ./CoreLocation.framework/Headers/CLLocationManagerDelegate.h ./CoreLocation.framework/Headers/CLLocationManager.h ./CoreLocation.framework/Headers/CLHeading.h ./CoreLocation.framework/Headers/CLBeaconRegion.h ./CoreLocation.framework/Headers/CLCircularRegion.h ./CoreLocation.framework/Headers/CLLocation.h ./CoreLocation.framework/Headers/CLRegion.h ./CoreLocation.framework/Headers/CLError.h ./CoreLocation.framework/Headers/CLErrorDomain.h ./CoreLocation.framework/Headers/CLAvailability.h ./CoreLocation.framework/Headers/CoreLocation.h ./CoreLocation.framework/Modules/module.modulemap /Users/stephreaves/Desktop/honeybees/honeybees/CoreLocation.framework/Modules/module.modulemap /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreLocation.swiftmodule /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreData.swiftmodule
|
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.jobs.ee.ejb.EJBInvokerJob;
// import java.lang.reflect.InvocationTargetException;
// import java.lang.reflect.Method;
// import java.rmi.RemoteException;
// import java.util.Hashtable;
// import javax.ejb.EJBHome;
// import javax.ejb.EJBMetaData;
// import javax.ejb.EJBObject;
// import javax.naming.Context;
// import javax.naming.InitialContext;
// import javax.naming.NamingException;
// import javax.rmi.PortableRemoteObject;
// import hunt.quartz.Job;
// import hunt.quartz.JobDataMap;
// import hunt.quartz.JobExecutionContext;
// import hunt.quartz.Exceptions;
// /**
// * <p>
// * A <code>Job</code> that invokes a method on an EJB.
// * </p>
// *
// * <p>
// * Expects the properties corresponding to the following keys to be in the
// * <code>JobDataMap</code> when it executes:
// * <ul>
// * <li><code>EJB_JNDI_NAME_KEY</code>- the JNDI name (location) of the
// * EJB's home interface.</li>
// * <li><code>EJB_METHOD_KEY</code>- the name of the method to invoke on the
// * EJB.</li>
// * <li><code>EJB_ARGS_KEY</code>- an Object[] of the args to pass to the
// * method (optional, if left out, there are no arguments).</li>
// * <li><code>EJB_ARG_TYPES_KEY</code>- an Class[] of the types of the args to
// * pass to the method (optional, if left out, the types will be derived by
// * calling getClass() on each of the arguments).</li>
// * </ul>
// * <br/>
// * The following keys can also be used at need:
// * <ul>
// * <li><code>INITIAL_CONTEXT_FACTORY</code> - the context factory used to
// * build the context.</li>
// * <li><code>PROVIDER_URL</code> - the name of the environment property
// * for specifying configuration information for the service provider to use.
// * </li>
// * </ul>
// * </p>
// *
// * <p>
// * The result of the EJB method invocation will be available to
// * <code>Job/TriggerListener</code>s via
// * <code>{@link hunt.quartz.JobExecutionContext#getResult()}</code>.
// * </p>
// *
// * @author Andrew Collins
// * @author James House
// * @author Joel Shellman
// * @author <a href="mailto:bonhamcm@thirdeyeconsulting.com">Chris Bonham</a>
// */
// class EJBInvokerJob : Job {
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Constants.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// enum string EJB_JNDI_NAME_KEY = "ejb";
// enum string EJB_METHOD_KEY = "method";
// enum string EJB_ARG_TYPES_KEY = "argTypes";
// enum string EJB_ARGS_KEY = "args";
// enum string INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial";
// enum string PROVIDER_URL = "java.naming.provider.url";
// enum string PRINCIPAL = "java.naming.security.principal";
// enum string CREDENTIALS = "java.naming.security.credentials";
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Constructors.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// EJBInvokerJob() {
// // nothing
// }
// /*
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// *
// * Interface.
// *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// */
// void execute(JobExecutionContext context) {
// JobDataMap dataMap = context.getMergedJobDataMap();
// string ejb = dataMap.getString(EJB_JNDI_NAME_KEY);
// string method = dataMap.getString(EJB_METHOD_KEY);
// Object[] arguments = (Object[]) dataMap.get(EJB_ARGS_KEY);
// if (arguments is null) {
// arguments = new Object[0];
// }
// if (ejb is null) {
// // must specify remote home
// throw new JobExecutionException();
// }
// InitialContext jndiContext = null;
// // get initial context
// try {
// jndiContext = getInitialContext(dataMap);
// } catch (NamingException ne) {
// throw new JobExecutionException(ne);
// }
// try {
// Object value = null;
// // locate home interface
// try {
// value = jndiContext.lookup(ejb);
// } catch (NamingException ne) {
// throw new JobExecutionException(ne);
// }
// // get home interface
// EJBHome ejbHome = (EJBHome) PortableRemoteObject.narrow(value,
// EJBHome.class);
// // get meta data
// EJBMetaData metaData = null;
// try {
// metaData = ejbHome.getEJBMetaData();
// } catch (RemoteException re) {
// throw new JobExecutionException(re);
// }
// // get home interface class
// TypeInfo_Class homeClass = metaData.getHomeInterfaceClass();
// // get remote interface class
// TypeInfo_Class remoteClass = metaData.getRemoteInterfaceClass();
// // get home interface
// ejbHome = (EJBHome) PortableRemoteObject.narrow(ejbHome, homeClass);
// Method methodCreate = null;
// try {
// // create method 'create()' on home interface
// methodCreate = homeClass.getMethod("create", ((Class[])null));
// } catch (NoSuchMethodException nsme) {
// throw new JobExecutionException(nsme);
// }
// // create remote object
// EJBObject remoteObj = null;
// try {
// // invoke 'create()' method on home interface
// remoteObj = (EJBObject) methodCreate.invoke(ejbHome, ((Object[])null));
// } catch (IllegalAccessException iae) {
// throw new JobExecutionException(iae);
// } catch (InvocationTargetException ite) {
// throw new JobExecutionException(ite);
// }
// // execute user-specified method on remote object
// Method methodExecute = null;
// try {
// // create method signature
// TypeInfo_Class[] argTypes = (Class[]) dataMap.get(EJB_ARG_TYPES_KEY);
// if (argTypes is null) {
// argTypes = new Class[arguments.length];
// for (int i = 0; i < arguments.length; i++) {
// argTypes[i] = arguments[i].getClass();
// }
// }
// // get method on remote object
// methodExecute = remoteClass.getMethod(method, argTypes);
// } catch (NoSuchMethodException nsme) {
// throw new JobExecutionException(nsme);
// }
// try {
// // invoke user-specified method on remote object
// Object returnObj = methodExecute.invoke(remoteObj, arguments);
// // Return any result in the JobExecutionContext so it will be
// // available to Job/TriggerListeners
// context.setResult(returnObj);
// } catch (IllegalAccessException iae) {
// throw new JobExecutionException(iae);
// } catch (InvocationTargetException ite) {
// throw new JobExecutionException(ite);
// }
// } finally {
// // Don't close jndiContext until after method execution because
// // WebLogic requires context to be open to keep the user credentials
// // available. See JIRA Issue: QUARTZ-401
// if (jndiContext !is null) {
// try {
// jndiContext.close();
// } catch (NamingException e) {
// // Ignore any errors closing the initial context
// }
// }
// }
// }
// protected InitialContext getInitialContext(JobDataMap jobDataMap) {
// Hashtable!(string, string) params = new Hashtable!(string, string)(2);
// string initialContextFactory =
// jobDataMap.getString(INITIAL_CONTEXT_FACTORY);
// if (initialContextFactory !is null) {
// params.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
// }
// string providerUrl = jobDataMap.getString(PROVIDER_URL);
// if (providerUrl !is null) {
// params.put(Context.PROVIDER_URL, providerUrl);
// }
// string principal = jobDataMap.getString(PRINCIPAL);
// if ( principal !is null ) {
// params.put( Context.SECURITY_PRINCIPAL, principal );
// }
// string credentials = jobDataMap.getString(CREDENTIALS);
// if ( credentials !is null ) {
// params.put( Context.SECURITY_CREDENTIALS, credentials );
// }
// return (params.size() == 0) ? new InitialContext() : new InitialContext(params);
// }
// }
|
D
|
/++
Linear Congruential generator.
Copyright: Copyright Andrei Alexandrescu 2008 - 2009, Ilya Yaroshenko 2016-.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(HTTP erdani.org, Andrei Alexandrescu) Ilya Yaroshenko (rework)
+/
module mir.random.engine.linear_congruential;
import std.traits;
import mir.random.engine;
/++
Linear Congruential generator.
+/
@RandomEngine struct LinearCongruentialEngine(Uint, Uint a, Uint c, Uint m)
if (isUnsigned!Uint)
{
/// Highest generated value ($(D modulus - 1 - bool(c == 0))).
enum Uint max = m - 1 - bool(c == 0);
/**
The parameters of this distribution. The random number is $(D_PARAM x
= (x * multipler + increment) % modulus).
*/
enum Uint multiplier = a;
///ditto
enum Uint increment = c;
///ditto
enum Uint modulus = m;
static assert(m == 0 || a < m);
static assert(m == 0 || c < m);
static assert(m == 0 || (cast(ulong)a * (m-1) + c) % m == (c < a ? c - a + m : c - a));
@disable this();
@disable this(this);
// Check for maximum range
private static ulong gcd()(ulong a, ulong b)
{
while (b)
{
auto t = b;
b = a % b;
a = t;
}
return a;
}
private static ulong primeFactorsOnly()(ulong n)
{
ulong result = 1;
ulong iter = 2;
for (; n >= iter * iter; iter += 2 - (iter == 2))
{
if (n % iter) continue;
result *= iter;
do
{
n /= iter;
} while (n % iter == 0);
}
return result * n;
}
@safe pure nothrow unittest
{
static assert(primeFactorsOnly(100) == 10);
static assert(primeFactorsOnly(11) == 11);
static assert(primeFactorsOnly(7 * 7 * 7 * 11 * 15 * 11) == 7 * 11 * 15);
static assert(primeFactorsOnly(129 * 2) == 129 * 2);
// enum x = primeFactorsOnly(7 * 7 * 7 * 11 * 15);
// static assert(x == 7 * 11 * 15);
}
private static bool properLinearCongruentialParameters()(ulong m,ulong a, ulong c)
{
if (m == 0)
{
static if (is(Uint == uint))
{
// Assume m is uint.max + 1
m = (1uL << 32);
}
else
{
return false;
}
}
// Bounds checking
if (a == 0 || a >= m || c >= m) return false;
// c and m are relatively prime
if (c > 0 && gcd(c, m) != 1) return false;
// a - 1 is divisible by all prime factors of m
if ((a - 1) % primeFactorsOnly(m)) return false;
// if a - 1 is multiple of 4, then m is a multiple of 4 too.
if ((a - 1) % 4 == 0 && m % 4) return false;
// Passed all tests
return true;
}
// check here
static assert(c == 0 || properLinearCongruentialParameters(m, a, c),
"Incorrect instantiation of LinearCongruentialEngine");
/**
Constructs a $(D_PARAM LinearCongruentialEngine) generator seeded with
$(D x0).
Params:
x0 = seed, must be positive if c equals to 0.
*/
this(Uint x0) @safe pure
{
static if (c == 0)
assert(x0, "Invalid (zero) seed for " ~ LinearCongruentialEngine.stringof);
_x = modulus ? (x0 % modulus) : x0;
}
/**
Advances the random sequence.
*/
Uint opCall() @safe pure nothrow @nogc
{
static if (m)
{
static if (is(Uint == uint))
{
static if (m == uint.max)
{
immutable ulong
x = (cast(ulong) a * _x + c),
v = x >> 32,
w = x & uint.max;
immutable y = cast(uint)(v + w);
_x = (y < v || y == uint.max) ? (y + 1) : y;
}
else static if (m == int.max)
{
immutable ulong
x = (cast(ulong) a * _x + c),
v = x >> 31,
w = x & int.max;
immutable uint y = cast(uint)(v + w);
_x = (y >= int.max) ? (y - int.max) : y;
}
else
{
_x = cast(uint) ((cast(ulong) a * _x + c) % m);
}
}
else static assert(0);
}
else
{
_x = a * _x + c;
}
static if (c == 0)
return _x - 1;
else
return _x;
}
private Uint _x;
}
/**
Define $(D_PARAM LinearCongruentialEngine) generators with well-chosen
parameters. $(D MinstdRand0) implements Park and Miller's "minimal
standard" $(HTTP
wikipedia.org/wiki/Park%E2%80%93Miller_random_number_generator,
generator) that uses 16807 for the multiplier. $(D MinstdRand)
implements a variant that has slightly better spectral behavior by
using the multiplier 48271. Both generators are rather simplistic.
*/
alias MinstdRand0 = LinearCongruentialEngine!(uint, 16807, 0, 2147483647);
/// ditto
alias MinstdRand = LinearCongruentialEngine!(uint, 48271, 0, 2147483647);
///
@safe unittest
{
// seed with a constant
auto rnd0 = MinstdRand0(1);
auto n = rnd0(); // same for each run
// Seed with an unpredictable value
rnd0 = MinstdRand0(cast(uint)unpredictableSeed);
n = rnd0(); // different across runs
import std.traits;
static assert(is(ReturnType!rnd0 == uint));
}
unittest
{
static assert(isRandomEngine!MinstdRand);
static assert(isRandomEngine!MinstdRand0);
static assert(!isSaturatedRandomEngine!MinstdRand);
static assert(!isSaturatedRandomEngine!MinstdRand0);
// The correct numbers are taken from The Database of Integer Sequences
// http://www.research.att.com/~njas/sequences/eisBTfry00128.txt
auto checking0 = [
16807,282475249,1622650073,984943658,1144108930,470211272,
101027544,1457850878,1458777923,2007237709,823564440,1115438165,
1784484492,74243042,114807987,1137522503,1441282327,16531729,
823378840,143542612 ];
auto rnd0 = MinstdRand0(1);
foreach (e; checking0)
{
assert(rnd0() == e - 1);
}
// Test the 10000th invocation
// Correct value taken from:
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf
rnd0 = MinstdRand0(1);
foreach(_; 0 .. 9999)
rnd0();
assert(rnd0() == 1043618065 - 1);
// Test MinstdRand
auto checking = [48271UL,182605794,1291394886,1914720637,2078669041,
407355683];
auto rnd = MinstdRand(1);
foreach (e; checking)
{
assert(rnd() == e - 1);
}
// Test the 10000th invocation
// Correct value taken from:
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf
rnd = MinstdRand(1);
foreach(_; 0 .. 9999)
rnd();
assert(rnd() == 399268537 - 1);
}
|
D
|
////////////////////////////////////////////////////////
// //
// Architect Mod //
// By benjamin foo //
// //
// Code created by mud-freak aka szapp //
// https://github.com/szapp/ //
// //
// See: //
// forum.worldofplayers.de/forum/threads/?p=25712257 //
// //
////////////////////////////////////////////////////////
/*
* insertAnything.d
* Source: https://forum.worldofplayers.de/forum/threads/?p=25712257
*
* Create and insert any kind of object inheriting from the zCVob class in real time.
*
*
* The core function behind this is
*
* func int InsertObject(string class, string objName, string visual, int trafoPtr, int parentVobPtr)
*
* However, for the most common object classes there are specific functions with simpler signature for inserting at
* - way points (functions with "WP" postfix)
* - exact coordinates with optionally specifying the direction (functions with "Pos" postfix)
* - aligned at a full trafo-matrix (functions without postfix)
*
* Additionally, the objects may be inserted as child vobs of other vobs. (functions with "AsChild" postfix)
* Objects inheriting from the oCMob class can then be further adjusted with additional functions listed below.
*
* [A] = {Vob,Mob,MobInter,MobLockable,MobContainer,MobDoor,MobFire}
* InsertMobContainerPos
* func int Insert[A]WP (string objName, string visual, string waypoint)
* func int Insert[A]Pos (string objName, string visual, int posPtr, int dirPtr)
* func int Insert[A] (string objName, string visual, int trafoPtr)
*
* func int Insert[A]AsChildWP (string objName, string visual, string waypoint, int parentVobPtr)
* func int Insert[A]AsChildPos (string objName, string visual, int posPtr, int dirPtr, int parentVobPtr)
* func int Insert[A]AsChild (string objName, string visual, int trafoPtr, int parentVobPtr)
*
*
* [B] = {Trigger,TriggerScript,TriggerChangeLevel}
*
* func int Insert[B]Pos (string objName, int posPtr, int dirPtr)
* func int Insert[B] (string objName, int trafoPtr)
*
* func int InsertMoverPos (string objName, string visual, int posPtr, int dirPtr)
* func int InsertMover (string objName, string visual, int trafoPtr)
*
* func int InsertItemWP (string scriptInst, int amount, string waypoint)
* func int InsertItemPos (string scriptInst, int amount, int posPtr, int dirPtr)
* func int InsertItem (string scriptInst, int amount, int trafoPtr)
*
* func void InsertPileOfVobs (string objName, string visual, int trafoPtr, int amount, int cm2, int rotate)
* func void InsertPileOfItems (string scriptInst, int trafoPtr, int amount, int cm2, int rotate)
*
*
* Additional functions (not all functions are mentioned here)
*
* func void SetVobToFloor (int vobPtr)
* func void SetWPToFloor (int wpPtr)
*
*
* Further mob setter-functions
*
* func int SetMobName (int mobPtr, string symbolicFocusName)
* func void SetMobOwner (int mobPtr, string owner, string ownerGuild)
* func void SetMobMisc (int mobPtr, string triggerTarget, string useWithItem, string onStateFuncName)
* func void LockMobLockable (int mobPtr, string keyInstance, string pickLockStr, int isLocked)
* func void FillMobContainer (int mobPtr, string contents)
*
*
* Example
*
* // Inserting a locked chest with specific contents
*
* const float pos[3] = { 9458.563477, 589.735718, -4732.891602 }; // World coordinates (use [ALT]+[P] in MARVIN-mode)
*
* var int chestPtr;
* chestPtr = InsertMobContainerPos("myNewChest", "CHESTBIG_OCCHESTLARGE.MDS", _@f(pos), 0);
*
* SetMobName(chestPtr, "MOBNAME_CHEST"); // Set focus name
* LockMobLockable(chestPtr, "ItKe_Key_01", "LRLR", TRUE); // A key and/or lock picking string can be set
* FillMobContainer(chestPtr, "ItMi_Gold:23,ItKe_Key_01:1 "); // Whoops, dropped the key inside!
*
*/
/*
* Creates an "empty" trafo-matrix
*/
func void NewTrafo(var int trafoPtr) {
const int zMAT4__s_identity_G1 = 8845416; //0x86F868
const int zMAT4__s_identity_G2 = 9258472; //0x8D45E8
const int sizeof_zMAT4 = 64; // Same for G1 and G2
MEM_CopyBytes(MEMINT_SwitchG1G2(zMAT4__s_identity_G1, zMAT4__s_identity_G2), trafoPtr, sizeof_zMAT4);
};
/*
* Rotate trafo-matrix around its up-vector (change front-facing direction)
*/
func void RotateTrafoY(var int trafoPtr, var int degrees) {
const int zMAT4__PostRotateY_G1 = 5274256; //0x507A90
const int zMAT4__PostRotateY_G2 = 5339008; //0x517780
const int call = 0;
if (CALL_Begin(call)) {
CALL_FloatParam(_@(degrees));
CALL__thiscall(_@(trafoPtr), MEMINT_SwitchG1G2(zMAT4__PostRotateY_G1, zMAT4__PostRotateY_G2));
call = CALL_End();
};
};
/*
* Store the positional information of a trafo-matrix into a vector
*/
func void TrfToPos(var int trafoPtr, var int posPtr) {
MEM_WriteIntArray(posPtr, 0, MEM_ReadIntArray(trafoPtr, 3));
MEM_WriteIntArray(posPtr, 1, MEM_ReadIntArray(trafoPtr, 7));
MEM_WriteIntArray(posPtr, 2, MEM_ReadIntArray(trafoPtr, 11));
};
/*
* Store positional and/or directional information into a trafo-matrix
*/
func void PosDirToTrf(var int posPtr, var int dirPtr, var int trafoPtr) {
const int zMAT4__MakeOrthonormal_G1 = 5273152; //0x507640
const int zMAT4__MakeOrthonormal_G2 = 5337904; //0x517330
if (posPtr) {
MEM_WriteIntArray(trafoPtr, 3, MEM_ReadIntArray(posPtr, 0));
MEM_WriteIntArray(trafoPtr, 7, MEM_ReadIntArray(posPtr, 1));
MEM_WriteIntArray(trafoPtr, 11, MEM_ReadIntArray(posPtr, 2));
};
if (dirPtr) {
MEM_WriteIntArray(trafoPtr, 2, MEM_ReadIntArray(dirPtr, 0));
MEM_WriteIntArray(trafoPtr, 6, MEM_ReadIntArray(dirPtr, 1));
MEM_WriteIntArray(trafoPtr, 10, MEM_ReadIntArray(dirPtr, 2));
const int call = 0;
if (CALL_Begin(call)) {
CALL__thiscall(_@(trafoPtr), MEMINT_SwitchG1G2(zMAT4__MakeOrthonormal_G1, zMAT4__MakeOrthonormal_G2));
call = CALL_End();
};
};
};
/*
* Get ground level (y-coordinate) from a position
*/
func int GetGroundLvlPos(var int posPtr) {
const float dir[3] = { 0.0, -2000.0, 0.0 }; // Check for ground up to 2000 cm below (Gothic does 1000 cm)
const int zCWorld__TraceRayNearestHit_G1 = 6243008; //0x5F42C0
const int zCWorld__TraceRayNearestHit_G2 = 6429568; //0x621B80
const int flags = 33; // 0x21 (zTRACERAY_VOB_IGNORE_NO_CD_DYN | zTRACERAY_STAT_POLY)
const int ignoreList = 0;
var int worldPtr; worldPtr = MEM_Game._zCSession_world;
var int dirPtr; dirPtr = _@f(dir);
const int call = 0;
if (CALL_Begin(call)) {
CALL_IntParam(_@(flags));
CALL_PtrParam(_@(ignoreList));
CALL_PtrParam(_@(dirPtr));
CALL__fastcall(_@(worldPtr), _@(posPtr), MEMINT_SwitchG1G2(zCWorld__TraceRayNearestHit_G1,
zCWorld__TraceRayNearestHit_G2));
call = CALL_End();
};
// Check for intersection and return y-position
if (CALL_RetValAsInt()) && ((MEM_World.foundPoly) || (MEM_World.foundVob)) {
return MEM_World.foundIntersection[1];
} else {
return subf(MEM_ReadInt(posPtr+4), mkf(2000));
};
};
/*
* Get ground level (y-coordinate) from a trafo-matrix
*/
func int GetGroundLvl(var int trfPtr) {
var int pos[3];
TrfToPos(trfPtr, _@(pos));
return GetGroundLvlPos(_@(pos));
};
/*
* Search a way point by its name
*/
func int SearchWaypointByName(var string waypoint) {
const int zCWayNet__GetWaypoint_G1 = 7366448; //0x706730
const int zCWayNet__GetWaypoint_G2 = 8061744; //0x7B0330
var int waynetPtr; waynetPtr = MEM_World.wayNet;
var int wpNamePtr; wpNamePtr = _@s(waypoint);
const int call = 0;
if (Call_Begin(call)) {
CALL__fastcall(_@(waynetPtr), _@(wpNamePtr), MEMINT_SwitchG1G2(zCWayNet__GetWaypoint_G1,
zCWayNet__GetWaypoint_G2));
call = CALL_End();
};
return CALL_RetValAsPtr();
};
/*
* Get trafo-matrix from way point
*/
func void GetTrafoFromWP(var string wpName, var int trafoPtr) {
var int wpPtr; wpPtr = SearchWaypointByName(wpName);
if (!wpPtr) {
MEM_Warn("Way point not found!");
return;
};
var zCWaypoint wp; wp = _^(wpPtr);
PosDirToTrf(_@(wp.pos), _@(wp.dir), trafoPtr);
};
/*
* Set way point to correct height above ground level
*/
func void SetWPToFloor(var int wpPtr) {
const int zCWaypoint__CorrectHeight_G1 = 7365792; //0x7064A0
const int zCWaypoint__CorrectHeight_G2 = 8061088; //0x7B00A0
var int worldPtr; worldPtr = MEM_Game._zCSession_world;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(worldPtr));
CALL__thiscall(_@(wpPtr), MEMINT_SwitchG1G2(zCWaypoint__CorrectHeight_G1, zCWaypoint__CorrectHeight_G2));
call = CALL_End();
};
};
/*
* Align a vob to a trafo-matrix
*/
func void AlignVobAt(var int vobPtr, var int trfPtr) {
if (!vobPtr) || (!trfPtr) {
return;
};
const int zCVob__SetTrafoObjToWorld_G1 = 6219616; //0x5EE760
const int zCVob__SetTrafoObjToWorld_G2 = 6405248; //0x61BC80
// Lift collision
var zCVob vob; vob = _^(vobPtr);
var int bits; bits = vob.bitfield[0];
vob.bitfield[0] = vob.bitfield[0] & ~zCVob_bitfield0_collDetectionStatic & ~zCVob_bitfield0_collDetectionDynamic;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(trfPtr));
CALL__thiscall(_@(vobPtr), MEMINT_SwitchG1G2(zCVob__SetTrafoObjToWorld_G1, zCVob__SetTrafoObjToWorld_G2));
call = CALL_End();
};
// Restore bits
vob.bitfield[0] = bits;
};
/*
* Set vob to align at ground level
*/
func void SetVobToFloor(var int vobPtr) {
if (!vobPtr) {
return;
};
// Correct height
var zCVob vob; vob = _^(vobPtr);
var int half; half = subf(vob.trafoObjToWorld[7], vob.bbox3D_mins[1]);
vob.trafoObjToWorld[7] = GetGroundLvl(_@(vob.trafoObjToWorld));
vob.trafoObjToWorld[7] = addf(vob.trafoObjToWorld[7], half);
vob.trafoObjToWorld[7] = subf(vob.trafoObjToWorld[7], castToIntf(0.5));
// Update position
AlignVobAt(vobPtr, _@(vob.trafoObjToWorld));
};
/*
* Set a visual of a given vob by string
*/
func void VobSetVisual(var int vobPtr, var String visual) {
const int zCVob__SetVisual_G1 = 6123424; //0x5D6FA0
const int zCVob__SetVisual_G2 = 6301312; //0x602680
if (!vobPtr) {
return;
};
var int strPtr; strPtr = _@s(visual);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(strPtr));
CALL__thiscall(_@(vobPtr), MEMINT_SwitchG1G2(zCVob__SetVisual_G1, zCVob__SetVisual_G2));
call = CALL_End();
};
};
/*
* Retrieve class definition address by string
*/
func int GetClassDefByString(var string classDefName) {
const int zCClassDef__GetClassDef_G1 = 5809264; //0x58A470
const int zCClassDef__GetClassDef_G2 = 5939168; //0x5A9FE0
var int classDefNamePtr; classDefNamePtr = _@s(classDefName);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(classDefNamePtr));
CALL__cdecl(MEMINT_SwitchG1G2(zCClassDef__GetClassDef_G1, zCClassDef__GetClassDef_G2));
call = CALL_End();
};
return CALL_RetValAsPtr();
};
/*
* Create a new instance by class definition
*/
func int CreateNewInstance(var int classDefAddr) {
const int zCClassDef__createNewInstance_offset = 64; //0x40 Same for G1 and G2
// This is a non-recyclable call, because of varying function address
CALL__cdecl(MEM_ReadInt(classDefAddr+zCClassDef__createNewInstance_offset));
return CALL_RetValAsPtr();
};
/*
* Create new instance by class definition name
*/
func int CreateNewInstanceByString(var string classDefName) {
var int classDefAddr; classDefAddr = GetClassDefByString(classDefName);
if (!classDefAddr) {
MEM_Warn("ClassDef not found");
return 0;
};
return CreateNewInstance(classDefAddr);
};
/*
* Create and insert object
*/
func int InsertObject(var string class, var string objName, var string visual, var int trfPtr, var int parentPtr) {
var int vobPtr; vobPtr = CreateNewInstanceByString(class);
if (!vobPtr) {
return 0;
};
VobSetVisual(vobPtr, visual);
MEM_RenameVob(vobPtr, objName);
// Adjust bits
var zCVob vob; vob = _^(vobPtr);
vob.bitfield[0] = vob.bitfield[0] & (-67108865); //0xFBFFFFFF
vob.bitfield[0] = vob.bitfield[0] & ~zCVob_bitfield0_collDetectionStatic & ~zCVob_bitfield0_collDetectionDynamic;
// Set positional and rotational information
AlignVobAt(vobPtr, trfPtr);
// Get parent vob tree
var int vobTreePtr;
if (parentPtr) {
var zCVob parent; parent = _^(parentPtr);
vobTreePtr = parent.globalVobTreeNode;
} else {
vobTreePtr = _@(MEM_Vobtree); // Global vob tree
};
// Insert into world
const int oCWorld__AddVobAsChild_G1 = 7171232; //0x6D6CA0
const int oCWorld__AddVobAsChild_G2 = 7863856; //0x77FE30
var int worldPtr; worldPtr = MEM_Game._zCSession_world;
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(vobTreePtr));
CALL_PtrParam(_@(vobPtr));
CALL_PutRetValTo(0);
CALL__thiscall(_@(worldPtr), MEMINT_SwitchG1G2(oCWorld__AddVobAsChild_G1, oCWorld__AddVobAsChild_G2));
call = CALL_End();
};
// Set bits
vob.bitfield[0] = vob.bitfield[0] | zCVob_bitfield0_collDetectionStatic | zCVob_bitfield0_collDetectionDynamic;
vob.bitfield[2] = vob.bitfield[2] & ~zCVob_bitfield2_sleepingMode; // vob.SetSleeping(1);
// Decrease reference counter... why is that necessary?
vob._zCObject_refCtr -= 1;
if (vob._zCObject_refCtr <= 0) {
const int _scalar_deleting_destructor_offset = 12; // Same for G1 and G2
CALL_IntParam(1);
CALL__thiscall(vobPtr, MEM_ReadInt(vob._vtbl+_scalar_deleting_destructor_offset));
};
return vobPtr;
};
func int InsertObjectPos(var string class, var string nm, var string vis, var int pos, var int dir, var int par) {
var int trafo[16]; NewTrafo(_@(trafo));
PosDirToTrf(pos, dir, _@(trafo));
return InsertObject(class, nm, vis, _@(trafo), par);
};
func int InsertObjectWP(var string class, var string nm, var string vis, var string wpName, var int par) {
var int wpPtr; wpPtr = SearchWaypointByName(wpName);
if (!wpPtr) {
MEM_Warn(ConcatStrings("Way point not found: ", wpName));
return 0;
};
var zCWaypoint wp; wp = _^(wpPtr);
return InsertObjectPos(class, nm, vis, _@(wp.pos), _@(wp.dir), par);
};
/*
* zCVob/oCVob functions:
*
* InsertVobWP (string objName, string visual, string waypoint)
* InsertVobPos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertVob (string objName, string visual, int[16] *trafoMat)
*
* InsertVobAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertVobAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertVobAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertVobAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("zCVob", nm, vis, trf, par);
};
func int InsertVobAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("zCVob", nm, vis, pos, dir, par);
};
func int InsertVobAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("zCVob", nm, vis, wp, par);
};
func int InsertVob(var string nm, var string vis, var int trf) {
return InsertObject("zCVob", nm, vis, trf, 0);
};
func int InsertVobPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("zCVob", nm, vis, pos, dir, 0);
};
func int InsertVobWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("zCVob", nm, vis, wp, 0);
};
/*
* oCMob functions:
*
* InsertMobWP (string objName, string visual, string waypoint)
* InsertMobPos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMob (string objName, string visual, int[16] *trafoMat)
*
* InsertMobAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMOB", nm, vis, trf, par);
};
func int InsertMobAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMOB", nm, vis, pos, dir, par);
};
func int InsertMobAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMOB", nm, vis, wp, par);
};
func int InsertMob(var string nm, var string vis, var int trf) {
return InsertObject("oCMOB", nm, vis, trf, 0);
};
func int InsertMobPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMOB", nm, vis, pos, dir, 0);
};
func int InsertMobWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMOB", nm, vis, wp, 0);
};
/*
* oCMobInter functions:
*
* InsertMobInterWP (string objName, string visual, string waypoint)
* InsertMobInterPos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMobInter (string objName, string visual, int[16] *trafoMat)
*
* InsertMobInterAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobInterAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobInterAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobInterAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMobInter", nm, vis, trf, par);
};
func int InsertMobInterAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMobInter", nm, vis, pos, dir, par);
};
func int InsertMobInterAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMobInter", nm, vis, wp, par);
};
func int InsertMobInter(var string nm, var string vis, var int trf) {
return InsertObject("oCMobInter", nm, vis, trf, 0);
};
func int InsertMobInterPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMobInter", nm, vis, pos, dir, 0);
};
func int InsertMobInterWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMobInter", nm, vis, wp, 0);
};
/*
* oCMobLockable functions:
*
* InsertMobLockableWP (string objName, string visual, string waypoint)
* InsertMobLockablePos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMobLockable (string objName, string visual, int[16] *trafoMat)
*
* InsertMobLockableAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobLockableAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobLockableAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobLockableAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMobLockable", nm, vis, trf, par);
};
func int InsertMobLockableAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMobLockable", nm, vis, pos, dir, par);
};
func int InsertMobLockableAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMobLockable", nm, vis, wp, par);
};
func int InsertMobLockable(var string nm, var string vis, var int trf) {
return InsertObject("oCMobLockable", nm, vis, trf, 0);
};
func int InsertMobLockablePos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMobLockable", nm, vis, pos, dir, 0);
};
func int InsertMobLockableWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMobLockable", nm, vis, wp, 0);
};
/*
* oCMobContainer functions:
*
* InsertMobContainerWP (string objName, string visual, string waypoint)
* InsertMobContainerPos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMobContainer (string objName, string visual, int[16] *trafoMat)
*
* InsertMobContainerAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobContainerAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobContainerAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobContainerAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMobContainer", nm, vis, trf, par);
};
func int InsertMobContainerAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMobContainer", nm, vis, pos, dir, par);
};
func int InsertMobContainerAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMobContainer", nm, vis, wp, par);
};
func int InsertMobContainer(var string nm, var string vis, var int trf) {
return InsertObject("oCMobContainer", nm, vis, trf, 0);
};
func int InsertMobContainerPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMobContainer", nm, vis, pos, dir, 0);
};
func int InsertMobContainerWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMobContainer", nm, vis, wp, 0);
};
/*
* oCMobDoor functions:
*
* InsertMobDoorWP (string objName, string visual, string waypoint)
* InsertMobDoorPos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMobDoor (string objName, string visual, int[16] *trafoMat)
*
* InsertMobDoorAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobDoorAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobDoorAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobDoorAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMobDoor", nm, vis, trf, par);
};
func int InsertMobDoorAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMobDoor", nm, vis, pos, dir, par);
};
func int InsertMobDoorAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMobDoor", nm, vis, wp, par);
};
func int InsertMobDoor(var string nm, var string vis, var int trf) {
return InsertObject("oCMobDoor", nm, vis, trf, 0);
};
func int InsertMobDoorPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMobDoor", nm, vis, pos, dir, 0);
};
func int InsertMobDoorWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMobDoor", nm, vis, wp, 0);
};
/*
* oCMobFire functions:
*
* InsertMobFireWP (string objName, string visual, string waypoint)
* InsertMobFirePos (string objName, string visual, int[3] *pos, int[3] *dir)
* InsertMobFire (string objName, string visual, int[16] *trafoMat)
*
* InsertMobFireAsChildWP (string objName, string visual, string waypoint, int *parentVob)
* InsertMobFireAsChildPos(string objName, string visual, int[3] *pos, int[3] *dir, int *parentVob)
* InsertMobFireAsChild (string objName, string visual, int[16] *trafoMat, int *parentVob)
*/
func int InsertMobFireAsChild(var string nm, var string vis, var int trf, var int par) {
return InsertObject("oCMobFire", nm, vis, trf, par);
};
func int InsertMobFireAsChildPos(var string nm, var string vis, var int pos, var int dir, var int par) {
return InsertObjectPos("oCMobFire", nm, vis, pos, dir, par);
};
func int InsertMobFireAsChildWP(var string nm, var string vis, var string wp, var int par) {
return InsertObjectWP("oCMobFire", nm, vis, wp, par);
};
func int InsertMobFire(var string nm, var string vis, var int trf) {
return InsertObject("oCMobFire", nm, vis, trf, 0);
};
func int InsertMobFirePos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("oCMobFire", nm, vis, pos, dir, 0);
};
func int InsertMobFireWP(var string nm, var string vis, var string wp) {
return InsertObjectWP("oCMobFire", nm, vis, wp, 0);
};
/*
* "Abstract" vob functions:
*
* InsertTriggerPos (string objName, int[3] *pos, int[3] *dir)
* InsertTriggerScriptPos (string objName, int[3] *pos, int[3] *dir)
* InsertTriggerChangeLevelPos(string objName, int[3] *pos, int[3] *dir)
* InsertMoverPos (string objName, string visual, int[3] *pos, int[3] *dir)
*
* InsertTrigger (string objName, int[16] *trafoMat)
* InsertTriggerScript (string objName, int[16] *trafoMat)
* InsertTriggerChangeLevel (string objName, int[16] *trafoMat)
* InsertMover (string objName, string visual, int[16] *trafoMat)
*/
func int InsertTrigger(var string nm, var int trf) {
return InsertObject("zCTrigger", nm, "", trf, 0);
};
func int InsertTriggerPos(var string nm, var int pos, var int dir) {
return InsertObjectPos("zCTrigger", nm, "", pos, dir, 0);
};
func int InsertTriggerScript(var string nm, var int trf) {
return InsertObject("oCTriggerScript", nm, "", trf, 0);
};
func int InsertTriggerScriptPos(var string nm, var int pos, var int dir) {
return InsertObjectPos("oCTriggerScript", nm, "", pos, dir, 0);
};
func int InsertTriggerChangeLevel(var string nm, var int trf) {
return InsertObject("oCTriggerChangeLevel", nm, "", trf, 0);
};
func int InsertTriggerChangeLevelPos(var string nm, var int pos, var int dir) {
return InsertObjectPos("oCTriggerChangeLevel", nm, "", pos, dir, 0);
};
func int InsertMover(var string nm, var string vis, var int trf) {
return InsertObject("zCMover", nm, vis, trf, 0);
};
func int InsertMoverPos(var string nm, var string vis, var int pos, var int dir) {
return InsertObjectPos("zCMover", nm, vis, pos, dir, 0);
};
/*
* oCItem functions:
*
* InsertItemWP (string itemInstance, int amount, string waypoint)
* InsertItemPos(string itemInstance, int amount, int* pos, int* dir)
* InsertItem (string itemInstance, int amount, int* trafoMat)
*/
func int InsertItemWP(var string itmInst, var int amount, var string wp) {
Wld_InsertItem(MEM_GetSymbolIndex(itmInst), wp);
var zCTree newTreeNode; newTreeNode = _^(MEM_World.globalVobTree_firstChild);
var int itmPtr; itmPtr = newTreeNode.data;
if (!itmPtr) {
MEM_Warn(ConcatStrings("Could not insert item: ", itmInst));
return 0;
};
var oCItem itm; itm = _^(itmPtr);
itm.amount = amount;
return itmPtr;
};
func int InsertItem(var string itmInst, var int amount, var int trf) {
var int itmPtr; itmPtr = InsertItemWP(itmInst, amount, MEM_FARFARAWAY);
AlignVobAt(itmPtr, trf);
return itmPtr;
};
func int InsertItemPos(var string itmInst, var int amount, var int pos, var int dir) {
var int trafo[16];
NewTrafo(_@(trafo));
PosDirToTrf(pos, dir, _@(trafo));
var int itmPtr; itmPtr = InsertItem(itmInst, amount, _@(trafo));
SetVobToFloor(itmPtr);
return itmPtr;
};
/*
* PileOf functions:
*
* InsertPileOf (string class, string objName, string visual, int[16]* trafoMat, int amount, int cm2, int rotate)
* InsertPileOfVobs ( string objName, string visual, int[16]* trafoMat, int amount, int cm2, int rotate)
* InsertPileOfItems( string itmInst, int[16]* trafoMat, int amount, int cm2, int rotate)
*/
func void InsertPileOf(var string cl, var string nm, var string vis, var int trf, var int am, var int cm, var int rot) {
const int sizeof_zMAT4 = 64; // Same for G1 and G2
repeat(i, am); var int i;
// Get new trafo from the original
var int trafo[16];
MEM_CopyBytes(trf, _@(trafo), sizeof_zMAT4);
// Increase height for better piling (will be "dropped")
trafo[ 7] = addf(trafo[ 7], mkf(200));
// Shift position (will be distributed over a square not a circle)
trafo[ 3] = addf(trafo[ 3], mkf(Hlp_Random(cm*2)-cm));
trafo[11] = addf(trafo[11], mkf(Hlp_Random(cm*2)-cm));
// Rotate
if (rot) {
RotateTrafoY(_@(trafo), mkf(Hlp_Random(360)));
};
// Create vob or item
var int vobPtr;
if (Hlp_StrCmp(cl, "oCItem")) {
vobPtr = InsertItem(nm, 1, _@(trafo));
} else {
var string name; name = ConcatStrings(nm, IntToString(i+1));
vobPtr = InsertObject(cl, name, vis, _@(trafo), 0);
};
SetVobToFloor(vobPtr);
end;
};
func void InsertPileOfVobs(var string nm, var string vis, var int trf, var int am, var int cm, var int rot) {
InsertPileOf("zCVob", nm, vis, trf, am, cm, rot);
};
func void InsertPileOfItems(var string itmInst, var int trf, var int am, var int cm, var int rot) {
InsertPileOf("oCItem", itmInst, "", trf, am, cm, rot);
};
/*
* Post-insert functions
*/
/*
* Set the focus name of a mob (see Text.d)
*/
func int SetMobName(var int mobPtr, var string symbolicFocusName) {
if (Hlp_Is_oCMob(mobPtr)) {
var oCMob mob; mob = _^(mobPtr);
mob.name = symbolicFocusName;
mob.focusNameIndex = MEM_GetSymbolIndex(symbolicFocusName);
};
return mobPtr;
};
/*
* Set mob owner. Thanks to Bisasam!
*/
func void SetMobOwner(var int mobPtr, var string owner, var string ownerGuild) {
if (!Hlp_Is_oCMob(mobPtr)) {
MEM_Warn("Not a oCMob!");
return;
};
var oCMob mob; mob = _^(mobPtr);
mob.ownerStr = owner;
mob.ownerGuildStr = ownerGuild;
};
/*
* Set some miscellaneous properties of mobs
*/
func void SetMobMisc(var int mobPtr, var string triggerTarget, var string useWithItem, var string onStateFuncName) {
if (!Hlp_Is_oCMobInter(mobPtr)) {
MEM_Warn("Not a oCMobInter!");
return;
};
var oCMobInter mob; mob = _^(mobPtr);
mob.triggerTarget = triggerTarget;
mob.useWithItem = useWithItem;
mob.onStateFuncName = onStateFuncName;
};
/*
* Lock a oCMobLockable
*/
func void LockMobLockable(var int mobPtr, var string keyInstance, var string pickLockStr, var int locked) {
if (!Hlp_Is_oCMobLockable(mobPtr)) {
MEM_Warn("Not a oCMobLocable!");
return;
};
var oCMobLockable mob; mob = _^(mobPtr);
mob.keyInstance = keyInstance;
mob.pickLockStr = pickLockStr;
if (locked) {
mob.bitfield = mob.bitfield | oCMobLockable_bitfield_locked;
};
};
/*
* Create contents of oCMobContainers by string
*/
func void FillMobContainer(var int mobPtr, var string contents) {
if (!Hlp_Is_oCMobContainer(mobPtr)) {
MEM_Warn("Not a oCMobContainer!");
return;
};
const int oCMobContainer__CreateContents_G1 = 6832208; //0x684050
const int oCMobContainer__CreateContents_G2 = 7496080; //0x726190
var int contentsPtr; contentsPtr = _@s(contents);
const int call = 0;
if (CALL_Begin(call)) {
CALL_PtrParam(_@(contentsPtr));
CALL__thiscall(_@(mobPtr), MEMINT_SwitchG1G2(oCMobContainer__CreateContents_G1,
oCMobContainer__CreateContents_G2));
call = CALL_End();
};
};
func void AI_TurnToPos (var int slfInstance, var int posPtr) {
if (!posPtr) { return; };
var oCNPC slf; slf = Hlp_GetNPC (slfInstance);
if (!Hlp_IsValidNPC (slf)) { return; };
slf.soundPosition[0] = MEM_ReadIntArray(posPtr, 0);
slf.soundPosition[1] = MEM_ReadIntArray(posPtr, 1);
slf.soundPosition[2] = MEM_ReadIntArray(posPtr, 2);
AI_TurnToSound (slf);
};
|
D
|
/**
* This module contains the implementation of the C++ header generation available through
* the command line switch -Hc.
*
* Copyright: Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 https://www.digitalmars.com, Walter Bright)
* License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dtohd, _dtoh.d)
* Documentation: https://dlang.org/phobos/dmd_dtoh.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dtoh.d
*/
module dmd.dtoh;
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.ctype;
import dmd.astcodegen;
import dmd.astenums;
import dmd.arraytypes;
import dmd.attrib;
import dmd.dsymbol;
import dmd.errors;
import dmd.globals;
import dmd.hdrgen;
import dmd.identifier;
import dmd.root.filename;
import dmd.visitor;
import dmd.tokens;
import dmd.common.outbuffer;
import dmd.utils;
//debug = Debug_DtoH;
// Generate asserts to validate the header
//debug = Debug_DtoH_Checks;
/**
* Generates a C++ header containing bindings for all `extern(C[++])` declarations
* found in the supplied modules.
*
* Params:
* ms = the modules
*
* Notes:
* - the header is written to `<global.params.cxxhdrdir>/<global.params.cxxhdrfile>`
* or `stdout` if no explicit file was specified
* - bindings conform to the C++ standard defined in `global.params.cplusplus`
* - ignored declarations are mentioned in a comment if `global.params.doCxxHdrGeneration`
* is set to `CxxHeaderMode.verbose`
*/
extern(C++) void genCppHdrFiles(ref Modules ms)
{
initialize();
OutBuffer fwd;
OutBuffer done;
OutBuffer decl;
// enable indent by spaces on buffers
fwd.doindent = true;
fwd.spaces = true;
decl.doindent = true;
decl.spaces = true;
scope v = new ToCppBuffer(&fwd, &done, &decl);
// Conditionally include another buffer for sanity checks
debug (Debug_DtoH_Checks)
{
OutBuffer check;
check.doindent = true;
check.spaces = true;
v.checkbuf = ✓
}
OutBuffer buf;
buf.doindent = true;
buf.spaces = true;
foreach (m; ms)
m.accept(v);
if (global.params.doCxxHdrGeneration == CxxHeaderMode.verbose)
buf.printf("// Automatically generated by %s Compiler v%d", global.vendor.ptr, global.versionNumber());
else
buf.printf("// Automatically generated by %s Compiler", global.vendor.ptr);
buf.writenl();
buf.writenl();
buf.writestringln("#pragma once");
buf.writenl();
hashInclude(buf, "<assert.h>");
hashInclude(buf, "<stddef.h>");
hashInclude(buf, "<stdint.h>");
hashInclude(buf, "<math.h>");
// buf.writestring(buf, "#include <stdio.h>\n");
// buf.writestring("#include <string.h>\n");
// Emit array compatibility because extern(C++) types may have slices
// as members (as opposed to function parameters)
buf.writestring(`
#ifdef CUSTOM_D_ARRAY_TYPE
#define _d_dynamicArray CUSTOM_D_ARRAY_TYPE
#else
/// Represents a D [] array
template<typename T>
struct _d_dynamicArray final
{
size_t length;
T *ptr;
_d_dynamicArray() : length(0), ptr(NULL) { }
_d_dynamicArray(size_t length_in, T *ptr_in)
: length(length_in), ptr(ptr_in) { }
T& operator[](const size_t idx) {
assert(idx < length);
return ptr[idx];
}
const T& operator[](const size_t idx) const {
assert(idx < length);
return ptr[idx];
}
};
#endif
`);
if (v.hasReal)
{
hashIf(buf, "!defined(_d_real)");
{
hashDefine(buf, "_d_real long double");
}
hashEndIf(buf);
}
buf.writenl();
// buf.writestringln("// fwd:");
buf.write(&fwd);
if (fwd.length > 0)
buf.writenl();
// buf.writestringln("// done:");
buf.write(&done);
// buf.writestringln("// decl:");
buf.write(&decl);
debug (Debug_DtoH_Checks)
{
// buf.writestringln("// check:");
buf.writestring(`
#if OFFSETS
template <class T>
size_t getSlotNumber(int dummy, ...)
{
T c;
va_list ap;
va_start(ap, dummy);
void *f = va_arg(ap, void*);
for (size_t i = 0; ; i++)
{
if ( (*(void***)&c)[i] == f)
return i;
}
va_end(ap);
}
void testOffsets()
{
`);
buf.write(&check);
buf.writestring(`
}
#endif
`);
}
if (global.params.cxxhdrname is null)
{
// Write to stdout; assume it succeeds
size_t n = fwrite(buf[].ptr, 1, buf.length, stdout);
assert(n == buf.length); // keep gcc happy about return values
}
else
{
const(char)[] name = FileName.combine(global.params.cxxhdrdir, global.params.cxxhdrname);
writeFile(Loc.initial, name, buf[]);
}
}
private:
/****************************************************
* Visitor that writes bindings for `extern(C[++]` declarations.
*/
extern(C++) final class ToCppBuffer : Visitor
{
alias visit = Visitor.visit;
public:
enum EnumKind
{
Int,
Numeric,
String,
Enum,
Other
}
/// Namespace providing the actual AST nodes
alias AST = ASTCodegen;
/// Visited nodes
bool[void*] visited;
/// Forward declared nodes (which might not be emitted yet)
bool[void*] forwarded;
/// Buffer for forward declarations
OutBuffer* fwdbuf;
/// Buffer for integrity checks
debug (Debug_DtoH_Checks) OutBuffer* checkbuf;
/// Buffer for declarations that must emitted before the currently
/// visited node but can't be forward declared (see `includeSymbol`)
OutBuffer* donebuf;
/// Default buffer for the currently visited declaration
OutBuffer* buf;
/// The generated header uses `real` emitted as `_d_real`?
bool hasReal;
/// The generated header should contain comments for skipped declarations?
const bool printIgnored;
/// State specific to the current context which depends
/// on the currently visited node and it's parents
static struct Context
{
/// Default linkage in the current scope (e.g. LINK.c inside `extern(C) { ... }`)
LINK linkage = LINK.d;
/// Enclosing class / struct / union
AST.AggregateDeclaration adparent;
/// Enclosing template declaration
AST.TemplateDeclaration tdparent;
/// Identifier of the currently visited `VarDeclaration`
/// (required to write variables of funtion pointers)
Identifier ident;
/// Original type of the currently visited declaration
AST.Type origType;
/// Last written visibility level applying to the current scope
AST.Visibility.Kind currentVisibility;
/// Currently applicable storage classes
AST.STC storageClass;
/// How many symbols were ignored
int ignoredCounter;
/// Currently visited types are required by another declaration
/// and hence must be emitted
bool mustEmit;
/// Processing a type that can be forward referenced
bool forwarding;
/// Inside of an anonymous struct/union (AnonDeclaration)
bool inAnonymousDecl;
}
/// Informations about the current context in the AST
Context context;
alias context this;
this(OutBuffer* fwdbuf, OutBuffer* donebuf, OutBuffer* buf)
{
this.fwdbuf = fwdbuf;
this.donebuf = donebuf;
this.buf = buf;
this.printIgnored = global.params.doCxxHdrGeneration == CxxHeaderMode.verbose;
}
/**
* Emits `dsym` into `donebuf` s.t. it is declared before the currently
* visited symbol that written to `buf`.
*
* Temporarily clears `context` to behave as if it was visited normally.
*/
private void includeSymbol(AST.Dsymbol dsym)
{
debug (Debug_DtoH)
{
printf("[includeSymbol(AST.Dsymbol) enter] %s\n", dsym.toChars());
scope(exit) printf("[includeSymbol(AST.Dsymbol) exit] %s\n", dsym.toChars());
}
auto ptr = cast(void*) dsym in visited;
if (ptr && *ptr)
return;
// Temporary replacement for `buf` which is appended to `donebuf`
OutBuffer decl;
decl.doindent = true;
decl.spaces = true;
scope (exit) donebuf.write(&decl);
auto ctxStash = this.context;
auto bufStash = this.buf;
this.context = Context.init;
this.buf = &decl;
this.mustEmit = true;
dsym.accept(this);
this.context = ctxStash;
this.buf = bufStash;
}
/// Determines what kind of enum `type` is (see `EnumKind`)
private EnumKind getEnumKind(AST.Type type)
{
if (type) switch (type.ty)
{
case AST.Tint32:
return EnumKind.Int;
case AST.Tbool,
AST.Tchar, AST.Twchar, AST.Tdchar,
AST.Tint8, AST.Tuns8,
AST.Tint16, AST.Tuns16,
AST.Tuns32,
AST.Tint64, AST.Tuns64:
return EnumKind.Numeric;
case AST.Tarray:
if (type.isString())
return EnumKind.String;
break;
case AST.Tenum:
return EnumKind.Enum;
default:
break;
}
return EnumKind.Other;
}
/// Determines the type used to represent `type` in C++.
/// Returns: `const [w,d]char*` for `[w,d]string` or `type`
private AST.Type determineEnumType(AST.Type type)
{
if (auto arr = type.isTypeDArray())
{
switch (arr.next.ty)
{
case AST.Tchar: return AST.Type.tchar.constOf.pointerTo;
case AST.Twchar: return AST.Type.twchar.constOf.pointerTo;
case AST.Tdchar: return AST.Type.tdchar.constOf.pointerTo;
default: break;
}
}
return type;
}
/// Writes a final `;` and insert an empty line outside of aggregates
private void writeDeclEnd()
{
buf.writestringln(";");
if (!adparent)
buf.writenl();
}
/// Writes the corresponding access specifier if necessary
private void writeProtection(const AST.Visibility.Kind kind)
{
// Don't write visibility for global declarations
if (!adparent || inAnonymousDecl)
return;
string token;
switch(kind) with(AST.Visibility.Kind)
{
case none, private_:
if (this.currentVisibility == AST.Visibility.Kind.private_)
return;
this.currentVisibility = AST.Visibility.Kind.private_;
token = "private:";
break;
case package_, protected_:
if (this.currentVisibility == AST.Visibility.Kind.protected_)
return;
this.currentVisibility = AST.Visibility.Kind.protected_;
token = "protected:";
break;
case undefined, public_, export_:
if (this.currentVisibility == AST.Visibility.Kind.public_)
return;
this.currentVisibility = AST.Visibility.Kind.public_;
token = "public:";
break;
default:
printf("Unexpected visibility: %d!\n", kind);
assert(0);
}
buf.level--;
buf.writestringln(token);
buf.level++;
}
/**
* Writes an identifier into `buf` and checks for reserved identifiers. The
* parameter `canFix` determines how this function handles C++ keywords:
*
* `false` => Raise a warning and print the identifier as-is
* `true` => Append an underscore to the identifier
*
* Params:
* s = the symbol denoting the identifier
* canFixup = whether the identifier may be changed without affecting
* binary compatibility
*/
private void writeIdentifier(const AST.Dsymbol s, const bool canFix = false)
{
writeIdentifier(s.ident, s.loc, s.kind(), canFix);
}
/** Overload of `writeIdentifier` used for all AST nodes not descending from Dsymbol **/
private void writeIdentifier(const Identifier ident, const Loc loc, const char* kind, const bool canFix = false)
{
bool needsFix;
void warnCxxCompat(const(char)* reason)
{
if (canFix)
{
needsFix = true;
return;
}
__gshared bool warned = false;
warning(loc, "%s `%s` is a %s", kind, ident.toChars(), reason);
if (!warned)
{
warningSupplemental(loc, "The generated C++ header will contain " ~
"identifiers that are keywords in C++");
warned = true;
}
}
if (global.params.warnings != DiagnosticReporting.off || canFix)
{
// Warn about identifiers that are keywords in C++.
if (auto kc = keywordClass(ident))
warnCxxCompat(kc);
}
buf.writestring(ident.toString());
if (needsFix)
buf.writeByte('_');
}
/// Checks whether `t` is a type that can be exported to C++
private bool isSupportedType(AST.Type t)
{
if (!t)
{
assert(tdparent);
return true;
}
switch (t.ty)
{
// Nested types
case AST.Tarray:
case AST.Tsarray:
case AST.Tpointer:
case AST.Treference:
case AST.Tdelegate:
return isSupportedType((cast(AST.TypeNext) t).next);
// Function pointers
case AST.Tfunction:
{
auto tf = cast(AST.TypeFunction) t;
if (!isSupportedType(tf.next))
return false;
foreach (_, param; tf.parameterList)
{
if (!isSupportedType(param.type))
return false;
}
return true;
}
// Noreturn has a different mangling
case AST.Tnoreturn:
// _Imaginary is C only.
case AST.Timaginary32:
case AST.Timaginary64:
case AST.Timaginary80:
return false;
default:
return true;
}
}
override void visit(AST.Dsymbol s)
{
debug (Debug_DtoH)
{
mixin(traceVisit!s);
import dmd.asttypename;
printf("[AST.Dsymbol enter] %s\n", s.astTypeName().ptr);
}
}
override void visit(AST.Import i)
{
debug (Debug_DtoH) mixin(traceVisit!i);
/// Writes `using <alias_> = <sym.ident>` into `buf`
const(char*) writeImport(AST.Dsymbol sym, const Identifier alias_)
{
/// `using` was introduced in C++ 11 and only works for types...
if (global.params.cplusplus < CppStdRevision.cpp11)
return "requires C++11";
if (auto ad = sym.isAliasDeclaration())
{
sym = ad.toAlias();
ad = sym.isAliasDeclaration();
// Might be an alias to a basic type
if (ad && !ad.aliassym && ad.type)
goto Emit;
}
// Restricted to types and other aliases
if (!sym.isScopeDsymbol() && !sym.isAggregateDeclaration())
return "only supports types";
// Write `using <alias_> = `<sym>`
Emit:
buf.writestring("using ");
writeIdentifier(alias_, i.loc, "renamed import");
buf.writestring(" = ");
// Start at module scope to avoid collisions with local symbols
if (this.context.adparent)
buf.writestring("::");
buf.writestring(sym.ident.toString());
writeDeclEnd();
return null;
}
// Only missing without semantic analysis
// FIXME: Templates need work due to missing parent & imported module
if (!i.parent)
{
assert(tdparent);
ignored("`%s` because it's inside of a template declaration", i.toChars());
return;
}
// Non-public imports don't create new symbols, include as needed
if (i.visibility.kind < AST.Visibility.Kind.public_)
return;
// Symbols from static imports should be emitted inline
if (i.isstatic)
return;
const isLocal = !i.parent.isModule();
// Need module for symbol lookup
assert(i.mod);
// Emit an alias for each public module member
if (isLocal && i.names.length == 0)
{
assert(i.mod.symtab);
// Sort alphabetically s.t. slight changes in semantic don't cause
// massive changes in the order of declarations
AST.Dsymbols entries;
entries.reserve(i.mod.symtab.length);
foreach (entry; i.mod.symtab.tab.asRange)
{
// Skip anonymous / invisible members
import dmd.access : symbolIsVisible;
if (!entry.key.isAnonymous() && symbolIsVisible(i, entry.value))
entries.push(entry.value);
}
// Seperate function because of a spurious dual-context deprecation
static int compare(const AST.Dsymbol* a, const AST.Dsymbol* b)
{
return strcmp(a.ident.toChars(), b.ident.toChars());
}
entries.sort!compare();
foreach (sym; entries)
{
includeSymbol(sym);
if (auto err = writeImport(sym, sym.ident))
ignored("public import for `%s` because `using` %s", sym.ident.toChars(), err);
}
return;
}
// Include all public imports and emit using declarations for each alias
foreach (const idx, name; i.names)
{
// Search the imported symbol
auto sym = i.mod.search(Loc.initial, name);
assert(sym); // Missing imports should error during semantic
includeSymbol(sym);
// Detect the assigned name for renamed import
auto alias_ = i.aliases[idx];
if (!alias_)
continue;
if (auto err = writeImport(sym, alias_))
ignored("renamed import `%s = %s` because `using` %s", alias_.toChars(), name.toChars(), err);
}
}
override void visit(AST.AttribDeclaration pd)
{
debug (Debug_DtoH) mixin(traceVisit!pd);
Dsymbols* decl = pd.include(null);
if (!decl)
return;
foreach (s; *decl)
{
if (adparent || s.visible().kind >= AST.Visibility.Kind.public_)
s.accept(this);
}
}
override void visit(AST.StorageClassDeclaration scd)
{
debug (Debug_DtoH) mixin(traceVisit!scd);
const stcStash = this.storageClass;
this.storageClass |= scd.stc;
visit(cast(AST.AttribDeclaration) scd);
this.storageClass = stcStash;
}
override void visit(AST.LinkDeclaration ld)
{
debug (Debug_DtoH) mixin(traceVisit!ld);
auto save = linkage;
linkage = ld.linkage;
visit(cast(AST.AttribDeclaration)ld);
linkage = save;
}
override void visit(AST.CPPMangleDeclaration md)
{
debug (Debug_DtoH) mixin(traceVisit!md);
const oldLinkage = this.linkage;
this.linkage = LINK.cpp;
visit(cast(AST.AttribDeclaration) md);
this.linkage = oldLinkage;
}
override void visit(AST.Module m)
{
debug (Debug_DtoH) mixin(traceVisit!m);
foreach (s; *m.members)
{
if (s.visible().kind < AST.Visibility.Kind.public_)
continue;
s.accept(this);
}
}
override void visit(AST.FuncDeclaration fd)
{
debug (Debug_DtoH) mixin(traceVisit!fd);
if (cast(void*)fd in visited)
return;
// printf("FuncDeclaration %s %s\n", fd.toPrettyChars(), fd.type.toChars());
visited[cast(void*)fd] = true;
// silently ignore non-user-defined destructors
if (fd.generated && fd.isDtorDeclaration())
return;
// Note that tf might be null for templated (member) functions
auto tf = cast(AST.TypeFunction)fd.type;
if ((tf && tf.linkage != LINK.c && tf.linkage != LINK.cpp) || (!tf && fd.isPostBlitDeclaration()))
{
ignored("function %s because of linkage", fd.toPrettyChars());
return checkVirtualFunction(fd);
}
if (!adparent && !fd.fbody)
{
ignored("function %s because it is extern", fd.toPrettyChars());
return;
}
if (fd.visibility.kind == AST.Visibility.Kind.none || fd.visibility.kind == AST.Visibility.Kind.private_)
{
ignored("function %s because it is private", fd.toPrettyChars());
return;
}
if (tf && !isSupportedType(tf.next))
{
ignored("function %s because its return type cannot be mapped to C++", fd.toPrettyChars());
return checkVirtualFunction(fd);
}
if (tf) foreach (i, fparam; tf.parameterList)
{
if (!isSupportedType(fparam.type))
{
ignored("function %s because one of its parameters has type `%s` which cannot be mapped to C++",
fd.toPrettyChars(), fparam.type.toChars());
return checkVirtualFunction(fd);
}
}
writeProtection(fd.visibility.kind);
if (tf && tf.linkage == LINK.c)
buf.writestring("extern \"C\" ");
else if (!adparent)
buf.writestring("extern ");
if (adparent && fd.isStatic())
buf.writestring("static ");
else if (adparent && (
// Virtual functions in non-templated classes
(fd.vtblIndex != -1 && !fd.isOverride()) ||
// Virtual functions in templated classes (fd.vtblIndex still -1)
(tdparent && adparent.isClassDeclaration() && !(this.storageClass & AST.STC.final_ || fd.isFinal))))
buf.writestring("virtual ");
debug (Debug_DtoH_Checks)
if (adparent && !tdparent)
{
auto s = adparent.search(Loc.initial, fd.ident);
auto cd = adparent.isClassDeclaration();
if (!(adparent.storage_class & AST.STC.abstract_) &&
!(cd && cd.isAbstract()) &&
s is fd && !fd.overnext)
{
const cn = adparent.ident.toChars();
const fn = fd.ident.toChars();
const vi = fd.vtblIndex;
checkbuf.printf("assert(getSlotNumber <%s>(0, &%s::%s) == %d);",
cn, cn, fn, vi);
checkbuf.writenl();
}
}
if (adparent && fd.isDisabled && global.params.cplusplus < CppStdRevision.cpp11)
writeProtection(AST.Visibility.Kind.private_);
funcToBuffer(tf, fd);
// FIXME: How to determine if fd is const without tf?
if (adparent && tf && (tf.isConst() || tf.isImmutable()))
{
bool fdOverridesAreConst = true;
foreach (fdv; fd.foverrides)
{
auto tfv = cast(AST.TypeFunction)fdv.type;
if (!tfv.isConst() && !tfv.isImmutable())
{
fdOverridesAreConst = false;
break;
}
}
buf.writestring(fdOverridesAreConst ? " const" : " /* const */");
}
if (adparent && fd.isAbstract())
buf.writestring(" = 0");
if (adparent && fd.isDisabled && global.params.cplusplus >= CppStdRevision.cpp11)
buf.writestring(" = delete");
buf.writestringln(";");
if (adparent && fd.isDisabled && global.params.cplusplus < CppStdRevision.cpp11)
writeProtection(AST.Visibility.Kind.public_);
if (!adparent)
buf.writenl();
}
/// Checks whether `fd` is a virtual function and emits a dummy declaration
/// if required to ensure proper vtable layout
private void checkVirtualFunction(AST.FuncDeclaration fd)
{
// Omit redundant declarations - the slot was already
// reserved in the base class
if (fd.isVirtual() && fd.introducing)
{
// Hide placeholders because they are not ABI compatible
writeProtection(AST.Visibility.Kind.private_);
__gshared int counter; // Ensure unique names in all cases
buf.printf("virtual void __vtable_slot_%u();", counter++);
buf.writenl();
}
}
override void visit(AST.UnitTestDeclaration utd)
{
debug (Debug_DtoH) mixin(traceVisit!utd);
}
override void visit(AST.VarDeclaration vd)
{
debug (Debug_DtoH) mixin(traceVisit!vd);
if (!shouldEmitAndMarkVisited(vd))
return;
// Tuple field are expanded into multiple VarDeclarations
// (we'll visit them later)
if (vd.type && vd.type.isTypeTuple())
return;
if (vd.originalType && vd.type == AST.Type.tsize_t)
origType = vd.originalType;
scope(exit) origType = null;
if (!vd.alignment.isDefault())
{
buf.printf("// Ignoring var %s alignment %d", vd.toChars(), vd.alignment.get());
buf.writenl();
}
// Determine the variable type which might be missing inside of
// template declarations. Infer the type from the initializer then
AST.Type type = vd.type;
if (!type)
{
assert(tdparent);
// Just a precaution, implicit type without initializer should be rejected
if (!vd._init)
return;
if (auto ei = vd._init.isExpInitializer())
type = ei.exp.type;
// Can happen if the expression needs further semantic
if (!type)
{
ignored("%s because the type could not be determined", vd.toPrettyChars());
return;
}
// Apply const/immutable to the inferred type
if (vd.storage_class & (AST.STC.const_ | AST.STC.immutable_))
type = type.constOf();
}
if (vd.storage_class & AST.STC.manifest)
{
EnumKind kind = getEnumKind(type);
if (vd.visibility.kind == AST.Visibility.Kind.none || vd.visibility.kind == AST.Visibility.Kind.private_) {
ignored("enum `%s` because it is `%s`.", vd.toPrettyChars(), AST.visibilityToChars(vd.visibility.kind));
return;
}
writeProtection(vd.visibility.kind);
final switch (kind)
{
case EnumKind.Int, EnumKind.Numeric:
// 'enum : type' is only available from C++-11 onwards.
if (global.params.cplusplus < CppStdRevision.cpp11)
goto case;
buf.writestring("enum : ");
determineEnumType(type).accept(this);
buf.writestring(" { ");
writeIdentifier(vd, true);
buf.writestring(" = ");
auto ie = AST.initializerToExpression(vd._init).isIntegerExp();
visitInteger(ie.toInteger(), type);
buf.writestring(" };");
break;
case EnumKind.String, EnumKind.Enum:
buf.writestring("static ");
auto target = determineEnumType(type);
target.accept(this);
buf.writestring(" const ");
writeIdentifier(vd, true);
buf.writestring(" = ");
auto e = AST.initializerToExpression(vd._init);
printExpressionFor(target, e);
buf.writestring(";");
break;
case EnumKind.Other:
ignored("enum `%s` because type `%s` is currently not supported for enum constants.", vd.toPrettyChars(), type.toChars());
return;
}
buf.writenl();
buf.writenl();
return;
}
if (vd.storage_class & (AST.STC.static_ | AST.STC.extern_ | AST.STC.tls | AST.STC.gshared) ||
vd.parent && vd.parent.isModule())
{
if (vd.linkage != LINK.c && vd.linkage != LINK.cpp && !(tdparent && (this.linkage == LINK.c || this.linkage == LINK.cpp)))
{
ignored("variable %s because of linkage", vd.toPrettyChars());
return;
}
if (vd.storage_class & AST.STC.tls)
{
ignored("variable %s because of thread-local storage", vd.toPrettyChars());
return;
}
if (!isSupportedType(type))
{
ignored("variable %s because its type cannot be mapped to C++", vd.toPrettyChars());
return;
}
if (auto kc = keywordClass(vd.ident))
{
ignored("variable %s because its name is a %s", vd.toPrettyChars(), kc);
return;
}
writeProtection(vd.visibility.kind);
if (vd.linkage == LINK.c)
buf.writestring("extern \"C\" ");
else if (!adparent)
buf.writestring("extern ");
if (adparent)
buf.writestring("static ");
typeToBuffer(type, vd);
writeDeclEnd();
return;
}
if (adparent)
{
writeProtection(vd.visibility.kind);
typeToBuffer(type, vd, true);
buf.writestringln(";");
debug (Debug_DtoH_Checks)
{
checkbuf.level++;
const pn = adparent.ident.toChars();
const vn = vd.ident.toChars();
const vo = vd.offset;
checkbuf.printf("assert(offsetof(%s, %s) == %d);",
pn, vn, vo);
checkbuf.writenl();
checkbuf.level--;
}
return;
}
visit(cast(AST.Dsymbol)vd);
}
override void visit(AST.TypeInfoDeclaration tid)
{
debug (Debug_DtoH) mixin(traceVisit!tid);
}
override void visit(AST.AliasDeclaration ad)
{
debug (Debug_DtoH) mixin(traceVisit!ad);
if (!shouldEmitAndMarkVisited(ad))
return;
writeProtection(ad.visibility.kind);
if (auto t = ad.type)
{
if (t.ty == AST.Tdelegate || t.ty == AST.Tident)
{
visit(cast(AST.Dsymbol)ad);
return;
}
// for function pointers we need to original type
if (ad.originalType && ad.type.ty == AST.Tpointer &&
(cast(AST.TypePointer)t).nextOf.ty == AST.Tfunction)
{
origType = ad.originalType;
}
scope(exit) origType = null;
buf.writestring("typedef ");
typeToBuffer(origType !is null ? origType : t, ad);
writeDeclEnd();
return;
}
if (!ad.aliassym)
{
assert(0);
}
if (auto ti = ad.aliassym.isTemplateInstance())
{
visitTi(ti);
return;
}
if (auto sd = ad.aliassym.isStructDeclaration())
{
buf.writestring("typedef ");
sd.type.accept(this);
buf.writestring(" ");
writeIdentifier(ad);
writeDeclEnd();
return;
}
else if (auto td = ad.aliassym.isTemplateDeclaration())
{
if (global.params.cplusplus < CppStdRevision.cpp11)
{
ignored("%s because `using` declarations require C++ 11", ad.toPrettyChars());
return;
}
printTemplateParams(td);
buf.writestring("using ");
writeIdentifier(ad);
buf.writestring(" = ");
writeFullName(td);
buf.writeByte('<');
foreach (const idx, const p; *td.parameters)
{
if (idx)
buf.writestring(", ");
writeIdentifier(p.ident, p.loc, "parameter", true);
}
buf.writestringln(">;");
return;
}
auto fd = ad.aliassym.isFuncDeclaration();
if (fd && (fd.generated || fd.isDtorDeclaration()))
{
// Ignore. It's taken care of while visiting FuncDeclaration
return;
}
// Recognize member function aliases, e.g. alias visit = Parent.visit;
if (adparent && fd)
{
auto pd = fd.isMember();
if (!pd)
{
ignored("%s because free functions cannot be aliased in C++", ad.toPrettyChars());
}
else if (global.params.cplusplus < CppStdRevision.cpp11)
{
ignored("%s because `using` declarations require C++ 11", ad.toPrettyChars());
}
else if (ad.ident != fd.ident)
{
ignored("%s because `using` cannot rename functions in aggregates", ad.toPrettyChars());
}
else if (fd.toAliasFunc().parent.isTemplateMixin())
{
// Member's of template mixins are directly emitted into the aggregate
}
else
{
buf.writestring("using ");
// Print prefix of the base class if this function originates from a superclass
// because alias might be resolved through multiple classes, e.g.
// e.g. for alias visit = typeof(super).visit in the visitors
if (!fd.introducing)
printPrefix(ad.toParent().isClassDeclaration().baseClass);
else
printPrefix(pd);
buf.writestring(fd.ident.toChars());
buf.writestringln(";");
}
return;
}
ignored("%s %s", ad.aliassym.kind(), ad.aliassym.toPrettyChars());
}
override void visit(AST.Nspace ns)
{
debug (Debug_DtoH) mixin(traceVisit!ns);
handleNspace(ns, ns.members);
}
override void visit(AST.CPPNamespaceDeclaration ns)
{
debug (Debug_DtoH) mixin(traceVisit!ns);
handleNspace(ns, ns.decl);
}
/// Writes the namespace declaration and visits all members
private void handleNspace(AST.Dsymbol namespace, Dsymbols* members)
{
buf.writestring("namespace ");
writeIdentifier(namespace);
buf.writenl();
buf.writestring("{");
buf.writenl();
buf.level++;
foreach(decl;(*members))
{
decl.accept(this);
}
buf.level--;
buf.writestring("}");
buf.writenl();
}
override void visit(AST.AnonDeclaration ad)
{
debug (Debug_DtoH) mixin(traceVisit!ad);
const anonStash = inAnonymousDecl;
inAnonymousDecl = true;
scope (exit) inAnonymousDecl = anonStash;
buf.writestringln(ad.isunion ? "union" : "struct");
buf.writestringln("{");
buf.level++;
foreach (s; *ad.decl)
{
s.accept(this);
}
buf.level--;
buf.writestringln("};");
}
private bool memberField(AST.VarDeclaration vd)
{
if (!vd.type || !vd.type.deco || !vd.ident)
return false;
if (!vd.isField())
return false;
if (vd.type.ty == AST.Tfunction)
return false;
if (vd.type.ty == AST.Tsarray)
return false;
return true;
}
override void visit(AST.StructDeclaration sd)
{
debug (Debug_DtoH) mixin(traceVisit!sd);
if (!shouldEmitAndMarkVisited(sd))
return;
const ignoredStash = this.ignoredCounter;
scope (exit) this.ignoredCounter = ignoredStash;
pushAlignToBuffer(sd.alignment);
writeProtection(sd.visibility.kind);
const structAsClass = sd.cppmangle == CPPMANGLE.asClass;
if (sd.isUnionDeclaration())
buf.writestring("union ");
else
buf.writestring(structAsClass ? "class " : "struct ");
writeIdentifier(sd);
if (!sd.members)
{
buf.writestringln(";");
buf.writenl();
return;
}
// D structs are always final
if (!sd.isUnionDeclaration())
buf.writestring(" final");
buf.writenl();
buf.writestring("{");
const protStash = this.currentVisibility;
this.currentVisibility = structAsClass ? AST.Visibility.Kind.private_ : AST.Visibility.Kind.public_;
scope (exit) this.currentVisibility = protStash;
buf.level++;
buf.writenl();
auto save = adparent;
adparent = sd;
foreach (m; *sd.members)
{
m.accept(this);
}
// Generate default ctor
if (!sd.noDefaultCtor && !sd.isUnionDeclaration())
{
writeProtection(AST.Visibility.Kind.public_);
buf.printf("%s()", sd.ident.toChars());
size_t varCount;
bool first = true;
buf.level++;
foreach (m; *sd.members)
{
if (auto vd = m.isVarDeclaration())
{
if (!memberField(vd))
continue;
varCount++;
if (!vd._init && !vd.type.isTypeBasic() && !vd.type.isTypePointer && !vd.type.isTypeStruct &&
!vd.type.isTypeClass && !vd.type.isTypeDArray && !vd.type.isTypeSArray)
{
continue;
}
if (vd._init && vd._init.isVoidInitializer())
continue;
if (first)
{
buf.writestringln(" :");
first = false;
}
else
{
buf.writestringln(",");
}
writeIdentifier(vd, true);
buf.writeByte('(');
if (vd._init)
{
auto e = AST.initializerToExpression(vd._init);
printExpressionFor(vd.type, e, true);
}
buf.printf(")");
}
}
buf.level--;
buf.writenl();
buf.writestringln("{");
buf.writestringln("}");
auto ctor = sd.ctor ? sd.ctor.isFuncDeclaration() : null;
if (varCount && (!ctor || ctor.storage_class & AST.STC.disable))
{
buf.printf("%s(", sd.ident.toChars());
first = true;
foreach (m; *sd.members)
{
if (auto vd = m.isVarDeclaration())
{
if (!memberField(vd))
continue;
if (!first)
buf.writestring(", ");
assert(vd.type);
assert(vd.ident);
typeToBuffer(vd.type, vd, true);
// Don't print default value for first parameter to not clash
// with the default ctor defined above
if (!first)
{
buf.writestring(" = ");
printExpressionFor(vd.type, findDefaultInitializer(vd));
}
first = false;
}
}
buf.writestring(") :");
buf.level++;
buf.writenl();
first = true;
foreach (m; *sd.members)
{
if (auto vd = m.isVarDeclaration())
{
if (!memberField(vd))
continue;
if (first)
first = false;
else
buf.writestringln(",");
writeIdentifier(vd, true);
buf.writeByte('(');
writeIdentifier(vd, true);
buf.writeByte(')');
}
}
buf.writenl();
buf.writestringln("{}");
buf.level--;
}
}
buf.level--;
adparent = save;
buf.writestringln("};");
popAlignToBuffer(sd.alignment);
buf.writenl();
// Workaround because size triggers a forward-reference error
// for struct templates (the size is undetermined even if the
// size doesn't depend on the parameters)
debug (Debug_DtoH_Checks)
if (!tdparent)
{
checkbuf.level++;
const sn = sd.ident.toChars();
const sz = sd.size(Loc.initial);
checkbuf.printf("assert(sizeof(%s) == %llu);", sn, sz);
checkbuf.writenl();
checkbuf.level--;
}
}
/// Starts a custom alignment section using `#pragma pack` if
/// `alignment` specifies a custom alignment
private void pushAlignToBuffer(structalign_t alignment)
{
// DMD ensures alignment is a power of two
//assert(alignment > 0 && ((alignment & (alignment - 1)) == 0),
// "Invalid alignment size");
// When no alignment is specified, `uint.max` is the default
// FIXME: alignment is 0 for structs templated members
if (alignment.isDefault() || (tdparent && alignment.isUnknown()))
{
return;
}
buf.printf("#pragma pack(push, %d)", alignment.get());
buf.writenl();
}
/// Ends a custom alignment section using `#pragma pack` if
/// `alignment` specifies a custom alignment
private void popAlignToBuffer(structalign_t alignment)
{
if (alignment.isDefault() || (tdparent && alignment.isUnknown()))
return;
buf.writestringln("#pragma pack(pop)");
}
override void visit(AST.ClassDeclaration cd)
{
debug (Debug_DtoH) mixin(traceVisit!cd);
if (cd.baseClass && shouldEmit(cd))
includeSymbol(cd.baseClass);
if (!shouldEmitAndMarkVisited(cd))
return;
writeProtection(cd.visibility.kind);
const classAsStruct = cd.cppmangle == CPPMANGLE.asStruct;
buf.writestring(classAsStruct ? "struct " : "class ");
writeIdentifier(cd);
if (cd.storage_class & AST.STC.final_ || (tdparent && this.storageClass & AST.STC.final_))
buf.writestring(" final");
assert(cd.baseclasses);
foreach (i, base; *cd.baseclasses)
{
buf.writestring(i == 0 ? " : public " : ", public ");
// Base classes/interfaces might depend on template parameters,
// e.g. class A(T) : B!T { ... }
if (base.sym is null)
{
base.type.accept(this);
}
else
{
writeFullName(base.sym);
}
}
if (!cd.members)
{
buf.writestring(";");
buf.writenl();
buf.writenl();
return;
}
buf.writenl();
buf.writestringln("{");
const protStash = this.currentVisibility;
this.currentVisibility = classAsStruct ? AST.Visibility.Kind.public_ : AST.Visibility.Kind.private_;
scope (exit) this.currentVisibility = protStash;
auto save = adparent;
adparent = cd;
buf.level++;
foreach (m; *cd.members)
{
m.accept(this);
}
buf.level--;
adparent = save;
buf.writestringln("};");
buf.writenl();
}
override void visit(AST.EnumDeclaration ed)
{
debug (Debug_DtoH) mixin(traceVisit!ed);
if (!shouldEmitAndMarkVisited(ed))
return;
if (ed.isSpecial())
{
//ignored("%s because it is a special C++ type", ed.toPrettyChars());
return;
}
// we need to know a bunch of stuff about the enum...
bool isAnonymous = ed.ident is null;
const isOpaque = !ed.members;
AST.Type type = ed.memtype;
if (!type && !isOpaque)
{
// check all keys have matching type
foreach (_m; *ed.members)
{
auto m = _m.isEnumMember();
if (!type)
type = m.type;
else if (m.type !is type)
{
type = null;
break;
}
}
}
EnumKind kind = getEnumKind(type);
if (isOpaque)
{
// Opaque enums were introduced in C++ 11 (workaround?)
if (global.params.cplusplus < CppStdRevision.cpp11)
{
ignored("%s because opaque enums require C++ 11", ed.toPrettyChars());
return;
}
// Opaque enum defaults to int but the type might not be set
else if (!type)
{
kind = EnumKind.Int;
}
// Cannot apply namespace workaround for non-integral types
else if (kind != EnumKind.Int && kind != EnumKind.Numeric)
{
ignored("enum %s because of its base type", ed.toPrettyChars());
return;
}
}
// determine if this is an enum, or just a group of manifest constants
bool manifestConstants = !isOpaque && (!type || (isAnonymous && kind == EnumKind.Other));
assert(!manifestConstants || isAnonymous);
writeProtection(ed.visibility.kind);
// write the enum header
if (!manifestConstants)
{
if (kind == EnumKind.Int || kind == EnumKind.Numeric)
{
buf.writestring("enum");
// D enums are strong enums, but there exists only a direct mapping
// with 'enum class' from C++-11 onwards.
if (global.params.cplusplus >= CppStdRevision.cpp11)
{
if (!isAnonymous)
{
buf.writestring(" class ");
writeIdentifier(ed);
}
if (kind == EnumKind.Numeric)
{
buf.writestring(" : ");
determineEnumType(type).accept(this);
}
}
else if (!isAnonymous)
{
buf.writeByte(' ');
writeIdentifier(ed);
}
}
else
{
buf.writestring("namespace");
if(!isAnonymous)
{
buf.writeByte(' ');
writeIdentifier(ed);
}
}
// Opaque enums have no members, hence skip the body
if (isOpaque)
{
buf.writestringln(";");
return;
}
else
{
buf.writenl();
buf.writestringln("{");
}
}
// emit constant for each member
if (!manifestConstants)
buf.level++;
foreach (_m; *ed.members)
{
auto m = _m.isEnumMember();
AST.Type memberType = type ? type : m.type;
const EnumKind memberKind = type ? kind : getEnumKind(memberType);
if (!manifestConstants && (kind == EnumKind.Int || kind == EnumKind.Numeric))
{
// C++-98 compatible enums must use the typename as a prefix to avoid
// collisions with other identifiers in scope. For consistency with D,
// the enum member `Type.member` is emitted as `Type_member` in C++-98.
if (!isAnonymous && global.params.cplusplus < CppStdRevision.cpp11)
{
writeIdentifier(ed);
buf.writeByte('_');
}
writeIdentifier(m, true);
buf.writestring(" = ");
auto ie = cast(AST.IntegerExp)m.value;
visitInteger(ie.toInteger(), memberType);
buf.writestring(",");
}
else if (global.params.cplusplus >= CppStdRevision.cpp11 &&
manifestConstants && (memberKind == EnumKind.Int || memberKind == EnumKind.Numeric))
{
buf.writestring("enum : ");
determineEnumType(memberType).accept(this);
buf.writestring(" { ");
writeIdentifier(m, true);
buf.writestring(" = ");
auto ie = cast(AST.IntegerExp)m.value;
visitInteger(ie.toInteger(), memberType);
buf.writestring(" };");
}
else
{
buf.writestring("static ");
auto target = determineEnumType(memberType);
target.accept(this);
buf.writestring(" const ");
writeIdentifier(m, true);
buf.writestring(" = ");
printExpressionFor(target, m.origValue);
buf.writestring(";");
}
buf.writenl();
}
if (!manifestConstants)
buf.level--;
// write the enum tail
if (!manifestConstants)
buf.writestring("};");
buf.writenl();
buf.writenl();
}
override void visit(AST.EnumMember em)
{
assert(em.ed);
// Members of anonymous members are reachable without referencing the
// EnumDeclaration, e.g. public import foo : someEnumMember;
if (em.ed.isAnonymous())
{
visit(em.ed);
return;
}
assert(false, "This node type should be handled in the EnumDeclaration");
}
/**
* Prints a member/parameter/variable declaration into `buf`.
*
* Params:
* t = the type (used if `this.origType` is null)
* s = the symbol denoting the identifier
* canFixup = whether the identifier may be changed without affecting
* binary compatibility (forwarded to `writeIdentifier`)
*/
private void typeToBuffer(AST.Type t, AST.Dsymbol s, const bool canFixup = false)
{
debug (Debug_DtoH)
{
printf("[typeToBuffer(AST.Type, AST.Dsymbol) enter] %s sym %s\n", t.toChars(), s.toChars());
scope(exit) printf("[typeToBuffer(AST.Type, AST.Dsymbol) exit] %s sym %s\n", t.toChars(), s.toChars());
}
this.ident = s.ident;
auto type = origType !is null ? origType : t;
AST.Dsymbol customLength;
// Check for quirks that are usually resolved during semantic
if (tdparent)
{
// Declarations within template declarations might use TypeAArray
// instead of TypeSArray when the length is not an IntegerExp,
// e.g. int[SOME_CONSTANT]
if (auto taa = type.isTypeAArray())
{
// Try to resolve the symbol from the key if it's not an actual type
Identifier id;
if (auto ti = taa.index.isTypeIdentifier())
id = ti.ident;
if (id)
{
auto sym = findSymbol(id, adparent ? adparent : tdparent);
if (!sym)
{
// Couldn't resolve, assume actual AA
}
else if (AST.isType(sym))
{
// a real associative array, forward to visit
}
else if (auto vd = sym.isVarDeclaration())
{
// Actually a static array with length symbol
customLength = sym;
type = taa.next; // visit the element type, length is written below
}
else
{
printf("Resolved unexpected symbol while determining static array length: %s\n", sym.toChars());
fflush(stdout);
fatal();
}
}
}
}
type.accept(this);
if (this.ident)
{
buf.writeByte(' ');
writeIdentifier(s, canFixup);
}
this.ident = null;
// Size is either taken from the type or resolved above
auto tsa = t.isTypeSArray();
if (tsa || customLength)
{
buf.writeByte('[');
if (tsa)
tsa.dim.accept(this);
else
writeFullName(customLength);
buf.writeByte(']');
}
else if (t.isTypeNoreturn())
buf.writestring("[0]");
}
override void visit(AST.Type t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
printf("Invalid type: %s\n", t.toPrettyChars());
assert(0);
}
override void visit(AST.TypeNoreturn t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
buf.writestring("/* noreturn */ char");
}
override void visit(AST.TypeIdentifier t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
// Try to resolve the referenced symbol
if (auto sym = findSymbol(t.ident))
ensureDeclared(outermostSymbol(sym));
if (t.idents.length)
buf.writestring("typename ");
writeIdentifier(t.ident, t.loc, "type", tdparent !is null);
foreach (arg; t.idents)
{
buf.writestring("::");
import dmd.root.rootobject;
// Is this even possible?
if (arg.dyncast != DYNCAST.identifier)
{
printf("arg.dyncast() = %d\n", arg.dyncast());
assert(false);
}
buf.writestring((cast(Identifier) arg).toChars());
}
}
override void visit(AST.TypeNull t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
if (global.params.cplusplus >= CppStdRevision.cpp11)
buf.writestring("nullptr_t");
else
buf.writestring("void*");
}
override void visit(AST.TypeTypeof t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
assert(t.exp);
if (t.exp.type)
{
t.exp.type.accept(this);
}
else if (t.exp.isThisExp())
{
// Short circuit typeof(this) => <Aggregate name>
assert(adparent);
buf.writestring(adparent.ident.toChars());
}
else
{
// Relying on C++'s typeof might produce wrong results
// but it's the best we've got here.
buf.writestring("typeof(");
t.exp.accept(this);
buf.writeByte(')');
}
}
override void visit(AST.TypeBasic t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
if (t.isConst() || t.isImmutable())
buf.writestring("const ");
string typeName;
switch (t.ty)
{
case AST.Tvoid: typeName = "void"; break;
case AST.Tbool: typeName = "bool"; break;
case AST.Tchar: typeName = "char"; break;
case AST.Twchar: typeName = "char16_t"; break;
case AST.Tdchar: typeName = "char32_t"; break;
case AST.Tint8: typeName = "int8_t"; break;
case AST.Tuns8: typeName = "uint8_t"; break;
case AST.Tint16: typeName = "int16_t"; break;
case AST.Tuns16: typeName = "uint16_t"; break;
case AST.Tint32: typeName = "int32_t"; break;
case AST.Tuns32: typeName = "uint32_t"; break;
case AST.Tint64: typeName = "int64_t"; break;
case AST.Tuns64: typeName = "uint64_t"; break;
case AST.Tfloat32: typeName = "float"; break;
case AST.Tfloat64: typeName = "double"; break;
case AST.Tfloat80:
typeName = "_d_real";
hasReal = true;
break;
case AST.Tcomplex32: typeName = "_Complex float"; break;
case AST.Tcomplex64: typeName = "_Complex double"; break;
case AST.Tcomplex80:
typeName = "_Complex _d_real";
hasReal = true;
break;
// ???: This is not strictly correct, but it should be ignored
// in all places where it matters most (variables, functions, ...).
case AST.Timaginary32: typeName = "float"; break;
case AST.Timaginary64: typeName = "double"; break;
case AST.Timaginary80:
typeName = "_d_real";
hasReal = true;
break;
default:
//t.print();
assert(0);
}
buf.writestring(typeName);
}
override void visit(AST.TypePointer t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
auto ts = t.next.isTypeStruct();
if (ts && !strcmp(ts.sym.ident.toChars(), "__va_list_tag"))
{
buf.writestring("va_list");
return;
}
// Pointer targets can be forward referenced
const fwdSave = forwarding;
forwarding = true;
scope (exit) forwarding = fwdSave;
t.next.accept(this);
if (t.next.ty != AST.Tfunction)
buf.writeByte('*');
if (t.isConst() || t.isImmutable())
buf.writestring(" const");
}
override void visit(AST.TypeSArray t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
t.next.accept(this);
}
override void visit(AST.TypeAArray t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
AST.Type.tvoidptr.accept(this);
}
override void visit(AST.TypeFunction tf)
{
debug (Debug_DtoH) mixin(traceVisit!tf);
tf.next.accept(this);
buf.writeByte('(');
buf.writeByte('*');
if (ident)
buf.writestring(ident.toChars());
ident = null;
buf.writeByte(')');
buf.writeByte('(');
foreach (i, fparam; tf.parameterList)
{
if (i)
buf.writestring(", ");
fparam.accept(this);
}
if (tf.parameterList.varargs)
{
if (tf.parameterList.parameters.dim && tf.parameterList.varargs == 1)
buf.writestring(", ");
buf.writestring("...");
}
buf.writeByte(')');
}
/// Writes the type that represents `ed` into `buf`.
/// (Might not be `ed` for special enums or enums that were emitted as namespaces)
private void enumToBuffer(AST.EnumDeclaration ed)
{
debug (Debug_DtoH) mixin(traceVisit!ed);
if (ed.isSpecial())
{
if (ed.ident == DMDType.c_long)
buf.writestring("long");
else if (ed.ident == DMDType.c_ulong)
buf.writestring("unsigned long");
else if (ed.ident == DMDType.c_longlong)
buf.writestring("long long");
else if (ed.ident == DMDType.c_ulonglong)
buf.writestring("unsigned long long");
else if (ed.ident == DMDType.c_long_double)
buf.writestring("long double");
else if (ed.ident == DMDType.c_wchar_t)
buf.writestring("wchar_t");
else if (ed.ident == DMDType.c_complex_float)
buf.writestring("_Complex float");
else if (ed.ident == DMDType.c_complex_double)
buf.writestring("_Complex double");
else if (ed.ident == DMDType.c_complex_real)
buf.writestring("_Complex long double");
else
{
//ed.print();
assert(0);
}
return;
}
const kind = getEnumKind(ed.memtype);
// Check if the enum was emitted as a real enum
if (kind == EnumKind.Int || kind == EnumKind.Numeric)
{
writeFullName(ed);
}
else
{
// Use the base type if the enum was emitted as a namespace
buf.printf("/* %s */ ", ed.ident.toChars());
ed.memtype.accept(this);
}
}
override void visit(AST.TypeEnum t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
if (t.isConst() || t.isImmutable())
buf.writestring("const ");
enumToBuffer(t.sym);
}
override void visit(AST.TypeStruct t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
if (t.isConst() || t.isImmutable())
buf.writestring("const ");
writeFullName(t.sym);
}
override void visit(AST.TypeDArray t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
if (t.isConst() || t.isImmutable())
buf.writestring("const ");
buf.writestring("_d_dynamicArray< ");
t.next.accept(this);
buf.writestring(" >");
}
override void visit(AST.TypeInstance t)
{
visitTi(t.tempinst);
}
private void visitTi(AST.TemplateInstance ti)
{
debug (Debug_DtoH) mixin(traceVisit!ti);
// Ensure that the TD appears before the instance
if (auto td = findTemplateDeclaration(ti))
ensureDeclared(td);
foreach (o; *ti.tiargs)
{
if (!AST.isType(o))
return;
}
buf.writestring(ti.name.toChars());
buf.writeByte('<');
foreach (i, o; *ti.tiargs)
{
if (i)
buf.writestring(", ");
if (auto tt = AST.isType(o))
{
tt.accept(this);
}
else
{
//ti.print();
//o.print();
assert(0);
}
}
buf.writestring(" >");
}
override void visit(AST.TemplateDeclaration td)
{
debug (Debug_DtoH) mixin(traceVisit!td);
if (!shouldEmitAndMarkVisited(td))
return;
if (!td.parameters || !td.onemember || (!td.onemember.isStructDeclaration && !td.onemember.isClassDeclaration && !td.onemember.isFuncDeclaration))
{
visit(cast(AST.Dsymbol)td);
return;
}
// Explicitly disallow templates with non-type parameters or specialization.
foreach (p; *td.parameters)
{
if (!p.isTemplateTypeParameter() || p.specialization())
{
visit(cast(AST.Dsymbol)td);
return;
}
}
auto save = tdparent;
tdparent = td;
const bookmark = buf.length;
printTemplateParams(td);
const oldIgnored = this.ignoredCounter;
td.onemember.accept(this);
// Remove "template<...>" if the symbol could not be emitted
if (oldIgnored != this.ignoredCounter)
buf.setsize(bookmark);
tdparent = save;
}
/// Writes the template<...> header for the supplied template declaration
private void printTemplateParams(const AST.TemplateDeclaration td)
{
buf.writestring("template <");
bool first = true;
foreach (p; *td.parameters)
{
if (first)
first = false;
else
buf.writestring(", ");
buf.writestring("typename ");
writeIdentifier(p.ident, p.loc, "template parameter", true);
}
buf.writestringln(">");
}
/// Emit declarations of the TemplateMixin in the current scope
override void visit(AST.TemplateMixin tm)
{
debug (Debug_DtoH) mixin(traceVisit!tm);
auto members = tm.members;
// members are missing for instances inside of TemplateDeclarations, e.g.
// template Foo(T) { mixin Bar!T; }
if (!members)
{
if (auto td = findTemplateDeclaration(tm))
members = td.members; // Emit members of the template
else
return; // Cannot emit mixin
}
foreach (s; *members)
{
// kind is undefined without semantic
const kind = s.visible().kind;
if (kind == AST.Visibility.Kind.public_ || kind == AST.Visibility.Kind.undefined)
s.accept(this);
}
}
/**
* Finds a symbol with the identifier `name` by iterating the linked list of parent
* symbols, starting from `context`.
*
* Returns: the symbol or `null` if missing
*/
private AST.Dsymbol findSymbol(Identifier name, AST.Dsymbol context)
{
// Follow the declaration context
for (auto par = context; par; par = par.toParentDecl())
{
// Check that `name` doesn't refer to a template parameter
if (auto td = par.isTemplateDeclaration())
{
foreach (const p; *td.parameters)
{
if (p.ident == name)
return null;
}
}
if (auto mem = findMember(par, name))
{
return mem;
}
}
return null;
}
/// ditto
private AST.Dsymbol findSymbol(Identifier name)
{
AST.Dsymbol sym;
if (adparent)
sym = findSymbol(name, adparent);
if (!sym && tdparent)
sym = findSymbol(name, tdparent);
return sym;
}
/// Finds the template declaration for instance `ti`
private AST.TemplateDeclaration findTemplateDeclaration(AST.TemplateInstance ti)
{
if (ti.tempdecl)
return ti.tempdecl.isTemplateDeclaration();
assert(tdparent); // Only missing inside of templates
// Search for the TemplateDeclaration, starting from the enclosing scope
// if known or the enclosing template.
auto sym = findSymbol(ti.name, ti.parent ? ti.parent : tdparent);
return sym ? sym.isTemplateDeclaration() : null;
}
override void visit(AST.TypeClass t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
// Classes are emitted as pointer and hence can be forwarded
const fwdSave = forwarding;
forwarding = true;
scope (exit) forwarding = fwdSave;
if (t.isConst() || t.isImmutable())
buf.writestring("const ");
writeFullName(t.sym);
buf.writeByte('*');
if (t.isConst() || t.isImmutable())
buf.writestring(" const");
}
/**
* Writes the function signature to `buf`.
*
* Params:
* fd = the function to print
* tf = fd's type
*/
private void funcToBuffer(AST.TypeFunction tf, AST.FuncDeclaration fd)
{
debug (Debug_DtoH)
{
printf("[funcToBuffer(AST.TypeFunction) enter] %s\n", fd.toChars());
scope(exit) printf("[funcToBuffer(AST.TypeFunction) exit] %s\n", fd.toChars());
}
auto originalType = cast(AST.TypeFunction)fd.originalType;
if (fd.isCtorDeclaration() || fd.isDtorDeclaration())
{
if (fd.isDtorDeclaration())
{
buf.writeByte('~');
}
buf.writestring(adparent.toChars());
if (!tf)
{
assert(fd.isDtorDeclaration());
buf.writestring("()");
return;
}
}
else
{
import dmd.root.string : toDString;
assert(tf.next, fd.loc.toChars().toDString());
tf.next == AST.Type.tsize_t ? originalType.next.accept(this) : tf.next.accept(this);
if (tf.isref)
buf.writeByte('&');
buf.writeByte(' ');
writeIdentifier(fd);
}
buf.writeByte('(');
foreach (i, fparam; tf.parameterList)
{
if (i)
buf.writestring(", ");
if (fparam.type == AST.Type.tsize_t && originalType)
{
fparam = originalType.parameterList[i];
}
fparam.accept(this);
}
if (tf.parameterList.varargs)
{
if (tf.parameterList.parameters.dim && tf.parameterList.varargs == 1)
buf.writestring(", ");
buf.writestring("...");
}
buf.writeByte(')');
}
override void visit(AST.Parameter p)
{
debug (Debug_DtoH) mixin(traceVisit!p);
ident = p.ident;
{
// Reference parameters can be forwarded
const fwdStash = this.forwarding;
this.forwarding = !!(p.storageClass & AST.STC.ref_);
p.type.accept(this);
this.forwarding = fwdStash;
}
if (p.storageClass & AST.STC.ref_)
buf.writeByte('&');
buf.writeByte(' ');
if (ident)
// FIXME: Parameter is missing a Loc
writeIdentifier(ident, Loc.initial, "parameter", true);
ident = null;
if (p.defaultArg)
{
//printf("%s %d\n", p.defaultArg.toChars, p.defaultArg.op);
buf.writestring(" = ");
printExpressionFor(p.type, p.defaultArg);
}
}
/**
* Prints `exp` as an expression of type `target` while inserting
* appropriate code when implicit conversion does not translate
* directly to C++, e.g. from an enum to its base type.
*
* Params:
* target = the type `exp` is converted to
* exp = the expression to print
* isCtor = if `exp` is a ctor argument
*/
private void printExpressionFor(AST.Type target, AST.Expression exp, const bool isCtor = false)
{
/// Determines if a static_cast is required
static bool needsCast(AST.Type target, AST.Expression exp)
{
// import std.stdio;
// writefln("%s:%s: target = %s, type = %s (%s)", exp.loc.linnum, exp.loc.charnum, target, exp.type, exp.op);
auto source = exp.type;
// DotVarExp resolve conversions, e.g from an enum to its base type
if (auto dve = exp.isDotVarExp())
source = dve.var.type;
if (!source)
// Defensively assume that the cast is required
return true;
// Conversions from enum class to base type require static_cast
if (global.params.cplusplus >= CppStdRevision.cpp11 &&
source.isTypeEnum && !target.isTypeEnum)
return true;
return false;
}
// Slices are emitted as a special struct, hence we need to fix up
// any expression initialising a slice variable/member
if (auto ta = target.isTypeDArray())
{
if (exp.isNullExp())
{
if (isCtor)
{
// Don't emit, use default ctor
}
else if (global.params.cplusplus >= CppStdRevision.cpp11)
{
// Prefer initializer list
buf.writestring("{}");
}
else
{
// Write __d_dynamic_array<TYPE>()
visit(ta);
buf.writestring("()");
}
return;
}
if (auto se = exp.isStringExp())
{
// Rewrite as <length> + <literal> pair optionally
// wrapped in a initializer list/ctor call
const initList = global.params.cplusplus >= CppStdRevision.cpp11;
if (!isCtor)
{
if (initList)
buf.writestring("{ ");
else
{
visit(ta);
buf.writestring("( ");
}
}
buf.printf("%zu, ", se.len);
visit(se);
if (!isCtor)
buf.writestring(initList ? " }" : " )");
return;
}
}
else if (auto ce = exp.isCastExp())
{
buf.writeByte('(');
if (ce.to)
ce.to.accept(this);
else if (ce.e1.type)
// Try the expression type with modifiers in case of cast(const) in templates
ce.e1.type.castMod(ce.mod).accept(this);
else
// Fallback, not necessarily correct but the best we've got here
target.accept(this);
buf.writestring(") ");
ce.e1.accept(this);
}
else if (needsCast(target, exp))
{
buf.writestring("static_cast<");
target.accept(this);
buf.writestring(">(");
exp.accept(this);
buf.writeByte(')');
}
else
{
exp.accept(this);
}
}
override void visit(AST.Expression e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
// Valid in most cases, others should be overriden below
// to use the appropriate operators (:: and ->)
buf.writestring(e.toString());
}
override void visit(AST.UnaExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
buf.writestring(expToString(e.op));
e.e1.accept(this);
}
override void visit(AST.BinExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
e.e1.accept(this);
buf.writeByte(' ');
buf.writestring(expToString(e.op));
buf.writeByte(' ');
e.e2.accept(this);
}
/// Translates operator `op` into the C++ representation
private extern(D) static string expToString(const EXP op)
{
switch (op) with (EXP)
{
case identity: return "==";
case notIdentity: return "!=";
default:
return EXPtoString(op);
}
}
override void visit(AST.VarExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
// Local members don't need another prefix and might've been renamed
if (e.var.isThis())
{
includeSymbol(e.var);
writeIdentifier(e.var, true);
}
else
writeFullName(e.var);
}
/// Partially prints the FQN including parent aggregates
private void printPrefix(AST.Dsymbol var)
{
if (!var || var is adparent || var.isModule())
return;
writeFullName(var);
buf.writestring("::");
}
override void visit(AST.CallExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
// Dereferencing function pointers requires additional braces: (*f)(args)
const isFp = e.e1.isPtrExp();
if (isFp)
buf.writeByte('(');
else if (e.f)
includeSymbol(outermostSymbol(e.f));
e.e1.accept(this);
if (isFp) buf.writeByte(')');
assert(e.arguments);
buf.writeByte('(');
foreach (i, arg; *e.arguments)
{
if (i)
buf.writestring(", ");
arg.accept(this);
}
buf.writeByte(')');
}
override void visit(AST.DotVarExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
if (auto sym = symbolFromType(e.e1.type))
includeSymbol(outermostSymbol(sym));
// Accessing members through a pointer?
if (auto pe = e.e1.isPtrExp)
{
pe.e1.accept(this);
buf.writestring("->");
}
else
{
e.e1.accept(this);
buf.writeByte('.');
}
// Should only be used to access non-static members
assert(e.var.isThis());
writeIdentifier(e.var, true);
}
override void visit(AST.DotIdExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
e.e1.accept(this);
buf.writestring("::");
buf.writestring(e.ident.toChars());
}
override void visit(AST.ScopeExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
// Usually a template instance in a TemplateDeclaration
if (auto ti = e.sds.isTemplateInstance())
visitTi(ti);
else
writeFullName(e.sds);
}
override void visit(AST.NullExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
if (global.params.cplusplus >= CppStdRevision.cpp11)
buf.writestring("nullptr");
else
buf.writestring("NULL");
}
override void visit(AST.ArrayLiteralExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
buf.writestring("arrayliteral");
}
override void visit(AST.StringExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
if (e.sz == 2)
buf.writeByte('u');
else if (e.sz == 4)
buf.writeByte('U');
buf.writeByte('"');
for (size_t i = 0; i < e.len; i++)
{
uint c = e.charAt(i);
switch (c)
{
case '"':
case '\\':
buf.writeByte('\\');
goto default;
default:
if (c <= 0xFF)
{
if (c >= 0x20 && c < 0x80)
buf.writeByte(c);
else
buf.printf("\\x%02x", c);
}
else if (c <= 0xFFFF)
buf.printf("\\u%04x", c);
else
buf.printf("\\U%08x", c);
break;
}
}
buf.writeByte('"');
}
override void visit(AST.RealExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
import dmd.root.ctfloat : CTFloat;
// Special case NaN and Infinity because floatToBuffer
// uses D literals (`nan` and `infinity`)
if (CTFloat.isNaN(e.value))
{
buf.writestring("NAN");
}
else if (CTFloat.isInfinity(e.value))
{
if (e.value < CTFloat.zero)
buf.writeByte('-');
buf.writestring("INFINITY");
}
else
{
import dmd.hdrgen;
// Hex floating point literals were introduced in C++ 17
const allowHex = global.params.cplusplus >= CppStdRevision.cpp17;
floatToBuffer(e.type, e.value, buf, allowHex);
}
}
override void visit(AST.IntegerExp e)
{
debug (Debug_DtoH) mixin(traceVisit!e);
visitInteger(e.toInteger, e.type);
}
/// Writes `v` as type `t` into `buf`
private void visitInteger(dinteger_t v, AST.Type t)
{
debug (Debug_DtoH) mixin(traceVisit!t);
switch (t.ty)
{
case AST.Tenum:
auto te = cast(AST.TypeEnum)t;
buf.writestring("(");
enumToBuffer(te.sym);
buf.writestring(")");
visitInteger(v, te.sym.memtype);
break;
case AST.Tbool:
buf.writestring(v ? "true" : "false");
break;
case AST.Tint8:
buf.printf("%d", cast(byte)v);
break;
case AST.Tuns8:
buf.printf("%uu", cast(ubyte)v);
break;
case AST.Tint16:
buf.printf("%d", cast(short)v);
break;
case AST.Tuns16:
case AST.Twchar:
buf.printf("%uu", cast(ushort)v);
break;
case AST.Tint32:
case AST.Tdchar:
buf.printf("%d", cast(int)v);
break;
case AST.Tuns32:
buf.printf("%uu", cast(uint)v);
break;
case AST.Tint64:
buf.printf("%lldLL", v);
break;
case AST.Tuns64:
buf.printf("%lluLLU", v);
break;
case AST.Tchar:
if (v > 0x20 && v < 0x80)
buf.printf("'%c'", cast(int)v);
else
buf.printf("%uu", cast(ubyte)v);
break;
default:
//t.print();
assert(0);
}
}
override void visit(AST.StructLiteralExp sle)
{
debug (Debug_DtoH) mixin(traceVisit!sle);
const isUnion = sle.sd.isUnionDeclaration();
sle.sd.type.accept(this);
buf.writeByte('(');
foreach(i, e; *sle.elements)
{
if (i)
buf.writestring(", ");
auto vd = sle.sd.fields[i];
// Expression may be null for unspecified elements
if (!e)
e = findDefaultInitializer(vd);
printExpressionFor(vd.type, e);
// Only emit the initializer of the first union member
if (isUnion)
break;
}
buf.writeByte(')');
}
/// Finds the default initializer for the given VarDeclaration
private static AST.Expression findDefaultInitializer(AST.VarDeclaration vd)
{
if (vd._init && !vd._init.isVoidInitializer())
return AST.initializerToExpression(vd._init);
else
return vd.type.defaultInitLiteral(Loc.initial);
}
static if (__VERSION__ < 2092)
{
private void ignored(const char* format, ...) nothrow
{
this.ignoredCounter++;
import core.stdc.stdarg;
if (!printIgnored)
return;
va_list ap;
va_start(ap, format);
buf.writestring("// Ignored ");
buf.vprintf(format, ap);
buf.writenl();
va_end(ap);
}
}
else
{
/// Writes a formatted message into `buf` if `printIgnored` is true
/// and increments `ignoredCounter`
pragma(printf)
private void ignored(const char* format, ...) nothrow
{
this.ignoredCounter++;
import core.stdc.stdarg;
if (!printIgnored)
return;
va_list ap;
va_start(ap, format);
buf.writestring("// Ignored ");
buf.vprintf(format, ap);
buf.writenl();
va_end(ap);
}
}
/**
* Determines whether `s` should be emitted. This requires that `sym`
* - is `extern(C[++]`)
* - is not instantiated from a template (visits the `TemplateDeclaration` instead)
*
* Params:
* sym = the symbol
*
* Returns: whether `sym` should be emitted
*/
private bool shouldEmit(AST.Dsymbol sym)
{
import dmd.aggregate : ClassKind;
debug (Debug_DtoH)
{
printf("[shouldEmitAndMarkVisited enter] %s\n", sym.toPrettyChars());
scope(exit) printf("[shouldEmitAndMarkVisited exit] %s\n", sym.toPrettyChars());
}
// Template *instances* should not be emitted
if (sym.isInstantiated())
return false;
// Matching linkage (except extern(C) classes which don't make sense)
if (linkage == LINK.cpp || (linkage == LINK.c && !sym.isClassDeclaration()))
return true;
// Check against the internal information which might be missing, e.g. inside of template declarations
if (auto dec = sym.isDeclaration())
return dec.linkage == LINK.cpp || dec.linkage == LINK.c;
if (auto ad = sym.isAggregateDeclaration())
return ad.classKind == ClassKind.cpp;
return false;
}
/**
* Determines whether `s` should be emitted. This requires that `sym`
* - was not visited before
* - is `extern(C[++]`)
* - is not instantiated from a template (visits the `TemplateDeclaration` instead)
* The result is cached in the visited nodes array.
*
* Params:
* sym = the symbol
*
* Returns: whether `sym` should be emitted
**/
private bool shouldEmitAndMarkVisited(AST.Dsymbol sym)
{
debug (Debug_DtoH)
{
printf("[shouldEmitAndMarkVisited enter] %s\n", sym.toPrettyChars());
scope(exit) printf("[shouldEmitAndMarkVisited exit] %s\n", sym.toPrettyChars());
}
auto statePtr = (cast(void*) sym) in visited;
// `sym` was already emitted or skipped and isn't required
if (statePtr && (*statePtr || !mustEmit))
return false;
// Template *instances* should not be emitted, forward to the declaration
if (auto ti = sym.isInstantiated())
{
auto td = findTemplateDeclaration(ti);
assert(td);
visit(td);
return false;
}
// Required or matching linkage (except extern(C) classes which don't make sense)
bool res = mustEmit || linkage == LINK.cpp || (linkage == LINK.c && !sym.isClassDeclaration());
if (!res)
{
// Check against the internal information which might be missing, e.g. inside of template declarations
auto dec = sym.isDeclaration();
res = dec && (dec.linkage == LINK.cpp || dec.linkage == LINK.c);
}
// Remember result for later calls
if (statePtr)
*statePtr = res;
else
visited[(cast(void*) sym)] = res;
// Print a warning when the symbol is ignored for the first time
// Might not be correct if it is required by symbol the is visited
// AFTER the current node
if (!statePtr && !res)
ignored("%s %s because of linkage", sym.kind(), sym.toPrettyChars());
return res;
}
/**
* Ensures that `sym` is declared before the current position in `buf` by
* either creating a forward reference in `fwdbuf` if possible or
* calling `includeSymbol` to emit the entire declaration into `donebuf`.
*/
private void ensureDeclared(AST.Dsymbol sym)
{
auto par = sym.toParent2();
auto ed = sym.isEnumDeclaration();
// Eagerly include the symbol if we cannot create a valid forward declaration
// Forwarding of scoped enums requires C++11 or above
if (!forwarding || (par && !par.isModule()) || (ed && global.params.cplusplus < CppStdRevision.cpp11))
{
// Emit the entire enclosing declaration if any
includeSymbol(outermostSymbol(sym));
return;
}
auto ti = sym.isInstantiated();
auto td = ti ? findTemplateDeclaration(ti) : null;
auto check = cast(void*) (td ? td : sym);
// Omit redundant fwd-declaration if we already emitted the entire declaration
if (visited.get(check, false))
return;
// Already created a fwd-declaration?
if (check in forwarded)
return;
forwarded[check] = true;
// Print template<...>
if (ti)
{
auto bufSave = buf;
buf = fwdbuf;
printTemplateParams(td);
buf = bufSave;
}
// Determine the kind of symbol that is forwared: struct, ...
const(char)* kind;
if (auto ad = sym.isAggregateDeclaration())
{
// Look for extern(C++, class) <some aggregate>
if (ad.cppmangle == CPPMANGLE.def)
kind = ad.kind();
else if (ad.cppmangle == CPPMANGLE.asStruct)
kind = "struct";
else
kind = "class";
}
else if (ed)
{
// Only called from enumToBuffer, so should always be emitted as an actual enum
kind = "enum class";
}
else
kind = sym.kind(); // Should be unreachable but just to be sure
fwdbuf.writestring(kind);
fwdbuf.writeByte(' ');
fwdbuf.writestring(sym.toChars());
fwdbuf.writestringln(";");
}
/**
* Writes the qualified name of `sym` into `buf` including parent
* symbols and template parameters.
*
* Params:
* sym = the symbol
* mustInclude = whether sym may not be forward declared
*/
private void writeFullName(AST.Dsymbol sym, const bool mustInclude = false)
in
{
assert(sym);
assert(sym.ident, sym.toString());
// Should never be called directly with a TI, only onemember
assert(!sym.isTemplateInstance(), sym.toString());
}
do
{
debug (Debug_DtoH)
{
printf("[writeFullName enter] %s\n", sym.toPrettyChars());
scope(exit) printf("[writeFullName exit] %s\n", sym.toPrettyChars());
}
/// Checks whether `sym` is nested in `par` and hence doesn't need the FQN
static bool isNestedIn(AST.Dsymbol sym, AST.Dsymbol par)
{
while (par)
{
if (sym is par)
return true;
par = par.toParent();
}
return false;
}
AST.TemplateInstance ti;
bool nested;
// Check if the `sym` is nested into another symbol and hence requires `Parent::sym`
if (auto par = sym.toParent())
{
// toParent() yields the template instance if `sym` is the onemember of a TI
ti = par.isTemplateInstance();
// Skip the TI because Foo!int.Foo is folded into Foo<int>
if (ti) par = ti.toParent();
// Prefix the name with any enclosing declaration
// Stop at either module or enclosing aggregate
nested = !par.isModule();
if (nested && !isNestedIn(par, adparent))
{
writeFullName(par, true);
buf.writestring("::");
}
}
if (!nested)
{
// Cannot forward the symbol when called recursively
// for a nested symbol
if (mustInclude)
includeSymbol(sym);
else
ensureDeclared(sym);
}
if (ti)
visitTi(ti);
else
buf.writestring(sym.ident.toString());
}
}
/// Namespace for identifiers used to represent special enums in C++
struct DMDType
{
__gshared Identifier c_long;
__gshared Identifier c_ulong;
__gshared Identifier c_longlong;
__gshared Identifier c_ulonglong;
__gshared Identifier c_long_double;
__gshared Identifier c_wchar_t;
__gshared Identifier c_complex_float;
__gshared Identifier c_complex_double;
__gshared Identifier c_complex_real;
static void _init()
{
c_long = Identifier.idPool("__c_long");
c_ulong = Identifier.idPool("__c_ulong");
c_longlong = Identifier.idPool("__c_longlong");
c_ulonglong = Identifier.idPool("__c_ulonglong");
c_long_double = Identifier.idPool("__c_long_double");
c_wchar_t = Identifier.idPool("__c_wchar_t");
c_complex_float = Identifier.idPool("__c_complex_float");
c_complex_double = Identifier.idPool("__c_complex_double");
c_complex_real = Identifier.idPool("__c_complex_real");
}
}
/// Initializes all data structures used by the header generator
void initialize()
{
__gshared bool initialized;
if (!initialized)
{
initialized = true;
DMDType._init();
}
}
/// Writes `#if <content>` into the supplied buffer
void hashIf(ref OutBuffer buf, string content)
{
buf.writestring("#if ");
buf.writestringln(content);
}
/// Writes `#elif <content>` into the supplied buffer
void hashElIf(ref OutBuffer buf, string content)
{
buf.writestring("#elif ");
buf.writestringln(content);
}
/// Writes `#endif` into the supplied buffer
void hashEndIf(ref OutBuffer buf)
{
buf.writestringln("#endif");
}
/// Writes `#define <content>` into the supplied buffer
void hashDefine(ref OutBuffer buf, string content)
{
buf.writestring("# define ");
buf.writestringln(content);
}
/// Writes `#include <content>` into the supplied buffer
void hashInclude(ref OutBuffer buf, string content)
{
buf.writestring("#include ");
buf.writestringln(content);
}
/// Determines whether `ident` is a reserved keyword in C++
/// Returns: the kind of keyword or `null`
const(char*) keywordClass(const Identifier ident)
{
if (!ident)
return null;
const name = ident.toString();
switch (name)
{
// C++ operators
case "and":
case "and_eq":
case "bitand":
case "bitor":
case "compl":
case "not":
case "not_eq":
case "or":
case "or_eq":
case "xor":
case "xor_eq":
return "special operator in C++";
// C++ keywords
case "_Complex":
case "const_cast":
case "delete":
case "dynamic_cast":
case "explicit":
case "friend":
case "inline":
case "mutable":
case "namespace":
case "operator":
case "register":
case "reinterpret_cast":
case "signed":
case "static_cast":
case "typedef":
case "typename":
case "unsigned":
case "using":
case "virtual":
case "volatile":
return "keyword in C++";
// Common macros imported by this header
// stddef.h
case "offsetof":
case "NULL":
return "default macro in C++";
// C++11 keywords
case "alignas":
case "alignof":
case "char16_t":
case "char32_t":
case "constexpr":
case "decltype":
case "noexcept":
case "nullptr":
case "static_assert":
case "thread_local":
case "wchar_t":
if (global.params.cplusplus >= CppStdRevision.cpp11)
return "keyword in C++11";
return null;
// C++20 keywords
case "char8_t":
case "consteval":
case "constinit":
// Concepts-related keywords
case "concept":
case "requires":
// Coroutines-related keywords
case "co_await":
case "co_yield":
case "co_return":
if (global.params.cplusplus >= CppStdRevision.cpp20)
return "keyword in C++20";
return null;
default:
// Identifiers starting with __ are reserved
if (name.length >= 2 && name[0..2] == "__")
return "reserved identifier in C++";
return null;
}
}
/// Finds the outermost symbol if `sym` is nested.
/// Returns `sym` if it appears at module scope
ASTCodegen.Dsymbol outermostSymbol(ASTCodegen.Dsymbol sym)
{
assert(sym);
while (true)
{
auto par = sym.toParent();
if (!par || par.isModule())
return sym;
sym = par;
}
}
/// Fetches the symbol for user-defined types from the type `t`
/// if `t` is either `TypeClass`, `TypeStruct` or `TypeEnum`
ASTCodegen.Dsymbol symbolFromType(ASTCodegen.Type t)
{
if (auto tc = t.isTypeClass())
return tc.sym;
if (auto ts = t.isTypeStruct())
return ts.sym;
if (auto te = t.isTypeEnum())
return te.sym;
return null;
}
/**
* Searches `sym` for a member with the given name.
*
* This method usually delegates to `Dsymbol.search` but might also
* manually check the members if the symbol did not receive semantic
* analysis.
*
* Params:
* sym = symbol to search
* name = identifier of the requested symbol
*
* Returns: the symbol or `null` if not found
*/
ASTCodegen.Dsymbol findMember(ASTCodegen.Dsymbol sym, Identifier name)
{
if (auto mem = sym.search(Loc.initial, name, ASTCodegen.IgnoreErrors))
return mem;
// search doesn't work for declarations inside of uninstantiated
// `TemplateDeclaration`s due to the missing symtab.
if (sym.semanticRun >= ASTCodegen.PASS.semanticdone)
return null;
// Manually check the members if present
auto sds = sym.isScopeDsymbol();
if (!sds || !sds.members)
return null;
/// Recursively searches for `name` without entering nested aggregates, ...
static ASTCodegen.Dsymbol search(ASTCodegen.Dsymbols* members, Identifier name)
{
foreach (mem; *members)
{
if (mem.ident == name)
return mem;
// Look inside of private:, ...
if (auto ad = mem.isAttribDeclaration())
{
if (auto s = search(ad.decl, name))
return s;
}
}
return null;
}
return search(sds.members, name);
}
debug (Debug_DtoH)
{
/// Generates code to trace the entry and exit of the enclosing `visit` function
string traceVisit(alias node)()
{
const type = typeof(node).stringof;
const method = __traits(hasMember, node, "toPrettyChars") ? "toPrettyChars" : "toChars";
const arg = __traits(identifier, node) ~ '.' ~ method;
return `printf("[` ~ type ~ ` enter] %s\n", ` ~ arg ~ `());
scope(exit) printf("[` ~ type ~ ` exit] %s\n", ` ~ arg ~ `());`;
}
}
|
D
|
module linkdir;
import vibe.vibe;
import dpq.connection;
import std;
import std.string;
import diet.html;
import std.format;
import std.conv;
import link_tree;
import tag_tree;
import login_manager;
class LinkDirWeb{
private LinkTree tree;
private Connection db;
private LoginManager login_manager;
this(string pgsql_sock_path="/run/postgresql/"){
db = Connection("host="~pgsql_sock_path~" dbname=linkdir user=linkdir");
tree = new LinkTree(db);
login_manager=new LoginManager(db);
}
void getLogin(scope HTTPServerRequest req,scope HTTPServerResponse res){
performBasicAuth(req,res,"Link Dir Realm",&login_manager.pwcheck);
redirect("/");
}
@path("/")
void getIndex(scope HTTPServerRequest req,scope HTTPServerResponse res){
//auto result = db.exec("select * from links;");
auto tagtree = tree.list_tags(0).renderHTML();
/*foreach (row; result)
{
writeln(row["name"].as!string,"\t",row["url"].as!string);
}*/
auto tagsub = tree.list_tags(0).get_subcategories();
auto username = login_manager.getUsername(req,res);
render!("index.dt",tagsub,tagtree,username);
}
@path("/id/:id")
void getTagById(scope HTTPServerRequest req,scope HTTPServerResponse res){
auto id = req.params["id"].to!int;
auto ttree=tree.list_tags(id);
auto tagsub = ttree.get_subcategories();
auto tagtree = ttree.renderHTML();
auto taglinks = tree.list_links(id);
auto tag = tree.get_tag_by_id(id).get(TagTree.Tag(0,"/",0,Nullable!int.init,Nullable!string.init));
auto tagname = tag.name;
auto tagparent = tag.parent;
auto tagsummary = tag.summary;
auto writeperm = login_manager.check_permission(req,res,tree.getId(),PermissionBits.EDIT_TAGS,false);
auto linkperm = login_manager.check_permission(req,res,tree.getId(),PermissionBits.EDIT_LINKS,false);
auto username = login_manager.getUsername(req,res);
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.READ);
render!("tag.dt",id,tagtree,taglinks,tagname,tagsub,tagparent,tagsummary,writeperm,linkperm,username);
}
void getAddTag(scope HTTPServerRequest req,scope HTTPServerResponse res,int parent,string name){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_TAGS);
tree.add_tag(name,parent);
redirect("/");
}
void getRmTag(scope HTTPServerRequest req,scope HTTPServerResponse res,int id){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_TAGS | PermissionBits.EDIT_LINKS);
tree.remove_tag(id);
redirect("/");
}
void getTagLink(scope HTTPServerRequest req,scope HTTPServerResponse res,int tag_id,int link_id){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_TAGS | PermissionBits.EDIT_LINKS);
tree.tag_link(tag_id,link_id);
}
void postAddLink(scope HTTPServerRequest req,scope HTTPServerResponse res){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_LINKS);
string linkname = req.form.get("linkname","");
string linkvalue = req.form.get("linkvalue","");
auto tags = req.form.getAll("tags");
if(linkname.length>0 && !tags.empty()){
if(linkvalue.length){
auto link_id = tree.add_link(linkname,linkvalue);
foreach (tag; tags){
tree.tag_link(tag.to!int,link_id);
}
}
}
res.redirect("/");
}
void getAddLink(scope HTTPServerRequest req,scope HTTPServerResponse res,){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_LINKS);
auto tagtree = tree.list_tags(0).renderHTML((t)=>"<input type='checkbox' name='tags' value='%d'/>".format(t.id));
render!("add_link.dt",tagtree);
}
void getManageTags(scope HTTPServerRequest req,scope HTTPServerResponse res,){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_TAGS);
auto tagtree = tree.list_tags(0).renderHTML((t)=>"<input type='radio' name='tag' value='%d'/>".format(t.id));
render!("manage_tags.dt",tagtree);
}
void postManageTags(scope HTTPServerRequest req,scope HTTPServerResponse res,string action,int tag=0,string name=""){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_TAGS);
if(action == "create" && name.length > 0){
tree.add_tag(name,tag);
}else if(action == "delete"){
tree.remove_tag(tag);
}
redirect("/manage_tags");
}
void getEditLink(scope HTTPServerRequest req,scope HTTPServerResponse res,int id=0){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_LINKS);
auto link_nullable = tree.get_link_by_id(id);
if(link_nullable.isNull()){
redirect("/add_link");
}else{
auto link = link_nullable.get();
auto rbtags = tree.get_link_tags(id);
string checkbox(tag_tree.TagTree.Tag t){
return "<input type='checkbox' name='tags' %s value='%d'/>".format(!rbtags.equalRange(t.id).empty?"checked":"",t.id);
}
auto tagtree = tree.list_tags(0).renderHTML((tag_tree.TagTree.Tag t)=>checkbox(t));
render!("edit_link.dt",tagtree,link);
}
}
void postEditLink(scope HTTPServerRequest req,scope HTTPServerResponse res,
string action,int id,string name,string url,string summary=""){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_LINKS);
if(action == "edit"){
tree.update_link(id,name,url,summary);
auto tags = SList!(int)();
foreach(tag;req.form.getAll("tags")){
tags.insertFront(tag.to!int);
}
tree.set_link_tags(id,tags);
redirect("/edit_link?id="~id.to!string);
}else if(action == "delete"){
tree.remove_link(id);
redirect("/");
}
}
void getSearch(scope HTTPServerRequest req,scope HTTPServerResponse res,string search = ""){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.READ);
auto links = tree.search_links(search);
auto tags = tree.search_tags(search);
render!("search.dt",search,tags,links);
}
void getEditTag(scope HTTPServerRequest req,scope HTTPServerResponse res,int id=0){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_TAGS);
auto tag = tree.get_tag_by_id(id);
if (tag.isNull()){
redirect("/manage_tags");
return;
}else{
render!("edit_tag.dt",tag);
}
}
void postEditTag(scope HTTPServerRequest req,scope HTTPServerResponse res,int id,string summary ){
login_manager.ensure_permission(req,res,tree.getId(), PermissionBits.EDIT_TAGS);
tree.update_tag(id,summary);
redirect("/id/"~id.to!string);
}
void getEditPermissions(scope HTTPServerRequest req,scope HTTPServerResponse res){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_PERMISSIONS);
auto users = login_manager.getUsers();
render!("edit_permissions.dt",users);
}
void postEditPermissions(scope HTTPServerRequest req,scope HTTPServerResponse res,int id,string perms){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_PERMISSIONS);
int[int] perm_bytes;
foreach(entry;perms.split){
auto k = entry.split(':')[0].to!int;
auto v = entry.split(':')[1].to!int;
perm_bytes[k] = v;
}
login_manager.updatePermissions(id,perm_bytes);
redirect("/edit_permissions");
}
void getDeleteUser(scope HTTPServerRequest req,scope HTTPServerResponse res,int id){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_PERMISSIONS);
login_manager.deleteUser(id);
redirect("/edit_permissions");
}
void postCreateUser(scope HTTPServerRequest req,scope HTTPServerResponse res,string username,string password,string email=""){
login_manager.ensure_permission(req,res,tree.getId(),PermissionBits.EDIT_PERMISSIONS);
login_manager.createUser(username,password,email);
redirect("/edit_permissions");
}
}
|
D
|
a burrowing ground squirrel of western America and Asia
|
D
|
void layoutTransaction(void delegate() action) {
action();
}
class Control {
protected void onTextChanged() {}
}
|
D
|
import std.stdio, std.conv, std.exception;
// Our Nodes, or Links inside the linked List
class Node(T) {
T val; // data stored in this node
Node!T prev; // reference to the previous node
Node!T next; // reference to the next node
// Node constructor
this(T data) {
val = data;
}
void display() {
writeln("Value: ", val);
}
}
struct PriorityQueue(T) {
//private
private Node!T head;
private int length;
// Initialize first node to be null
// this() {
// }
// Postblit constructor
// Returns true if stack is empty
bool empty() {
return length == 0;
}
void insert(T data) {
Node!T node = new Node!T(data);
Node!T previousNode = null;
Node!T current = head;
while (current !is null && node.val > current.val) {
previousNode = current;
current = current.next;
}
if (previousNode is null) {
head = node;
}
else {
previousNode.next = node;
}
node.next = current;
++length;
}
T extractMax() {
Node!T node1 = head;
Node!T node2 = head;
enforce(length > 0, "Error: Cannot apply extractMax()--priority queue is empty");
// only one node--it's the max
if (length == 1) {
auto temp = node1.val;
head = null;
--length;
return temp;
}
// Get second to last node
if (length != 1) {
while (node2.next.next !is null) {
node2 = node2.next;
}
}
// Get the last node
while (node1.next !is null) {
node1 = node1.next;
}
// now temp is the max node
auto temp = node1.val;
// save to temp, and get rid of reference
node2.next = null;
--length;
return temp;
}
string toString() {
Node!T node = head;
string result = "";
if (length == 0) return "Empty priority queue";
while(node !is null) {
if (node.next is null) result = to!string(node.val) ~ result;
else result = "\n" ~ to!string(node.val) ~ result;
node = node.next;
}
return result;
}
}
|
D
|
module Windows.ApplicationModel.Contacts.Provider;
import dwinrt;
@uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746")
@WinrtFactory("Windows.ApplicationModel.Contacts.Provider.ContactPickerUI")
interface IContactPickerUI : IInspectable
{
extern(Windows):
deprecated("AddContact may be altered or unavailable for releases after Windows 8.1. Instead, use AddContact without the ID.")
HRESULT abi_AddContact(HSTRING id, Windows.ApplicationModel.Contacts.Contact contact, Windows.ApplicationModel.Contacts.Provider.AddContactResult* return_result);
HRESULT abi_RemoveContact(HSTRING id);
HRESULT abi_ContainsContact(HSTRING id, bool* return_isContained);
deprecated("DesiredFields may be altered or unavailable for releases after Windows 8.1. Instead, use DesiredFieldsWithContactFieldType.")
HRESULT get_DesiredFields(Windows.Foundation.Collections.IVectorView!(HSTRING)* return_value);
HRESULT get_SelectionMode(Windows.ApplicationModel.Contacts.ContactSelectionMode* return_value);
HRESULT add_ContactRemoved(Windows.Foundation.TypedEventHandler!(Windows.ApplicationModel.Contacts.Provider.ContactPickerUI, Windows.ApplicationModel.Contacts.Provider.ContactRemovedEventArgs) handler, EventRegistrationToken* return_token);
HRESULT remove_ContactRemoved(EventRegistrationToken token);
}
@uuid("6e449e28-7b25-4999-9b0b-875400a1e8c8")
@WinrtFactory("Windows.ApplicationModel.Contacts.Provider.ContactPickerUI")
interface IContactPickerUI2 : IInspectable
{
extern(Windows):
HRESULT abi_AddContact(Windows.ApplicationModel.Contacts.Contact contact, Windows.ApplicationModel.Contacts.Provider.AddContactResult* return_result);
HRESULT get_DesiredFieldsWithContactFieldType(Windows.Foundation.Collections.IVector!(Windows.ApplicationModel.Contacts.ContactFieldType)* return_value);
}
@uuid("6f354338-3302-4d13-ad8d-adcc0ff9e47c")
@WinrtFactory("Windows.ApplicationModel.Contacts.Provider.ContactRemovedEventArgs")
interface IContactRemovedEventArgs : IInspectable
{
extern(Windows):
HRESULT get_Id(HSTRING* return_value);
}
interface ContactPickerUI : Windows.ApplicationModel.Contacts.Provider.IContactPickerUI, Windows.ApplicationModel.Contacts.Provider.IContactPickerUI2
{
extern(Windows):
deprecated("AddContact may be altered or unavailable for releases after Windows 8.1. Instead, use AddContact without the ID.")
final Windows.ApplicationModel.Contacts.Provider.AddContactResult AddContact(HSTRING id, Windows.ApplicationModel.Contacts.Contact contact)
{
Windows.ApplicationModel.Contacts.Provider.AddContactResult _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).abi_AddContact(id, contact, &_ret));
return _ret;
}
final void RemoveContact(HSTRING id)
{
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).abi_RemoveContact(id));
}
final bool ContainsContact(HSTRING id)
{
bool _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).abi_ContainsContact(id, &_ret));
return _ret;
}
deprecated("DesiredFields may be altered or unavailable for releases after Windows 8.1. Instead, use DesiredFieldsWithContactFieldType.")
final Windows.Foundation.Collections.IVectorView!(HSTRING) DesiredFields()
{
Windows.Foundation.Collections.IVectorView!(HSTRING) _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).get_DesiredFields(&_ret));
return _ret;
}
final Windows.ApplicationModel.Contacts.ContactSelectionMode SelectionMode()
{
Windows.ApplicationModel.Contacts.ContactSelectionMode _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).get_SelectionMode(&_ret));
return _ret;
}
final EventRegistrationToken OnContactRemoved(void delegate(Windows.ApplicationModel.Contacts.Provider.ContactPickerUI, Windows.ApplicationModel.Contacts.Provider.ContactRemovedEventArgs) fn)
{
EventRegistrationToken tok;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).add_ContactRemoved(event!(Windows.Foundation.TypedEventHandler!(Windows.ApplicationModel.Contacts.Provider.ContactPickerUI, Windows.ApplicationModel.Contacts.Provider.ContactRemovedEventArgs), Windows.ApplicationModel.Contacts.Provider.ContactPickerUI, Windows.ApplicationModel.Contacts.Provider.ContactRemovedEventArgs)(fn), &tok));
return tok;
}
final void removeContactRemoved(EventRegistrationToken token)
{
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI)this.asInterface(uuid("e2cc1366-cf66-43c4-a96a-a5a112db4746"))).remove_ContactRemoved(token));
}
final Windows.ApplicationModel.Contacts.Provider.AddContactResult AddContact(Windows.ApplicationModel.Contacts.Contact contact)
{
Windows.ApplicationModel.Contacts.Provider.AddContactResult _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI2)this.asInterface(uuid("6e449e28-7b25-4999-9b0b-875400a1e8c8"))).abi_AddContact(contact, &_ret));
return _ret;
}
final Windows.Foundation.Collections.IVector!(Windows.ApplicationModel.Contacts.ContactFieldType) DesiredFieldsWithContactFieldType()
{
Windows.Foundation.Collections.IVector!(Windows.ApplicationModel.Contacts.ContactFieldType) _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactPickerUI2)this.asInterface(uuid("6e449e28-7b25-4999-9b0b-875400a1e8c8"))).get_DesiredFieldsWithContactFieldType(&_ret));
return _ret;
}
}
interface ContactRemovedEventArgs : Windows.ApplicationModel.Contacts.Provider.IContactRemovedEventArgs
{
extern(Windows):
final HSTRING Id()
{
HSTRING _ret;
Debug.OK((cast(Windows.ApplicationModel.Contacts.Provider.IContactRemovedEventArgs)this.asInterface(uuid("6f354338-3302-4d13-ad8d-adcc0ff9e47c"))).get_Id(&_ret));
return _ret;
}
}
enum AddContactResult
{
Added = 0,
AlreadyAdded = 1,
Unavailable = 2
}
|
D
|
/Users/burlhazza/Desktop/TestApps/Pokedexv1/Build/Intermediates/Pokedex v1.build/Debug-iphonesimulator/Pokedex v1.build/Objects-normal/x86_64/ViewController.o : /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/ViewController.swift /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/AppDelegate.swift /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/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
/Users/burlhazza/Desktop/TestApps/Pokedexv1/Build/Intermediates/Pokedex v1.build/Debug-iphonesimulator/Pokedex v1.build/Objects-normal/x86_64/ViewController~partial.swiftmodule : /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/ViewController.swift /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/AppDelegate.swift /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/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
/Users/burlhazza/Desktop/TestApps/Pokedexv1/Build/Intermediates/Pokedex v1.build/Debug-iphonesimulator/Pokedex v1.build/Objects-normal/x86_64/ViewController~partial.swiftdoc : /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/ViewController.swift /Users/burlhazza/Desktop/TestApps/Pokedexv1/Pokedex\ v1/AppDelegate.swift /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/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
|
D
|
module dummy;
@safe @nogc public struct Dummy
{
static const int MAX_MEMBER_INT = 3;
int memberInt;
string memberStr;
/*
* Newest version layout:
* in (memberInt > MAX_MEMBER_INT)
* out (; this.memberInt == memberInt)
* out (; this.memberStr == memberStr)
* {
* this.memberInt = memberInt;
* this.memberStr = memberStr;
* }
*/
this(int memberInt, string memberStr) nothrow @safe @nogc
in
{
assert(memberInt > MAX_MEMBER_INT);
}
out
{
assert(this.memberInt == memberInt);
assert(this.memberStr == memberStr);
}
do
{
this.memberInt = memberInt;
this.memberStr = memberStr;
}
int doStuff() pure nothrow @safe @nogc
{
auto result = this.memberInt - 1;
if (result <= MAX_MEMBER_INT)
result = 1 + MAX_MEMBER_INT;
return result;
}
}
|
D
|
import std.stdio;
import std.format;
import std.conv;
import std.algorithm;
import std.array;
import std.string;
import terminal;
import lexer;
int nextId = 0;
enum Primitive
{
U64,
U8,
I64,
Bool,
Auto,
}
class NotFoundException : Exception
{
this(string msg)
{
super(msg);
}
}
interface HasToken
{
Token getToken();
}
mixin template HasTokenDefault()
{
Token token;
override Token getToken()
{
return token;
}
}
string indent(string s)
{
auto lines = map!(l => " " ~ l)(s.splitLines());
return join(lines, "\n");
}
abstract class Type : HasToken
{
mixin HasTokenDefault;
// The number of pointers this represents:
// u64 a -> 0
// u64* a -> 1
// u64** a -> 2
int pointerDepth;
Node elements;
this(int pointerDepth=0, Node elements=null, Token token=null)
{
this.token = token;
this.pointerDepth = pointerDepth;
this.elements = elements;
}
abstract string baseTypeToString();
override string toString()
{
auto ret = this.baseTypeToString();
if (this.elements is null)
{
for (int i = pointerDepth; i > 0; i--)
{
ret ~= "*";
}
}
else
{
ret ~= format("[%s]", this.elements);
}
// TODO: crappy cast hack
if (cast(IncompleteType)this is null)
{
ret = colorGreen(ret);
}
return ret;
}
abstract Type clone();
abstract bool compare(Type other);
abstract bool compatibleWith(Type other);
abstract int baseTypeSize();
// Makes sure the number of elements is known at compile-time
bool isConcrete()
{
return this.elements is null || cast(U64Literal)this.elements !is null;
}
bool isComplete()
{
return cast(IncompleteType)this is null;
}
bool isPrimitive()
{
return cast(PrimitiveType)this !is null;
}
bool isPrimitive(Primitive p)
{
return this.isPrimitive() && (cast(PrimitiveType)this).primitive == p;
}
bool isStruct()
{
return cast(StructType)this !is null;
}
bool isStruct(Struct s)
{
return this.isStruct() && (cast(StructType)this).struct_ == s;
}
}
// A type where the base type (u64 or a struct name) is still a string and has
// not yet been parsed or linked up to the AST.
class IncompleteType : Type
{
string moduleName;
string name;
Type[] typeParameters;
this(string name, Type[] typeParameters, int pointerDepth=0,
Node elements=null, string moduleName=null, Token token=null)
{
super(pointerDepth=pointerDepth, elements=elements, token=token);
this.name = name;
this.typeParameters = typeParameters;
this.moduleName = moduleName;
}
override string baseTypeToString()
{
return this.name;
}
override string toString()
{
string typeParams = "";
foreach (t; this.typeParameters)
{
if (typeParams != "")
{
typeParams ~= ", ";
}
typeParams ~= t.toString();
}
if (typeParams != "")
{
typeParams = "<" ~ typeParams ~ ">";
}
string mod = "";
if (this.moduleName !is null)
{
mod = moduleName ~ "::";
}
return colorYellow(
format("%s%s%s", mod, super.toString(), typeParams));
}
override Type clone()
{
return new IncompleteType(this.name, this.typeParameters,
pointerDepth=this.pointerDepth, elements=this.elements,
moduleName=this.moduleName, token=this.token);
}
override bool compare(Type other)
{
throw new Exception("Cannot compare incomplete types");
}
override bool compatibleWith(Type other)
{
throw new Exception(
"Incomplete types are not compatible with anything");
}
override int baseTypeSize()
{
throw new Exception(format(
"Incomplete type (%s) has no known base type size", this));
}
}
class StructType : Type
{
Struct struct_;
this(Struct struct_, int pointerDepth=0, Node elements=null,
Token token=null)
{
super(pointerDepth=pointerDepth, elements=elements, token=token);
this.struct_ = struct_;
}
override string baseTypeToString()
{
return to!string(this.struct_.name);
}
override Type clone()
{
return new StructType(this.struct_, pointerDepth=this.pointerDepth,
elements=this.elements, token=this.token);
}
override bool compare(Type other)
{
return other.isStruct(this.struct_);
}
override bool compatibleWith(Type other)
{
throw new Exception("Structs aren't compatible with other types");
}
override int baseTypeSize()
{
if (this.pointerDepth > 0)
{
return 8;
}
auto ret = 0;
foreach (member; this.struct_.members)
{
ret += member.type.baseTypeSize();
}
return ret;
}
}
class VoidType : Type
{
this(Token token = null)
{
super(pointerDepth=0, elements=null, token=token);
}
override string baseTypeToString()
{
return "void";
}
override Type clone()
{
return new VoidType();
}
override bool compare(Type other)
{
return cast(VoidType)other !is null;
}
override bool compatibleWith(Type other)
{
return this.compare(other);
}
override int baseTypeSize()
{
throw new Exception("void has no size");
}
}
class PrimitiveType : Type
{
Primitive primitive;
this(Primitive primitive, int pointerDepth=0, Node elements=null,
Token token=null)
{
super(pointerDepth=pointerDepth, elements=elements, token=token);
this.primitive = primitive;
}
override string baseTypeToString()
{
return primitiveToString(this.primitive);
}
override Type clone()
{
return new PrimitiveType(this.primitive,
pointerDepth=this.pointerDepth, elements=this.elements,
token=this.token);
}
override bool compare(Type other)
{
if (!this.isComplete() || !other.isComplete())
{
throw new Exception("Can't compare incomplete types");
}
auto otherPrimitive = cast(PrimitiveType)other;
if (otherPrimitive is null)
{
return false;
}
return this.primitive == otherPrimitive.primitive &&
this.pointerDepth == otherPrimitive.pointerDepth &&
this.elements == otherPrimitive.elements; // TODO: value-compare
// node?
}
// TODO: maybe compare should depend on compatibleWith instead of the
// other way around.
override bool compatibleWith(Type other)
{
if (!this.isComplete() || !other.isComplete())
{
throw new Exception("Can't compare incomplete types");
}
auto otherPrimitive = cast(PrimitiveType)other;
if (otherPrimitive is null)
{
return false;
}
return this.compare(other) ||
this.primitive == Primitive.U64 && other.pointerDepth > 0 ||
this.primitive == Primitive.Auto ||
otherPrimitive.primitive == Primitive.Auto ||
this.pointerDepth > 0 &&
otherPrimitive.primitive == Primitive.U64;
}
override int baseTypeSize()
{
if (this.pointerDepth > 0 && this.elements is null)
{
return 8;
}
return primitiveSize(this.primitive);
}
}
int primitiveSize(Primitive t)
{
switch (t)
{
case Primitive.U64:
case Primitive.I64:
return 8;
case Primitive.Bool:
case Primitive.U8:
return 1;
case Primitive.Auto:
throw new Exception("Auto type has no size");
default:
throw new Exception(format("Unknown size for %s", t));
}
}
Primitive parsePrimitive(string s)
{
switch (s)
{
case "u64":
return Primitive.U64;
case "u8":
return Primitive.U8;
case "i64":
return Primitive.I64;
case "bool":
return Primitive.Bool;
case "auto":
return Primitive.Auto;
default:
throw new Exception(format("Unrecognized type: %s", s));
}
}
string primitiveToString(Primitive p)
{
switch (p)
{
case Primitive.U64:
return "u64";
case Primitive.U8:
return "u8";
case Primitive.I64:
return "i64";
case Primitive.Bool:
return "bool";
case Primitive.Auto:
return "auto";
default:
throw new Exception(format("Unrecognized primitive: %s", p));
}
}
interface InsideFunction
{
FunctionSignature containingFunction();
}
abstract class Node : InsideFunction
{
Token token;
Type type;
InsideFunction parent;
// TODO: this sucks, shouldn't need this.
string tag;
Node[] childNodes()
{
return [];
}
// Called when a descendant node has been changed or its type has been
// completed to trigger a walk up the tree changing any ancestor types.
void retype()
{
auto parentNode = cast(Node)this.parent;
if (parentNode !is null)
{
parentNode.retype();
}
}
FunctionSignature containingFunction()
{
if (this.parent is null)
{
return null;
}
return this.parent.containingFunction();
}
Node clone()
{
throw new Exception("No clone() implementation for this Node");
}
// Walk the tree replacing template type parameters with the given
// actual types.
void templateReplace(TypeParameter[] params, Type[] types)
{
foreach (c; this.childNodes())
{
c.templateReplace(params, types);
}
}
}
enum OperatorType
{
Plus,
Minus,
Divide,
Multiply,
Modulo,
Equality,
Inequality,
GreaterThan,
GreaterThanOrEqual,
LessThan,
LessThanOrEqual,
LogicalAnd,
LogicalOr,
DotAccessor,
LeftShift,
RightShift,
BitwiseAnd,
Reference,
Dereference,
}
enum OperatorClass
{
Math,
Relational,
Logical
}
OperatorClass operatorTypeToClass(OperatorType t)
{
switch (t)
{
case OperatorType.Plus:
case OperatorType.Minus:
case OperatorType.Multiply:
case OperatorType.Divide:
case OperatorType.Modulo:
case OperatorType.LeftShift:
case OperatorType.RightShift:
case OperatorType.BitwiseAnd:
return OperatorClass.Math;
case OperatorType.Equality:
case OperatorType.Inequality:
case OperatorType.GreaterThan:
case OperatorType.GreaterThanOrEqual:
case OperatorType.LessThan:
case OperatorType.LessThanOrEqual:
return OperatorClass.Relational;
case OperatorType.LogicalAnd:
case OperatorType.LogicalOr:
return OperatorClass.Logical;
default:
throw new Exception(format("Unrecognized OperatorType: %s", t));
}
}
string operatorTypeToString(OperatorType t)
{
switch (t)
{
case OperatorType.Plus:
return "+";
case OperatorType.Minus:
return "-";
case OperatorType.Divide:
return "/";
case OperatorType.Multiply:
return "*";
case OperatorType.Modulo:
return "%";
case OperatorType.Equality:
return "==";
case OperatorType.Inequality:
return "!=";
case OperatorType.GreaterThan:
return ">";
case OperatorType.GreaterThanOrEqual:
return ">=";
case OperatorType.LessThan:
return "<";
case OperatorType.LessThanOrEqual:
return "<=";
case OperatorType.LogicalAnd:
return "&&";
case OperatorType.LogicalOr:
return "||";
case OperatorType.DotAccessor:
return ".";
case OperatorType.LeftShift:
return "<<";
case OperatorType.RightShift:
return ">>";
case OperatorType.BitwiseAnd:
return "&";
case OperatorType.Dereference:
return "*";
default:
throw new Exception(format("Unrecognized OperatorType: %s", t));
}
}
class Operator : Node
{
OperatorType operatorType;
Node left;
Node right;
this(Node left, OperatorType operatorType, Node right)
{
this.operatorType = operatorType;
this.left = left;
this.right = right;
this.left.parent = this;
this.right.parent = this;
this.retype();
}
override Node clone()
{
return new Operator(this.left.clone(), this.operatorType,
this.right.clone());
}
override void retype()
{
if (this.left.type is null || this.right.type is null ||
!this.left.type.isComplete() || !this.right.type.isComplete())
{
return;
}
switch (operatorTypeToClass(this.operatorType))
{
case OperatorClass.Math:
if (!this.left.type.compatibleWith(this.right.type))
{
throw new Exception(format("Can't combine types %s and %s",
this.left.type, this.right.type));
}
this.type = this.left.type;
break;
case OperatorClass.Relational:
case OperatorClass.Logical:
this.type = new PrimitiveType(Primitive.Bool);
break;
default:
throw new Exception(format("Unrecognized type %s",
operatorType));
}
super.retype();
}
override string toString()
{
return format("(%s %s %s)", left, operatorTypeToString(operatorType),
right);
}
override Node[] childNodes()
{
return [left, right];
}
}
class Binding : Node
{
string name;
TypeSignature local;
this(TypeSignature local, string name)
{
this.local = local;
this.name = name;
this.retype();
}
override Node clone()
{
return new Binding(this.local !is null ? this.local.clone() : null,
this.name);
}
override void retype()
{
if (this.local is null)
{
return;
}
this.type = this.local.type;
super.retype();
}
override string toString()
{
return this.name;
}
}
abstract class Literal : Node
{
this(PrimitiveType type)
{
this.type = type;
}
}
class U64Literal : Literal
{
ulong value;
this(ulong value)
{
super(new PrimitiveType(Primitive.U64));
this.value = value;
}
override Node clone()
{
return new U64Literal(this.value);
}
override string toString()
{
return to!string(this.value);
}
}
class U8Literal : Literal
{
ubyte value;
this(ubyte value)
{
super(new PrimitiveType(Primitive.U8));
this.value = value;
}
override Node clone()
{
return new U8Literal(this.value);
}
override string toString()
{
return to!string(this.value);
}
}
class I64Literal : Literal
{
long value;
this(long value)
{
super(new PrimitiveType(Primitive.I64));
this.value = value;
}
override Node clone()
{
return new I64Literal(this.value);
}
override string toString()
{
return to!string(this.value);
}
}
class BoolLiteral : Literal
{
bool value;
this(bool value)
{
super(new PrimitiveType(Primitive.Bool));
this.value = value;
}
override Node clone()
{
return new BoolLiteral(this.value);
}
override string toString()
{
return to!string(this.value);
}
}
class StringLiteral : Literal
{
string value;
this(string value)
{
auto type = new PrimitiveType(Primitive.U8);
type.pointerDepth = 1;
super(type);
this.value = value;
}
override Node clone()
{
return new StringLiteral(this.value);
}
override string toString()
{
return format("\"%s\"", this.value.replace("\n", "\\n"));
}
}
class SizeOf : Node
{
Type argument;
this(Type argument)
{
this.argument = argument;
this.type = new PrimitiveType(Primitive.U64);
}
override Node clone()
{
return new SizeOf(this.argument.clone());
}
override string toString()
{
return format("sizeof(%s)", this.argument);
}
override void templateReplace(TypeParameter[] params, Type[] types)
{
super.templateReplace(params, types);
this.argument = replaceTypeParameter(this.argument, params, types);
}
}
class Call : Node
{
// TODO: doesn't apply to MethodCall
string moduleName;
string functionName;
Node[] parameters;
FunctionSignature targetSignature;
Type[] typeParameters;
this(string moduleName, string functionName, Type[] typeParameters,
Node[] parameters)
{
this.moduleName = moduleName;
this.functionName = functionName;
this.typeParameters = typeParameters;
this.parameters = parameters;
foreach (param; this.parameters)
{
param.parent = this;
}
}
override Node clone()
{
Node[] params;
foreach (p; this.parameters)
{
params ~= p.clone();
}
Type[] typeParams;
foreach (t; this.typeParameters)
{
typeParams ~= t.clone();
}
return new Call(moduleName, functionName, typeParams, params);
}
override void retype()
{
if (this.targetSignature is null)
{
return;
}
this.type = this.targetSignature.returnType;
super.retype();
}
override string toString()
{
auto moduleName = "";
if (this.moduleName !is null)
{
moduleName = this.moduleName ~ "::";
}
auto typeParams = "";
if (this.typeParameters.length > 0)
{
foreach (typeParam; this.typeParameters)
{
if (typeParams != "")
{
typeParams ~= ", ";
}
typeParams ~= typeParam.toString();
}
typeParams = "<" ~ typeParams ~ ">";
}
string[] params;
foreach (p; parameters)
{
params ~= p.toString();
}
return format("%s%s%s(%s)", moduleName, this.functionName,
typeParams, join(params, ", "));
}
override Node[] childNodes()
{
return this.parameters;
}
}
class MethodCall : Call
{
Node container;
this(Node container, string functionName, Node[] parameters)
{
super(null, functionName, [], parameters);
this.container = container;
this.container.parent = this;
}
override Node clone()
{
Node[] params;
foreach (p; this.parameters)
{
params ~= p.clone();
}
return new MethodCall(this.container.clone(), this.functionName,
params);
}
override string toString()
{
return format("%s.%s", this.container, super.toString());
}
override Node[] childNodes()
{
auto ret = super.childNodes();
// Add container if it isn't already a parameter
bool found = false;
foreach (r; ret)
{
if (r == this.container)
{
found = true;
break;
}
}
if (!found)
{
ret ~= this.container;
}
return ret;
}
@property MethodSignature methodSignature()
{
if (this.targetSignature is null)
{
return null;
}
auto ret = cast(MethodSignature)this.targetSignature;
if (ret is null)
{
throw new Exception(format(
"MethodCall has a bad target %s", this));
}
return ret;
}
@property MethodSignature methodSignature(MethodSignature sig)
{
this.targetSignature = sig;
return this.methodSignature;
}
}
class Cast : Node
{
Node target;
this(Type newType, Node target)
{
if (target !is null)
{
this.target = target;
this.target.parent = this;
}
this.type = newType;
}
override Node clone()
{
return new Cast(this.type.clone(), this.target.clone());
}
override string toString()
{
return format("(%s)%s", this.type, this.target);
}
override Node[] childNodes()
{
return [this.target];
}
}
class Reference : Node
{
Node source;
this(Node source)
{
this.source = source;
this.source.parent = this;
this.retype();
}
override Node clone()
{
return new Reference(this.source.clone());
}
override void retype()
{
if (this.source.type is null)
{
return;
}
this.type = this.source.type.clone();
// Array decays into pointer
if (this.type.elements !is null)
{
this.type.elements = null;
}
// Pointer becomes pointer to pointer
else
{
this.type.pointerDepth++;
}
super.retype();
}
override string toString()
{
return format("&%s", this.source);
}
override Node[] childNodes()
{
return [this.source];
}
}
class Dereference : Node
{
Node source;
this(Node source)
{
this.source = source;
this.source.parent = this;
this.retype();
}
override Node clone()
{
return new Dereference(this.source.clone());
}
override void retype()
{
if (this.source.type is null)
{
return;
}
this.type = this.source.type.clone();
this.type.pointerDepth--;
super.retype();
}
override string toString()
{
return format("*%s", this.source);
}
override Node[] childNodes()
{
return [this.source];
}
}
class DotAccessor : Node
{
Node container;
string memberName;
TypeSignature member;
this(Node container, string memberName)
{
this.container = container;
this.memberName = memberName;
this.container.parent = this;
this.retype();
}
override Node clone()
{
auto ret = new DotAccessor(this.container.clone(), this.memberName);
if (this.member !is null)
{
ret.member = this.member.clone();
}
return ret;
}
override string toString()
{
return format("(%s.%s)", container, memberName);
}
override void retype()
{
if (this.container.type is null || !this.container.type.isComplete())
{
return;
}
auto containerStruct = cast(StructType)this.container.type;
if (containerStruct is null)
{
throw new Exception("Dot accessor with non-struct container");
}
// Look up struct member
this.member = null;
foreach (m; containerStruct.struct_.members)
{
if (m.name == this.memberName)
{
this.member = m;
}
}
if (this.member is null)
{
throw new Exception(format("Can't find member %s",
this.memberName));
}
this.type = this.member.type;
super.retype();
}
override Node[] childNodes()
{
return [this.container];
}
}
class TypeSignature
{
Type type;
string name;
this(Type type, string name)
{
this.type = type;
this.name = name;
}
override string toString()
{
return format("%s %s", this.type, this.name);
}
TypeSignature clone()
{
return new TypeSignature(this.type.clone(), this.name);
}
}
class Struct
{
string name;
TypeSignature[] members;
Method[] methods;
// Whether this struct (and all of its methods) is available for import
// by other modules.
bool exported;
this(string name, TypeSignature[] members, bool exported=false)
{
this.name = name;
this.members = members;
this.exported = exported;
}
override string toString()
{
string ret = exported ? "export " : "";
ret ~= "struct " ~ this.name ~ "\n";
ret ~= "{\n";
foreach (member; this.members)
{
ret ~= indent(member.toString()) ~ ";\n";
}
ret ~= "}\n";
foreach (method; this.methods)
{
ret ~= method.toString();
}
return ret;
}
// TODO: pretty copypasta, unify methods with functions
MethodSignature findMethod(MethodCall call)
{
MethodSignature[] candidates;
foreach (method; this.methods)
{
if (method.methodSignature.name == call.functionName)
{
candidates ~= method.methodSignature;
}
}
foreach (c; candidates)
{
if (matchFunctionToCall(c, call))
{
return c;
}
}
throw new Exception(format("Method %s not found", call));
}
}
class StructRendering
{
StructTemplate structTemplate;
Struct rendering;
Type[] typeParameters;
this(StructTemplate structTemplate, Struct rendering,
Type[] typeParameters)
{
this.structTemplate = structTemplate;
this.rendering = rendering;
this.typeParameters = typeParameters;
}
Method renderMethod(Method original)
{
FunctionSignature signature;
Block block;
renderAsTemplate(this.structTemplate.typeParameters,
this.typeParameters, original.signature, original.block,
signature, block);
auto methodSig = cast(MethodSignature)signature;
if (methodSig is null)
{
throw new Exception("Rendered signature is wrong type");
}
methodSig.containerType = new StructType(this.rendering);
return new Method(methodSig, block);
}
}
class StructTemplate : Struct
{
TypeParameter[] typeParameters;
StructRendering[] renderings;
this(string name, TypeParameter[] typeParameters, TypeSignature[] members,
bool exported=false)
{
super(name, members, exported=exported);
this.typeParameters = typeParameters;
}
override string toString()
{
return "template " ~ super.toString();
}
StructRendering render(Type[] types)
{
// Mangle the name
auto name = "template_" ~ this.name;
foreach (t; types)
{
name ~= "_" ~ templateTypeName(t);
}
// Replace type parameter names in members
TypeSignature[] members;
foreach (member; this.members)
{
auto cloned = member.clone();
cloned.type = replaceTypeParameter(cloned.type,
this.typeParameters, types);
members ~= cloned;
}
auto ret = new StructRendering(this, new Struct(name, members), types);
this.renderings ~= ret;
return ret;
}
}
abstract class StatementBase : InsideFunction
{
Token token;
InsideFunction parent;
int id;
this(Token token)
{
this.token = token;
this.id = nextId++;
}
StatementBase clone();
LocalDeclaration[] declarations()
{
return [];
}
StatementBase[] childStatements()
{
return [];
}
Node[] childNodes()
{
return [];
}
FunctionSignature containingFunction()
{
if (parent is null)
{
return null;
}
return parent.containingFunction();
}
While containingWhile()
{
auto parentWhile = cast(While)parent;
if (parentWhile !is null)
{
return parentWhile;
}
auto parentStatementBase = cast(StatementBase)parent;
if (parentStatementBase !is null)
{
return parentStatementBase.containingWhile();
}
return null;
}
// Walk the tree replacing template type parameters with the given
// actual types.
void templateReplace(TypeParameter[] params, Type[] types)
{
foreach (c; this.childStatements())
{
c.templateReplace(params, types);
}
foreach (c; this.childNodes())
{
c.templateReplace(params, types);
}
}
}
class Indexer : Node
{
Node source;
Node index;
this(Node source, Node index)
{
this.source = source;
this.index = index;
this.source.parent = this;
this.index.parent = this;
this.retype();
}
override Node clone()
{
return new Indexer(this.source.clone(), this.index.clone());
}
override void retype()
{
if (this.source.type is null)
{
return;
}
this.type = this.source.type.clone();
this.type.pointerDepth--;
this.type.elements = null;
super.retype();
}
override string toString()
{
return format("%s[%s]", this.source, this.index);
}
override Node[] childNodes()
{
return [this.source, this.index];
}
}
class Statement : StatementBase
{
Node expression;
this(Token token, Node expression)
{
super(token);
this.expression = expression;
if (this.expression !is null)
{
this.expression.parent = this;
}
}
override StatementBase clone()
{
return new Statement(this.token, this.expression.clone());
}
override string toString()
{
return expression.toString();
}
override Node[] childNodes()
{
if (this.expression is null)
{
return [];
}
else
{
return [this.expression];
}
}
}
class LocalDeclaration : StatementBase
{
TypeSignature signature;
Node value;
this(Token token, TypeSignature signature, Node value)
{
super(token);
this.signature = signature;
this.value = value;
if (this.value !is null)
{
this.value.parent = this;
}
}
override StatementBase clone()
{
return new LocalDeclaration(this.token, this.signature.clone(),
this.value is null ? null : this.value.clone());
}
override string toString()
{
const string assignment =
this.value !is null ? " = " ~ this.value.toString() : "";
return format("%s%s;", signature, assignment);
}
override LocalDeclaration[] declarations()
{
return [this];
}
override Node[] childNodes()
{
if (this.value is null)
{
return [];
}
else
{
return [this.value];
}
}
// Walk the tree replacing template type parameters with the given
// actual types.
override void templateReplace(TypeParameter[] params, Type[] types)
{
super.templateReplace(params, types);
this.signature.type = replaceTypeParameter(this.signature.type, params,
types);
}
}
class Assignment : StatementBase
{
Node lvalue;
Node value;
this(Token token, Node lvalue, Node value)
{
super(token);
this.lvalue = lvalue;
this.value = value;
this.lvalue.parent = this;
this.value.parent = this;
}
override StatementBase clone()
{
return new Assignment(this.token, this.lvalue.clone(),
this.value.clone());
}
override string toString()
{
return format("%s = %s;", this.lvalue, this.value);
}
override Node[] childNodes()
{
return [this.lvalue, this.value];
}
}
class Break : StatementBase
{
this(Token token)
{
super(token);
}
override StatementBase clone()
{
return new Break(this.token);
}
override string toString()
{
return "break";
}
}
class Continue : StatementBase
{
this(Token token)
{
super(token);
}
override StatementBase clone()
{
return new Continue(this.token);
}
override string toString()
{
return "continue";
}
}
class Defer : StatementBase
{
StatementBase statement;
this(Token token, StatementBase statement)
{
super(token);
this.statement = statement;
this.statement.parent = this;
}
override StatementBase clone()
{
return new Defer(this.token, this.statement.clone());
}
override string toString()
{
return format("defer %s", this.statement);
}
override StatementBase[] childStatements()
{
return [this.statement];
}
}
class ConditionalBlock : StatementBase
{
Node conditional;
StatementBase block;
this(Token token, Node conditional, StatementBase block)
{
super(token);
this.conditional = conditional;
this.block = block;
this.conditional.parent = this;
this.block.parent = this;
}
override StatementBase clone()
{
return new ConditionalBlock(this.token, this.conditional.clone(),
this.block.clone());
}
override string toString()
{
return format("%s\n%s", this.conditional, this.block);
}
override LocalDeclaration[] declarations()
{
return block.declarations();
}
override StatementBase[] childStatements()
{
return [this.block];
}
override Node[] childNodes()
{
return [this.conditional];
}
}
class While : ConditionalBlock
{
this(Token token, Node conditional, StatementBase block)
{
super(token, conditional, block);
}
override StatementBase clone()
{
return new While(this.token, this.conditional.clone(),
this.block.clone());
}
override string toString()
{
return format("while %s", super.toString());
}
string startLabel()
{
return format("while_start_%d", this.id);
}
string endLabel()
{
return format("while_end_%d", this.id);
}
}
class If : StatementBase
{
ConditionalBlock ifBlock;
ConditionalBlock[] elseIfBlocks;
StatementBase elseBlock;
this(Token token, ConditionalBlock ifBlock,
ConditionalBlock[] elseIfBlocks, StatementBase elseBlock)
{
super(token);
this.ifBlock = ifBlock;
this.elseIfBlocks = elseIfBlocks;
this.elseBlock = elseBlock;
this.ifBlock.parent = this;
foreach (elseIf; this.elseIfBlocks)
{
elseIf.parent = this;
}
if (this.elseBlock !is null)
{
this.elseBlock.parent = this;
}
}
override StatementBase clone()
{
ConditionalBlock ifBlock = cast(ConditionalBlock)this.ifBlock.clone();
if (ifBlock is null)
{
throw new Exception("Clone failed");
}
ConditionalBlock[] elseIfs;
foreach (e; this.elseIfBlocks)
{
ConditionalBlock cloned = cast(ConditionalBlock)e.clone();
if (cloned is null)
{
throw new Exception("Clone failed");
}
elseIfs ~= cloned;
}
auto elseBlock = this.elseBlock !is null ? this.elseBlock.clone() :
this.elseBlock;
return new If(this.token, ifBlock, elseIfs, elseBlock);
}
override string toString()
{
auto ret = format("if %s\n%s", this.ifBlock.conditional,
this.ifBlock.block);
foreach (elseIf; this.elseIfBlocks)
{
ret ~= format("else if %s\n%s", elseIf.conditional, elseIf.block);
}
if (this.elseBlock !is null)
{
ret ~= format("else\n%s", this.elseBlock);
}
return ret;
}
override LocalDeclaration[] declarations()
{
LocalDeclaration[] ret = this.ifBlock.declarations();
foreach (elseIf; this.elseIfBlocks)
{
ret ~= elseIf.declarations();
}
if (this.elseBlock !is null)
{
ret ~= this.elseBlock.declarations();
}
return ret;
}
override StatementBase[] childStatements()
{
StatementBase[] ret = [this.ifBlock];
ret ~= this.elseIfBlocks;
if (this.elseBlock !is null)
{
ret ~= this.elseBlock;
}
return ret;
}
}
class Return : StatementBase
{
Node expression;
this(Token token, Node expression)
{
super(token);
this.expression = expression;
if (this.expression !is null)
{
this.expression.parent = this;
}
}
override StatementBase clone()
{
return new Return(this.token, this.expression.clone());
}
override string toString()
{
return format("return %s;", this.expression);
}
override Node[] childNodes()
{
if (this.expression is null)
{
return [];
}
else
{
return [this.expression];
}
}
}
class Block : StatementBase
{
StatementBase[] statements;
this(StatementBase[] statements)
{
super(null);
this.statements = statements;
foreach (st; this.statements)
{
st.parent = this;
}
}
override StatementBase clone()
{
StatementBase[] st;
foreach (s; this.statements)
{
st ~= s.clone();
}
return new Block(st);
}
override string toString()
{
auto ret = "{\n";
foreach (statement; this.statements)
{
ret ~= indent(statement.toString()) ~ "\n";
}
return ret ~ "}\n";
}
override LocalDeclaration[] declarations()
{
LocalDeclaration[] ret;
foreach (statement; this.statements)
{
ret ~= statement.declarations();
}
return ret;
}
override StatementBase[] childStatements()
{
return this.statements;
}
}
class TypeParameter
{
string name;
this(string name)
{
this.name = name;
}
override string toString()
{
return this.name;
}
}
class FunctionSignature
{
Module mod;
Type returnType;
string name;
TypeSignature[] parameters;
bool variadic;
// Whether the function is available for import by other modules
bool exported;
// For generating return variables and other things that can't clash within
// a function.
int nextGeneratedIndex;
// Whether this function is overloaded elsewhere
bool overloaded;
this(Type returnType, string name, TypeSignature[] parameters,
bool variadic, bool exported=false)
{
this.returnType = returnType;
this.name = name;
this.parameters = parameters;
this.variadic = variadic;
this.exported = exported;
this.nextGeneratedIndex = 0;
this.overloaded = false;
}
FunctionSignature clone()
{
TypeSignature[] params;
foreach (p; this.parameters)
{
params ~= p.clone();
}
auto ret = new FunctionSignature(this.returnType.clone(), this.name,
params, this.variadic);
ret.mod = this.mod;
return ret;
}
string fullName()
{
return this.name;
}
override string toString()
{
string ret = returnType.toString() ~ " " ~ this.fullName();
// Parameters
string[] params;
foreach (p; parameters)
{
params ~= p.toString();
}
if (variadic)
{
params ~= "...";
}
return ret ~ "(" ~ join(params, ", ") ~ ")";
}
}
class MethodSignature : FunctionSignature
{
Type containerType;
this(Type returnType, Type containerType, string methodName,
TypeSignature[] parameters, bool variadic)
{
super(returnType, methodName, parameters, variadic);
this.containerType = containerType;
}
override string fullName()
{
return format("%s::%s", this.containerType, this.name);
}
bool matchMethodCall(MethodCall call)
{
return call.container.type.compare(this.containerType) &&
call.functionName == this.name;
}
override FunctionSignature clone()
{
TypeSignature[] params;
foreach (p; this.parameters)
{
params ~= p.clone();
}
auto ret = new MethodSignature(this.returnType.clone(),
this.containerType.clone(), this.name, params, this.variadic);
ret.mod = this.mod;
return ret;
}
}
class Function : InsideFunction
{
FunctionSignature signature;
Block block;
this(FunctionSignature signature, Block block)
{
this.signature = signature;
this.block = block;
this.block.parent = this;
}
override string toString()
{
return format("%s\n%s", this.signature, this.block);
}
FunctionSignature containingFunction()
{
return this.signature;
}
}
class FunctionRendering
{
FunctionTemplate functionTemplate;
Function rendering;
Type[] typeParameters;
this(FunctionTemplate functionTemplate, Function rendering,
Type[] typeParameters)
{
this.functionTemplate = functionTemplate;
this.rendering = rendering;
this.typeParameters = typeParameters;
}
}
Type replaceTypeParameter(Type type, TypeParameter[] params,
Type[] replacements)
{
if (params.length != replacements.length)
{
throw new Exception("Type parameter count mismatch");
}
auto incomplete = cast(IncompleteType)type;
if (incomplete is null)
{
return type;
}
if (incomplete.typeParameters.length > 0)
{
throw new Exception("Not implemented");
}
for (int i = 0; i < params.length; i++)
{
if (incomplete.name == params[i].name)
{
auto ret = replacements[i].clone();
ret.pointerDepth += type.pointerDepth;
return ret;
}
}
return type;
}
// Get the name of a type for use in function name mangling for templates
string templateTypeName(Type t)
{
string ret = t.baseTypeToString();
for (int i = 0; i < t.pointerDepth; i++)
{
ret ~= "p";
}
return ret;
}
string templateName(string name, Type[] types)
{
auto ret = "template_" ~ name;
foreach (t; types)
{
ret ~= "_" ~ templateTypeName(t);
}
return ret;
}
// TODO: make this part of FunctionTemplate or something? The problem is
// method templates need this functionality but there isn't really a
// MethodTemplate object, just a StuctTemplate.
void renderAsTemplate(TypeParameter[] typeParams, Type[] types,
FunctionSignature originalSignature, StatementBase originalBlock,
out FunctionSignature signature, out Block block)
{
signature = originalSignature.clone();
signature.name = templateName(signature.name, types);
signature.returnType = replaceTypeParameter(signature.returnType,
typeParams, types);
foreach (p; signature.parameters)
{
p.type = replaceTypeParameter(p.type, typeParams, types);
}
block = cast(Block)originalBlock.clone();
if (block is null)
{
throw new Exception("Clone failure");
}
block.templateReplace(typeParams, types);
}
class FunctionTemplate : Function
{
TypeParameter[] typeParameters;
FunctionRendering[] renderings;
this(FunctionSignature signature, Block block,
TypeParameter[] typeParameters)
{
super(signature, block);
this.typeParameters = typeParameters;
this.renderings = [];
}
FunctionRendering render(Type[] types)
{
FunctionSignature signature;
Block block;
renderAsTemplate(this.typeParameters, types, this.signature,
this.block, signature, block);
return new FunctionRendering(this, new Function(signature, block),
types);
}
}
class Method : Function
{
this(MethodSignature signature, Block block)
{
super(signature, block);
}
@property MethodSignature methodSignature()
{
if (this.signature is null)
{
return null;
}
auto ret = cast(MethodSignature)this.signature;
if (ret is null)
{
throw new Exception(format("Method has a bad signature %s", this));
}
return ret;
}
@property MethodSignature methodSignature(MethodSignature sig)
{
this.signature = sig;
return this.methodSignature;
}
}
class Import
{
string filename;
string name;
FunctionSignature[] functions;
FunctionTemplate[] functionTemplates;
Struct[] structs;
StructTemplate[] structTemplates;
// Unqualified imports do not require a module name and scope operator to
// references their exports
bool unqualified;
this(string filename, string name, FunctionSignature[] functions,
FunctionTemplate[] functionTemplates, Struct[] structs,
StructTemplate[] structTemplates, bool unqualified=false)
{
this.filename = filename;
this.name = name;
this.functions = functions;
this.functionTemplates = functionTemplates;
this.structs = structs;
this.structTemplates = structTemplates;
this.unqualified = unqualified;
}
override string toString()
{
return format("import %s;", this.name);
}
FunctionSignature[] findFunctions(string name)
{
FunctionSignature[] ret;
foreach (func; this.functions)
{
if (func.name == name)
{
ret ~= func;
}
}
return ret;
}
}
class Global
{
TypeSignature signature;
Node value;
this(TypeSignature signature, Node value)
{
this.signature = signature;
this.value = value;
}
override string toString()
{
if (this.value is null)
{
return this.signature.toString();
}
else
{
return format("%s = %s", this.signature, this.value);
}
}
}
bool matchFunctionToCall(FunctionSignature func, Call call)
{
if (func.name != call.functionName)
{
return false;
}
bool isMethod = cast(MethodSignature)func !is null;
// Validate arguments
TypeSignature[] funcParams;
for (auto i = 0; i < func.parameters.length; i++)
{
// Skip the first parameter if this is a method call and this has been
// injected
if (isMethod && i == 0 && func.parameters[i].name == "this")
{
continue;
}
funcParams ~= func.parameters[i];
}
Node[] callArgs;
foreach (p; call.parameters)
{
callArgs ~= p;
if (func.variadic && callArgs.length >= func.parameters.length)
{
break;
}
}
if (funcParams.length != callArgs.length)
{
return false;
}
for (auto i = 0; i < callArgs.length; i++)
{
if (!funcParams[i].type.compare(callArgs[i].type))
{
return false;
}
}
return true;
}
class Module
{
string name;
Import[] imports;
Struct[] structs;
StructTemplate[] structTemplates;
Function[] functions;
Global[] globals;
FunctionSignature[] externs;
this(string name, Import[] imports, Struct[] structs, Function[] functions,
Global[] globals, FunctionSignature[] externs,
StructTemplate[] structTemplates)
{
this.name = name;
this.imports = imports;
this.structs = structs;
this.functions = functions;
this.globals = globals;
this.externs = externs;
this.structTemplates = structTemplates;
}
override string toString()
{
auto ret = "";
foreach (imp; this.imports)
{
ret ~= imp.toString() ~ "\n";
foreach (st; imp.structTemplates)
{
foreach (r; st.renderings)
{
ret ~= r.rendering.toString() ~ "\n";
}
}
}
foreach (ext; this.externs)
{
ret ~= ext.toString() ~ "\n";
}
foreach (g; this.globals)
{
ret ~= g.toString() ~ "\n";
}
foreach (s; this.structs)
{
ret ~= s.toString() ~ "\n";
}
foreach (s; this.structTemplates)
{
ret ~= s.toString() ~ "\n";
foreach (r; s.renderings)
{
ret ~= r.rendering.toString() ~ "\n";
}
}
foreach (func; this.functions)
{
ret ~= func.toString() ~ "\n";
}
return ret;
}
Function[] functionsAndMethods()
{
Function[] ret;
foreach (func; this.functions)
{
if (cast(FunctionTemplate)func is null)
{
ret ~= func;
}
}
foreach (st; this.structs)
{
ret ~= st.methods;
}
return ret;
}
Function[] justFunctions()
{
Function[] ret;
foreach (func; this.functions)
{
if (cast(Method)func is null && cast(FunctionTemplate)func is null)
{
ret ~= func;
}
}
return ret;
}
FunctionTemplate[] justFunctionTemplates()
{
FunctionTemplate[] ret;
foreach (func; this.functions)
{
auto ft = cast(FunctionTemplate)func;
if (ft !is null)
{
ret ~= ft;
}
}
return ret;
}
FunctionTemplate[] unqualifiedFunctionTemplates()
{
FunctionTemplate[] ret = this.justFunctionTemplates();
foreach (imp; this.imports)
{
if (imp.unqualified)
{
ret ~= imp.functionTemplates;
}
}
return ret;
}
FunctionSignature[] findFunctions(string moduleName, string functionName)
{
// Search imported modules
if (moduleName !is null)
{
auto imp = this.findImport(moduleName);
return imp.findFunctions(functionName);
}
FunctionSignature[] ret;
// Search functions
foreach (func; this.justFunctions())
{
if (func.signature.name == functionName)
{
ret ~= func.signature;
}
}
// Search for externs defined in the current module
foreach (ext; this.externs)
{
if (ext.name == functionName)
{
ret ~= ext;
}
}
// Search unqualified imports
foreach (imp; this.imports)
{
foreach (f; imp.functions)
{
if (f.name == functionName)
{
ret ~= f;
}
}
}
return ret;
}
FunctionSignature findFunction(Call call)
{
// Built-in: syscall
if (call.functionName == "syscall")
{
return new FunctionSignature(new PrimitiveType(Primitive.U64),
"syscall", [], false);
}
// Built-in: variadic
if (call.functionName == "variadic")
{
return new FunctionSignature(
new PrimitiveType(Primitive.U64),
"variadic",
[new TypeSignature(new PrimitiveType(Primitive.U64),
"index")],
false);
}
auto candidates = this.findFunctions(call.moduleName,
call.functionName);
foreach (c; candidates)
{
if (matchFunctionToCall(c, call))
{
return c;
}
}
// TODO: this can be misleading when the problem is a type mismatch
throw new Exception(format("Function %s not found",
call.functionName));
}
Import findImport(string name)
{
foreach (imp; this.imports)
{
if (imp.name == name)
{
return imp;
}
}
throw new NotFoundException(format("Import %s not found", name));
}
// If the given struct is a rendering of a struct template, find that
// rendering. Otherwise, return null.
StructRendering findStructRendering(Struct struct_)
{
foreach (st; this.structTemplates)
{
foreach (r; st.renderings)
{
if (r.rendering is struct_)
{
return r;
}
}
}
// Look in imports
foreach (imp; this.imports)
{
foreach (st; imp.structTemplates)
{
foreach (r; st.renderings)
{
if (r.rendering is struct_)
{
return r;
}
}
}
}
return null;
}
StructTemplate findStructTemplate(string moduleName, string structName)
{
StructTemplate[] search = this.structTemplates;
// Find qualified import
if (moduleName !is null)
{
search = this.findImport(moduleName).structTemplates;
}
// Find unqualified imports
else
{
foreach (imp; this.imports)
{
if (imp.unqualified)
{
search ~= imp.structTemplates;
}
}
}
foreach (st; search)
{
if (st.name == structName)
{
return st;
}
}
throw new NotFoundException("Struct not found");
}
}
|
D
|
/Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/DerivedData/PitchPerfect/Build/Intermediates/PitchPerfect.build/Debug-iphonesimulator/PitchPerfect.build/Objects-normal/x86_64/RecordSoundsViewController.o : /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordedAudio.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordSoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/PlaySoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/AppDelegate.swift /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/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/UIKit.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/DerivedData/PitchPerfect/Build/Intermediates/PitchPerfect.build/Debug-iphonesimulator/PitchPerfect.build/Objects-normal/x86_64/RecordSoundsViewController~partial.swiftmodule : /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordedAudio.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordSoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/PlaySoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/AppDelegate.swift /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/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/UIKit.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
/Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/DerivedData/PitchPerfect/Build/Intermediates/PitchPerfect.build/Debug-iphonesimulator/PitchPerfect.build/Objects-normal/x86_64/RecordSoundsViewController~partial.swiftdoc : /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordedAudio.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/RecordSoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/PlaySoundsViewController.swift /Users/DboyLiao/Documents/MOOCs/Udacity/iOS/Intro_iOS_App_Dev/PitchPerfect/PitchPerfect/AppDelegate.swift /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/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/UIKit.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/AVFoundation.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreMedia.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/x86_64/CoreAudio.swiftmodule
|
D
|
INSTANCE Info_Mod_LeibwacheHymir_Treue (C_INFO)
{
npc = Mod_1014_KGD_Leibwache_MT;
nr = 1;
condition = Info_Mod_LeibwacheHymir_Treue_Condition;
information = Info_Mod_LeibwacheHymir_Treue_Info;
permanent = 0;
important = 1;
};
FUNC INT Info_Mod_LeibwacheHymir_Treue_Condition()
{
if (!Npc_KnowsInfo(hero, Info_Mod_Ole_Vorbereitungen2))
&& (Npc_KnowsInfo(hero, Info_Mod_Hagen_AndreVermaechtnis11))
{
return 1;
};
};
FUNC VOID Info_Mod_LeibwacheHymir_Treue_Info()
{
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_Treue_06_00"); //Halt! Hier geht es nicht weiter für dich.
AI_Output(hero, self, "Info_Mod_LeibwacheHymir_Treue_15_01"); //Ich habe eine Botschaft von Lord Hagen. Schau.
B_UseFakeScroll();
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_Treue_06_02"); //Tatsächlich ... versehen mit dem königlichen Siegel. In Ordnung, du darfst zu Hymir.
AI_StopProcessInfos (self);
};
INSTANCE Info_Mod_LeibwacheHymir_Hi (C_INFO)
{
npc = Mod_1014_KGD_Leibwache_MT;
nr = 1;
condition = Info_Mod_LeibwacheHymir_Hi_Condition;
information = Info_Mod_LeibwacheHymir_Hi_Info;
permanent = 1;
important = 1;
};
FUNC INT Info_Mod_LeibwacheHymir_Hi_Condition()
{
if (!Npc_KnowsInfo(hero, Info_Mod_Ole_Vorbereitungen2))
&& (!Npc_KnowsInfo(hero, Info_Mod_LeibwacheHymir_Treue))
{
return 1;
};
};
FUNC VOID Info_Mod_LeibwacheHymir_Hi_Info()
{
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_Hi_06_00"); //Halt! Ohne Erlaubnis wird niemand zu Hymir vorgelassen.
AI_Output(hero, self, "Info_Mod_LeibwacheHymir_Hi_15_01"); //Warum das denn? Er sieht nicht so aus, als hätte er viel zu tun.
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_Hi_06_02"); //Das ist egal. Ich habe den Befehl, niemanden passieren zu lassen, und auch du wirst dich danach richten, verstanden!
AI_Output(hero, self, "Info_Mod_LeibwacheHymir_Hi_15_03"); //Schon in Ordnung, ich geh ja schon.
AI_TurnAway (hero, self);
AI_GotoWP (hero, "MC_THRON_1");
AI_StopProcessInfos (self);
};
INSTANCE Info_Mod_LeibwacheHymir_DarfDurch (C_INFO)
{
npc = Mod_1014_KGD_Leibwache_MT;
nr = 1;
condition = Info_Mod_LeibwacheHymir_DarfDurch_Condition;
information = Info_Mod_LeibwacheHymir_DarfDurch_Info;
permanent = 0;
important = 1;
};
FUNC INT Info_Mod_LeibwacheHymir_DarfDurch_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Ole_Vorbereitungen2))
{
return 1;
};
};
FUNC VOID Info_Mod_LeibwacheHymir_DarfDurch_Info()
{
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_DarfDurch_06_00"); //Halt!
AI_Output(hero, self, "Info_Mod_LeibwacheHymir_DarfDurch_15_01"); //Ole schickt mich, er meint Hymir will mich sehen.
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_DarfDurch_06_02"); //Warte hier!
AI_TurnToNpc (self, Mod_1016_KGD_Hymir_MT);
AI_Wait (self, 3);
AI_TurnToNpc (self, hero);
AI_Output(self, hero, "Info_Mod_LeibwacheHymir_DarfDurch_06_03"); //Gut! Du darfst zu ihm gehen.
};
INSTANCE Info_Mod_LeibwacheHymir_EXIT (C_INFO)
{
npc = Mod_1014_KGD_Leibwache_MT;
nr = 1;
condition = Info_Mod_LeibwacheHymir_EXIT_Condition;
information = Info_Mod_LeibwacheHymir_EXIT_Info;
permanent = 1;
important = 0;
description = DIALOG_ENDE;
};
FUNC INT Info_Mod_LeibwacheHymir_EXIT_Condition()
{
return 1;
};
FUNC VOID Info_Mod_LeibwacheHymir_EXIT_Info()
{
AI_StopProcessInfos (self);
};
|
D
|
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Node.build/Core/Context.swift.o : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Node.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeInitializable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UUID+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Schema+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Date+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/String+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Optional+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Bool+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Integer+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UnsignedInteger+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/SchemaWrapper+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Set+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/FloatingPoint+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Array+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Dictionary+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Number/Number.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Identifier.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/FuzzyConverter.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Cases.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Literals.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Getters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Setters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Errors.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Init.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Context.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Fuzzy+Any.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/PathIndexable.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Darwin.apinotes
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Node.build/Context~partial.swiftmodule : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Node.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeInitializable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UUID+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Schema+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Date+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/String+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Optional+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Bool+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Integer+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UnsignedInteger+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/SchemaWrapper+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Set+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/FloatingPoint+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Array+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Dictionary+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Number/Number.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Identifier.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/FuzzyConverter.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Cases.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Literals.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Getters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Setters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Errors.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Init.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Context.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Fuzzy+Any.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/PathIndexable.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Darwin.apinotes
/Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Node.build/Context~partial.swiftdoc : /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Polymorphic.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Convenience.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Node.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Equatable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeRepresentable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+PathIndexable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeInitializable.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UUID+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Schema+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Date+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/String+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Optional+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Bool+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/Integer+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/UnsignedInteger+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/SchemaWrapper+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Set+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Convertibles/FloatingPoint+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Array+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Dictionary+Convertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/NodeConvertible.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Number/Number.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Identifier.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/FuzzyConverter.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Cases.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredDataWrapper/StructuredDataWrapper+Literals.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Getters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Accessors/Setters.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Errors.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Utilities/Exports.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/StructuredData/StructuredData+Init.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Core/Context.swift /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/checkouts/node.git-9175390252000121167/Sources/Node/Fuzzy/Fuzzy+Any.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/libc.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/PathIndexable.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/Core.swiftmodule /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.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/Desktop/VaporProject/LaSalleChat/.build/x86_64-apple-macosx10.10/debug/CHTTP.build/module.modulemap /Users/AleixDiaz/Desktop/VaporProject/LaSalleChat/.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/Darwin.apinotes
|
D
|
/Users/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/FluentProvider.build/Objects-normal/x86_64/Config+Preparation.o : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Node+Row+JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Cache.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Request+Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Query+Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/SQLite+Config.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Model.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Pagination.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Provider.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/UpdateableKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/URI.framework/Modules/URI.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SMTP.framework/Modules/SMTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/HTTP.framework/Modules/HTTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/TLS.framework/Modules/TLS.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/FormData.framework/Modules/FormData.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cache.framework/Modules/Cache.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Routing.framework/Modules/Routing.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Crypto.framework/Modules/Crypto.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Vapor.framework/Modules/Vapor.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Branches.framework/Modules/Branches.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cookies.framework/Modules/Cookies.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Configs.framework/Modules/Configs.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sessions.framework/Modules/Sessions.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/WebSockets.framework/Modules/WebSockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Fluent.framework/Modules/Fluent.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/BCrypt.framework/Modules/BCrypt.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Multipart.framework/Modules/Multipart.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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 /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/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CHTTP/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/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/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/FluentProvider.build/Objects-normal/x86_64/Config+Preparation~partial.swiftmodule : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Node+Row+JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Cache.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Request+Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Query+Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/SQLite+Config.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Model.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Pagination.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Provider.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/UpdateableKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/URI.framework/Modules/URI.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SMTP.framework/Modules/SMTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/HTTP.framework/Modules/HTTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/TLS.framework/Modules/TLS.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/FormData.framework/Modules/FormData.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cache.framework/Modules/Cache.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Routing.framework/Modules/Routing.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Crypto.framework/Modules/Crypto.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Vapor.framework/Modules/Vapor.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Branches.framework/Modules/Branches.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cookies.framework/Modules/Cookies.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Configs.framework/Modules/Configs.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sessions.framework/Modules/Sessions.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/WebSockets.framework/Modules/WebSockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Fluent.framework/Modules/Fluent.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/BCrypt.framework/Modules/BCrypt.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Multipart.framework/Modules/Multipart.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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 /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/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CHTTP/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/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/cansoykarafakili/Desktop/Hello/build/Intermediates/Hello.build/Debug/FluentProvider.build/Objects-normal/x86_64/Config+Preparation~partial.swiftdoc : /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Node+Row+JSON.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Storage.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Cache.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Request+Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/Updateable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Query+Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/Filterable.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Droplet+Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Prepare.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/SQLite+Config.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey+String.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Model.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Pagination.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Preparation.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Provider.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Droplet/Config+Driver.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Exports.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Updateable/UpdateableKey.swift /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/fluent-provider.git-1502561075136423204/Sources/FluentProvider/Filterable/FilterableKey.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.apinotesc /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/URI.framework/Modules/URI.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/JSON.framework/Modules/JSON.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SMTP.framework/Modules/SMTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/HTTP.framework/Modules/HTTP.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/TLS.framework/Modules/TLS.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/FormData.framework/Modules/FormData.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/libc.framework/Modules/libc.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Node.framework/Modules/Node.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cache.framework/Modules/Cache.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/PathIndexable.framework/Modules/PathIndexable.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Console.framework/Modules/Console.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Core.framework/Modules/Core.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/SQLite.framework/Modules/SQLite.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Debugging.framework/Modules/Debugging.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Routing.framework/Modules/Routing.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Random.framework/Modules/Random.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Crypto.framework/Modules/Crypto.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Vapor.framework/Modules/Vapor.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Branches.framework/Modules/Branches.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Cookies.framework/Modules/Cookies.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Configs.framework/Modules/Configs.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sessions.framework/Modules/Sessions.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Sockets.framework/Modules/Sockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/WebSockets.framework/Modules/WebSockets.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Bits.framework/Modules/Bits.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Fluent.framework/Modules/Fluent.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/BCrypt.framework/Modules/BCrypt.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Multipart.framework/Modules/Multipart.swiftmodule/x86_64.swiftmodule /Users/cansoykarafakili/Desktop/Hello/build/Products/Debug/Transport.framework/Modules/Transport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.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 /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/cansoykarafakili/Desktop/Hello/.build/checkouts/sqlite.git--8232814251736334455/Sources/CSQLite/include/sqlite3.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/cansoykarafakili/Desktop/Hello/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CHTTP/module.modulemap /Users/cansoykarafakili/Desktop/Hello/Hello.xcodeproj/GeneratedModuleMap/CSQLite/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) 2017-2018 Timur Gafarov
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 dagon.core.ownership;
import dlib.core.memory;
import dlib.container.array;
public import dlib.core.ownership;
|
D
|
instance DJG_735_ToterDrachenjaeger (Npc_Default)
{
// ------ NSC ------
name = NAME_ToterDrachenjaeger;
guild = GIL_DJG;
id = 735;
voice = 6;
flags = 0; //NPC_FLAG_IMMORTAL oder 0
npctype = NPCTYPE_AMBIENT;
// ------ Attribute ------
B_SetAttributesToChapter (self, 5); //setzt Attribute und LEVEL entsprechend dem angegebenen Kapitel (1-6)
// ------ Kampf-Taktik ------
fight_tactic = FAI_HUMAN_STRONG; // MASTER / STRONG / COWARD
// ------ Equippte Waffen ------ //Munition wird automatisch generiert, darf aber angegeben werden
EquipItem (self, ItMw_2H_SLD_Sword);
// ------ 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_Psionic", Face_N_Richter, BodyTex_N, ITAR_DJG_L);
Mdl_SetModelFatness (self, 1);
Mdl_ApplyOverlayMds (self, "Humans_Relaxed.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, 65); //Grenzen für Talent-Level liegen bei 30 und 60
// ------ TA anmelden ------
daily_routine = Rtn_Start_735;
};
FUNC VOID Rtn_Start_735 ()
{
TA_Sit_Bench (08,00,23,00,"OW_DRAGONSWAMP_023"); //Joly: beim Swampdragon im Seitengang
TA_Sit_Bench (23,00,08,00,"OW_DRAGONSWAMP_023");
};
|
D
|
on certain occasions or in certain cases but not always
|
D
|
instance DIA_Addon_Patrick_NW_EXIT(C_Info)
{
npc = STRF_1123_Addon_Patrick_NW;
nr = 999;
condition = DIA_Addon_Patrick_NW_EXIT_Condition;
information = DIA_Addon_Patrick_NW_EXIT_Info;
permanent = TRUE;
description = Dialog_Ende;
};
func int DIA_Addon_Patrick_NW_EXIT_Condition()
{
return TRUE;
};
func void DIA_Addon_Patrick_NW_EXIT_Info()
{
AI_StopProcessInfos(self);
};
instance DIA_Addon_Patrick_NW_Hi(C_Info)
{
npc = STRF_1123_Addon_Patrick_NW;
nr = 2;
condition = DIA_Addon_Patrick_NW_Hi_Condition;
information = DIA_Addon_Patrick_NW_Hi_Info;
permanent = FALSE;
description = "Итак, с вами все в порядке?";
};
func int DIA_Addon_Patrick_NW_Hi_Condition()
{
return TRUE;
};
func void DIA_Addon_Patrick_NW_Hi_Info()
{
AI_Output(other,self,"DIA_Addon_Patrick_NW_Hi_15_00"); //Итак, с вами все в порядке?
AI_Output(self,other,"DIA_Addon_Patrick_NW_Hi_07_01"); //Все хорошо. Маги Воды вывели нас из этой проклятой долины.
AI_Output(other,self,"DIA_Addon_Patrick_NW_Hi_15_02"); //И что вы будете делать дальше?
AI_Output(self,other,"DIA_Addon_Patrick_NW_Hi_07_03"); //Я продолжу работать на Ли. А в один прекрасный день мы покинем этот остров...
AI_Output(other,self,"DIA_Addon_Patrick_NW_Hi_15_04"); //И что будет тогда?
AI_Output(self,other,"DIA_Addon_Patrick_NW_Hi_07_05"); //Увидим. Если война все еще идет, мы будем сражаться с орками. Но это станет ясно позднее.
};
|
D
|
/************************************************
* NSC ohne Wahrnehmung benutzt Bett, *
* wenn kein Bett da, macht der ZS_StandAround *
*************************************************/
func void ZS_SleepNoSense()
{
PrintDebugNpc (PD_TA_FRAME,"ZS_SleepNoSense");
AI_SetWalkmode (self, NPC_WALK);
if (!C_BodyStateContains(self,BS_MOBINTERACT))
{
if (Hlp_StrCmp(Npc_GetNearestWP(self), self.wp)== 0)
{
AI_GotoWP (self, self.wp);
};
};
AI_StartState (self, ZS_SleepBedNoSense, 1, "");
};
func void ZS_SleepBedNoSense()
{
PrintDebugNpc (PD_TA_FRAME,"ZS_SleepBedNoSense");
if (Wld_IsMobAvailable (self,SCEMENAME_BED))
{
AI_UseMob (self, SCEMENAME_BED,1);
}
else if (Wld_IsMobAvailable (self,SCEMENAME_BEDHIGH)||Wld_IsMobAvailable (self,SCEMENAME_BEDLOW))
{
AI_UseMob (self, SCEMENAME_BEDHIGH,1); //Mehrfache Mob-Benutzung okay, weil nachfolgende UseMobs ignoriert werden, wenn UseMob schon aktiv ist
AI_UseMob (self, SCEMENAME_BEDLOW,1); // Mobs werden nur benutzt, wenn NSC sie sehen kann und wenn sie frei sind (sagt Ulf)
}
else
{
// JP: Muß ohne den Endzustand gemacht werden, da im End die Schlafregenerierung vorgenommen wird
// ist auch kein Problem , da im End nur die Mobsis abgemeldet und eben HP voll gemacht werden
AI_StartState (self, ZS_StandAround, 0, "");
};
};
func int ZS_SleepBedNoSense_Loop()
{
PrintDebugNpc (PD_TA_LOOP,"ZS_SleepBedNoSense_Loop");
/* SN: Workaround dafür, daß Wld_IsMobAvailable() zwar TRUE geliefert hat, AI_UseMob() aber gescheitert ist!
if !C_BodyStateContains(self,BS_MOBINTERACT)
&& (Npc_GetStateTime(self) > 3)
{
AI_StartState (self, ZS_SitAround, 1, "");
};*/
AI_Wait (self, 1);
return LOOP_CONTINUE;
};
func void ZS_SleepBedNoSense_End()
{
PrintDebugNpc (PD_TA_FRAME,"ZS_SleepBedNoSense_End");
if Wld_IsTime(07,00, 08,30)
{
B_Say (self, NULL, "$AWAKE");
};
AI_UseMob (self,SCEMENAME_BEDHIGH,-1);
AI_UseMob (self,SCEMENAME_BEDLOW,-1);
AI_UseMob (self,SCEMENAME_BED,-1);
// JP: Schlafen soll die Nsc´s voll regenerieren
Npc_ChangeAttribute (self, ATR_HITPOINTS, (self.attribute[ATR_HITPOINTS_MAX]-self.attribute[ATR_HITPOINTS]));
};
|
D
|
/Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/AFError.o : /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartFormData.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartUpload.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AlamofireExtended.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Protected.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPMethod.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Combine.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Result+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Response.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/SessionDelegate.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoding.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Session.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Validation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ResponseSerialization.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestTaskMap.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RedirectHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AFError.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/EventMonitor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Notifications.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPHeaders.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Request.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/deepansh/Desktop/ForexWatchlist/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/AFError~partial.swiftmodule : /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartFormData.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartUpload.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AlamofireExtended.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Protected.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPMethod.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Combine.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Result+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Response.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/SessionDelegate.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoding.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Session.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Validation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ResponseSerialization.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestTaskMap.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RedirectHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AFError.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/EventMonitor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Notifications.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPHeaders.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Request.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/deepansh/Desktop/ForexWatchlist/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/AFError~partial.swiftdoc : /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartFormData.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartUpload.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AlamofireExtended.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Protected.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPMethod.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Combine.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Result+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Response.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/SessionDelegate.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoding.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Session.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Validation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ResponseSerialization.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestTaskMap.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RedirectHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AFError.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/EventMonitor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Notifications.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPHeaders.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Request.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/deepansh/Desktop/ForexWatchlist/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/Objects-normal/x86_64/AFError~partial.swiftsourceinfo : /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartFormData.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/MultipartUpload.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AlamofireExtended.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Protected.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPMethod.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Combine.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/OperationQueue+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/StringEncoding+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Result+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLRequest+Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Alamofire.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Response.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/SessionDelegate.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoding.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Session.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Validation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ServerTrustEvaluation.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ResponseSerialization.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestTaskMap.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/URLEncodedFormEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/ParameterEncoder.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/NetworkReachabilityManager.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/CachedResponseHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RedirectHandler.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AFError.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/EventMonitor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/AuthenticationInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RequestInterceptor.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Notifications.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/HTTPHeaders.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/Request.swift /Users/deepansh/Desktop/ForexWatchlist/Pods/Alamofire/Source/RetryPolicy.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/deepansh/Desktop/ForexWatchlist/Pods/Target\ Support\ Files/Alamofire/Alamofire-umbrella.h /Users/deepansh/Desktop/ForexWatchlist/DerivedData/ForexWatchlist/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Alamofire.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.6.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
module dash.editor.editor;
import dash.core.dgame;
import dash.editor.websockets;
import dash.utility.output;
import vibe.data.json;
import std.uuid, std.typecons;
/**
* The editor manager class. Handles all interactions with editors.
*
* May be overridden to override default event implementations.
*/
class Editor
{
public:
// Event handlers
alias JsonEventHandler = void delegate( Json );
alias JsonEventResponseHandler = void delegate( Json, void delegate( Json ) );
alias TypedEventHandler( DataType ) = void delegate( DataType );
alias TypedEventResponseHandler( ResponseType, DataType ) = void delegate( DataType, void delegate( ResponseType ) );
/**
* Initializes the editor with a DGame instance.
*
* Called by DGame.
*/
final void initialize( DGame instance )
{
game = instance;
server.start( this );
registerDefaultEvents();
onInitialize();
}
/**
* Processes pending events.
*
* Called by DGame.
*/
final void update()
{
server.update();
processEvents();
}
/**
* Shutsdown the editor interface.
*
* Called by DGame.
*/
final void shutdown()
{
server.stop();
}
/**
* Sends a message to all attached editors.
*
* Params:
* key = The key of the event.
* value = The data along side it.
*/
final void send( string key, Json value )
{
EventMessage msg;
msg.key = key;
msg.value = value;
server.send( msg );
}
/**
* Sends a message to all attached editors.
*
* Params:
* key = The key of the event.
* value = The data along side it.
* cb = The callback to call when a response is received.
*/
final void send( string key, Json value, JsonEventHandler cb )
{
UUID cbId = randomUUID();
registerCallbackHandler( cbId, msg => cb( msg.value ) );
EventMessage msg;
msg.key = key;
msg.value = value;
msg.callbackId = cbId.toString();
server.send( msg );
}
/**
* Sends a message to all attached editors.
*
* Params:
* key = The key of the event.
* value = The data along side it.
*/
final void send( DataType )( string key, DataType value )
{
send( key, value.serializeToJson() );
}
static assert(is(typeof( send!( string )( "key", "data" ) )));
/**
* Sends a message to all attached editors.
*
* Params:
* key = The key of the event.
* value = The data along side it.
* cb = The callback to call when a response is received.
*/
final void send( ResponseType, DataType )( string key, DataType value, TypedEventHandler!ResponseType cb )
{
send( key, value.serializeToJson(), ( Json json ) { cb( json.deserializeJson!ResponseType ); } );
}
static assert(is(typeof( send!( string, string )( "key", "data", ( response ) { } ) )));
/**
* Registers an event callback, for when an event with the given key is received.
*
* Params:
* key = The key of the event.
* event = The handler to call.
*
* Returns: The ID of the event, so it can be unregistered later.
*/
final UUID registerEventHandler( string key, JsonEventHandler event )
{
void handler( EventMessage msg )
{
event( msg.value );
}
return registerInternalMessageHandler( key, &handler );
}
/**
* Registers an event callback, for when an event with the given key is received.
*
* Params:
* key = The key of the event.
* event = The handler to call.
*
* Returns: The ID of the event, so it can be unregistered later.
*/
final UUID registerEventHandler( string key, JsonEventResponseHandler event )
{
void handler( EventMessage msg )
{
void writeback( Json json )
{
EventMessage newMsg;
newMsg.key = CallbackMessageKey;
newMsg.value = json;
newMsg.callbackId = msg.callbackId;
server.send( newMsg );
}
event( msg.value, &writeback );
}
return registerInternalMessageHandler( key, &handler );
}
/**
* Registers an event callback, for when an event with the given key is received.
*
* Params:
* key = The key of the event.
* event = The handler to call.
*
* Returns: The ID of the event, so it can be unregistered later.
*/
final UUID registerEventHandler( DataType )( string key, TypedEventHandler!DataType event )
{
void handler( EventMessage msg )
{
event( msg.value.deserializeJson!DataType() );
}
return registerInternalMessageHandler( key, &handler );
}
static assert(is(typeof( registerEventHandler!( string )( "key", ( data ) { } ) )));
/**
* Registers an event callback, for when an event with the given key is received.
*
* Params:
* key = The key of the event.
* event = The handler to call.
*
* Returns: The ID of the event, so it can be unregistered later.
*/
final UUID registerEventHandler( ResponseType, DataType )( string key, TypedEventResponseHandler!( ResponseType, DataType ) event )
{
void handler( EventMessage msg )
{
void writeback( ResponseType res )
{
EventMessage newMsg;
newMsg.key = CallbackMessageKey;
newMsg.value = res.serializeToJsonString();
newMsg.callbackId = msg.callbackId;
server.send( newMsg );
}
event( msg.value.deserializeJson!DataType, &writeback );
}
return registerInternalMessageHandler( key, &handler );
}
static assert(is(typeof( registerEventHandler!( string, string )( "key", ( data, writeback ) { } ) )));
/**
* Unregisters an event callback.
*
* Params:
* id = The id of the handler to remove.
*/
final void unregisterEventHandler( UUID id )
{
foreach( _, handlerTupArr; eventHandlers )
{
foreach( i, handlerTup; handlerTupArr )
{
if( handlerTup.id == id )
{
auto end = handlerTupArr[ i+1..$ ];
handlerTupArr = handlerTupArr[ 0..i ] ~ end;
}
}
}
}
package:
final void queueEvent( EventMessage msg )
{
pendingEvents ~= msg;
}
protected:
DGame game;
WebSocketServer server;
/// To be overridden
void onInitialize() { }
/// ditto
void onStartPlay() { }
/// ditto
void onPausePlay() { }
/// ditto
void onStopPlay() { }
/**
* Processes all pending events.
*
* Called by update.
*/
final void processEvents()
{
// Clear the events
scope(exit) pendingEvents.length = 0;
foreach( event; pendingEvents )
{
// Dispatch to handlers.
if( auto handlerTupArray = event.key in eventHandlers )
{
foreach( handlerTup; *handlerTupArray )
{
handlerTup.handler( event );
}
}
else
{
logWarning( "Invalid editor event received with key ", event.key );
}
}
}
private:
enum CallbackMessageKey = "__callback__";
alias InternalEventHandler = void delegate( EventMessage );
alias EventHandlerTuple = Tuple!(UUID, "id", InternalEventHandler, "handler");
EventMessage[] pendingEvents;
EventHandlerTuple[][string] eventHandlers;
InternalEventHandler[UUID] callbacks;
/// Register a
final UUID registerInternalMessageHandler( string key, InternalEventHandler handler )
{
auto id = randomUUID();
eventHandlers[ key ] ~= EventHandlerTuple( id, handler );
return id;
}
final void registerCallbackHandler( UUID id, InternalEventHandler handler )
{
callbacks[ id ] = handler;
}
/// Handle an event that is a callback.
final void handleCallback( EventMessage msg )
{
// If it's a callback, dispatch it as such.
UUID id = msg.callbackId.parseUUID();
if( auto cb = id in callbacks )
{
(*cb)( msg );
callbacks.remove( id );
}
else
{
logFatal( "Callback reference lost: ", msg.callbackId );
}
}
final void registerDefaultEvents()
{
registerInternalMessageHandler( CallbackMessageKey, &handleCallback );
registerEventHandler( "dgame:refresh", ( json ) { game.currentState = EngineState.Refresh; } );
registerEventHandler( "loopback", ( json, cb ) => cb( json ) );
}
}
|
D
|
/home/runner/TETRIO-Bot-node/AI/Rust-AI/target/debug/build/crossbeam-utils-471af4b3a3bd58bb/build_script_build-471af4b3a3bd58bb: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/build.rs
/home/runner/TETRIO-Bot-node/AI/Rust-AI/target/debug/build/crossbeam-utils-471af4b3a3bd58bb/build_script_build-471af4b3a3bd58bb.d: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/build.rs
/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.7.2/build.rs:
|
D
|
a genus of tropical American plants have sword-shaped leaves and a fleshy compound fruits composed of the fruits of several flowers (such as pineapples)
large sweet fleshy tropical fruit with a terminal tuft of stiff leaves
|
D
|
// *************
// SPL_Blutopfer
// *************
const int SPL_Cost_Blutopfer = 70;
const int SPL_Damage_Blutopfer = 100;
INSTANCE Spell_Blutopfer (C_Spell_Proto)
{
time_per_mana = 0; //Spell wirkt Instant
damage_per_level = SPL_Damage_Blutopfer;
};
func int Spell_Logic_Blutopfer (var int manaInvested)
{
PrintDebugNpc(PD_Magic, "Spell_Logic_Blutopfer");
if (Npc_GetActiveSpellIsScroll(self) && (self.attribute[ATR_MANA] >= SPL_Cost_Scroll))
{
return SPL_SENDCAST;
}
else if (self.attribute[ATR_MANA] >= SPL_Cost_Blutopfer)
{
return SPL_SENDCAST;
}
else //nicht genug Mana
{
return SPL_SENDSTOP;
};
};
func void Spell_Cast_Blutopfer ()
{
PrintDebugNpc(PD_Magic, "Spell_Cast_Blutopfer");
if (Npc_GetActiveSpellIsScroll(self))
{
self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Scroll;
}
else
{
self.attribute[ATR_MANA] = self.attribute[ATR_MANA] - SPL_Cost_Blutopfer;
};
self.attribute[ATR_HITPOINTS] -= (self.attribute[ATR_HITPOINTS] / 2);
self.aivar[AIV_Damage] = self.attribute[ATR_HITPOINTS];
B_PrismaAdd(SPL_Damage_Blutopfer);
self.aivar[AIV_SelectSpell] += 1;
};
|
D
|
module served.commands.definition;
import served.extension;
import served.types;
import served.utils.ddoc;
import workspaced.api;
import workspaced.com.dcd;
import workspaced.coms;
import std.experimental.logger;
import std.path : buildPath, isAbsolute;
import std.string;
import fs = std.file;
import io = std.stdio;
struct DeclarationInfo
{
string declaration;
Location location;
}
DeclarationInfo findDeclarationImpl(WorkspaceD.Instance instance, scope ref Document doc,
int bytes, bool includeDefinition)
{
auto result = instance.get!DCDComponent.findDeclaration(doc.rawText, bytes).getYield;
if (result == DCDDeclaration.init)
return DeclarationInfo.init;
auto uri = doc.uri;
if (result.file != "stdin")
{
if (isAbsolute(result.file))
uri = uriFromFile(result.file);
else
uri = null;
}
trace("raw declaration result: ", uri, ":", result.position);
size_t byteOffset = cast(size_t) result.position;
bool tempLoad;
auto found = documents.getOrFromFilesystem(uri, tempLoad);
DeclarationInfo ret;
if (found.uri)
{
TextRange range;
if (instance.has!DCDExtComponent)
{
auto dcdext = instance.get!DCDExtComponent;
range = getDeclarationRange(dcdext, found, byteOffset, includeDefinition);
trace(" declaration refined to ", range);
}
if (range is TextRange.init)
{
auto pos = found.bytesToPosition(byteOffset);
range = TextRange(pos, pos);
}
if (range !is TextRange.init)
{
ret.declaration = found.sliceRawText(range).idup;
// TODO: resolve auto type
if (instance.has!DfmtComponent)
{
trace("Formatting declaration ", [ret.declaration]);
ret.declaration = instance.get!DfmtComponent.formatSync(ret.declaration,
[
"--keep_line_breaks=false",
"--single_indent=true",
"--indent_size=2",
"--indent_style=space",
"--max_line_length=60",
"--soft_max_line_length=50",
"--end_of_line=lf"
]);
}
}
if (tempLoad)
documents.unloadDocument(uri);
ret.location = Location(uri, range);
}
return ret;
}
TextRange getDeclarationRange(DCDExtComponent dcdext, ref Document doc, size_t byteOffset, bool includeDefinition)
{
auto range = dcdext.getDeclarationRange(doc.rawText, byteOffset, includeDefinition);
if (range == typeof(range).init)
return TextRange.init;
return doc.byteRangeToTextRange(range);
}
@protocolMethod("textDocument/definition")
ArrayOrSingle!Location provideDefinition(TextDocumentPositionParams params)
{
auto instance = activeInstance = backend.getBestInstance!DCDComponent(
params.textDocument.uri.uriToFile);
if (!instance)
return ArrayOrSingle!Location.init;
auto document = documents[params.textDocument.uri];
if (document.languageId != "d")
return ArrayOrSingle!Location.init;
auto result = findDeclarationImpl(instance, document,
cast(int) document.positionToBytes(params.position), true);
if (result == DeclarationInfo.init)
return ArrayOrSingle!Location.init;
return ArrayOrSingle!Location(result.location);
}
@protocolMethod("textDocument/hover")
Hover provideHover(TextDocumentPositionParams params)
{
auto instance = activeInstance = backend.getBestInstance!DCDComponent(
params.textDocument.uri.uriToFile);
if (!instance)
return Hover.init;
auto document = documents[params.textDocument.uri];
if (document.languageId != "d")
return Hover.init;
DCDComponent dcd = instance.get!DCDComponent();
auto docs = dcd.getDocumentation(document.rawText,
cast(int) document.positionToBytes(params.position)).getYield;
auto marked = docs.ddocToMarked;
try
{
auto result = findDeclarationImpl(instance, document,
cast(int) document.positionToBytes(params.position), false);
result.declaration = result.declaration.strip;
if (result.declaration.length)
marked = MarkedString(result.declaration, "d") ~ marked;
}
catch (Exception e)
{
}
Hover ret;
ret.contents = marked;
return ret;
}
|
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_move_wide_16_6.java
.class public dot.junit.opcodes.move_wide_16.d.T_move_wide_16_6
.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 static run()V
.limit regs 5000
const v123, 123
move-wide/16 v255, v123
return-void
.end method
|
D
|
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
module otapi;
static import otapi_im;
static import tango.stdc.config;
static import tango.stdc.stringz;
static import tango.stdc.stringz;
char[] OT_PW_DISPLAY() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OT_PW_DISPLAY_get());
return ret;
}
int OTPASSWORD_BLOCKSIZE() {
auto ret = otapi_im.OTPASSWORD_BLOCKSIZE_get();
return ret;
}
int OTPASSWORD_MEMSIZE() {
auto ret = otapi_im.OTPASSWORD_MEMSIZE_get();
return ret;
}
int OT_LARGE_BLOCKSIZE() {
auto ret = otapi_im.OT_LARGE_BLOCKSIZE_get();
return ret;
}
int OT_LARGE_MEMSIZE() {
auto ret = otapi_im.OT_LARGE_MEMSIZE_get();
return ret;
}
int OT_DEFAULT_BLOCKSIZE() {
auto ret = otapi_im.OT_DEFAULT_BLOCKSIZE_get();
return ret;
}
int OT_DEFAULT_MEMSIZE() {
auto ret = otapi_im.OT_DEFAULT_MEMSIZE_get();
return ret;
}
class OTPassword {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(OTPassword obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTPassword(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
enum BlockSize {
DEFAULT_SIZE = 128,
LARGER_SIZE = 32767
}
public OTPassword.BlockSize m_theBlockSize() {
OTPassword.BlockSize ret = cast(OTPassword.BlockSize)otapi_im.OTPassword_m_theBlockSize_get(cast(void*)swigCPtr);
return ret;
}
public bool isPassword() {
bool ret = otapi_im.OTPassword_isPassword(cast(void*)swigCPtr) ? true : false;
return ret;
}
public SWIGTYPE_p_uint8_t getPassword_uint8() {
void* cPtr = otapi_im.OTPassword_getPassword_uint8(cast(void*)swigCPtr);
SWIGTYPE_p_uint8_t ret = (cPtr is null) ? null : new SWIGTYPE_p_uint8_t(cPtr, false);
return ret;
}
public char[] getPassword() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTPassword_getPassword(cast(void*)swigCPtr));
return ret;
}
public SWIGTYPE_p_uint8_t getPasswordWritable() {
void* cPtr = otapi_im.OTPassword_getPasswordWritable(cast(void*)swigCPtr);
SWIGTYPE_p_uint8_t ret = (cPtr is null) ? null : new SWIGTYPE_p_uint8_t(cPtr, false);
return ret;
}
public char[] getPasswordWritable_char() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTPassword_getPasswordWritable_char(cast(void*)swigCPtr));
return ret;
}
public int setPassword(char[] szInput, int nInputSize) {
auto ret = otapi_im.OTPassword_setPassword(cast(void*)swigCPtr, (szInput ? tango.stdc.stringz.toStringz(szInput) : null), nInputSize);
return ret;
}
public SWIGTYPE_p_int32_t setPassword_uint8(SWIGTYPE_p_uint8_t szInput, SWIGTYPE_p_uint32_t nInputSize) {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_setPassword_uint8(cast(void*)swigCPtr, SWIGTYPE_p_uint8_t.swigGetCPtr(szInput), SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool addChar(SWIGTYPE_p_uint8_t theChar) {
bool ret = otapi_im.OTPassword_addChar(cast(void*)swigCPtr, SWIGTYPE_p_uint8_t.swigGetCPtr(theChar)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_int32_t randomizePassword(SWIGTYPE_p_uint32_t nNewSize) {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_randomizePassword__SWIG_0(cast(void*)swigCPtr, SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_int32_t randomizePassword() {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_randomizePassword__SWIG_1(cast(void*)swigCPtr), true);
return ret;
}
public static bool randomizePassword_uint8(SWIGTYPE_p_uint8_t szDestination, SWIGTYPE_p_uint32_t nNewSize) {
bool ret = otapi_im.OTPassword_randomizePassword_uint8(SWIGTYPE_p_uint8_t.swigGetCPtr(szDestination), SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool randomizePassword(char[] szDestination, SWIGTYPE_p_uint32_t nNewSize) {
bool ret = otapi_im.OTPassword_randomizePassword__SWIG_2((szDestination ? tango.stdc.stringz.toStringz(szDestination) : null), SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool isMemory() {
bool ret = otapi_im.OTPassword_isMemory(cast(void*)swigCPtr) ? true : false;
return ret;
}
public void* getMemory() {
auto ret = cast(void*)otapi_im.OTPassword_getMemory(cast(void*)swigCPtr);
return ret;
}
public SWIGTYPE_p_uint8_t getMemory_uint8() {
void* cPtr = otapi_im.OTPassword_getMemory_uint8(cast(void*)swigCPtr);
SWIGTYPE_p_uint8_t ret = (cPtr is null) ? null : new SWIGTYPE_p_uint8_t(cPtr, false);
return ret;
}
public void* getMemoryWritable() {
auto ret = cast(void*)otapi_im.OTPassword_getMemoryWritable(cast(void*)swigCPtr);
return ret;
}
public SWIGTYPE_p_int32_t setMemory(void* vInput, SWIGTYPE_p_uint32_t nInputSize) {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_setMemory(cast(void*)swigCPtr, cast(void*)vInput, SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_int32_t addMemory(void* vAppend, SWIGTYPE_p_uint32_t nAppendSize) {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_addMemory(cast(void*)swigCPtr, cast(void*)vAppend, SWIGTYPE_p_uint32_t.swigGetCPtr(nAppendSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_int32_t randomizeMemory(SWIGTYPE_p_uint32_t nNewSize) {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_randomizeMemory__SWIG_0(cast(void*)swigCPtr, SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_int32_t randomizeMemory() {
SWIGTYPE_p_int32_t ret = new SWIGTYPE_p_int32_t(otapi_im.OTPassword_randomizeMemory__SWIG_1(cast(void*)swigCPtr), true);
return ret;
}
public static bool randomizeMemory_uint8(SWIGTYPE_p_uint8_t szDestination, SWIGTYPE_p_uint32_t nNewSize) {
bool ret = otapi_im.OTPassword_randomizeMemory_uint8(SWIGTYPE_p_uint8_t.swigGetCPtr(szDestination), SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool randomizeMemory(void* szDestination, SWIGTYPE_p_uint32_t nNewSize) {
bool ret = otapi_im.OTPassword_randomizeMemory__SWIG_2(cast(void*)szDestination, SWIGTYPE_p_uint32_t.swigGetCPtr(nNewSize)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_uint32_t getBlockSize() {
SWIGTYPE_p_uint32_t ret = new SWIGTYPE_p_uint32_t(otapi_im.OTPassword_getBlockSize(cast(void*)swigCPtr), true);
return ret;
}
public bool Compare(OTPassword rhs) {
bool ret = otapi_im.OTPassword_Compare(cast(void*)swigCPtr, OTPassword.swigGetCPtr(rhs)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public SWIGTYPE_p_uint32_t getPasswordSize() {
SWIGTYPE_p_uint32_t ret = new SWIGTYPE_p_uint32_t(otapi_im.OTPassword_getPasswordSize(cast(void*)swigCPtr), true);
return ret;
}
public SWIGTYPE_p_uint32_t getMemorySize() {
SWIGTYPE_p_uint32_t ret = new SWIGTYPE_p_uint32_t(otapi_im.OTPassword_getMemorySize(cast(void*)swigCPtr), true);
return ret;
}
public void zeroMemory() {
otapi_im.OTPassword_zeroMemory__SWIG_0(cast(void*)swigCPtr);
}
public static void zeroMemory(SWIGTYPE_p_uint8_t szMemory, SWIGTYPE_p_uint32_t theSize) {
otapi_im.OTPassword_zeroMemory__SWIG_1(SWIGTYPE_p_uint8_t.swigGetCPtr(szMemory), SWIGTYPE_p_uint32_t.swigGetCPtr(theSize));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static void zeroMemory(void* vMemory, SWIGTYPE_p_uint32_t theSize) {
otapi_im.OTPassword_zeroMemory__SWIG_2(cast(void*)vMemory, SWIGTYPE_p_uint32_t.swigGetCPtr(theSize));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static void* safe_memcpy(void* dest, SWIGTYPE_p_uint32_t dest_size, void* src, SWIGTYPE_p_uint32_t src_length, bool bZeroSource) {
auto ret = cast(void*)otapi_im.OTPassword_safe_memcpy__SWIG_0(cast(void*)dest, SWIGTYPE_p_uint32_t.swigGetCPtr(dest_size), cast(void*)src, SWIGTYPE_p_uint32_t.swigGetCPtr(src_length), bZeroSource);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static void* safe_memcpy(void* dest, SWIGTYPE_p_uint32_t dest_size, void* src, SWIGTYPE_p_uint32_t src_length) {
auto ret = cast(void*)otapi_im.OTPassword_safe_memcpy__SWIG_1(cast(void*)dest, SWIGTYPE_p_uint32_t.swigGetCPtr(dest_size), cast(void*)src, SWIGTYPE_p_uint32_t.swigGetCPtr(src_length));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OTPassword CreateTextBuffer() {
void* cPtr = otapi_im.OTPassword_CreateTextBuffer();
OTPassword ret = (cPtr is null) ? null : new OTPassword(cPtr, false);
return ret;
}
public bool SetSize(SWIGTYPE_p_uint32_t uSize) {
bool ret = otapi_im.OTPassword_SetSize(cast(void*)swigCPtr, SWIGTYPE_p_uint32_t.swigGetCPtr(uSize)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public this(OTPassword.BlockSize theBlockSize) {
this(otapi_im.new_OTPassword__SWIG_0(cast(int)theBlockSize), true);
}
public this() {
this(otapi_im.new_OTPassword__SWIG_1(), true);
}
public this(OTPassword rhs) {
this(otapi_im.new_OTPassword__SWIG_2(OTPassword.swigGetCPtr(rhs)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(char[] szInput, SWIGTYPE_p_uint32_t nInputSize, OTPassword.BlockSize theBlockSize) {
this(otapi_im.new_OTPassword__SWIG_3((szInput ? tango.stdc.stringz.toStringz(szInput) : null), SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize), cast(int)theBlockSize), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(char[] szInput, SWIGTYPE_p_uint32_t nInputSize) {
this(otapi_im.new_OTPassword__SWIG_4((szInput ? tango.stdc.stringz.toStringz(szInput) : null), SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(SWIGTYPE_p_uint8_t szInput, SWIGTYPE_p_uint32_t nInputSize, OTPassword.BlockSize theBlockSize) {
this(otapi_im.new_OTPassword__SWIG_5(SWIGTYPE_p_uint8_t.swigGetCPtr(szInput), SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize), cast(int)theBlockSize), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(SWIGTYPE_p_uint8_t szInput, SWIGTYPE_p_uint32_t nInputSize) {
this(otapi_im.new_OTPassword__SWIG_6(SWIGTYPE_p_uint8_t.swigGetCPtr(szInput), SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(void* vInput, SWIGTYPE_p_uint32_t nInputSize, OTPassword.BlockSize theBlockSize) {
this(otapi_im.new_OTPassword__SWIG_7(cast(void*)vInput, SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize), cast(int)theBlockSize), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public this(void* vInput, SWIGTYPE_p_uint32_t nInputSize) {
this(otapi_im.new_OTPassword__SWIG_8(cast(void*)vInput, SWIGTYPE_p_uint32_t.swigGetCPtr(nInputSize)), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
}
class OTCallback {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(OTCallback obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTCallback(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public this() {
this(otapi_im.new_OTCallback(), true);
swigDirectorConnect();
}
public void runOne(char[] szDisplay, OTPassword theOutput) {
if (swigIsMethodOverridden!(void delegate(char[], OTPassword), void function(char[], OTPassword), runOne)()) otapi_im.OTCallback_runOneSwigExplicitOTCallback(cast(void*)swigCPtr, (szDisplay ? tango.stdc.stringz.toStringz(szDisplay) : null), OTPassword.swigGetCPtr(theOutput)); else otapi_im.OTCallback_runOne(cast(void*)swigCPtr, (szDisplay ? tango.stdc.stringz.toStringz(szDisplay) : null), OTPassword.swigGetCPtr(theOutput));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public void runTwo(char[] szDisplay, OTPassword theOutput) {
if (swigIsMethodOverridden!(void delegate(char[], OTPassword), void function(char[], OTPassword), runTwo)()) otapi_im.OTCallback_runTwoSwigExplicitOTCallback(cast(void*)swigCPtr, (szDisplay ? tango.stdc.stringz.toStringz(szDisplay) : null), OTPassword.swigGetCPtr(theOutput)); else otapi_im.OTCallback_runTwo(cast(void*)swigCPtr, (szDisplay ? tango.stdc.stringz.toStringz(szDisplay) : null), OTPassword.swigGetCPtr(theOutput));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
private void swigDirectorConnect() {
otapi_im.SwigDirector_OTCallback_Callback0 callback0;
if (swigIsMethodOverridden!(void delegate(char[], OTPassword), void function(char[], OTPassword), runOne)()) {
callback0 = &swigDirectorCallback_OTCallback_runOne;
}
otapi_im.SwigDirector_OTCallback_Callback1 callback1;
if (swigIsMethodOverridden!(void delegate(char[], OTPassword), void function(char[], OTPassword), runTwo)()) {
callback1 = &swigDirectorCallback_OTCallback_runTwo;
}
otapi_im.OTCallback_director_connect(cast(void*)swigCPtr, cast(void*)this, callback0, callback1);
}
private bool swigIsMethodOverridden(DelegateType, FunctionType, alias fn)() {
DelegateType dg = &fn;
return dg.funcptr != SwigNonVirtualAddressOf!(FunctionType, fn);
}
private static Function SwigNonVirtualAddressOf(Function, alias fn)() {
return cast(Function) &fn;
}
}
private extern(C) void swigDirectorCallback_OTCallback_runOne(void* dObject, char* szDisplay, void* theOutput) {
(cast(OTCallback)dObject).runOne(tango.stdc.stringz.fromStringz(szDisplay), new OTPassword(theOutput, false));
}
private extern(C) void swigDirectorCallback_OTCallback_runTwo(void* dObject, char* szDisplay, void* theOutput) {
(cast(OTCallback)dObject).runTwo(tango.stdc.stringz.fromStringz(szDisplay), new OTPassword(theOutput, false));
}
class OTCaller {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(OTCaller obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTCaller(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public this() {
this(otapi_im.new_OTCaller(), true);
}
public bool GetPassword(OTPassword theOutput) {
bool ret = otapi_im.OTCaller_GetPassword(cast(void*)swigCPtr, OTPassword.swigGetCPtr(theOutput)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void ZeroOutPassword() {
otapi_im.OTCaller_ZeroOutPassword(cast(void*)swigCPtr);
}
public char[] GetDisplay() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTCaller_GetDisplay(cast(void*)swigCPtr));
return ret;
}
public void SetDisplay(char[] szDisplay, int nLength) {
otapi_im.OTCaller_SetDisplay(cast(void*)swigCPtr, (szDisplay ? tango.stdc.stringz.toStringz(szDisplay) : null), nLength);
}
public void delCallback() {
otapi_im.OTCaller_delCallback(cast(void*)swigCPtr);
}
public void setCallback(OTCallback cb) {
otapi_im.OTCaller_setCallback(cast(void*)swigCPtr, OTCallback.swigGetCPtr(cb));
}
public bool isCallbackSet() {
bool ret = otapi_im.OTCaller_isCallbackSet(cast(void*)swigCPtr) ? true : false;
return ret;
}
public void callOne() {
otapi_im.OTCaller_callOne(cast(void*)swigCPtr);
}
public void callTwo() {
otapi_im.OTCaller_callTwo(cast(void*)swigCPtr);
}
}
class OTAPI_Basic {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(OTAPI_Basic obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTAPI_Basic(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public this() {
this(otapi_im.new_OTAPI_Basic(), true);
}
public static bool AppStartup() {
bool ret = otapi_im.OTAPI_Basic_AppStartup() ? true : false;
return ret;
}
public static bool AppShutdown() {
bool ret = otapi_im.OTAPI_Basic_AppShutdown() ? true : false;
return ret;
}
public static void SetAppBinaryFolder(char[] strFolder) {
otapi_im.OTAPI_Basic_SetAppBinaryFolder((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static void SetHomeFolder(char[] strFolder) {
otapi_im.OTAPI_Basic_SetHomeFolder((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static bool Init() {
bool ret = otapi_im.OTAPI_Basic_Init() ? true : false;
return ret;
}
public static bool SetWallet(char[] strWalletFilename) {
bool ret = otapi_im.OTAPI_Basic_SetWallet((strWalletFilename ? tango.stdc.stringz.toStringz(strWalletFilename) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool WalletExists() {
bool ret = otapi_im.OTAPI_Basic_WalletExists() ? true : false;
return ret;
}
public static bool LoadWallet() {
bool ret = otapi_im.OTAPI_Basic_LoadWallet() ? true : false;
return ret;
}
public static bool SwitchWallet() {
bool ret = otapi_im.OTAPI_Basic_SwitchWallet() ? true : false;
return ret;
}
public static void Output(tango.stdc.config.c_long nLogLevel, char[] strOutput) {
otapi_im.OTAPI_Basic_Output(nLogLevel, (strOutput ? tango.stdc.stringz.toStringz(strOutput) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static char[] GetTime() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetTime());
return ret;
}
public static char[] NumList_Add(char[] strNumList, char[] strNumbers) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_NumList_Add((strNumList ? tango.stdc.stringz.toStringz(strNumList) : null), (strNumbers ? tango.stdc.stringz.toStringz(strNumbers) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] NumList_Remove(char[] strNumList, char[] strNumbers) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_NumList_Remove((strNumList ? tango.stdc.stringz.toStringz(strNumList) : null), (strNumbers ? tango.stdc.stringz.toStringz(strNumbers) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool NumList_VerifyQuery(char[] strNumList, char[] strNumbers) {
bool ret = otapi_im.OTAPI_Basic_NumList_VerifyQuery((strNumList ? tango.stdc.stringz.toStringz(strNumList) : null), (strNumbers ? tango.stdc.stringz.toStringz(strNumbers) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool NumList_VerifyAll(char[] strNumList, char[] strNumbers) {
bool ret = otapi_im.OTAPI_Basic_NumList_VerifyAll((strNumList ? tango.stdc.stringz.toStringz(strNumList) : null), (strNumbers ? tango.stdc.stringz.toStringz(strNumbers) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long NumList_Count(char[] strNumList) {
auto ret = otapi_im.OTAPI_Basic_NumList_Count((strNumList ? tango.stdc.stringz.toStringz(strNumList) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Encode(char[] strPlaintext, bool bLineBreaks) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Encode((strPlaintext ? tango.stdc.stringz.toStringz(strPlaintext) : null), bLineBreaks));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Decode(char[] strEncoded, bool bLineBreaks) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Decode((strEncoded ? tango.stdc.stringz.toStringz(strEncoded) : null), bLineBreaks));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Encrypt(char[] RECIPIENT_NYM_ID, char[] strPlaintext) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Encrypt((RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (strPlaintext ? tango.stdc.stringz.toStringz(strPlaintext) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Decrypt(char[] RECIPIENT_NYM_ID, char[] strCiphertext) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Decrypt((RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (strCiphertext ? tango.stdc.stringz.toStringz(strCiphertext) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CreateSymmetricKey() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreateSymmetricKey());
return ret;
}
public static char[] SymmetricEncrypt(char[] SYMMETRIC_KEY, char[] PLAintEXT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SymmetricEncrypt((SYMMETRIC_KEY ? tango.stdc.stringz.toStringz(SYMMETRIC_KEY) : null), (PLAintEXT ? tango.stdc.stringz.toStringz(PLAintEXT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SymmetricDecrypt(char[] SYMMETRIC_KEY, char[] CIPHERTEXT_ENVELOPE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SymmetricDecrypt((SYMMETRIC_KEY ? tango.stdc.stringz.toStringz(SYMMETRIC_KEY) : null), (CIPHERTEXT_ENVELOPE ? tango.stdc.stringz.toStringz(CIPHERTEXT_ENVELOPE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SignContract(char[] SIGNER_NYM_ID, char[] THE_CONTRACT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SignContract((SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] FlatSign(char[] SIGNER_NYM_ID, char[] THE_INPUT, char[] CONTRACT_TYPE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_FlatSign((SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (THE_INPUT ? tango.stdc.stringz.toStringz(THE_INPUT) : null), (CONTRACT_TYPE ? tango.stdc.stringz.toStringz(CONTRACT_TYPE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] AddSignature(char[] SIGNER_NYM_ID, char[] THE_CONTRACT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_AddSignature((SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool VerifySignature(char[] SIGNER_NYM_ID, char[] THE_CONTRACT) {
bool ret = otapi_im.OTAPI_Basic_VerifySignature((SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] VerifyAndRetrieveXMLContents(char[] THE_CONTRACT, char[] SIGNER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_VerifyAndRetrieveXMLContents((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_ID ? tango.stdc.stringz.toStringz(SIGNER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetMemlogSize() {
auto ret = otapi_im.OTAPI_Basic_GetMemlogSize();
return ret;
}
public static char[] GetMemlogAtIndex(tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetMemlogAtIndex(nIndex));
return ret;
}
public static char[] PeekMemlogFront() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_PeekMemlogFront());
return ret;
}
public static char[] PeekMemlogBack() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_PeekMemlogBack());
return ret;
}
public static bool PopMemlogFront() {
bool ret = otapi_im.OTAPI_Basic_PopMemlogFront() ? true : false;
return ret;
}
public static bool PopMemlogBack() {
bool ret = otapi_im.OTAPI_Basic_PopMemlogBack() ? true : false;
return ret;
}
public static char[] CreateNym(tango.stdc.config.c_long nKeySize, char[] NYM_ID_SOURCE, char[] ALT_LOCATION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreateNym(nKeySize, (NYM_ID_SOURCE ? tango.stdc.stringz.toStringz(NYM_ID_SOURCE) : null), (ALT_LOCATION ? tango.stdc.stringz.toStringz(ALT_LOCATION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_SourceForID(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_SourceForID((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_AltSourceLocation(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_AltSourceLocation((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_CredentialCount(char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_CredentialCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_CredentialID(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_CredentialID((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_CredentialContents(char[] NYM_ID, char[] CREDENTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_CredentialContents((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (CREDENTIAL_ID ? tango.stdc.stringz.toStringz(CREDENTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_RevokedCredCount(char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_RevokedCredCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_RevokedCredID(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_RevokedCredID((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_RevokedCredContents(char[] NYM_ID, char[] CREDENTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_RevokedCredContents((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (CREDENTIAL_ID ? tango.stdc.stringz.toStringz(CREDENTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_SubcredentialCount(char[] NYM_ID, char[] MASTER_CRED_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_SubcredentialCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MASTER_CRED_ID ? tango.stdc.stringz.toStringz(MASTER_CRED_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_SubCredentialID(char[] NYM_ID, char[] MASTER_CRED_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_SubCredentialID((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MASTER_CRED_ID ? tango.stdc.stringz.toStringz(MASTER_CRED_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_SubCredentialContents(char[] NYM_ID, char[] MASTER_CRED_ID, char[] SUB_CRED_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_SubCredentialContents((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MASTER_CRED_ID ? tango.stdc.stringz.toStringz(MASTER_CRED_ID) : null), (SUB_CRED_ID ? tango.stdc.stringz.toStringz(SUB_CRED_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] AddSubcredential(char[] NYM_ID, char[] MASTER_CRED_ID, tango.stdc.config.c_long nKeySize) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_AddSubcredential((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MASTER_CRED_ID ? tango.stdc.stringz.toStringz(MASTER_CRED_ID) : null), nKeySize));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool RevokeSubcredential(char[] NYM_ID, char[] MASTER_CRED_ID, char[] SUB_CRED_ID) {
bool ret = otapi_im.OTAPI_Basic_RevokeSubcredential((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MASTER_CRED_ID ? tango.stdc.stringz.toStringz(MASTER_CRED_ID) : null), (SUB_CRED_ID ? tango.stdc.stringz.toStringz(SUB_CRED_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CreateServerContract(char[] NYM_ID, char[] strXMLcontents) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreateServerContract((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (strXMLcontents ? tango.stdc.stringz.toStringz(strXMLcontents) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CreateAssetContract(char[] NYM_ID, char[] strXMLcontents) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreateAssetContract((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (strXMLcontents ? tango.stdc.stringz.toStringz(strXMLcontents) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CalculateAssetContractID(char[] str_Contract) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CalculateAssetContractID((str_Contract ? tango.stdc.stringz.toStringz(str_Contract) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CalculateServerContractID(char[] str_Contract) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CalculateServerContractID((str_Contract ? tango.stdc.stringz.toStringz(str_Contract) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long AddServerContract(char[] strContract) {
auto ret = otapi_im.OTAPI_Basic_AddServerContract((strContract ? tango.stdc.stringz.toStringz(strContract) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long AddAssetContract(char[] strContract) {
auto ret = otapi_im.OTAPI_Basic_AddAssetContract((strContract ? tango.stdc.stringz.toStringz(strContract) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetServerCount() {
auto ret = otapi_im.OTAPI_Basic_GetServerCount();
return ret;
}
public static tango.stdc.config.c_long GetAssetTypeCount() {
auto ret = otapi_im.OTAPI_Basic_GetAssetTypeCount();
return ret;
}
public static tango.stdc.config.c_long GetAccountCount() {
auto ret = otapi_im.OTAPI_Basic_GetAccountCount();
return ret;
}
public static tango.stdc.config.c_long GetNymCount() {
auto ret = otapi_im.OTAPI_Basic_GetNymCount();
return ret;
}
public static char[] GetServer_ID(tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetServer_ID(nIndex));
return ret;
}
public static char[] GetServer_Name(char[] SERVER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetServer_Name((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetServer_Contract(char[] SERVER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetServer_Contract((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] FormatAmount(char[] ASSET_TYPE_ID, char[] THE_AMOUNT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_FormatAmount((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_AMOUNT ? tango.stdc.stringz.toStringz(THE_AMOUNT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] StringToAmount(char[] ASSET_TYPE_ID, char[] str_input) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_StringToAmount((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (str_input ? tango.stdc.stringz.toStringz(str_input) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAssetType_ID(tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAssetType_ID(nIndex));
return ret;
}
public static char[] GetAssetType_Name(char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAssetType_Name((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAssetType_TLA(char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAssetType_TLA((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAssetType_Contract(char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAssetType_Contract((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_ID(tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_ID(nIndex));
return ret;
}
public static char[] GetAccountWallet_Name(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_Name((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_Balance(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_Balance((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_Type(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_Type((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_AssetTypeID(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_AssetTypeID((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_ServerID(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_ServerID((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_NymID(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_NymID((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_InboxHash(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_InboxHash((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetAccountWallet_OutboxHash(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetAccountWallet_OutboxHash((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool VerifyAccountReceipt(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID) {
bool ret = otapi_im.OTAPI_Basic_VerifyAccountReceipt((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_TransactionNumCount(char[] SERVER_ID, char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_TransactionNumCount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_ID(tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_ID(nIndex));
return ret;
}
public static char[] GetNym_Name(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_Name((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_Stats(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_Stats((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_NymboxHash(char[] SERVER_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_NymboxHash((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_RecentHash(char[] SERVER_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_RecentHash((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_InboxHash(char[] ACCOUNT_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_InboxHash((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutboxHash(char[] ACCOUNT_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutboxHash((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool IsNym_RegisteredAtServer(char[] NYM_ID, char[] SERVER_ID) {
bool ret = otapi_im.OTAPI_Basic_IsNym_RegisteredAtServer((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_MailCount(char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_MailCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_MailContentsByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_MailContentsByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_MailSenderIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_MailSenderIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_MailServerIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_MailServerIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_RemoveMailByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_RemoveMailByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_VerifyMailByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_VerifyMailByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_OutmailCount(char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_OutmailCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutmailContentsByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutmailContentsByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutmailRecipientIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutmailRecipientIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutmailServerIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutmailServerIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_RemoveOutmailByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_RemoveOutmailByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_VerifyOutmailByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_VerifyOutmailByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long GetNym_OutpaymentsCount(char[] NYM_ID) {
auto ret = otapi_im.OTAPI_Basic_GetNym_OutpaymentsCount((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutpaymentsContentsByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutpaymentsContentsByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutpaymentsRecipientIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutpaymentsRecipientIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GetNym_OutpaymentsServerIDByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetNym_OutpaymentsServerIDByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_RemoveOutpaymentsByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_RemoveOutpaymentsByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Nym_VerifyOutpaymentsByIndex(char[] NYM_ID, tango.stdc.config.c_long nIndex) {
bool ret = otapi_im.OTAPI_Basic_Nym_VerifyOutpaymentsByIndex((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_CanRemoveServer(char[] SERVER_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_CanRemoveServer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_RemoveServer(char[] SERVER_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_RemoveServer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_CanRemoveAssetType(char[] ASSET_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_CanRemoveAssetType((ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_RemoveAssetType(char[] ASSET_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_RemoveAssetType((ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_CanRemoveNym(char[] NYM_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_CanRemoveNym((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_RemoveNym(char[] NYM_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_RemoveNym((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_CanRemoveAccount(char[] ACCOUNT_ID) {
bool ret = otapi_im.OTAPI_Basic_Wallet_CanRemoveAccount((ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_ChangePassphrase() {
bool ret = otapi_im.OTAPI_Basic_Wallet_ChangePassphrase() ? true : false;
return ret;
}
public static char[] Wallet_ExportNym(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_ExportNym((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_ImportNym(char[] FILE_CONTENTS) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_ImportNym((FILE_CONTENTS ? tango.stdc.stringz.toStringz(FILE_CONTENTS) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_ImportCert(char[] DISPLAY_NAME, char[] FILE_CONTENTS) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_ImportCert((DISPLAY_NAME ? tango.stdc.stringz.toStringz(DISPLAY_NAME) : null), (FILE_CONTENTS ? tango.stdc.stringz.toStringz(FILE_CONTENTS) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_ExportCert(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_ExportCert((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_GetNymIDFromPartial(char[] PARTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_GetNymIDFromPartial((PARTIAL_ID ? tango.stdc.stringz.toStringz(PARTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_GetServerIDFromPartial(char[] PARTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_GetServerIDFromPartial((PARTIAL_ID ? tango.stdc.stringz.toStringz(PARTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_GetAssetIDFromPartial(char[] PARTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_GetAssetIDFromPartial((PARTIAL_ID ? tango.stdc.stringz.toStringz(PARTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Wallet_GetAccountIDFromPartial(char[] PARTIAL_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Wallet_GetAccountIDFromPartial((PARTIAL_ID ? tango.stdc.stringz.toStringz(PARTIAL_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool SetNym_Name(char[] NYM_ID, char[] SIGNER_NYM_ID, char[] NYM_NEW_NAME) {
bool ret = otapi_im.OTAPI_Basic_SetNym_Name((NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (NYM_NEW_NAME ? tango.stdc.stringz.toStringz(NYM_NEW_NAME) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool SetAccountWallet_Name(char[] ACCT_ID, char[] SIGNER_NYM_ID, char[] ACCT_NEW_NAME) {
bool ret = otapi_im.OTAPI_Basic_SetAccountWallet_Name((ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (ACCT_NEW_NAME ? tango.stdc.stringz.toStringz(ACCT_NEW_NAME) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool SetAssetType_Name(char[] ASSET_ID, char[] STR_NEW_NAME) {
bool ret = otapi_im.OTAPI_Basic_SetAssetType_Name((ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null), (STR_NEW_NAME ? tango.stdc.stringz.toStringz(STR_NEW_NAME) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool SetServer_Name(char[] SERVER_ID, char[] STR_NEW_NAME) {
bool ret = otapi_im.OTAPI_Basic_SetServer_Name((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (STR_NEW_NAME ? tango.stdc.stringz.toStringz(STR_NEW_NAME) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] WriteCheque(char[] SERVER_ID, char[] CHEQUE_AMOUNT, char[] VALID_FROM, char[] VALID_TO, char[] SENDER_ACCT_ID, char[] SENDER_USER_ID, char[] CHEQUE_MEMO, char[] RECIPIENT_USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_WriteCheque((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (CHEQUE_AMOUNT ? tango.stdc.stringz.toStringz(CHEQUE_AMOUNT) : null), (VALID_FROM ? tango.stdc.stringz.toStringz(VALID_FROM) : null), (VALID_TO ? tango.stdc.stringz.toStringz(VALID_TO) : null), (SENDER_ACCT_ID ? tango.stdc.stringz.toStringz(SENDER_ACCT_ID) : null), (SENDER_USER_ID ? tango.stdc.stringz.toStringz(SENDER_USER_ID) : null), (CHEQUE_MEMO ? tango.stdc.stringz.toStringz(CHEQUE_MEMO) : null), (RECIPIENT_USER_ID ? tango.stdc.stringz.toStringz(RECIPIENT_USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool DiscardCheque(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] THE_CHEQUE) {
bool ret = otapi_im.OTAPI_Basic_DiscardCheque((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (THE_CHEQUE ? tango.stdc.stringz.toStringz(THE_CHEQUE) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] ProposePaymentPlan(char[] SERVER_ID, char[] VALID_FROM, char[] VALID_TO, char[] SENDER_ACCT_ID, char[] SENDER_USER_ID, char[] PLAN_CONSIDERATION, char[] RECIPIENT_ACCT_ID, char[] RECIPIENT_USER_ID, char[] INITIAL_PAYMENT_AMOUNT, char[] INITIAL_PAYMENT_DELAY, char[] PAYMENT_PLAN_AMOUNT, char[] PAYMENT_PLAN_DELAY, char[] PAYMENT_PLAN_PERIOD, char[] PAYMENT_PLAN_LENGTH, tango.stdc.config.c_long PAYMENT_PLAN_MAX_PAYMENTS) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_ProposePaymentPlan((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (VALID_FROM ? tango.stdc.stringz.toStringz(VALID_FROM) : null), (VALID_TO ? tango.stdc.stringz.toStringz(VALID_TO) : null), (SENDER_ACCT_ID ? tango.stdc.stringz.toStringz(SENDER_ACCT_ID) : null), (SENDER_USER_ID ? tango.stdc.stringz.toStringz(SENDER_USER_ID) : null), (PLAN_CONSIDERATION ? tango.stdc.stringz.toStringz(PLAN_CONSIDERATION) : null), (RECIPIENT_ACCT_ID ? tango.stdc.stringz.toStringz(RECIPIENT_ACCT_ID) : null), (RECIPIENT_USER_ID ? tango.stdc.stringz.toStringz(RECIPIENT_USER_ID) : null), (INITIAL_PAYMENT_AMOUNT ? tango.stdc.stringz.toStringz(INITIAL_PAYMENT_AMOUNT) : null), (INITIAL_PAYMENT_DELAY ? tango.stdc.stringz.toStringz(INITIAL_PAYMENT_DELAY) : null), (PAYMENT_PLAN_AMOUNT ? tango.stdc.stringz.toStringz(PAYMENT_PLAN_AMOUNT) : null), (PAYMENT_PLAN_DELAY ? tango.stdc.stringz.toStringz(PAYMENT_PLAN_DELAY) : null), (PAYMENT_PLAN_PERIOD ? tango.stdc.stringz.toStringz(PAYMENT_PLAN_PERIOD) : null), (PAYMENT_PLAN_LENGTH ? tango.stdc.stringz.toStringz(PAYMENT_PLAN_LENGTH) : null), PAYMENT_PLAN_MAX_PAYMENTS));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] EasyProposePlan(char[] SERVER_ID, char[] DATE_RANGE, char[] SENDER_ACCT_ID, char[] SENDER_USER_ID, char[] PLAN_CONSIDERATION, char[] RECIPIENT_ACCT_ID, char[] RECIPIENT_USER_ID, char[] INITIAL_PAYMENT, char[] PAYMENT_PLAN, char[] PLAN_EXPIRY) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_EasyProposePlan((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (DATE_RANGE ? tango.stdc.stringz.toStringz(DATE_RANGE) : null), (SENDER_ACCT_ID ? tango.stdc.stringz.toStringz(SENDER_ACCT_ID) : null), (SENDER_USER_ID ? tango.stdc.stringz.toStringz(SENDER_USER_ID) : null), (PLAN_CONSIDERATION ? tango.stdc.stringz.toStringz(PLAN_CONSIDERATION) : null), (RECIPIENT_ACCT_ID ? tango.stdc.stringz.toStringz(RECIPIENT_ACCT_ID) : null), (RECIPIENT_USER_ID ? tango.stdc.stringz.toStringz(RECIPIENT_USER_ID) : null), (INITIAL_PAYMENT ? tango.stdc.stringz.toStringz(INITIAL_PAYMENT) : null), (PAYMENT_PLAN ? tango.stdc.stringz.toStringz(PAYMENT_PLAN) : null), (PLAN_EXPIRY ? tango.stdc.stringz.toStringz(PLAN_EXPIRY) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] ConfirmPaymentPlan(char[] SERVER_ID, char[] SENDER_USER_ID, char[] SENDER_ACCT_ID, char[] RECIPIENT_USER_ID, char[] PAYMENT_PLAN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_ConfirmPaymentPlan((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (SENDER_USER_ID ? tango.stdc.stringz.toStringz(SENDER_USER_ID) : null), (SENDER_ACCT_ID ? tango.stdc.stringz.toStringz(SENDER_ACCT_ID) : null), (RECIPIENT_USER_ID ? tango.stdc.stringz.toStringz(RECIPIENT_USER_ID) : null), (PAYMENT_PLAN ? tango.stdc.stringz.toStringz(PAYMENT_PLAN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Create_SmartContract(char[] SIGNER_NYM_ID, char[] VALID_FROM, char[] VALID_TO) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Create_SmartContract((SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (VALID_FROM ? tango.stdc.stringz.toStringz(VALID_FROM) : null), (VALID_TO ? tango.stdc.stringz.toStringz(VALID_TO) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddBylaw(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] BYLAW_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddBylaw((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddClause(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] BYLAW_NAME, char[] CLAUSE_NAME, char[] SOURCE_CODE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddClause((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null), (SOURCE_CODE ? tango.stdc.stringz.toStringz(SOURCE_CODE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddVariable(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] BYLAW_NAME, char[] VAR_NAME, char[] VAR_ACCESS, char[] VAR_TYPE, char[] VAR_VALUE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddVariable((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (VAR_NAME ? tango.stdc.stringz.toStringz(VAR_NAME) : null), (VAR_ACCESS ? tango.stdc.stringz.toStringz(VAR_ACCESS) : null), (VAR_TYPE ? tango.stdc.stringz.toStringz(VAR_TYPE) : null), (VAR_VALUE ? tango.stdc.stringz.toStringz(VAR_VALUE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddCallback(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] BYLAW_NAME, char[] CALLBACK_NAME, char[] CLAUSE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddCallback((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (CALLBACK_NAME ? tango.stdc.stringz.toStringz(CALLBACK_NAME) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddHook(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] BYLAW_NAME, char[] HOOK_NAME, char[] CLAUSE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddHook((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (HOOK_NAME ? tango.stdc.stringz.toStringz(HOOK_NAME) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddParty(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] PARTY_NAME, char[] AGENT_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddParty((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (AGENT_NAME ? tango.stdc.stringz.toStringz(AGENT_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_AddAccount(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] PARTY_NAME, char[] ACCT_NAME, char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_AddAccount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (ACCT_NAME ? tango.stdc.stringz.toStringz(ACCT_NAME) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long SmartContract_CountNumsNeeded(char[] THE_CONTRACT, char[] AGENT_NAME) {
auto ret = otapi_im.OTAPI_Basic_SmartContract_CountNumsNeeded((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (AGENT_NAME ? tango.stdc.stringz.toStringz(AGENT_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_ConfirmAccount(char[] THE_CONTRACT, char[] SIGNER_NYM_ID, char[] PARTY_NAME, char[] ACCT_NAME, char[] AGENT_NAME, char[] ACCT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_ConfirmAccount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (ACCT_NAME ? tango.stdc.stringz.toStringz(ACCT_NAME) : null), (AGENT_NAME ? tango.stdc.stringz.toStringz(AGENT_NAME) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] SmartContract_ConfirmParty(char[] THE_CONTRACT, char[] PARTY_NAME, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_SmartContract_ConfirmParty((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Smart_AreAllPartiesConfirmed(char[] THE_CONTRACT) {
bool ret = otapi_im.OTAPI_Basic_Smart_AreAllPartiesConfirmed((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Smart_IsPartyConfirmed(char[] THE_CONTRACT, char[] PARTY_NAME) {
bool ret = otapi_im.OTAPI_Basic_Smart_IsPartyConfirmed((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Smart_GetBylawCount(char[] THE_CONTRACT) {
auto ret = otapi_im.OTAPI_Basic_Smart_GetBylawCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Smart_GetBylawByIndex(char[] THE_CONTRACT, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Smart_GetBylawByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Bylaw_GetLanguage(char[] THE_CONTRACT, char[] BYLAW_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Bylaw_GetLanguage((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Bylaw_GetClauseCount(char[] THE_CONTRACT, char[] BYLAW_NAME) {
auto ret = otapi_im.OTAPI_Basic_Bylaw_GetClauseCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Clause_GetNameByIndex(char[] THE_CONTRACT, char[] BYLAW_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Clause_GetNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Clause_GetContents(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] CLAUSE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Clause_GetContents((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Bylaw_GetVariableCount(char[] THE_CONTRACT, char[] BYLAW_NAME) {
auto ret = otapi_im.OTAPI_Basic_Bylaw_GetVariableCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Variable_GetNameByIndex(char[] THE_CONTRACT, char[] BYLAW_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Variable_GetNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Variable_GetType(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] VARIABLE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Variable_GetType((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (VARIABLE_NAME ? tango.stdc.stringz.toStringz(VARIABLE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Variable_GetAccess(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] VARIABLE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Variable_GetAccess((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (VARIABLE_NAME ? tango.stdc.stringz.toStringz(VARIABLE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Variable_GetContents(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] VARIABLE_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Variable_GetContents((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (VARIABLE_NAME ? tango.stdc.stringz.toStringz(VARIABLE_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Bylaw_GetHookCount(char[] THE_CONTRACT, char[] BYLAW_NAME) {
auto ret = otapi_im.OTAPI_Basic_Bylaw_GetHookCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Hook_GetNameByIndex(char[] THE_CONTRACT, char[] BYLAW_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Hook_GetNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Hook_GetClauseCount(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] HOOK_NAME) {
auto ret = otapi_im.OTAPI_Basic_Hook_GetClauseCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (HOOK_NAME ? tango.stdc.stringz.toStringz(HOOK_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Hook_GetClauseAtIndex(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] HOOK_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Hook_GetClauseAtIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (HOOK_NAME ? tango.stdc.stringz.toStringz(HOOK_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Bylaw_GetCallbackCount(char[] THE_CONTRACT, char[] BYLAW_NAME) {
auto ret = otapi_im.OTAPI_Basic_Bylaw_GetCallbackCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Callback_GetNameByIndex(char[] THE_CONTRACT, char[] BYLAW_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Callback_GetNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Callback_GetClause(char[] THE_CONTRACT, char[] BYLAW_NAME, char[] CALLBACK_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Callback_GetClause((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (BYLAW_NAME ? tango.stdc.stringz.toStringz(BYLAW_NAME) : null), (CALLBACK_NAME ? tango.stdc.stringz.toStringz(CALLBACK_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Smart_GetPartyCount(char[] THE_CONTRACT) {
auto ret = otapi_im.OTAPI_Basic_Smart_GetPartyCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Smart_GetPartyByIndex(char[] THE_CONTRACT, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Smart_GetPartyByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetID(char[] THE_CONTRACT, char[] PARTY_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetID((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Party_GetAcctCount(char[] THE_CONTRACT, char[] PARTY_NAME) {
auto ret = otapi_im.OTAPI_Basic_Party_GetAcctCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAcctNameByIndex(char[] THE_CONTRACT, char[] PARTY_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAcctNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAcctID(char[] THE_CONTRACT, char[] PARTY_NAME, char[] ACCT_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAcctID((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (ACCT_NAME ? tango.stdc.stringz.toStringz(ACCT_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAcctAssetID(char[] THE_CONTRACT, char[] PARTY_NAME, char[] ACCT_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAcctAssetID((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (ACCT_NAME ? tango.stdc.stringz.toStringz(ACCT_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAcctAgentName(char[] THE_CONTRACT, char[] PARTY_NAME, char[] ACCT_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAcctAgentName((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (ACCT_NAME ? tango.stdc.stringz.toStringz(ACCT_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Party_GetAgentCount(char[] THE_CONTRACT, char[] PARTY_NAME) {
auto ret = otapi_im.OTAPI_Basic_Party_GetAgentCount((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAgentNameByIndex(char[] THE_CONTRACT, char[] PARTY_NAME, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAgentNameByIndex((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Party_GetAgentID(char[] THE_CONTRACT, char[] PARTY_NAME, char[] AGENT_NAME) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Party_GetAgentID((THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null), (PARTY_NAME ? tango.stdc.stringz.toStringz(PARTY_NAME) : null), (AGENT_NAME ? tango.stdc.stringz.toStringz(AGENT_NAME) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long activateSmartContract(char[] SERVER_ID, char[] USER_ID, char[] THE_SMART_CONTRACT) {
auto ret = otapi_im.OTAPI_Basic_activateSmartContract((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_SMART_CONTRACT ? tango.stdc.stringz.toStringz(THE_SMART_CONTRACT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long triggerClause(char[] SERVER_ID, char[] USER_ID, char[] TRANSACTION_NUMBER, char[] CLAUSE_NAME, char[] STR_PARAM) {
auto ret = otapi_im.OTAPI_Basic_triggerClause((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null), (STR_PARAM ? tango.stdc.stringz.toStringz(STR_PARAM) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Msg_HarvestTransactionNumbers(char[] THE_MESSAGE, char[] USER_ID, bool bHarvestingForRetry, bool bReplyWasSuccess, bool bReplyWasFailure, bool bTransactionWasSuccess, bool bTransactionWasFailure) {
bool ret = otapi_im.OTAPI_Basic_Msg_HarvestTransactionNumbers((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), bHarvestingForRetry, bReplyWasSuccess, bReplyWasFailure, bTransactionWasSuccess, bTransactionWasFailure) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadUserPubkey_Encryption(char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadUserPubkey_Encryption((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadUserPubkey_Signing(char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadUserPubkey_Signing((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadPubkey_Encryption(char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadPubkey_Encryption((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadPubkey_Signing(char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadPubkey_Signing((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool VerifyUserPrivateKey(char[] USER_ID) {
bool ret = otapi_im.OTAPI_Basic_VerifyUserPrivateKey((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadPurse(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadPurse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadMint(char[] SERVER_ID, char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadMint((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadAssetContract(char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadAssetContract((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadServerContract(char[] SERVER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadServerContract((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Mint_IsStillGood(char[] SERVER_ID, char[] ASSET_TYPE_ID) {
bool ret = otapi_im.OTAPI_Basic_Mint_IsStillGood((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool IsBasketCurrency(char[] ASSET_TYPE_ID) {
bool ret = otapi_im.OTAPI_Basic_IsBasketCurrency((ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Basket_GetMemberCount(char[] BASKET_ASSET_TYPE_ID) {
auto ret = otapi_im.OTAPI_Basic_Basket_GetMemberCount((BASKET_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_TYPE_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Basket_GetMemberType(char[] BASKET_ASSET_TYPE_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Basket_GetMemberType((BASKET_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_TYPE_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Basket_GetMinimumTransferAmount(char[] BASKET_ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Basket_GetMinimumTransferAmount((BASKET_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Basket_GetMemberMinimumTransferAmount(char[] BASKET_ASSET_TYPE_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Basket_GetMemberMinimumTransferAmount((BASKET_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_TYPE_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadAssetAccount(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadAssetAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadInbox(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadInbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadOutbox(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadOutbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadInboxNoVerify(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadInboxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadOutboxNoVerify(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadOutboxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadPaymentInbox(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadPaymentInbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadPaymentInboxNoVerify(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadPaymentInboxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadRecordBox(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadRecordBox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadRecordBoxNoVerify(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadRecordBoxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool ClearRecord(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, tango.stdc.config.c_long nIndex, bool bClearAll) {
bool ret = otapi_im.OTAPI_Basic_ClearRecord((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), nIndex, bClearAll) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadExpiredBox(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadExpiredBox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadExpiredBoxNoVerify(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadExpiredBoxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool ClearExpired(char[] SERVER_ID, char[] USER_ID, tango.stdc.config.c_long nIndex, bool bClearAll) {
bool ret = otapi_im.OTAPI_Basic_ClearExpired((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), nIndex, bClearAll) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Ledger_GetCount(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER) {
auto ret = otapi_im.OTAPI_Basic_Ledger_GetCount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_CreateResponse(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] ORIGINAL_LEDGER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_CreateResponse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (ORIGINAL_LEDGER ? tango.stdc.stringz.toStringz(ORIGINAL_LEDGER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_GetTransactionByIndex(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_GetTransactionByIndex((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_GetTransactionByID(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER, char[] TRANSACTION_NUMBER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_GetTransactionByID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null), (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_GetTransactionIDByIndex(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_GetTransactionIDByIndex((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_AddTransaction(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_AddTransaction((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_CreateResponse(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] RESPONSE_LEDGER, char[] ORIGINAL_TRANSACTION, bool BOOL_DO_I_ACCEPT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_CreateResponse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (RESPONSE_LEDGER ? tango.stdc.stringz.toStringz(RESPONSE_LEDGER) : null), (ORIGINAL_TRANSACTION ? tango.stdc.stringz.toStringz(ORIGINAL_TRANSACTION) : null), BOOL_DO_I_ACCEPT));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_FinalizeResponse(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_FinalizeResponse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Ledger_GetInstrument(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_LEDGER, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Ledger_GetInstrument((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_LEDGER ? tango.stdc.stringz.toStringz(THE_LEDGER) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool RecordPayment(char[] SERVER_ID, char[] USER_ID, bool bIsInbox, tango.stdc.config.c_long nIndex, bool bSaveCopy) {
bool ret = otapi_im.OTAPI_Basic_RecordPayment((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), bIsInbox, nIndex, bSaveCopy) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetType(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetType((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] ReplyNotice_GetRequestNum(char[] SERVER_ID, char[] USER_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_ReplyNotice_GetRequestNum((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetVoucher(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetVoucher((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Transaction_GetSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
auto ret = otapi_im.OTAPI_Basic_Transaction_GetSuccess((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Transaction_IsCanceled(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
auto ret = otapi_im.OTAPI_Basic_Transaction_IsCanceled((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Transaction_GetBalanceAgreementSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
auto ret = otapi_im.OTAPI_Basic_Transaction_GetBalanceAgreementSuccess((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetDateSigned(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetDateSigned((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetAmount(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetAmount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Pending_GetNote(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Pending_GetNote((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetSenderUserID(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetSenderUserID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetSenderAcctID(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetSenderAcctID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetRecipientUserID(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetRecipientUserID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetRecipientAcctID(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetRecipientAcctID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Transaction_GetDisplayReferenceToNum(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_TRANSACTION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Transaction_GetDisplayReferenceToNum((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_TRANSACTION ? tango.stdc.stringz.toStringz(THE_TRANSACTION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool SavePurse(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] USER_ID, char[] THE_PURSE) {
bool ret = otapi_im.OTAPI_Basic_SavePurse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CreatePurse(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] OWNER_ID, char[] SIGNER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreatePurse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (OWNER_ID ? tango.stdc.stringz.toStringz(OWNER_ID) : null), (SIGNER_ID ? tango.stdc.stringz.toStringz(SIGNER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] CreatePurse_Passphrase(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] SIGNER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_CreatePurse_Passphrase((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (SIGNER_ID ? tango.stdc.stringz.toStringz(SIGNER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Purse_GetTotalValue(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_PURSE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Purse_GetTotalValue((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Purse_Count(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_PURSE) {
auto ret = otapi_im.OTAPI_Basic_Purse_Count((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Purse_HasPassword(char[] SERVER_ID, char[] THE_PURSE) {
bool ret = otapi_im.OTAPI_Basic_Purse_HasPassword((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Purse_Peek(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] OWNER_ID, char[] THE_PURSE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Purse_Peek((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (OWNER_ID ? tango.stdc.stringz.toStringz(OWNER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Purse_Pop(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] OWNER_OR_SIGNER_ID, char[] THE_PURSE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Purse_Pop((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (OWNER_OR_SIGNER_ID ? tango.stdc.stringz.toStringz(OWNER_OR_SIGNER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Purse_Push(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] SIGNER_ID, char[] OWNER_ID, char[] THE_PURSE, char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Purse_Push((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (SIGNER_ID ? tango.stdc.stringz.toStringz(SIGNER_ID) : null), (OWNER_ID ? tango.stdc.stringz.toStringz(OWNER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Purse_Empty(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] SIGNER_ID, char[] THE_PURSE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Purse_Empty((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (SIGNER_ID ? tango.stdc.stringz.toStringz(SIGNER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool Wallet_ImportPurse(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] USER_ID, char[] THE_PURSE) {
bool ret = otapi_im.OTAPI_Basic_Wallet_ImportPurse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long exchangePurse(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] USER_ID, char[] THE_PURSE) {
auto ret = otapi_im.OTAPI_Basic_exchangePurse((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_ChangeOwner(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN, char[] SIGNER_NYM_ID, char[] OLD_OWNER, char[] NEW_OWNER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_ChangeOwner((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null), (SIGNER_NYM_ID ? tango.stdc.stringz.toStringz(SIGNER_NYM_ID) : null), (OLD_OWNER ? tango.stdc.stringz.toStringz(OLD_OWNER) : null), (NEW_OWNER ? tango.stdc.stringz.toStringz(NEW_OWNER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetID(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetDenomination(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetDenomination((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Token_GetSeries(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN) {
auto ret = otapi_im.OTAPI_Basic_Token_GetSeries((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetValidFrom(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetValidFrom((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetValidTo(char[] SERVER_ID, char[] ASSET_TYPE_ID, char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetValidTo((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetAssetID(char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetAssetID((THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Token_GetServerID(char[] THE_TOKEN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Token_GetServerID((THE_TOKEN ? tango.stdc.stringz.toStringz(THE_TOKEN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetAmount(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetAmount((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetTransNum(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetTransNum((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetValidFrom(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetValidFrom((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetValidTo(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetValidTo((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetMemo(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetMemo((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetType(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetType((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetServerID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetServerID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetAssetID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetAssetID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetSenderUserID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetSenderUserID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetSenderAcctID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetSenderAcctID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetRemitterUserID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetRemitterUserID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetRemitterAcctID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetRemitterAcctID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetRecipientUserID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetRecipientUserID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Instrmnt_GetRecipientAcctID(char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Instrmnt_GetRecipientAcctID((THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long checkServerID(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_checkServerID((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long createUserAccount(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_createUserAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long deleteUserAccount(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_deleteUserAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long deleteAssetAccount(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID) {
auto ret = otapi_im.OTAPI_Basic_deleteAssetAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long usageCredits(char[] SERVER_ID, char[] USER_ID, char[] USER_ID_CHECK, char[] ADJUSTMENT) {
auto ret = otapi_im.OTAPI_Basic_usageCredits((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (USER_ID_CHECK ? tango.stdc.stringz.toStringz(USER_ID_CHECK) : null), (ADJUSTMENT ? tango.stdc.stringz.toStringz(ADJUSTMENT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetUsageCredits(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetUsageCredits((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long checkUser(char[] SERVER_ID, char[] USER_ID, char[] USER_ID_CHECK) {
auto ret = otapi_im.OTAPI_Basic_checkUser((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (USER_ID_CHECK ? tango.stdc.stringz.toStringz(USER_ID_CHECK) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long sendUserMessage(char[] SERVER_ID, char[] USER_ID, char[] USER_ID_RECIPIENT, char[] RECIPIENT_PUBKEY, char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_sendUserMessage((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (USER_ID_RECIPIENT ? tango.stdc.stringz.toStringz(USER_ID_RECIPIENT) : null), (RECIPIENT_PUBKEY ? tango.stdc.stringz.toStringz(RECIPIENT_PUBKEY) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long sendUserInstrument(char[] SERVER_ID, char[] USER_ID, char[] USER_ID_RECIPIENT, char[] RECIPIENT_PUBKEY, char[] THE_INSTRUMENT, char[] INSTRUMENT_FOR_SENDER) {
auto ret = otapi_im.OTAPI_Basic_sendUserInstrument((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (USER_ID_RECIPIENT ? tango.stdc.stringz.toStringz(USER_ID_RECIPIENT) : null), (RECIPIENT_PUBKEY ? tango.stdc.stringz.toStringz(RECIPIENT_PUBKEY) : null), (THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null), (INSTRUMENT_FOR_SENDER ? tango.stdc.stringz.toStringz(INSTRUMENT_FOR_SENDER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getRequest(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_getRequest((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getTransactionNumber(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_getTransactionNumber((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long issueAssetType(char[] SERVER_ID, char[] USER_ID, char[] THE_CONTRACT) {
auto ret = otapi_im.OTAPI_Basic_issueAssetType((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getContract(char[] SERVER_ID, char[] USER_ID, char[] ASSET_ID) {
auto ret = otapi_im.OTAPI_Basic_getContract((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getMint(char[] SERVER_ID, char[] USER_ID, char[] ASSET_ID) {
auto ret = otapi_im.OTAPI_Basic_getMint((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long createAssetAccount(char[] SERVER_ID, char[] USER_ID, char[] ASSET_ID) {
auto ret = otapi_im.OTAPI_Basic_createAssetAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getAccount(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID) {
auto ret = otapi_im.OTAPI_Basic_getAccount((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getAccountFiles(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID) {
auto ret = otapi_im.OTAPI_Basic_getAccountFiles((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GenerateBasketCreation(char[] USER_ID, char[] MINIMUM_TRANSFER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GenerateBasketCreation((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (MINIMUM_TRANSFER ? tango.stdc.stringz.toStringz(MINIMUM_TRANSFER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] AddBasketCreationItem(char[] USER_ID, char[] THE_BASKET, char[] ASSET_TYPE_ID, char[] MINIMUM_TRANSFER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_AddBasketCreationItem((USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (MINIMUM_TRANSFER ? tango.stdc.stringz.toStringz(MINIMUM_TRANSFER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long issueBasket(char[] SERVER_ID, char[] USER_ID, char[] THE_BASKET) {
auto ret = otapi_im.OTAPI_Basic_issueBasket((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] GenerateBasketExchange(char[] SERVER_ID, char[] USER_ID, char[] BASKET_ASSET_TYPE_ID, char[] BASKET_ASSET_ACCT_ID, tango.stdc.config.c_long TRANSFER_MULTIPLE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GenerateBasketExchange((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (BASKET_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_TYPE_ID) : null), (BASKET_ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_ACCT_ID) : null), TRANSFER_MULTIPLE));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] AddBasketExchangeItem(char[] SERVER_ID, char[] USER_ID, char[] THE_BASKET, char[] ASSET_TYPE_ID, char[] ASSET_ACCT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_AddBasketExchangeItem((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(ASSET_ACCT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long exchangeBasket(char[] SERVER_ID, char[] USER_ID, char[] BASKET_ASSET_ID, char[] THE_BASKET, bool BOOL_EXCHANGE_IN_OR_OUT) {
auto ret = otapi_im.OTAPI_Basic_exchangeBasket((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (BASKET_ASSET_ID ? tango.stdc.stringz.toStringz(BASKET_ASSET_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null), BOOL_EXCHANGE_IN_OR_OUT);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long notarizeWithdrawal(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] AMOUNT) {
auto ret = otapi_im.OTAPI_Basic_notarizeWithdrawal((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long notarizeDeposit(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] THE_PURSE) {
auto ret = otapi_im.OTAPI_Basic_notarizeDeposit((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (THE_PURSE ? tango.stdc.stringz.toStringz(THE_PURSE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long notarizeTransfer(char[] SERVER_ID, char[] USER_ID, char[] ACCT_FROM, char[] ACCT_TO, char[] AMOUNT, char[] NOTE) {
auto ret = otapi_im.OTAPI_Basic_notarizeTransfer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_FROM ? tango.stdc.stringz.toStringz(ACCT_FROM) : null), (ACCT_TO ? tango.stdc.stringz.toStringz(ACCT_TO) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null), (NOTE ? tango.stdc.stringz.toStringz(NOTE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getInbox(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID) {
auto ret = otapi_im.OTAPI_Basic_getInbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getOutbox(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID) {
auto ret = otapi_im.OTAPI_Basic_getOutbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getNymbox(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_getNymbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadNymbox(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadNymbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] LoadNymboxNoVerify(char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_LoadNymboxNoVerify((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Nymbox_GetReplyNotice(char[] SERVER_ID, char[] USER_ID, char[] REQUEST_NUMBER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Nymbox_GetReplyNotice((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (REQUEST_NUMBER ? tango.stdc.stringz.toStringz(REQUEST_NUMBER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool HaveAlreadySeenReply(char[] SERVER_ID, char[] USER_ID, char[] REQUEST_NUMBER) {
bool ret = otapi_im.OTAPI_Basic_HaveAlreadySeenReply((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (REQUEST_NUMBER ? tango.stdc.stringz.toStringz(REQUEST_NUMBER) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getBoxReceipt(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, tango.stdc.config.c_long nBoxType, char[] TRANSACTION_NUMBER) {
auto ret = otapi_im.OTAPI_Basic_getBoxReceipt((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), nBoxType, (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool DoesBoxReceiptExist(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, tango.stdc.config.c_long nBoxType, char[] TRANSACTION_NUMBER) {
bool ret = otapi_im.OTAPI_Basic_DoesBoxReceiptExist((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), nBoxType, (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long processInbox(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] ACCT_LEDGER) {
auto ret = otapi_im.OTAPI_Basic_processInbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (ACCT_LEDGER ? tango.stdc.stringz.toStringz(ACCT_LEDGER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long processNymbox(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_processNymbox((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long withdrawVoucher(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] RECIPIENT_USER_ID, char[] CHEQUE_MEMO, char[] AMOUNT) {
auto ret = otapi_im.OTAPI_Basic_withdrawVoucher((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (RECIPIENT_USER_ID ? tango.stdc.stringz.toStringz(RECIPIENT_USER_ID) : null), (CHEQUE_MEMO ? tango.stdc.stringz.toStringz(CHEQUE_MEMO) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long payDividend(char[] SERVER_ID, char[] ISSUER_USER_ID, char[] DIVIDEND_FROM_ACCT_ID, char[] SHARES_ASSET_TYPE_ID, char[] DIVIDEND_MEMO, char[] AMOUNT_PER_SHARE) {
auto ret = otapi_im.OTAPI_Basic_payDividend((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (ISSUER_USER_ID ? tango.stdc.stringz.toStringz(ISSUER_USER_ID) : null), (DIVIDEND_FROM_ACCT_ID ? tango.stdc.stringz.toStringz(DIVIDEND_FROM_ACCT_ID) : null), (SHARES_ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(SHARES_ASSET_TYPE_ID) : null), (DIVIDEND_MEMO ? tango.stdc.stringz.toStringz(DIVIDEND_MEMO) : null), (AMOUNT_PER_SHARE ? tango.stdc.stringz.toStringz(AMOUNT_PER_SHARE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long depositCheque(char[] SERVER_ID, char[] USER_ID, char[] ACCT_ID, char[] THE_CHEQUE) {
auto ret = otapi_im.OTAPI_Basic_depositCheque((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (THE_CHEQUE ? tango.stdc.stringz.toStringz(THE_CHEQUE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long depositPaymentPlan(char[] SERVER_ID, char[] USER_ID, char[] THE_PAYMENT_PLAN) {
auto ret = otapi_im.OTAPI_Basic_depositPaymentPlan((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_PAYMENT_PLAN ? tango.stdc.stringz.toStringz(THE_PAYMENT_PLAN) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long issueMarketOffer(char[] ASSET_ACCT_ID, char[] CURRENCY_ACCT_ID, char[] MARKET_SCALE, char[] MINIMUM_INCREMENT, char[] TOTAL_ASSETS_ON_OFFER, char[] PRICE_LIMIT, bool bBuyingOrSelling, char[] LIFESPAN_IN_SECONDS, char[] STOP_SIGN, char[] ACTIVATION_PRICE) {
auto ret = otapi_im.OTAPI_Basic_issueMarketOffer((ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(ASSET_ACCT_ID) : null), (CURRENCY_ACCT_ID ? tango.stdc.stringz.toStringz(CURRENCY_ACCT_ID) : null), (MARKET_SCALE ? tango.stdc.stringz.toStringz(MARKET_SCALE) : null), (MINIMUM_INCREMENT ? tango.stdc.stringz.toStringz(MINIMUM_INCREMENT) : null), (TOTAL_ASSETS_ON_OFFER ? tango.stdc.stringz.toStringz(TOTAL_ASSETS_ON_OFFER) : null), (PRICE_LIMIT ? tango.stdc.stringz.toStringz(PRICE_LIMIT) : null), bBuyingOrSelling, (LIFESPAN_IN_SECONDS ? tango.stdc.stringz.toStringz(LIFESPAN_IN_SECONDS) : null), (STOP_SIGN ? tango.stdc.stringz.toStringz(STOP_SIGN) : null), (ACTIVATION_PRICE ? tango.stdc.stringz.toStringz(ACTIVATION_PRICE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getMarketList(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_getMarketList((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getMarketOffers(char[] SERVER_ID, char[] USER_ID, char[] MARKET_ID, char[] MAX_DEPTH) {
auto ret = otapi_im.OTAPI_Basic_getMarketOffers((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (MARKET_ID ? tango.stdc.stringz.toStringz(MARKET_ID) : null), (MAX_DEPTH ? tango.stdc.stringz.toStringz(MAX_DEPTH) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getMarketRecentTrades(char[] SERVER_ID, char[] USER_ID, char[] MARKET_ID) {
auto ret = otapi_im.OTAPI_Basic_getMarketRecentTrades((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (MARKET_ID ? tango.stdc.stringz.toStringz(MARKET_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long getNym_MarketOffers(char[] SERVER_ID, char[] USER_ID) {
auto ret = otapi_im.OTAPI_Basic_getNym_MarketOffers((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long killMarketOffer(char[] SERVER_ID, char[] USER_ID, char[] ASSET_ACCT_ID, char[] TRANSACTION_NUMBER) {
auto ret = otapi_im.OTAPI_Basic_killMarketOffer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(ASSET_ACCT_ID) : null), (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long killPaymentPlan(char[] SERVER_ID, char[] USER_ID, char[] FROM_ACCT_ID, char[] TRANSACTION_NUMBER) {
auto ret = otapi_im.OTAPI_Basic_killPaymentPlan((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (FROM_ACCT_ID ? tango.stdc.stringz.toStringz(FROM_ACCT_ID) : null), (TRANSACTION_NUMBER ? tango.stdc.stringz.toStringz(TRANSACTION_NUMBER) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] PopMessageBuffer(char[] REQUEST_NUMBER, char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_PopMessageBuffer((REQUEST_NUMBER ? tango.stdc.stringz.toStringz(REQUEST_NUMBER) : null), (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static void FlushMessageBuffer() {
otapi_im.OTAPI_Basic_FlushMessageBuffer();
}
public static char[] GetSentMessage(char[] REQUEST_NUMBER, char[] SERVER_ID, char[] USER_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_GetSentMessage((REQUEST_NUMBER ? tango.stdc.stringz.toStringz(REQUEST_NUMBER) : null), (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool RemoveSentMessage(char[] REQUEST_NUMBER, char[] SERVER_ID, char[] USER_ID) {
bool ret = otapi_im.OTAPI_Basic_RemoveSentMessage((REQUEST_NUMBER ? tango.stdc.stringz.toStringz(REQUEST_NUMBER) : null), (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static void FlushSentMessages(bool bHarvestingForRetry, char[] SERVER_ID, char[] USER_ID, char[] THE_NYMBOX) {
otapi_im.OTAPI_Basic_FlushSentMessages(bHarvestingForRetry, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_NYMBOX ? tango.stdc.stringz.toStringz(THE_NYMBOX) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static void Sleep(char[] MILLISECONDS) {
otapi_im.OTAPI_Basic_Sleep((MILLISECONDS ? tango.stdc.stringz.toStringz(MILLISECONDS) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public static bool ResyncNymWithServer(char[] SERVER_ID, char[] USER_ID, char[] THE_MESSAGE) {
bool ret = otapi_im.OTAPI_Basic_ResyncNymWithServer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetCommand(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetCommand((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Message_GetSuccess(char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_Message_GetSuccess((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long queryAssetTypes(char[] SERVER_ID, char[] USER_ID, char[] ENCODED_MAP) {
auto ret = otapi_im.OTAPI_Basic_queryAssetTypes((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ENCODED_MAP ? tango.stdc.stringz.toStringz(ENCODED_MAP) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetPayload(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetPayload((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Message_GetDepth(char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_Message_GetDepth((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Message_GetTransactionSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_Message_GetTransactionSuccess((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Message_IsTransactionCanceled(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_Message_IsTransactionCanceled((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static tango.stdc.config.c_long Message_GetBalanceAgreementSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] THE_MESSAGE) {
auto ret = otapi_im.OTAPI_Basic_Message_GetBalanceAgreementSuccess((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetLedger(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetLedger((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetNewAssetTypeID(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetNewAssetTypeID((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetNewIssuerAcctID(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetNewIssuerAcctID((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetNewAcctID(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetNewAcctID((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static char[] Message_GetNymboxHash(char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTAPI_Basic_Message_GetNymboxHash((THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool ConnectServer(char[] SERVER_ID, char[] USER_ID, char[] strCA_FILE, char[] strKEY_FILE, char[] strKEY_PASSWORD) {
bool ret = otapi_im.OTAPI_Basic_ConnectServer((SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (strCA_FILE ? tango.stdc.stringz.toStringz(strCA_FILE) : null), (strKEY_FILE ? tango.stdc.stringz.toStringz(strKEY_FILE) : null), (strKEY_PASSWORD ? tango.stdc.stringz.toStringz(strKEY_PASSWORD) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static bool ProcessSockets() {
bool ret = otapi_im.OTAPI_Basic_ProcessSockets() ? true : false;
return ret;
}
}
class OTMadeEasy {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(OTMadeEasy obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTMadeEasy(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public this() {
this(otapi_im.new_OTMadeEasy(), true);
}
public bool make_sure_enough_trans_nums(tango.stdc.config.c_long nNumberNeeded, char[] SERVER_ID, char[] NYM_ID) {
bool ret = otapi_im.OTMadeEasy_make_sure_enough_trans_nums(cast(void*)swigCPtr, nNumberNeeded, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] register_nym(char[] SERVER_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_register_nym(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] check_user(char[] SERVER_ID, char[] NYM_ID, char[] TARGET_NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_check_user(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (TARGET_NYM_ID ? tango.stdc.stringz.toStringz(TARGET_NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] create_pseudonym(tango.stdc.config.c_long nKeybits, char[] NYM_ID_SOURCE, char[] ALT_LOCATION) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_create_pseudonym(cast(void*)swigCPtr, nKeybits, (NYM_ID_SOURCE ? tango.stdc.stringz.toStringz(NYM_ID_SOURCE) : null), (ALT_LOCATION ? tango.stdc.stringz.toStringz(ALT_LOCATION) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] issue_asset_type(char[] SERVER_ID, char[] NYM_ID, char[] THE_CONTRACT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_issue_asset_type(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (THE_CONTRACT ? tango.stdc.stringz.toStringz(THE_CONTRACT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] issue_basket_currency(char[] SERVER_ID, char[] NYM_ID, char[] THE_BASKET) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_issue_basket_currency(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] exchange_basket_currency(char[] SERVER_ID, char[] NYM_ID, char[] ASSET_TYPE_ID, char[] THE_BASKET, char[] ACCOUNT_ID, bool IN_OR_OUT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_exchange_basket_currency(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (THE_BASKET ? tango.stdc.stringz.toStringz(THE_BASKET) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), IN_OR_OUT));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] retrieve_contract(char[] SERVER_ID, char[] NYM_ID, char[] CONTRACT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_retrieve_contract(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (CONTRACT_ID ? tango.stdc.stringz.toStringz(CONTRACT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_or_retrieve_contract(char[] SERVER_ID, char[] NYM_ID, char[] CONTRACT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_or_retrieve_contract(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (CONTRACT_ID ? tango.stdc.stringz.toStringz(CONTRACT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] create_asset_acct(char[] SERVER_ID, char[] NYM_ID, char[] ASSET_TYPE_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_create_asset_acct(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] stat_asset_account(char[] ACCOUNT_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_stat_asset_account(cast(void*)swigCPtr, (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool retrieve_account(char[] SERVER_ID, char[] NYM_ID, char[] ACCOUNT_ID) {
bool ret = otapi_im.OTMadeEasy_retrieve_account__SWIG_0(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool retrieve_account(char[] SERVER_ID, char[] NYM_ID, char[] ACCOUNT_ID, bool bForceDownload) {
bool ret = otapi_im.OTMadeEasy_retrieve_account__SWIG_1(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), bForceDownload) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool retrieve_nym(char[] SERVER_ID, char[] NYM_ID) {
bool ret = otapi_im.OTMadeEasy_retrieve_nym__SWIG_0(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool retrieve_nym(char[] SERVER_ID, char[] NYM_ID, bool bForceDownload) {
bool ret = otapi_im.OTMadeEasy_retrieve_nym__SWIG_1(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), bForceDownload) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_transfer(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_FROM, char[] ACCT_TO, char[] AMOUNT, char[] NOTE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_transfer(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_FROM ? tango.stdc.stringz.toStringz(ACCT_FROM) : null), (ACCT_TO ? tango.stdc.stringz.toStringz(ACCT_TO) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null), (NOTE ? tango.stdc.stringz.toStringz(NOTE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] process_inbox(char[] SERVER_ID, char[] NYM_ID, char[] ACCOUNT_ID, char[] RESPONSE_LEDGER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_process_inbox(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (RESPONSE_LEDGER ? tango.stdc.stringz.toStringz(RESPONSE_LEDGER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool accept_inbox_items(char[] ACCOUNT_ID, tango.stdc.config.c_long nItemType, char[] INDICES) {
bool ret = otapi_im.OTMadeEasy_accept_inbox_items(cast(void*)swigCPtr, (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), nItemType, (INDICES ? tango.stdc.stringz.toStringz(INDICES) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool discard_incoming_payments(char[] SERVER_ID, char[] NYM_ID, char[] INDICES) {
bool ret = otapi_im.OTMadeEasy_discard_incoming_payments(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (INDICES ? tango.stdc.stringz.toStringz(INDICES) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool cancel_outgoing_payments(char[] NYM_ID, char[] ACCOUNT_ID, char[] INDICES) {
bool ret = otapi_im.OTMadeEasy_cancel_outgoing_payments(cast(void*)swigCPtr, (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (INDICES ? tango.stdc.stringz.toStringz(INDICES) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long accept_from_paymentbox(char[] ACCOUNT_ID, char[] INDICES, char[] PAYMENT_TYPE) {
auto ret = otapi_im.OTMadeEasy_accept_from_paymentbox(cast(void*)swigCPtr, (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (INDICES ? tango.stdc.stringz.toStringz(INDICES) : null), (PAYMENT_TYPE ? tango.stdc.stringz.toStringz(PAYMENT_TYPE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_public_encryption_key(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_public_encryption_key(cast(void*)swigCPtr, (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_public_signing_key(char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_public_signing_key(cast(void*)swigCPtr, (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_or_retrieve_encrypt_key(char[] SERVER_ID, char[] NYM_ID, char[] TARGET_NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_or_retrieve_encrypt_key(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (TARGET_NYM_ID ? tango.stdc.stringz.toStringz(TARGET_NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_or_retrieve_signing_key(char[] SERVER_ID, char[] NYM_ID, char[] TARGET_NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_or_retrieve_signing_key(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (TARGET_NYM_ID ? tango.stdc.stringz.toStringz(TARGET_NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_msg_pubkey(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] RECIPIENT_PUBKEY, char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_msg_pubkey(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (RECIPIENT_PUBKEY ? tango.stdc.stringz.toStringz(RECIPIENT_PUBKEY) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_pmnt_pubkey(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] RECIPIENT_PUBKEY, char[] THE_INSTRUMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_pmnt_pubkey(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (RECIPIENT_PUBKEY ? tango.stdc.stringz.toStringz(RECIPIENT_PUBKEY) : null), (THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_cash_pubkey(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] RECIPIENT_PUBKEY, char[] THE_INSTRUMENT, char[] INSTRUMENT_FOR_SENDER) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_cash_pubkey(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (RECIPIENT_PUBKEY ? tango.stdc.stringz.toStringz(RECIPIENT_PUBKEY) : null), (THE_INSTRUMENT ? tango.stdc.stringz.toStringz(THE_INSTRUMENT) : null), (INSTRUMENT_FOR_SENDER ? tango.stdc.stringz.toStringz(INSTRUMENT_FOR_SENDER) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_msg(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] THE_MESSAGE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_msg(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (THE_MESSAGE ? tango.stdc.stringz.toStringz(THE_MESSAGE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_payment(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] THE_PAYMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_payment(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (THE_PAYMENT ? tango.stdc.stringz.toStringz(THE_PAYMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] send_user_cash(char[] SERVER_ID, char[] NYM_ID, char[] RECIPIENT_NYM_ID, char[] THE_PAYMENT, char[] SENDERS_COPY) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_send_user_cash(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (THE_PAYMENT ? tango.stdc.stringz.toStringz(THE_PAYMENT) : null), (SENDERS_COPY ? tango.stdc.stringz.toStringz(SENDERS_COPY) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool withdraw_and_send_cash(char[] ACCT_ID, char[] RECIPIENT_NYM_ID, char[] MEMO, char[] AMOUNT) {
bool ret = otapi_im.OTMadeEasy_withdraw_and_send_cash(cast(void*)swigCPtr, (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (RECIPIENT_NYM_ID ? tango.stdc.stringz.toStringz(RECIPIENT_NYM_ID) : null), (MEMO ? tango.stdc.stringz.toStringz(MEMO) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_payment_instrument(char[] SERVER_ID, char[] NYM_ID, tango.stdc.config.c_long nIndex) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_payment_instrument__SWIG_0(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_payment_instrument(char[] SERVER_ID, char[] NYM_ID, tango.stdc.config.c_long nIndex, char[] PRELOADED_INBOX) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_payment_instrument__SWIG_1(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), nIndex, (PRELOADED_INBOX ? tango.stdc.stringz.toStringz(PRELOADED_INBOX) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_box_receipt(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, tango.stdc.config.c_long nBoxType, char[] TRANS_NUM) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_box_receipt(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), nBoxType, (TRANS_NUM ? tango.stdc.stringz.toStringz(TRANS_NUM) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] retrieve_mint(char[] SERVER_ID, char[] NYM_ID, char[] ASSET_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_retrieve_mint(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] load_or_retrieve_mint(char[] SERVER_ID, char[] NYM_ID, char[] ASSET_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_load_or_retrieve_mint(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ASSET_ID ? tango.stdc.stringz.toStringz(ASSET_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] query_asset_types(char[] SERVER_ID, char[] NYM_ID, char[] ENCODED_MAP) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_query_asset_types(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ENCODED_MAP ? tango.stdc.stringz.toStringz(ENCODED_MAP) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] create_market_offer(char[] ASSET_ACCT_ID, char[] CURRENCY_ACCT_ID, char[] scale, char[] minIncrement, char[] quantity, char[] price, bool bSelling, char[] LIFESPAN_IN_SECONDS, char[] STOP_SIGN, char[] ACTIVATION_PRICE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_create_market_offer(cast(void*)swigCPtr, (ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(ASSET_ACCT_ID) : null), (CURRENCY_ACCT_ID ? tango.stdc.stringz.toStringz(CURRENCY_ACCT_ID) : null), (scale ? tango.stdc.stringz.toStringz(scale) : null), (minIncrement ? tango.stdc.stringz.toStringz(minIncrement) : null), (quantity ? tango.stdc.stringz.toStringz(quantity) : null), (price ? tango.stdc.stringz.toStringz(price) : null), bSelling, (LIFESPAN_IN_SECONDS ? tango.stdc.stringz.toStringz(LIFESPAN_IN_SECONDS) : null), (STOP_SIGN ? tango.stdc.stringz.toStringz(STOP_SIGN) : null), (ACTIVATION_PRICE ? tango.stdc.stringz.toStringz(ACTIVATION_PRICE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] kill_market_offer(char[] SERVER_ID, char[] NYM_ID, char[] ASSET_ACCT_ID, char[] TRANS_NUM) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_kill_market_offer(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ASSET_ACCT_ID ? tango.stdc.stringz.toStringz(ASSET_ACCT_ID) : null), (TRANS_NUM ? tango.stdc.stringz.toStringz(TRANS_NUM) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] kill_payment_plan(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] TRANS_NUM) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_kill_payment_plan(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (TRANS_NUM ? tango.stdc.stringz.toStringz(TRANS_NUM) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] cancel_payment_plan(char[] SERVER_ID, char[] NYM_ID, char[] THE_PAYMENT_PLAN) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_cancel_payment_plan(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (THE_PAYMENT_PLAN ? tango.stdc.stringz.toStringz(THE_PAYMENT_PLAN) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] activate_smart_contract(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] AGENT_NAME, char[] THE_SMART_CONTRACT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_activate_smart_contract(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (AGENT_NAME ? tango.stdc.stringz.toStringz(AGENT_NAME) : null), (THE_SMART_CONTRACT ? tango.stdc.stringz.toStringz(THE_SMART_CONTRACT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] trigger_clause(char[] SERVER_ID, char[] NYM_ID, char[] TRANS_NUM, char[] CLAUSE_NAME, char[] STR_PARAM) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_trigger_clause(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (TRANS_NUM ? tango.stdc.stringz.toStringz(TRANS_NUM) : null), (CLAUSE_NAME ? tango.stdc.stringz.toStringz(CLAUSE_NAME) : null), (STR_PARAM ? tango.stdc.stringz.toStringz(STR_PARAM) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] withdraw_cash(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] AMOUNT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_withdraw_cash(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long easy_withdraw_cash(char[] ACCT_ID, char[] AMOUNT) {
auto ret = otapi_im.OTMadeEasy_easy_withdraw_cash(cast(void*)swigCPtr, (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] export_cash(char[] SERVER_ID, char[] FROM_NYM_ID, char[] ASSET_TYPE_ID, char[] TO_NYM_ID, char[] STR_INDICES, bool bPasswordProtected, SWIGTYPE_p_std__string STR_RETAINED_COPY) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_export_cash(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (FROM_NYM_ID ? tango.stdc.stringz.toStringz(FROM_NYM_ID) : null), (ASSET_TYPE_ID ? tango.stdc.stringz.toStringz(ASSET_TYPE_ID) : null), (TO_NYM_ID ? tango.stdc.stringz.toStringz(TO_NYM_ID) : null), (STR_INDICES ? tango.stdc.stringz.toStringz(STR_INDICES) : null), bPasswordProtected, SWIGTYPE_p_std__string.swigGetCPtr(STR_RETAINED_COPY)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] withdraw_voucher(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] RECIP_NYM_ID, char[] STR_MEMO, char[] AMOUNT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_withdraw_voucher(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (RECIP_NYM_ID ? tango.stdc.stringz.toStringz(RECIP_NYM_ID) : null), (STR_MEMO ? tango.stdc.stringz.toStringz(STR_MEMO) : null), (AMOUNT ? tango.stdc.stringz.toStringz(AMOUNT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] pay_dividend(char[] SERVER_ID, char[] NYM_ID, char[] SOURCE_ACCT_ID, char[] SHARES_ASSET_ID, char[] STR_MEMO, char[] AMOUNT_PER_SHARE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_pay_dividend(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (SOURCE_ACCT_ID ? tango.stdc.stringz.toStringz(SOURCE_ACCT_ID) : null), (SHARES_ASSET_ID ? tango.stdc.stringz.toStringz(SHARES_ASSET_ID) : null), (STR_MEMO ? tango.stdc.stringz.toStringz(STR_MEMO) : null), (AMOUNT_PER_SHARE ? tango.stdc.stringz.toStringz(AMOUNT_PER_SHARE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] deposit_cheque(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] STR_CHEQUE) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_deposit_cheque(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (STR_CHEQUE ? tango.stdc.stringz.toStringz(STR_CHEQUE) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long deposit_cash(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] STR_PURSE) {
auto ret = otapi_im.OTMadeEasy_deposit_cash(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (STR_PURSE ? tango.stdc.stringz.toStringz(STR_PURSE) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long deposit_local_purse(char[] SERVER_ID, char[] NYM_ID, char[] ACCT_ID, char[] STR_INDICES) {
auto ret = otapi_im.OTMadeEasy_deposit_local_purse(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (ACCT_ID ? tango.stdc.stringz.toStringz(ACCT_ID) : null), (STR_INDICES ? tango.stdc.stringz.toStringz(STR_INDICES) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_market_list(char[] SERVER_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_market_list(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_market_offers(char[] SERVER_ID, char[] NYM_ID, char[] MARKET_ID, char[] MAX_DEPTH) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_market_offers(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MARKET_ID ? tango.stdc.stringz.toStringz(MARKET_ID) : null), (MAX_DEPTH ? tango.stdc.stringz.toStringz(MAX_DEPTH) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_nym_market_offers(char[] SERVER_ID, char[] NYM_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_nym_market_offers(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] get_market_recent_trades(char[] SERVER_ID, char[] NYM_ID, char[] MARKET_ID) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_get_market_recent_trades(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (NYM_ID ? tango.stdc.stringz.toStringz(NYM_ID) : null), (MARKET_ID ? tango.stdc.stringz.toStringz(MARKET_ID) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] adjust_usage_credits(char[] SERVER_ID, char[] USER_NYM_ID, char[] TARGET_NYM_ID, char[] ADJUSTMENT) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTMadeEasy_adjust_usage_credits(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_NYM_ID ? tango.stdc.stringz.toStringz(USER_NYM_ID) : null), (TARGET_NYM_ID ? tango.stdc.stringz.toStringz(TARGET_NYM_ID) : null), (ADJUSTMENT ? tango.stdc.stringz.toStringz(ADJUSTMENT) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long VerifyMessageSuccess(char[] str_Message) {
auto ret = otapi_im.OTMadeEasy_VerifyMessageSuccess(cast(void*)swigCPtr, (str_Message ? tango.stdc.stringz.toStringz(str_Message) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long VerifyMsgBalanceAgrmntSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] str_Message) {
auto ret = otapi_im.OTMadeEasy_VerifyMsgBalanceAgrmntSuccess(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (str_Message ? tango.stdc.stringz.toStringz(str_Message) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long VerifyMsgTrnxSuccess(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] str_Message) {
auto ret = otapi_im.OTMadeEasy_VerifyMsgTrnxSuccess(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (str_Message ? tango.stdc.stringz.toStringz(str_Message) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public tango.stdc.config.c_long InterpretTransactionMsgReply(char[] SERVER_ID, char[] USER_ID, char[] ACCOUNT_ID, char[] str_Attempt, char[] str_Response) {
auto ret = otapi_im.OTMadeEasy_InterpretTransactionMsgReply(cast(void*)swigCPtr, (SERVER_ID ? tango.stdc.stringz.toStringz(SERVER_ID) : null), (USER_ID ? tango.stdc.stringz.toStringz(USER_ID) : null), (ACCOUNT_ID ? tango.stdc.stringz.toStringz(ACCOUNT_ID) : null), (str_Attempt ? tango.stdc.stringz.toStringz(str_Attempt) : null), (str_Response ? tango.stdc.stringz.toStringz(str_Response) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
}
enum PackType {
PACK_MESSAGE_PACK = 0,
PACK_PROTOCOL_BUFFERS,
PACK_TYPE_ERROR
}
enum StorageType {
STORE_FILESYSTEM = 0,
STORE_TYPE_SUBCLASS
}
enum StoredObjectType {
STORED_OBJ_STRING = 0,
STORED_OBJ_BLOB,
STORED_OBJ_STRING_MAP,
STORED_OBJ_WALLET_DATA,
STORED_OBJ_BITCOIN_ACCT,
STORED_OBJ_BITCOIN_SERVER,
STORED_OBJ_RIPPLE_SERVER,
STORED_OBJ_LOOM_SERVER,
STORED_OBJ_SERVER_INFO,
STORED_OBJ_CONTACT_NYM,
STORED_OBJ_CONTACT_ACCT,
STORED_OBJ_CONTACT,
STORED_OBJ_ADDRESS_BOOK,
STORED_OBJ_MARKET_DATA,
STORED_OBJ_MARKET_LIST,
STORED_OBJ_BID_DATA,
STORED_OBJ_ASK_DATA,
STORED_OBJ_OFFER_LIST_MARKET,
STORED_OBJ_TRADE_DATA_MARKET,
STORED_OBJ_TRADE_LIST_MARKET,
STORED_OBJ_OFFER_DATA_NYM,
STORED_OBJ_OFFER_LIST_NYM,
STORED_OBJ_TRADE_DATA_NYM,
STORED_OBJ_TRADE_LIST_NYM,
STORED_OBJ_ERROR
}
class Storable {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(Storable obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Storable(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public static Storable Create(StoredObjectType eType, PackType thePackType) {
void* cPtr = otapi_im.Storable_Create(cast(int)eType, cast(int)thePackType);
Storable ret = (cPtr is null) ? null : new Storable(cPtr, false);
return ret;
}
public static Storable ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Storable_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, false);
return ret;
}
}
class Storage {
private void* swigCPtr;
protected bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
public static void* swigGetCPtr(Storage obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Storage(cast(void*)swigCPtr);
}
swigCPtr = null;
}
}
}
public SWIGTYPE_p_OTPacker GetPacker(PackType ePackType) {
void* cPtr = otapi_im.Storage_GetPacker__SWIG_0(cast(void*)swigCPtr, cast(int)ePackType);
SWIGTYPE_p_OTPacker ret = (cPtr is null) ? null : new SWIGTYPE_p_OTPacker(cPtr, false);
return ret;
}
public SWIGTYPE_p_OTPacker GetPacker() {
void* cPtr = otapi_im.Storage_GetPacker__SWIG_1(cast(void*)swigCPtr);
SWIGTYPE_p_OTPacker ret = (cPtr is null) ? null : new SWIGTYPE_p_OTPacker(cPtr, false);
return ret;
}
public bool Exists(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Storage_Exists__SWIG_0(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool Exists(char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Storage_Exists__SWIG_1(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool Exists(char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Storage_Exists__SWIG_2(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool Exists(char[] strFolder) {
bool ret = otapi_im.Storage_Exists__SWIG_3(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Storage_StoreString__SWIG_0(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Storage_StoreString__SWIG_1(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreString(char[] strContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Storage_StoreString__SWIG_2(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreString(char[] strContents, char[] strFolder) {
bool ret = otapi_im.Storage_StoreString__SWIG_3(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryString(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryString__SWIG_0(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryString(char[] strFolder, char[] oneStr, char[] twoStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryString__SWIG_1(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryString(char[] strFolder, char[] oneStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryString__SWIG_2(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryString(char[] strFolder) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryString__SWIG_3(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Storage_StorePlainString__SWIG_0(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Storage_StorePlainString__SWIG_1(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Storage_StorePlainString__SWIG_2(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StorePlainString(char[] strContents, char[] strFolder) {
bool ret = otapi_im.Storage_StorePlainString__SWIG_3(cast(void*)swigCPtr, (strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryPlainString(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryPlainString__SWIG_0(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryPlainString(char[] strFolder, char[] oneStr, char[] twoStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryPlainString__SWIG_1(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryPlainString(char[] strFolder, char[] oneStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryPlainString__SWIG_2(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] QueryPlainString(char[] strFolder) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_QueryPlainString__SWIG_3(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Storage_StoreObject__SWIG_0(cast(void*)swigCPtr, Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Storage_StoreObject__SWIG_1(cast(void*)swigCPtr, Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Storage_StoreObject__SWIG_2(cast(void*)swigCPtr, Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool StoreObject(Storable theContents, char[] strFolder) {
bool ret = otapi_im.Storage_StoreObject__SWIG_3(cast(void*)swigCPtr, Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
void* cPtr = otapi_im.Storage_QueryObject__SWIG_0(cast(void*)swigCPtr, cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr, char[] twoStr) {
void* cPtr = otapi_im.Storage_QueryObject__SWIG_1(cast(void*)swigCPtr, cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr) {
void* cPtr = otapi_im.Storage_QueryObject__SWIG_2(cast(void*)swigCPtr, cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable QueryObject(StoredObjectType theObjectType, char[] strFolder) {
void* cPtr = otapi_im.Storage_QueryObject__SWIG_3(cast(void*)swigCPtr, cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public char[] EncodeObject(Storable theContents) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Storage_EncodeObject(cast(void*)swigCPtr, Storable.swigGetCPtr(theContents)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable DecodeObject(StoredObjectType theObjectType, char[] strInput) {
void* cPtr = otapi_im.Storage_DecodeObject(cast(void*)swigCPtr, cast(int)theObjectType, (strInput ? tango.stdc.stringz.toStringz(strInput) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool EraseValueByKey(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Storage_EraseValueByKey__SWIG_0(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool EraseValueByKey(char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Storage_EraseValueByKey__SWIG_1(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool EraseValueByKey(char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Storage_EraseValueByKey__SWIG_2(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public bool EraseValueByKey(char[] strFolder) {
bool ret = otapi_im.Storage_EraseValueByKey__SWIG_3(cast(void*)swigCPtr, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public Storable CreateObject(StoredObjectType eType) {
void* cPtr = otapi_im.Storage_CreateObject(cast(void*)swigCPtr, cast(int)eType);
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
return ret;
}
public static Storage Create(StorageType eStorageType, PackType ePackType) {
void* cPtr = otapi_im.Storage_Create(cast(int)eStorageType, cast(int)ePackType);
Storage ret = (cPtr is null) ? null : new Storage(cPtr, false);
return ret;
}
public StorageType GetType() {
StorageType ret = cast(StorageType)otapi_im.Storage_GetType(cast(void*)swigCPtr);
return ret;
}
}
bool InitDefaultStorage(StorageType eStoreType, PackType ePackType) {
bool ret = otapi_im.InitDefaultStorage(cast(int)eStoreType, cast(int)ePackType) ? true : false;
return ret;
}
Storage GetDefaultStorage() {
void* cPtr = otapi_im.GetDefaultStorage();
Storage ret = (cPtr is null) ? null : new Storage(cPtr, false);
return ret;
}
Storage CreateStorageContext(StorageType eStoreType, PackType ePackType) {
void* cPtr = otapi_im.CreateStorageContext__SWIG_0(cast(int)eStoreType, cast(int)ePackType);
Storage ret = (cPtr is null) ? null : new Storage(cPtr, true);
return ret;
}
Storage CreateStorageContext(StorageType eStoreType) {
void* cPtr = otapi_im.CreateStorageContext__SWIG_1(cast(int)eStoreType);
Storage ret = (cPtr is null) ? null : new Storage(cPtr, true);
return ret;
}
Storable CreateObject(StoredObjectType eType) {
void* cPtr = otapi_im.CreateObject(cast(int)eType);
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
return ret;
}
bool CheckStringsExistInOrder(SWIGTYPE_p_std__string strFolder, SWIGTYPE_p_std__string oneStr, SWIGTYPE_p_std__string twoStr, SWIGTYPE_p_std__string threeStr, char[] szFuncName) {
bool ret = otapi_im.CheckStringsExistInOrder__SWIG_0(SWIGTYPE_p_std__string.swigGetCPtr(strFolder), SWIGTYPE_p_std__string.swigGetCPtr(oneStr), SWIGTYPE_p_std__string.swigGetCPtr(twoStr), SWIGTYPE_p_std__string.swigGetCPtr(threeStr), (szFuncName ? tango.stdc.stringz.toStringz(szFuncName) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool CheckStringsExistInOrder(SWIGTYPE_p_std__string strFolder, SWIGTYPE_p_std__string oneStr, SWIGTYPE_p_std__string twoStr, SWIGTYPE_p_std__string threeStr) {
bool ret = otapi_im.CheckStringsExistInOrder__SWIG_1(SWIGTYPE_p_std__string.swigGetCPtr(strFolder), SWIGTYPE_p_std__string.swigGetCPtr(oneStr), SWIGTYPE_p_std__string.swigGetCPtr(twoStr), SWIGTYPE_p_std__string.swigGetCPtr(threeStr)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool Exists(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.Exists__SWIG_0((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool Exists(char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.Exists__SWIG_1((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool Exists(char[] strFolder, char[] oneStr) {
bool ret = otapi_im.Exists__SWIG_2((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool Exists(char[] strFolder) {
bool ret = otapi_im.Exists__SWIG_3((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.StoreString__SWIG_0((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.StoreString__SWIG_1((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreString(char[] strContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.StoreString__SWIG_2((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreString(char[] strContents, char[] strFolder) {
bool ret = otapi_im.StoreString__SWIG_3((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryString(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryString__SWIG_0((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryString(char[] strFolder, char[] oneStr, char[] twoStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryString__SWIG_1((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryString(char[] strFolder, char[] oneStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryString__SWIG_2((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryString(char[] strFolder) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryString__SWIG_3((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.StorePlainString__SWIG_0((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.StorePlainString__SWIG_1((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StorePlainString(char[] strContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.StorePlainString__SWIG_2((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StorePlainString(char[] strContents, char[] strFolder) {
bool ret = otapi_im.StorePlainString__SWIG_3((strContents ? tango.stdc.stringz.toStringz(strContents) : null), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryPlainString(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryPlainString__SWIG_0((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryPlainString(char[] strFolder, char[] oneStr, char[] twoStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryPlainString__SWIG_1((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryPlainString(char[] strFolder, char[] oneStr) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryPlainString__SWIG_2((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] QueryPlainString(char[] strFolder) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.QueryPlainString__SWIG_3((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.StoreObject__SWIG_0(Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.StoreObject__SWIG_1(Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreObject(Storable theContents, char[] strFolder, char[] oneStr) {
bool ret = otapi_im.StoreObject__SWIG_2(Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool StoreObject(Storable theContents, char[] strFolder) {
bool ret = otapi_im.StoreObject__SWIG_3(Storable.swigGetCPtr(theContents), (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
void* cPtr = otapi_im.QueryObject__SWIG_0(cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr, char[] twoStr) {
void* cPtr = otapi_im.QueryObject__SWIG_1(cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
Storable QueryObject(StoredObjectType theObjectType, char[] strFolder, char[] oneStr) {
void* cPtr = otapi_im.QueryObject__SWIG_2(cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
Storable QueryObject(StoredObjectType theObjectType, char[] strFolder) {
void* cPtr = otapi_im.QueryObject__SWIG_3(cast(int)theObjectType, (strFolder ? tango.stdc.stringz.toStringz(strFolder) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
char[] EncodeObject(Storable theContents) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.EncodeObject(Storable.swigGetCPtr(theContents)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
Storable DecodeObject(StoredObjectType theObjectType, char[] strInput) {
void* cPtr = otapi_im.DecodeObject(cast(int)theObjectType, (strInput ? tango.stdc.stringz.toStringz(strInput) : null));
Storable ret = (cPtr is null) ? null : new Storable(cPtr, true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool EraseValueByKey(char[] strFolder, char[] oneStr, char[] twoStr, char[] threeStr) {
bool ret = otapi_im.EraseValueByKey__SWIG_0((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null), (threeStr ? tango.stdc.stringz.toStringz(threeStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool EraseValueByKey(char[] strFolder, char[] oneStr, char[] twoStr) {
bool ret = otapi_im.EraseValueByKey__SWIG_1((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null), (twoStr ? tango.stdc.stringz.toStringz(twoStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool EraseValueByKey(char[] strFolder, char[] oneStr) {
bool ret = otapi_im.EraseValueByKey__SWIG_2((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null), (oneStr ? tango.stdc.stringz.toStringz(oneStr) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
bool EraseValueByKey(char[] strFolder) {
bool ret = otapi_im.EraseValueByKey__SWIG_3((strFolder ? tango.stdc.stringz.toStringz(strFolder) : null)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
class OTDBString : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.OTDBString_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(OTDBString obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OTDBString(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void m_string(char[] value) {
otapi_im.OTDBString_m_string_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] m_string() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OTDBString_m_string_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OTDBString ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.OTDBString_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
OTDBString ret = (cPtr is null) ? null : new OTDBString(cPtr, false);
return ret;
}
}
class Blob : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.Blob_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(Blob obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Blob(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void m_memBuffer(SWIGTYPE_p_std__vectorT_unsigned_char_t value) {
otapi_im.Blob_m_memBuffer_set(cast(void*)swigCPtr, SWIGTYPE_p_std__vectorT_unsigned_char_t.swigGetCPtr(value));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public SWIGTYPE_p_std__vectorT_unsigned_char_t m_memBuffer() {
SWIGTYPE_p_std__vectorT_unsigned_char_t ret = new SWIGTYPE_p_std__vectorT_unsigned_char_t(otapi_im.Blob_m_memBuffer_get(cast(void*)swigCPtr), true);
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static Blob ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Blob_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Blob ret = (cPtr is null) ? null : new Blob(cPtr, false);
return ret;
}
}
class StringMap : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.StringMap_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(StringMap obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_StringMap(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void the_map(SWIGTYPE_p_std__mapT_std__string_std__string_t value) {
otapi_im.StringMap_the_map_set(cast(void*)swigCPtr, SWIGTYPE_p_std__mapT_std__string_std__string_t.swigGetCPtr(value));
}
public SWIGTYPE_p_std__mapT_std__string_std__string_t the_map() {
void* cPtr = otapi_im.StringMap_the_map_get(cast(void*)swigCPtr);
SWIGTYPE_p_std__mapT_std__string_std__string_t ret = (cPtr is null) ? null : new SWIGTYPE_p_std__mapT_std__string_std__string_t(cPtr, false);
return ret;
}
public void SetValue(char[] strKey, char[] strValue) {
otapi_im.StringMap_SetValue(cast(void*)swigCPtr, (strKey ? tango.stdc.stringz.toStringz(strKey) : null), (strValue ? tango.stdc.stringz.toStringz(strValue) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] GetValue(char[] strKey) {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.StringMap_GetValue(cast(void*)swigCPtr, (strKey ? tango.stdc.stringz.toStringz(strKey) : null)));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static StringMap ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.StringMap_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
StringMap ret = (cPtr is null) ? null : new StringMap(cPtr, false);
return ret;
}
}
class Displayable : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.Displayable_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(Displayable obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Displayable(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.Displayable_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Displayable_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static Displayable ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Displayable_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Displayable ret = (cPtr is null) ? null : new Displayable(cPtr, false);
return ret;
}
}
class MarketData : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.MarketData_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(MarketData obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_MarketData(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.MarketData_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.MarketData_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void market_id(char[] value) {
otapi_im.MarketData_market_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] market_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_market_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void asset_type_id(char[] value) {
otapi_im.MarketData_asset_type_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] asset_type_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_asset_type_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void currency_type_id(char[] value) {
otapi_im.MarketData_currency_type_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] currency_type_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_currency_type_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void scale(char[] value) {
otapi_im.MarketData_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void total_assets(char[] value) {
otapi_im.MarketData_total_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] total_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_total_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void number_bids(char[] value) {
otapi_im.MarketData_number_bids_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] number_bids() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_number_bids_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void number_asks(char[] value) {
otapi_im.MarketData_number_asks_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] number_asks() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_number_asks_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void last_sale_price(char[] value) {
otapi_im.MarketData_last_sale_price_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] last_sale_price() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_last_sale_price_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void current_bid(char[] value) {
otapi_im.MarketData_current_bid_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] current_bid() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_current_bid_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void current_ask(char[] value) {
otapi_im.MarketData_current_ask_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] current_ask() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_current_ask_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void volume_trades(char[] value) {
otapi_im.MarketData_volume_trades_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] volume_trades() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_volume_trades_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void volume_assets(char[] value) {
otapi_im.MarketData_volume_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] volume_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_volume_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void volume_currency(char[] value) {
otapi_im.MarketData_volume_currency_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] volume_currency() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_volume_currency_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void recent_highest_bid(char[] value) {
otapi_im.MarketData_recent_highest_bid_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] recent_highest_bid() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_recent_highest_bid_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void recent_lowest_ask(char[] value) {
otapi_im.MarketData_recent_lowest_ask_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] recent_lowest_ask() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_recent_lowest_ask_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void last_sale_date(char[] value) {
otapi_im.MarketData_last_sale_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] last_sale_date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.MarketData_last_sale_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static MarketData ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.MarketData_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
MarketData ret = (cPtr is null) ? null : new MarketData(cPtr, false);
return ret;
}
}
class MarketList : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.MarketList_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(MarketList obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_MarketList(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetMarketDataCount() {
auto ret = otapi_im.MarketList_GetMarketDataCount(cast(void*)swigCPtr);
return ret;
}
public MarketData GetMarketData(size_t nIndex) {
void* cPtr = otapi_im.MarketList_GetMarketData(cast(void*)swigCPtr, nIndex);
MarketData ret = (cPtr is null) ? null : new MarketData(cPtr, false);
return ret;
}
public bool RemoveMarketData(size_t nIndexMarketData) {
bool ret = otapi_im.MarketList_RemoveMarketData(cast(void*)swigCPtr, nIndexMarketData) ? true : false;
return ret;
}
public bool AddMarketData(MarketData disownObject) {
bool ret = otapi_im.MarketList_AddMarketData(cast(void*)swigCPtr, MarketData.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static MarketList ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.MarketList_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
MarketList ret = (cPtr is null) ? null : new MarketList(cPtr, false);
return ret;
}
}
class OfferDataMarket : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.OfferDataMarket_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(OfferDataMarket obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OfferDataMarket(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.OfferDataMarket_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.OfferDataMarket_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price_per_scale(char[] value) {
otapi_im.OfferDataMarket_price_per_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price_per_scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_price_per_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void available_assets(char[] value) {
otapi_im.OfferDataMarket_available_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] available_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_available_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void minimum_increment(char[] value) {
otapi_im.OfferDataMarket_minimum_increment_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] minimum_increment() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_minimum_increment_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.OfferDataMarket_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataMarket_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OfferDataMarket ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.OfferDataMarket_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
OfferDataMarket ret = (cPtr is null) ? null : new OfferDataMarket(cPtr, false);
return ret;
}
}
class BidData : OfferDataMarket {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.BidData_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(BidData obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_BidData(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.BidData_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.BidData_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price_per_scale(char[] value) {
otapi_im.BidData_price_per_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price_per_scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_price_per_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void available_assets(char[] value) {
otapi_im.BidData_available_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] available_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_available_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void minimum_increment(char[] value) {
otapi_im.BidData_minimum_increment_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] minimum_increment() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_minimum_increment_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.BidData_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BidData_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static BidData ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.BidData_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
BidData ret = (cPtr is null) ? null : new BidData(cPtr, false);
return ret;
}
}
class AskData : OfferDataMarket {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.AskData_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(AskData obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_AskData(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.AskData_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.AskData_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price_per_scale(char[] value) {
otapi_im.AskData_price_per_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price_per_scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_price_per_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void available_assets(char[] value) {
otapi_im.AskData_available_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] available_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_available_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void minimum_increment(char[] value) {
otapi_im.AskData_minimum_increment_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] minimum_increment() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_minimum_increment_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.AskData_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.AskData_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static AskData ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.AskData_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
AskData ret = (cPtr is null) ? null : new AskData(cPtr, false);
return ret;
}
}
class OfferListMarket : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.OfferListMarket_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(OfferListMarket obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OfferListMarket(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetBidDataCount() {
auto ret = otapi_im.OfferListMarket_GetBidDataCount(cast(void*)swigCPtr);
return ret;
}
public BidData GetBidData(size_t nIndex) {
void* cPtr = otapi_im.OfferListMarket_GetBidData(cast(void*)swigCPtr, nIndex);
BidData ret = (cPtr is null) ? null : new BidData(cPtr, false);
return ret;
}
public bool RemoveBidData(size_t nIndexBidData) {
bool ret = otapi_im.OfferListMarket_RemoveBidData(cast(void*)swigCPtr, nIndexBidData) ? true : false;
return ret;
}
public bool AddBidData(BidData disownObject) {
bool ret = otapi_im.OfferListMarket_AddBidData(cast(void*)swigCPtr, BidData.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetAskDataCount() {
auto ret = otapi_im.OfferListMarket_GetAskDataCount(cast(void*)swigCPtr);
return ret;
}
public AskData GetAskData(size_t nIndex) {
void* cPtr = otapi_im.OfferListMarket_GetAskData(cast(void*)swigCPtr, nIndex);
AskData ret = (cPtr is null) ? null : new AskData(cPtr, false);
return ret;
}
public bool RemoveAskData(size_t nIndexAskData) {
bool ret = otapi_im.OfferListMarket_RemoveAskData(cast(void*)swigCPtr, nIndexAskData) ? true : false;
return ret;
}
public bool AddAskData(AskData disownObject) {
bool ret = otapi_im.OfferListMarket_AddAskData(cast(void*)swigCPtr, AskData.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OfferListMarket ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.OfferListMarket_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
OfferListMarket ret = (cPtr is null) ? null : new OfferListMarket(cPtr, false);
return ret;
}
}
class TradeDataMarket : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.TradeDataMarket_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(TradeDataMarket obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_TradeDataMarket(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.TradeDataMarket_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataMarket_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.TradeDataMarket_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataMarket_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.TradeDataMarket_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataMarket_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price(char[] value) {
otapi_im.TradeDataMarket_price_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataMarket_price_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void amount_sold(char[] value) {
otapi_im.TradeDataMarket_amount_sold_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] amount_sold() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataMarket_amount_sold_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static TradeDataMarket ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.TradeDataMarket_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
TradeDataMarket ret = (cPtr is null) ? null : new TradeDataMarket(cPtr, false);
return ret;
}
}
class TradeListMarket : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.TradeListMarket_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(TradeListMarket obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_TradeListMarket(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetTradeDataMarketCount() {
auto ret = otapi_im.TradeListMarket_GetTradeDataMarketCount(cast(void*)swigCPtr);
return ret;
}
public TradeDataMarket GetTradeDataMarket(size_t nIndex) {
void* cPtr = otapi_im.TradeListMarket_GetTradeDataMarket(cast(void*)swigCPtr, nIndex);
TradeDataMarket ret = (cPtr is null) ? null : new TradeDataMarket(cPtr, false);
return ret;
}
public bool RemoveTradeDataMarket(size_t nIndexTradeDataMarket) {
bool ret = otapi_im.TradeListMarket_RemoveTradeDataMarket(cast(void*)swigCPtr, nIndexTradeDataMarket) ? true : false;
return ret;
}
public bool AddTradeDataMarket(TradeDataMarket disownObject) {
bool ret = otapi_im.TradeListMarket_AddTradeDataMarket(cast(void*)swigCPtr, TradeDataMarket.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static TradeListMarket ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.TradeListMarket_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
TradeListMarket ret = (cPtr is null) ? null : new TradeListMarket(cPtr, false);
return ret;
}
}
class OfferDataNym : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.OfferDataNym_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(OfferDataNym obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OfferDataNym(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.OfferDataNym_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void valid_from(char[] value) {
otapi_im.OfferDataNym_valid_from_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] valid_from() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_valid_from_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void valid_to(char[] value) {
otapi_im.OfferDataNym_valid_to_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] valid_to() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_valid_to_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.OfferDataNym_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void asset_type_id(char[] value) {
otapi_im.OfferDataNym_asset_type_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] asset_type_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_asset_type_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void asset_acct_id(char[] value) {
otapi_im.OfferDataNym_asset_acct_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] asset_acct_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_asset_acct_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void currency_type_id(char[] value) {
otapi_im.OfferDataNym_currency_type_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] currency_type_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_currency_type_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void currency_acct_id(char[] value) {
otapi_im.OfferDataNym_currency_acct_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] currency_acct_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_currency_acct_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void selling(bool value) {
otapi_im.OfferDataNym_selling_set(cast(void*)swigCPtr, value);
}
public bool selling() {
bool ret = otapi_im.OfferDataNym_selling_get(cast(void*)swigCPtr) ? true : false;
return ret;
}
public void scale(char[] value) {
otapi_im.OfferDataNym_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price_per_scale(char[] value) {
otapi_im.OfferDataNym_price_per_scale_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price_per_scale() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_price_per_scale_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.OfferDataNym_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void total_assets(char[] value) {
otapi_im.OfferDataNym_total_assets_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] total_assets() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_total_assets_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void finished_so_far(char[] value) {
otapi_im.OfferDataNym_finished_so_far_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] finished_so_far() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_finished_so_far_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void minimum_increment(char[] value) {
otapi_im.OfferDataNym_minimum_increment_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] minimum_increment() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_minimum_increment_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void stop_sign(char[] value) {
otapi_im.OfferDataNym_stop_sign_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] stop_sign() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_stop_sign_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void stop_price(char[] value) {
otapi_im.OfferDataNym_stop_price_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] stop_price() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_stop_price_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.OfferDataNym_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.OfferDataNym_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OfferDataNym ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.OfferDataNym_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
OfferDataNym ret = (cPtr is null) ? null : new OfferDataNym(cPtr, false);
return ret;
}
}
class OfferListNym : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.OfferListNym_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(OfferListNym obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_OfferListNym(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetOfferDataNymCount() {
auto ret = otapi_im.OfferListNym_GetOfferDataNymCount(cast(void*)swigCPtr);
return ret;
}
public OfferDataNym GetOfferDataNym(size_t nIndex) {
void* cPtr = otapi_im.OfferListNym_GetOfferDataNym(cast(void*)swigCPtr, nIndex);
OfferDataNym ret = (cPtr is null) ? null : new OfferDataNym(cPtr, false);
return ret;
}
public bool RemoveOfferDataNym(size_t nIndexOfferDataNym) {
bool ret = otapi_im.OfferListNym_RemoveOfferDataNym(cast(void*)swigCPtr, nIndexOfferDataNym) ? true : false;
return ret;
}
public bool AddOfferDataNym(OfferDataNym disownObject) {
bool ret = otapi_im.OfferListNym_AddOfferDataNym(cast(void*)swigCPtr, OfferDataNym.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static OfferListNym ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.OfferListNym_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
OfferListNym ret = (cPtr is null) ? null : new OfferListNym(cPtr, false);
return ret;
}
}
class TradeDataNym : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.TradeDataNym_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(TradeDataNym obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_TradeDataNym(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.TradeDataNym_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void transaction_id(char[] value) {
otapi_im.TradeDataNym_transaction_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] transaction_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_transaction_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void completed_count(char[] value) {
otapi_im.TradeDataNym_completed_count_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] completed_count() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_completed_count_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void date(char[] value) {
otapi_im.TradeDataNym_date_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] date() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_date_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void price(char[] value) {
otapi_im.TradeDataNym_price_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] price() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_price_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void amount_sold(char[] value) {
otapi_im.TradeDataNym_amount_sold_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] amount_sold() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_amount_sold_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void updated_id(char[] value) {
otapi_im.TradeDataNym_updated_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] updated_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_updated_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void offer_price(char[] value) {
otapi_im.TradeDataNym_offer_price_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] offer_price() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_offer_price_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void finished_so_far(char[] value) {
otapi_im.TradeDataNym_finished_so_far_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] finished_so_far() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_finished_so_far_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void asset_id(char[] value) {
otapi_im.TradeDataNym_asset_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] asset_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_asset_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void currency_id(char[] value) {
otapi_im.TradeDataNym_currency_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] currency_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_currency_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void currency_paid(char[] value) {
otapi_im.TradeDataNym_currency_paid_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] currency_paid() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.TradeDataNym_currency_paid_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static TradeDataNym ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.TradeDataNym_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
TradeDataNym ret = (cPtr is null) ? null : new TradeDataNym(cPtr, false);
return ret;
}
}
class TradeListNym : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.TradeListNym_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(TradeListNym obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_TradeListNym(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetTradeDataNymCount() {
auto ret = otapi_im.TradeListNym_GetTradeDataNymCount(cast(void*)swigCPtr);
return ret;
}
public TradeDataNym GetTradeDataNym(size_t nIndex) {
void* cPtr = otapi_im.TradeListNym_GetTradeDataNym(cast(void*)swigCPtr, nIndex);
TradeDataNym ret = (cPtr is null) ? null : new TradeDataNym(cPtr, false);
return ret;
}
public bool RemoveTradeDataNym(size_t nIndexTradeDataNym) {
bool ret = otapi_im.TradeListNym_RemoveTradeDataNym(cast(void*)swigCPtr, nIndexTradeDataNym) ? true : false;
return ret;
}
public bool AddTradeDataNym(TradeDataNym disownObject) {
bool ret = otapi_im.TradeListNym_AddTradeDataNym(cast(void*)swigCPtr, TradeDataNym.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static TradeListNym ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.TradeListNym_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
TradeListNym ret = (cPtr is null) ? null : new TradeListNym(cPtr, false);
return ret;
}
}
class Acct : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.Acct_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(Acct obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Acct(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.Acct_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Acct_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void acct_id(char[] value) {
otapi_im.Acct_acct_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] acct_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Acct_acct_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.Acct_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Acct_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static Acct ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Acct_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Acct ret = (cPtr is null) ? null : new Acct(cPtr, false);
return ret;
}
}
class BitcoinAcct : Acct {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.BitcoinAcct_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(BitcoinAcct obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_BitcoinAcct(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.BitcoinAcct_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinAcct_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void acct_id(char[] value) {
otapi_im.BitcoinAcct_acct_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] acct_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinAcct_acct_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.BitcoinAcct_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinAcct_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void bitcoin_acct_name(char[] value) {
otapi_im.BitcoinAcct_bitcoin_acct_name_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] bitcoin_acct_name() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinAcct_bitcoin_acct_name_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static BitcoinAcct ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.BitcoinAcct_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
BitcoinAcct ret = (cPtr is null) ? null : new BitcoinAcct(cPtr, false);
return ret;
}
}
class ServerInfo : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.ServerInfo_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(ServerInfo obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_ServerInfo(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.ServerInfo_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ServerInfo_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.ServerInfo_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ServerInfo_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.ServerInfo_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ServerInfo_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static ServerInfo ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.ServerInfo_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
ServerInfo ret = (cPtr is null) ? null : new ServerInfo(cPtr, false);
return ret;
}
}
class Server : ServerInfo {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.Server_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(Server obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Server(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.Server_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Server_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.Server_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Server_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.Server_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Server_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_host(char[] value) {
otapi_im.Server_server_host_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_host() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Server_server_host_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_port(char[] value) {
otapi_im.Server_server_port_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_port() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Server_server_port_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static Server ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Server_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Server ret = (cPtr is null) ? null : new Server(cPtr, false);
return ret;
}
}
class BitcoinServer : Server {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.BitcoinServer_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(BitcoinServer obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_BitcoinServer(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.BitcoinServer_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.BitcoinServer_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.BitcoinServer_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_host(char[] value) {
otapi_im.BitcoinServer_server_host_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_host() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_server_host_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_port(char[] value) {
otapi_im.BitcoinServer_server_port_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_port() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_server_port_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void bitcoin_username(char[] value) {
otapi_im.BitcoinServer_bitcoin_username_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] bitcoin_username() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_bitcoin_username_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void bitcoin_password(char[] value) {
otapi_im.BitcoinServer_bitcoin_password_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] bitcoin_password() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.BitcoinServer_bitcoin_password_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static BitcoinServer ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.BitcoinServer_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
BitcoinServer ret = (cPtr is null) ? null : new BitcoinServer(cPtr, false);
return ret;
}
}
class RippleServer : Server {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.RippleServer_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(RippleServer obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_RippleServer(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.RippleServer_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.RippleServer_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.RippleServer_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_host(char[] value) {
otapi_im.RippleServer_server_host_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_host() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_server_host_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_port(char[] value) {
otapi_im.RippleServer_server_port_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_port() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_server_port_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void ripple_username(char[] value) {
otapi_im.RippleServer_ripple_username_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] ripple_username() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_ripple_username_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void ripple_password(char[] value) {
otapi_im.RippleServer_ripple_password_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] ripple_password() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_ripple_password_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void namefield_id(char[] value) {
otapi_im.RippleServer_namefield_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] namefield_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_namefield_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void passfield_id(char[] value) {
otapi_im.RippleServer_passfield_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] passfield_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.RippleServer_passfield_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static RippleServer ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.RippleServer_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
RippleServer ret = (cPtr is null) ? null : new RippleServer(cPtr, false);
return ret;
}
}
class LoomServer : Server {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.LoomServer_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(LoomServer obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_LoomServer(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.LoomServer_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.LoomServer_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.LoomServer_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_host(char[] value) {
otapi_im.LoomServer_server_host_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_host() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_server_host_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_port(char[] value) {
otapi_im.LoomServer_server_port_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_port() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_server_port_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void loom_username(char[] value) {
otapi_im.LoomServer_loom_username_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] loom_username() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_loom_username_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void namefield_id(char[] value) {
otapi_im.LoomServer_namefield_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] namefield_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.LoomServer_namefield_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static LoomServer ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.LoomServer_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
LoomServer ret = (cPtr is null) ? null : new LoomServer(cPtr, false);
return ret;
}
}
class ContactNym : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.ContactNym_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(ContactNym obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_ContactNym(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.ContactNym_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactNym_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void nym_type(char[] value) {
otapi_im.ContactNym_nym_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] nym_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactNym_nym_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void nym_id(char[] value) {
otapi_im.ContactNym_nym_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] nym_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactNym_nym_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void public_key(char[] value) {
otapi_im.ContactNym_public_key_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] public_key() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactNym_public_key_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void memo(char[] value) {
otapi_im.ContactNym_memo_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] memo() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactNym_memo_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetServerInfoCount() {
auto ret = otapi_im.ContactNym_GetServerInfoCount(cast(void*)swigCPtr);
return ret;
}
public ServerInfo GetServerInfo(size_t nIndex) {
void* cPtr = otapi_im.ContactNym_GetServerInfo(cast(void*)swigCPtr, nIndex);
ServerInfo ret = (cPtr is null) ? null : new ServerInfo(cPtr, false);
return ret;
}
public bool RemoveServerInfo(size_t nIndexServerInfo) {
bool ret = otapi_im.ContactNym_RemoveServerInfo(cast(void*)swigCPtr, nIndexServerInfo) ? true : false;
return ret;
}
public bool AddServerInfo(ServerInfo disownObject) {
bool ret = otapi_im.ContactNym_AddServerInfo(cast(void*)swigCPtr, ServerInfo.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static ContactNym ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.ContactNym_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
ContactNym ret = (cPtr is null) ? null : new ContactNym(cPtr, false);
return ret;
}
}
class WalletData : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.WalletData_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(WalletData obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_WalletData(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetBitcoinServerCount() {
auto ret = otapi_im.WalletData_GetBitcoinServerCount(cast(void*)swigCPtr);
return ret;
}
public BitcoinServer GetBitcoinServer(size_t nIndex) {
void* cPtr = otapi_im.WalletData_GetBitcoinServer(cast(void*)swigCPtr, nIndex);
BitcoinServer ret = (cPtr is null) ? null : new BitcoinServer(cPtr, false);
return ret;
}
public bool RemoveBitcoinServer(size_t nIndexBitcoinServer) {
bool ret = otapi_im.WalletData_RemoveBitcoinServer(cast(void*)swigCPtr, nIndexBitcoinServer) ? true : false;
return ret;
}
public bool AddBitcoinServer(BitcoinServer disownObject) {
bool ret = otapi_im.WalletData_AddBitcoinServer(cast(void*)swigCPtr, BitcoinServer.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetBitcoinAcctCount() {
auto ret = otapi_im.WalletData_GetBitcoinAcctCount(cast(void*)swigCPtr);
return ret;
}
public BitcoinAcct GetBitcoinAcct(size_t nIndex) {
void* cPtr = otapi_im.WalletData_GetBitcoinAcct(cast(void*)swigCPtr, nIndex);
BitcoinAcct ret = (cPtr is null) ? null : new BitcoinAcct(cPtr, false);
return ret;
}
public bool RemoveBitcoinAcct(size_t nIndexBitcoinAcct) {
bool ret = otapi_im.WalletData_RemoveBitcoinAcct(cast(void*)swigCPtr, nIndexBitcoinAcct) ? true : false;
return ret;
}
public bool AddBitcoinAcct(BitcoinAcct disownObject) {
bool ret = otapi_im.WalletData_AddBitcoinAcct(cast(void*)swigCPtr, BitcoinAcct.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetRippleServerCount() {
auto ret = otapi_im.WalletData_GetRippleServerCount(cast(void*)swigCPtr);
return ret;
}
public RippleServer GetRippleServer(size_t nIndex) {
void* cPtr = otapi_im.WalletData_GetRippleServer(cast(void*)swigCPtr, nIndex);
RippleServer ret = (cPtr is null) ? null : new RippleServer(cPtr, false);
return ret;
}
public bool RemoveRippleServer(size_t nIndexRippleServer) {
bool ret = otapi_im.WalletData_RemoveRippleServer(cast(void*)swigCPtr, nIndexRippleServer) ? true : false;
return ret;
}
public bool AddRippleServer(RippleServer disownObject) {
bool ret = otapi_im.WalletData_AddRippleServer(cast(void*)swigCPtr, RippleServer.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetLoomServerCount() {
auto ret = otapi_im.WalletData_GetLoomServerCount(cast(void*)swigCPtr);
return ret;
}
public LoomServer GetLoomServer(size_t nIndex) {
void* cPtr = otapi_im.WalletData_GetLoomServer(cast(void*)swigCPtr, nIndex);
LoomServer ret = (cPtr is null) ? null : new LoomServer(cPtr, false);
return ret;
}
public bool RemoveLoomServer(size_t nIndexLoomServer) {
bool ret = otapi_im.WalletData_RemoveLoomServer(cast(void*)swigCPtr, nIndexLoomServer) ? true : false;
return ret;
}
public bool AddLoomServer(LoomServer disownObject) {
bool ret = otapi_im.WalletData_AddLoomServer(cast(void*)swigCPtr, LoomServer.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static WalletData ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.WalletData_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
WalletData ret = (cPtr is null) ? null : new WalletData(cPtr, false);
return ret;
}
}
class ContactAcct : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.ContactAcct_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(ContactAcct obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_ContactAcct(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.ContactAcct_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_type(char[] value) {
otapi_im.ContactAcct_server_type_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_type() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_server_type_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void server_id(char[] value) {
otapi_im.ContactAcct_server_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] server_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_server_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void asset_type_id(char[] value) {
otapi_im.ContactAcct_asset_type_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] asset_type_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_asset_type_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void acct_id(char[] value) {
otapi_im.ContactAcct_acct_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] acct_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_acct_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void nym_id(char[] value) {
otapi_im.ContactAcct_nym_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] nym_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_nym_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void memo(char[] value) {
otapi_im.ContactAcct_memo_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] memo() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_memo_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void public_key(char[] value) {
otapi_im.ContactAcct_public_key_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] public_key() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.ContactAcct_public_key_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static ContactAcct ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.ContactAcct_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
ContactAcct ret = (cPtr is null) ? null : new ContactAcct(cPtr, false);
return ret;
}
}
class Contact : Displayable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.Contact_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(Contact obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_Contact(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public void gui_label(char[] value) {
otapi_im.Contact_gui_label_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] gui_label() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Contact_gui_label_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void contact_id(char[] value) {
otapi_im.Contact_contact_id_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] contact_id() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Contact_contact_id_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void email(char[] value) {
otapi_im.Contact_email_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] email() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Contact_email_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void memo(char[] value) {
otapi_im.Contact_memo_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] memo() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Contact_memo_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public void public_key(char[] value) {
otapi_im.Contact_public_key_set(cast(void*)swigCPtr, (value ? tango.stdc.stringz.toStringz(value) : null));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
}
public char[] public_key() {
char[] ret = tango.stdc.stringz.fromStringz(otapi_im.Contact_public_key_get(cast(void*)swigCPtr));
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetContactNymCount() {
auto ret = otapi_im.Contact_GetContactNymCount(cast(void*)swigCPtr);
return ret;
}
public ContactNym GetContactNym(size_t nIndex) {
void* cPtr = otapi_im.Contact_GetContactNym(cast(void*)swigCPtr, nIndex);
ContactNym ret = (cPtr is null) ? null : new ContactNym(cPtr, false);
return ret;
}
public bool RemoveContactNym(size_t nIndexContactNym) {
bool ret = otapi_im.Contact_RemoveContactNym(cast(void*)swigCPtr, nIndexContactNym) ? true : false;
return ret;
}
public bool AddContactNym(ContactNym disownObject) {
bool ret = otapi_im.Contact_AddContactNym(cast(void*)swigCPtr, ContactNym.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public size_t GetContactAcctCount() {
auto ret = otapi_im.Contact_GetContactAcctCount(cast(void*)swigCPtr);
return ret;
}
public ContactAcct GetContactAcct(size_t nIndex) {
void* cPtr = otapi_im.Contact_GetContactAcct(cast(void*)swigCPtr, nIndex);
ContactAcct ret = (cPtr is null) ? null : new ContactAcct(cPtr, false);
return ret;
}
public bool RemoveContactAcct(size_t nIndexContactAcct) {
bool ret = otapi_im.Contact_RemoveContactAcct(cast(void*)swigCPtr, nIndexContactAcct) ? true : false;
return ret;
}
public bool AddContactAcct(ContactAcct disownObject) {
bool ret = otapi_im.Contact_AddContactAcct(cast(void*)swigCPtr, ContactAcct.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static Contact ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.Contact_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
Contact ret = (cPtr is null) ? null : new Contact(cPtr, false);
return ret;
}
}
class AddressBook : Storable {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super(otapi_im.AddressBook_Upcast(cObject), ownCObject);
swigCPtr = cObject;
}
public static void* swigGetCPtr(AddressBook obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
~this() {
dispose();
}
public override void dispose() {
synchronized(this) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
otapi_im.delete_AddressBook(cast(void*)swigCPtr);
}
swigCPtr = null;
super.dispose();
}
}
}
public size_t GetContactCount() {
auto ret = otapi_im.AddressBook_GetContactCount(cast(void*)swigCPtr);
return ret;
}
public Contact GetContact(size_t nIndex) {
void* cPtr = otapi_im.AddressBook_GetContact(cast(void*)swigCPtr, nIndex);
Contact ret = (cPtr is null) ? null : new Contact(cPtr, false);
return ret;
}
public bool RemoveContact(size_t nIndexContact) {
bool ret = otapi_im.AddressBook_RemoveContact(cast(void*)swigCPtr, nIndexContact) ? true : false;
return ret;
}
public bool AddContact(Contact disownObject) {
bool ret = otapi_im.AddressBook_AddContact(cast(void*)swigCPtr, Contact.swigGetCPtr(disownObject)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
public static AddressBook ot_dynamic_cast(Storable pObject) {
void* cPtr = otapi_im.AddressBook_ot_dynamic_cast(Storable.swigGetCPtr(pObject));
AddressBook ret = (cPtr is null) ? null : new AddressBook(cPtr, false);
return ret;
}
}
bool OT_API_Set_PasswordCallback(OTCaller theCaller) {
bool ret = otapi_im.OT_API_Set_PasswordCallback(OTCaller.swigGetCPtr(theCaller)) ? true : false;
if (otapi_im.SwigPendingException.isPending) throw otapi_im.SwigPendingException.retrieve();
return ret;
}
class SWIGTYPE_p_std__mapT_std__string_std__string_t {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_std__mapT_std__string_std__string_t obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_std__string {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_std__string obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_std__vectorT_unsigned_char_t {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_std__vectorT_unsigned_char_t obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_int32_t {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_int32_t obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_uint32_t {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_uint32_t obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_OTPacker {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_OTPacker obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
class SWIGTYPE_p_uint8_t {
private void* swigCPtr;
public this(void* cObject, bool futureUse) {
swigCPtr = cObject;
}
protected this() {
swigCPtr = null;
}
public static void* swigGetCPtr(SWIGTYPE_p_uint8_t obj) {
return (obj is null) ? null : obj.swigCPtr;
}
mixin otapi_im.SwigOperatorDefinitions;
}
|
D
|
import pyd.def;
import pyd.exception;
extern(C) void PydMain();
version(Python_3_0_Or_Later) {
import deimos.python.Python;
pragma(msg, "in here!");
extern(C) export PyObject* PyInit_hello() {
return pyd.exception.exception_catcher(delegate PyObject*() {
pyd.def.pyd_module_name = "hello";
PydMain();
return pyd.def.pyd_modules[""];
});
}
}else version(Python_2_4_Or_Later) {
extern(C) export void inithello() {
pyd.exception.exception_catcher(delegate void() {
pyd.def.pyd_module_name = "hello";
PydMain();
});
}
}else static assert(false);
extern(C) void _Dmain(){
// make druntime happy
}
|
D
|
/Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/Objects-normal/x86_64/FTPopOverMenu.o : /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIScreen+Frame.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenuCell.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FT+Extension.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTCellConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConstants.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIControl+Point.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenu.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/Target\ Support\ Files/FTPopOverMenu_Swift/FTPopOverMenu_Swift-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/dyld.modulemap /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/Objects-normal/x86_64/FTPopOverMenu~partial.swiftmodule : /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIScreen+Frame.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenuCell.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FT+Extension.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTCellConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConstants.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIControl+Point.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenu.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/Target\ Support\ Files/FTPopOverMenu_Swift/FTPopOverMenu_Swift-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/dyld.modulemap /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/Objects-normal/x86_64/FTPopOverMenu~partial.swiftdoc : /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIScreen+Frame.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenuCell.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FT+Extension.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTCellConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConstants.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIControl+Point.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenu.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/Target\ Support\ Files/FTPopOverMenu_Swift/FTPopOverMenu_Swift-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/dyld.modulemap /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
/Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/Objects-normal/x86_64/FTPopOverMenu~partial.swiftsourceinfo : /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIScreen+Frame.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenuCell.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FT+Extension.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTCellConfiguration.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTConstants.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/UIControl+Point.swift /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/FTPopOverMenu_Swift/FTPopOverMenu_Swift/FTPopOverMenu.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/ObjectiveC.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreImage.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Combine.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/QuartzCore.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Dispatch.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Metal.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Darwin.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Foundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreFoundation.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/CoreGraphics.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/Swift.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/UIKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/SwiftOnoneSupport.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Pods/Target\ Support\ Files/FTPopOverMenu_Swift/FTPopOverMenu_Swift-umbrella.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/dyld.modulemap /Users/anusoft/Downloads/caddiecards_Xcode12-master-2/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FTPopOverMenu_Swift.build/unextended-module.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/mach-o/compact_unwind_encoding.modulemap /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/objc/ObjectiveC.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/OpenGLES.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.apinotes /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/apinotes/Dispatch.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/usr/include/Darwin.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/UserNotifications.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/CoreText.framework/Headers/CoreText.apinotes /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.4.sdk/System/Library/Frameworks/Security.framework/Headers/Security.apinotes
|
D
|
/**
License:
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.
Authors:
Alexandru Ermicioi
**/
module aermicioi.aedi.exception.invalid_cast_exception;
/**
It is thrown when a factory detects that fetched object from DI container cannot be casted to required interface/class
that should be passed to newly constructed object.
**/
class InvalidCastException : Exception {
@safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
{
super(msg, file, line, next);
}
@safe pure nothrow this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__)
{
super(msg, file, line, next);
}
}
|
D
|
// PERMUTE_ARGS:
// EXTRA_SOURCES: /extra-files/ddoc9676a.ddoc
// REQUIRED_ARGS: -D -Dd${RESULTS_DIR}/compilable -o-
// POST_SCRIPT: compilable/extra-files/ddocAny-postscript.sh 9676a
module ddoc9676a;
///
deprecated void foo() {}
|
D
|
/*
* This file is part of gtkD.
*
* gtkD 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.
*
* gtkD 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 gtkD; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
/*
* Conversion parameters:
* inFile = GtkCalendar.html
* outPack = gtk
* outFile = Calendar
* strct = GtkCalendar
* realStrct=
* ctorStrct=
* clss = Calendar
* interf =
* class Code: No
* interface Code: No
* template for:
* extend =
* implements:
* prefixes:
* - gtk_calendar_
* - gtk_
* omit structs:
* omit prefixes:
* omit code:
* omit signals:
* imports:
* structWrap:
* module aliases:
* local aliases:
* overrides:
*/
module gtkD.gtk.Calendar;
public import gtkD.gtkc.gtktypes;
private import gtkD.gtkc.gtk;
private import gtkD.glib.ConstructionException;
private import gtkD.gobject.Signals;
public import gtkD.gtkc.gdktypes;
private import gtkD.gtk.Widget;
/**
* Description
* GtkCalendar is a widget that displays a calendar, one month at a time.
* It can be created with gtk_calendar_new().
* The month and year currently displayed can be altered with
* gtk_calendar_select_month(). The exact day can be selected from the displayed
* month using gtk_calendar_select_day().
* To place a visual marker on a particular day, use gtk_calendar_mark_day()
* and to remove the marker, gtk_calendar_unmark_day().
* Alternative, all marks can be cleared with gtk_calendar_clear_marks().
* The way in which the calendar itself is displayed can be altered using
* gtk_calendar_set_display_options().
* The selected date can be retrieved from a GtkCalendar using
* gtk_calendar_get_date().
*/
public class Calendar : Widget
{
/** the main Gtk struct */
protected GtkCalendar* gtkCalendar;
public GtkCalendar* getCalendarStruct()
{
return gtkCalendar;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gtkCalendar;
}
/**
* Sets our main struct and passes it to the parent class
*/
public this (GtkCalendar* gtkCalendar)
{
if(gtkCalendar is null)
{
this = null;
return;
}
//Check if there already is a D object for this gtk struct
void* ptr = getDObject(cast(GObject*)gtkCalendar);
if( ptr !is null )
{
this = cast(Calendar)ptr;
return;
}
super(cast(GtkWidget*)gtkCalendar);
this.gtkCalendar = gtkCalendar;
}
/**
*/
int[char[]] connectedSignals;
void delegate(Calendar)[] onDaySelectedListeners;
/**
* Emitted when the user selects a day.
*/
void addOnDaySelected(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("day-selected" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"day-selected",
cast(GCallback)&callBackDaySelected,
cast(void*)this,
null,
connectFlags);
connectedSignals["day-selected"] = 1;
}
onDaySelectedListeners ~= dlg;
}
extern(C) static void callBackDaySelected(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onDaySelectedListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onDaySelectedDoubleClickListeners;
/**
*/
void addOnDaySelectedDoubleClick(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("day-selected-double-click" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"day-selected-double-click",
cast(GCallback)&callBackDaySelectedDoubleClick,
cast(void*)this,
null,
connectFlags);
connectedSignals["day-selected-double-click"] = 1;
}
onDaySelectedDoubleClickListeners ~= dlg;
}
extern(C) static void callBackDaySelectedDoubleClick(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onDaySelectedDoubleClickListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onMonthChangedListeners;
/**
* Emitted when the user clicks a button to change the selected month on a
* calendar.
*/
void addOnMonthChanged(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("month-changed" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"month-changed",
cast(GCallback)&callBackMonthChanged,
cast(void*)this,
null,
connectFlags);
connectedSignals["month-changed"] = 1;
}
onMonthChangedListeners ~= dlg;
}
extern(C) static void callBackMonthChanged(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onMonthChangedListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onNextMonthListeners;
/**
*/
void addOnNextMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("next-month" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"next-month",
cast(GCallback)&callBackNextMonth,
cast(void*)this,
null,
connectFlags);
connectedSignals["next-month"] = 1;
}
onNextMonthListeners ~= dlg;
}
extern(C) static void callBackNextMonth(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onNextMonthListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onNextYearListeners;
/**
*/
void addOnNextYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("next-year" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"next-year",
cast(GCallback)&callBackNextYear,
cast(void*)this,
null,
connectFlags);
connectedSignals["next-year"] = 1;
}
onNextYearListeners ~= dlg;
}
extern(C) static void callBackNextYear(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onNextYearListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onPrevMonthListeners;
/**
*/
void addOnPrevMonth(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("prev-month" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"prev-month",
cast(GCallback)&callBackPrevMonth,
cast(void*)this,
null,
connectFlags);
connectedSignals["prev-month"] = 1;
}
onPrevMonthListeners ~= dlg;
}
extern(C) static void callBackPrevMonth(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onPrevMonthListeners )
{
dlg(calendar);
}
}
void delegate(Calendar)[] onPrevYearListeners;
/**
*/
void addOnPrevYear(void delegate(Calendar) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
if ( !("prev-year" in connectedSignals) )
{
Signals.connectData(
getStruct(),
"prev-year",
cast(GCallback)&callBackPrevYear,
cast(void*)this,
null,
connectFlags);
connectedSignals["prev-year"] = 1;
}
onPrevYearListeners ~= dlg;
}
extern(C) static void callBackPrevYear(GtkCalendar* calendarStruct, Calendar calendar)
{
foreach ( void delegate(Calendar) dlg ; calendar.onPrevYearListeners )
{
dlg(calendar);
}
}
/**
* Creates a new calendar, with the current date being selected.
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this ()
{
// GtkWidget* gtk_calendar_new (void);
auto p = gtk_calendar_new();
if(p is null)
{
throw new ConstructionException("null returned by gtk_calendar_new()");
}
this(cast(GtkCalendar*) p);
}
/**
* Shifts the calendar to a different month.
* Params:
* month = a month number between 0 and 11.
* year = the year the month is in.
* Returns: TRUE, always
*/
public int selectMonth(uint month, uint year)
{
// gboolean gtk_calendar_select_month (GtkCalendar *calendar, guint month, guint year);
return gtk_calendar_select_month(gtkCalendar, month, year);
}
/**
* Selects a day from the current month.
* Params:
* day = the day number between 1 and 31, or 0 to unselect
* the currently selected day.
*/
public void selectDay(uint day)
{
// void gtk_calendar_select_day (GtkCalendar *calendar, guint day);
gtk_calendar_select_day(gtkCalendar, day);
}
/**
* Places a visual marker on a particular day.
* Params:
* day = the day number to mark between 1 and 31.
* Returns: TRUE, always
*/
public int markDay(uint day)
{
// gboolean gtk_calendar_mark_day (GtkCalendar *calendar, guint day);
return gtk_calendar_mark_day(gtkCalendar, day);
}
/**
* Removes the visual marker from a particular day.
* Params:
* day = the day number to unmark between 1 and 31.
* Returns: TRUE, always
*/
public int unmarkDay(uint day)
{
// gboolean gtk_calendar_unmark_day (GtkCalendar *calendar, guint day);
return gtk_calendar_unmark_day(gtkCalendar, day);
}
/**
* Remove all visual markers.
*/
public void clearMarks()
{
// void gtk_calendar_clear_marks (GtkCalendar *calendar);
gtk_calendar_clear_marks(gtkCalendar);
}
/**
* Returns the current display options of calendar.
* Since 2.4
* Returns: the display options.
*/
public GtkCalendarDisplayOptions getDisplayOptions()
{
// GtkCalendarDisplayOptions gtk_calendar_get_display_options (GtkCalendar *calendar);
return gtk_calendar_get_display_options(gtkCalendar);
}
/**
* Sets display options (whether to display the heading and the month
* headings).
* Since 2.4
* Params:
* flags = the display options to set
*/
public void setDisplayOptions(GtkCalendarDisplayOptions flags)
{
// void gtk_calendar_set_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags);
gtk_calendar_set_display_options(gtkCalendar, flags);
}
/**
* Obtains the selected date from a GtkCalendar.
* Params:
* year = location to store the year number, or NULL
* month = location to store the month number (between 0 and 11), or NULL
* day = location to store the day number (between 1 and 31), or NULL
*/
public void getDate(out uint year, out uint month, out uint day)
{
// void gtk_calendar_get_date (GtkCalendar *calendar, guint *year, guint *month, guint *day);
gtk_calendar_get_date(gtkCalendar, &year, &month, &day);
}
/**
* Installs a function which provides Pango markup with detail information
* for each day. Examples for such details are holidays or appointments. That
* information is shown below each day when "show-details" is set.
* A tooltip containing with full detail information is provided, if the entire
* text should not fit into the details area, or if "show-details"
* is not set.
* The size of the details area can be restricted by setting the
* "detail-width-chars" and "detail-height-rows"
* properties.
* Since 2.14
* Params:
* func = a function providing details for each day.
* data = data to pass to func invokations.
* destroy = a function for releasing data.
*/
public void setDetailFunc(GtkCalendarDetailFunc func, void* data, GDestroyNotify destroy)
{
// void gtk_calendar_set_detail_func (GtkCalendar *calendar, GtkCalendarDetailFunc func, gpointer data, GDestroyNotify destroy);
gtk_calendar_set_detail_func(gtkCalendar, func, data, destroy);
}
/**
* Queries the width of detail cells, in characters.
* See "detail-width-chars".
* Since 2.14
* Returns: The width of detail cells, in characters.
*/
public int getDetailWidthChars()
{
// gint gtk_calendar_get_detail_width_chars (GtkCalendar *calendar);
return gtk_calendar_get_detail_width_chars(gtkCalendar);
}
/**
* Updates the width of detail cells.
* See "detail-width-chars".
* Since 2.14
* Params:
* chars = detail width in characters.
*/
public void setDetailWidthChars(int chars)
{
// void gtk_calendar_set_detail_width_chars (GtkCalendar *calendar, gint chars);
gtk_calendar_set_detail_width_chars(gtkCalendar, chars);
}
/**
* Queries the height of detail cells, in rows.
* See "detail-width-chars".
* Since 2.14
* Returns: The height of detail cells, in rows.
*/
public int getDetailHeightRows()
{
// gint gtk_calendar_get_detail_height_rows (GtkCalendar *calendar);
return gtk_calendar_get_detail_height_rows(gtkCalendar);
}
/**
* Updates the height of detail cells.
* See "detail-height-rows".
* Since 2.14
* Params:
* rows = detail height in rows.
*/
public void setDetailHeightRows(int rows)
{
// void gtk_calendar_set_detail_height_rows (GtkCalendar *calendar, gint rows);
gtk_calendar_set_detail_height_rows(gtkCalendar, rows);
}
/**
* Warning
* gtk_calendar_display_options has been deprecated since version 2.4 and should not be used in newly-written code. Use gtk_calendar_set_display_options() instead
* Sets display options (whether to display the heading and the month headings).
* Params:
* flags = the display options to set.
*/
public void displayOptions(GtkCalendarDisplayOptions flags)
{
// void gtk_calendar_display_options (GtkCalendar *calendar, GtkCalendarDisplayOptions flags);
gtk_calendar_display_options(gtkCalendar, flags);
}
/**
* Warning
* gtk_calendar_freeze has been deprecated since version 2.8 and should not be used in newly-written code.
* Does nothing. Previously locked the display of the calendar until
* it was thawed with gtk_calendar_thaw().
*/
public void freeze()
{
// void gtk_calendar_freeze (GtkCalendar *calendar);
gtk_calendar_freeze(gtkCalendar);
}
/**
* Warning
* gtk_calendar_thaw has been deprecated since version 2.8 and should not be used in newly-written code.
* Does nothing. Previously defrosted a calendar; all the changes made
* since the last gtk_calendar_freeze() were displayed.
*/
public void thaw()
{
// void gtk_calendar_thaw (GtkCalendar *calendar);
gtk_calendar_thaw(gtkCalendar);
}
}
|
D
|
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (c) 1999-2017 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/irstate.d, _irstate.d)
* Documentation: https://dlang.org/phobos/dmd_irstate.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/irstate.d
*/
module dmd.irstate;
import dmd.root.array;
import dmd.arraytypes;
import dmd.backend.type;
import dmd.dmodule;
import dmd.dsymbol;
import dmd.func;
import dmd.identifier;
import dmd.statement;
import dmd.globals;
import dmd.mtype;
import dmd.backend.cc;
import dmd.backend.el;
/****************************************
* Our label symbol, with vector to keep track of forward references.
*/
struct Label
{
block *lblock; // The block to which the label is defined.
block *fwdrefs; // The first use of the label before it is defined.
}
/***********************************************************
*/
struct IRState
{
IRState* prev;
Statement statement;
Module m; // module
private FuncDeclaration symbol; // function that code is being generate for
Identifier ident;
Symbol* shidden; // hidden parameter to function
Symbol* sthis; // 'this' parameter to function (member and nested)
Symbol* sclosure; // pointer to closure instance
Blockx* blx;
Dsymbols* deferToObj; // array of Dsymbol's to run toObjFile(bool multiobj) on later
elem* ehidden; // transmit hidden pointer to CallExp::toElem()
Symbol* startaddress;
Array!(elem*)* varsInScope; // variables that are in scope that will need destruction later
Label*[void*]* labels; // table of labels used/declared in function
bool mayThrow; // the expression being evaluated may throw
block* breakBlock;
block* contBlock;
block* switchBlock;
block* defaultBlock;
block* finallyBlock;
this(IRState* irs, Statement s)
{
prev = irs;
statement = s;
if (irs)
{
m = irs.m;
shidden = irs.shidden;
sclosure = irs.sclosure;
sthis = irs.sthis;
blx = irs.blx;
deferToObj = irs.deferToObj;
varsInScope = irs.varsInScope;
labels = irs.labels;
mayThrow = irs.mayThrow;
}
}
this(Module m, FuncDeclaration fd, Array!(elem*)* varsInScope, Dsymbols* deferToObj, Label*[void*]* labels)
{
this.m = m;
this.symbol = fd;
this.varsInScope = varsInScope;
this.deferToObj = deferToObj;
this.labels = labels;
mayThrow = global.params.useExceptions &&
!(fd && fd.eh_none);
}
/****
* Access labels AA from C++ code.
* Params:
* s = key
* Returns:
* pointer to value if it's there, null if not
*/
Label** lookupLabel(Statement s)
{
return cast(void*)s in *labels;
}
/****
* Access labels AA from C++ code.
* Params:
* s = key
* label = value
*/
void insertLabel(Statement s, Label* label)
{
(*labels)[cast(void*)s] = label;
}
block* getBreakBlock(Identifier ident)
{
IRState* bc;
if (ident)
{
Statement related = null;
block* ret = null;
for (bc = &this; bc; bc = bc.prev)
{
// The label for a breakBlock may actually be some levels up (e.g.
// on a try/finally wrapping a loop). We'll see if this breakBlock
// is the one to return once we reach that outer statement (which
// in many cases will be this same statement).
if (bc.breakBlock)
{
related = bc.statement.getRelatedLabeled();
ret = bc.breakBlock;
}
if (bc.statement == related && bc.prev.ident == ident)
return ret;
}
}
else
{
for (bc = &this; bc; bc = bc.prev)
{
if (bc.breakBlock)
return bc.breakBlock;
}
}
return null;
}
block* getContBlock(Identifier ident)
{
IRState* bc;
if (ident)
{
block* ret = null;
for (bc = &this; bc; bc = bc.prev)
{
// The label for a contBlock may actually be some levels up (e.g.
// on a try/finally wrapping a loop). We'll see if this contBlock
// is the one to return once we reach that outer statement (which
// in many cases will be this same statement).
if (bc.contBlock)
{
ret = bc.contBlock;
}
if (bc.prev && bc.prev.ident == ident)
return ret;
}
}
else
{
for (bc = &this; bc; bc = bc.prev)
{
if (bc.contBlock)
return bc.contBlock;
}
}
return null;
}
block* getSwitchBlock()
{
IRState* bc;
for (bc = &this; bc; bc = bc.prev)
{
if (bc.switchBlock)
return bc.switchBlock;
}
return null;
}
block* getDefaultBlock()
{
IRState* bc;
for (bc = &this; bc; bc = bc.prev)
{
if (bc.defaultBlock)
return bc.defaultBlock;
}
return null;
}
block* getFinallyBlock()
{
IRState* bc;
for (bc = &this; bc; bc = bc.prev)
{
if (bc.finallyBlock)
return bc.finallyBlock;
}
return null;
}
FuncDeclaration getFunc()
{
for (auto bc = &this; 1; bc = bc.prev)
{
if (!bc.prev)
return bc.symbol;
}
}
/**********************
* Returns:
* true if do array bounds checking for the current function
*/
bool arrayBoundsCheck()
{
bool result;
final switch (global.params.useArrayBounds)
{
case CHECKENABLE.off:
result = false;
break;
case CHECKENABLE.on:
result = true;
break;
case CHECKENABLE.safeonly:
{
result = false;
FuncDeclaration fd = getFunc();
if (fd)
{
Type t = fd.type;
if (t.ty == Tfunction && (cast(TypeFunction)t).trust == TRUSTsafe)
result = true;
}
break;
}
case CHECKENABLE._default:
assert(0);
}
return result;
}
/****************************
* Returns:
* true if in a nothrow section of code
*/
bool isNothrow()
{
return !mayThrow;
}
}
|
D
|
instance Sld_701_Orik_Exit(C_Info)
{
npc = SLD_701_Orik;
nr = 999;
condition = Sld_701_Orik_Exit_Condition;
information = Sld_701_Orik_Exit_Info;
important = 0;
permanent = 1;
description = "KONEC";
};
func int Sld_701_Orik_Exit_Condition()
{
return 1;
};
func void Sld_701_Orik_Exit_Info()
{
AI_StopProcessInfos(self);
};
|
D
|
/*
* Copyright (c) 2004-2008 Derelict Developers
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the names 'Derelict', 'DerelictGL', nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module derelict.opengl.extension.ext.shared_texture_palette;
private
{
import derelict.opengl.gltypes;
import derelict.opengl.gl;
import derelict.util.wrapper;
}
private bool enabled = false;
struct EXTSharedTexturePalette
{
static bool load(char[] extString)
{
if(extString.findStr("GL_EXT_shared_texture_palette") == -1)
return false;
enabled = true;
return true;
}
static bool isEnabled()
{
return enabled;
}
}
version(DerelictGL_NoExtensionLoaders)
{
}
else
{
static this()
{
DerelictGL.registerExtensionLoader(&EXTSharedTexturePalette.load);
}
}
enum : GLenum
{
GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB
}
|
D
|
/Users/shawngong/Centa/.build/debug/Turnstile.build/Realm/Realm.swift.o : /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/TurnstileError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Subject.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Turnstile.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/APIKey.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Credentials.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/CredentialsError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Token.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/UsernamePassword.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Account.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/MemoryRealm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Realm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/MemorySessionManager.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/SessionManager.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/shawngong/Centa/.build/debug/CLibreSSL.build/module.modulemap /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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/shawngong/Centa/.build/debug/TurnstileCrypto.swiftmodule
/Users/shawngong/Centa/.build/debug/Turnstile.build/Realm~partial.swiftmodule : /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/TurnstileError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Subject.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Turnstile.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/APIKey.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Credentials.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/CredentialsError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Token.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/UsernamePassword.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Account.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/MemoryRealm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Realm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/MemorySessionManager.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/SessionManager.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/shawngong/Centa/.build/debug/CLibreSSL.build/module.modulemap /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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/shawngong/Centa/.build/debug/TurnstileCrypto.swiftmodule
/Users/shawngong/Centa/.build/debug/Turnstile.build/Realm~partial.swiftdoc : /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/TurnstileError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Subject.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Core/Turnstile.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/APIKey.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Credentials.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/CredentialsError.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/Token.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Credentials/UsernamePassword.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Account.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/MemoryRealm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/Realm/Realm.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/MemorySessionManager.swift /Users/shawngong/Centa/Packages/Turnstile-1.0.5/Sources/Turnstile/SessionManager/SessionManager.swift /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/SwiftOnoneSupport.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule /Users/shawngong/Centa/.build/debug/CLibreSSL.build/module.modulemap /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/Dispatch.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/IOKit.swiftmodule /Users/shawngong/Centa/.build/debug/TurnstileCrypto.swiftmodule
|
D
|
INSTANCE Info_Mod_Melvin_Hi (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Hi_Condition;
information = Info_Mod_Melvin_Hi_Info;
permanent = 0;
important = 1;
};
FUNC INT Info_Mod_Melvin_Hi_Condition()
{
return 1;
};
FUNC VOID Info_Mod_Melvin_Hi_Info()
{
AI_Output(self, hero, "Info_Mod_Melvin_Hi_29_00"); //Hey, du, du ... Was willst du hier?
Info_ClearChoices (Info_Mod_Melvin_Hi);
Info_AddChoice (Info_Mod_Melvin_Hi, "Das Lager hier ausräuchern, wonach sieht's denn sonst aus?", Info_Mod_Melvin_Hi_B);
Info_AddChoice (Info_Mod_Melvin_Hi, "Ich sehe mich nur um.", Info_Mod_Melvin_Hi_A);
};
FUNC VOID Info_Mod_Melvin_Hi_B()
{
AI_Output(hero, self, "Info_Mod_Melvin_Hi_B_15_00"); //Das Lager hier ausräuchern, wonach sieht's denn sonst aus?
AI_Output(self, hero, "Info_Mod_Melvin_Hi_B_29_01"); //Genau das hab' ich befürchtet. Los, Männer, macht ihn kalt!
Info_ClearChoices (Info_Mod_Melvin_Hi);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_GuildEnemy, 0);
};
FUNC VOID Info_Mod_Melvin_Hi_A()
{
AI_Output(hero, self, "Info_Mod_Melvin_Hi_A_15_00"); //Ich sehe mich nur um.
AI_Output(self, hero, "Info_Mod_Melvin_Hi_A_29_01"); //Das ist aber schlecht. Wir, äh, wollen lieber nicht entdeckt werden.
AI_Output(self, hero, "Info_Mod_Melvin_Hi_A_29_02"); //Das heißt, weil du jetzt ja weißt, wo wir zu finden sind, musst du unser Komplize werden. Sonst könntest du uns ja verpfeifen.
AI_Output(self, hero, "Info_Mod_Melvin_Hi_A_29_03"); //Und das wiederum bedeutet, dass du dem Bauern sein Korn stehlen musst.
AI_Output(self, hero, "Info_Mod_Melvin_Hi_A_29_04"); //Das brauchen wir nämlich. Verstanden, äh, oder gibt's noch Fragen?
Info_ClearChoices (Info_Mod_Melvin_Hi);
Info_AddChoice (Info_Mod_Melvin_Hi, "Was wollt ihr denn damit anstellen?", Info_Mod_Melvin_Hi_D);
Info_AddChoice (Info_Mod_Melvin_Hi, "Woher bekomme ich das Korn?", Info_Mod_Melvin_Hi_C);
};
FUNC VOID Info_Mod_Melvin_Hi_D()
{
AI_Output(hero, self, "Info_Mod_Melvin_Hi_D_15_00"); //Was wollt ihr denn damit anstellen?
AI_Output(self, hero, "Info_Mod_Melvin_Hi_D_29_01"); //Das brauchen wir für, na ja, fürn Mittel, das wir uns basteln wollen. (Pause) Wir wollen uns halt ein bisschen Freudenspender selbst machen, kapiert?
AI_Output(hero, self, "Info_Mod_Melvin_Hi_D_15_02"); //Mit Korn ...?
AI_Output(self, hero, "Info_Mod_Melvin_Hi_D_29_03"); //Ja, genau, mit Korn. Wir haben da so ein Rezept gefunden.
AI_Output(self, hero, "Info_Mod_Melvin_Hi_D_29_04"); //Alle anderen Zutaten haben wir schon, Scavengerdung, Schnaps und drei Fliegenpilze.
AI_Output(hero, self, "Info_Mod_Melvin_Hi_D_15_05"); //Und ihr meint, dass das funktioniert?
AI_Output(self, hero, "Info_Mod_Melvin_Hi_D_29_06"); //Äh, sicher. Halluzinationen garantiert, steht auf dem Rezept.
Mod_REL_Korndiebe += 1;
if (Mod_REL_Korndiebe == 1)
{
Info_ClearChoices (Info_Mod_Melvin_Hi);
Info_AddChoice (Info_Mod_Melvin_Hi, "Woher bekomme ich das Korn?", Info_Mod_Melvin_Hi_C);
}
else
{
Info_ClearChoices (Info_Mod_Melvin_Hi);
};
};
FUNC VOID Info_Mod_Melvin_Hi_C()
{
AI_Output(hero, self, "Info_Mod_Melvin_Hi_C_15_00"); //Woher bekomme ich das Korn?
AI_Output(self, hero, "Info_Mod_Melvin_Hi_C_29_01"); //Alles, was wir brauchen, steht bei Erhard im Haus. Drei Säcke sollten reichen.
Log_CreateTopic (TOPIC_MOD_KHORATA_KORNDIEBE, LOG_MISSION);
B_SetTopicStatus (TOPIC_MOD_KHORATA_KORNDIEBE, LOG_RUNNING);
B_LogEntry (TOPIC_MOD_KHORATA_KORNDIEBE, "Der Räuber Melvin braucht drei Säcke Korn aus dem Haus des Bauern Erhard für ein ominöses Mittel, das in der Wirkung Freudenspender ähneln soll.");
Mod_REL_Korndiebe += 1;
if (Mod_REL_Korndiebe == 1)
{
Info_ClearChoices (Info_Mod_Melvin_Hi);
Info_AddChoice (Info_Mod_Melvin_Hi, "Was wollt ihr denn damit anstellen?", Info_Mod_Melvin_Hi_D);
}
else
{
Info_ClearChoices (Info_Mod_Melvin_Hi);
};
};
INSTANCE Info_Mod_Melvin_Korndiebe (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Korndiebe_Condition;
information = Info_Mod_Melvin_Korndiebe_Info;
permanent = 0;
important = 0;
description = "Der Bauer hat kein Korn mehr.";
};
FUNC INT Info_Mod_Melvin_Korndiebe_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Hi))
&& (Npc_KnowsInfo(hero, Info_Mod_Erhard_Korndiebe))
{
return 1;
};
};
FUNC VOID Info_Mod_Melvin_Korndiebe_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Korndiebe_15_00"); //Der Bauer hat kein Korn mehr.
AI_Output(self, hero, "Info_Mod_Melvin_Korndiebe_29_01"); //Hä, wie ist das möglich? Müssen wir jetzt bis zur nächsten Ernte warten? Was sollen wir denn so lange machen?
AI_Output(hero, self, "Info_Mod_Melvin_Korndiebe_15_02"); //Sucht einfach ein neues Rezept.
AI_Output(self, hero, "Info_Mod_Melvin_Korndiebe_29_03"); //Ja, das ist gut. (laut) Jungs, habt ihr das gehört? Wir suchen nach einem anderen Rezept!
B_SetTopicStatus (TOPIC_MOD_KHORATA_KORNDIEBE, LOG_SUCCESS);
CurrentNQ += 1;
Mod_REL_QuestCounter += 1;
};
INSTANCE Info_Mod_Melvin_Korndiebe2 (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Korndiebe2_Condition;
information = Info_Mod_Melvin_Korndiebe2_Info;
permanent = 0;
important = 0;
description = "Ich habe das Korn.";
};
FUNC INT Info_Mod_Melvin_Korndiebe2_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Hi))
&& (Npc_HasItems(hero, ItMi_Kornballen) == 3)
&& (!Npc_KnowsInfo(hero, Info_Mod_Erhard_Korndiebe))
{
return 1;
};
};
FUNC VOID Info_Mod_Melvin_Korndiebe2_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Korndiebe2_15_00"); //Ich habe das Korn.
B_GiveInvItems (hero, self, ItMi_Kornballen, 3);
AI_Output(self, hero, "Info_Mod_Melvin_Korndiebe2_29_01"); //Sehr gut. Äh, wir werden dann also jetzt den Trank brauen.
AI_Output(self, hero, "Info_Mod_Melvin_Korndiebe2_29_02"); //Wenn du morgen wiederkommst, kannst du auch einen Schluck haben.
B_LogEntry (TOPIC_MOD_KHORATA_KORNDIEBE, "Ich habe das Korn gestohlen und kann mir einen Teil des Trankes als Belohnung abholen, wenn ich das nächste Mal vorbei komme.");
B_SetTopicStatus (TOPIC_MOD_KHORATA_KORNDIEBE, LOG_SUCCESS);
B_GivePlayerXP (100);
B_Göttergefallen(3, 1);
Mod_REL_MelvinTrank = Wld_GetDay();
CurrentNQ += 1;
Mod_REL_Korndiebe = 3;
Mod_REL_QuestCounter += 1;
};
INSTANCE Info_Mod_Melvin_Korndiebe3 (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Korndiebe3_Condition;
information = Info_Mod_Melvin_Korndiebe3_Info;
permanent = 0;
important = 1;
};
FUNC INT Info_Mod_Melvin_Korndiebe3_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Korndiebe2))
&& (Wld_GetDay() > Mod_REL_MelvinTrank)
{
return 1;
};
};
FUNC VOID Info_Mod_Melvin_Korndiebe3_Info()
{
AI_Output(self, hero, "Info_Mod_Melvin_Korndiebe3_29_00"); //Hier ist das gute Zeug. Ist ein bisschen stark geworden, glaube ich, wir haben es noch nicht probiert.
B_GiveInvItems (self, hero, ItPo_FreudenspenderSuppe, 1);
};
INSTANCE Info_Mod_Melvin_Frauenkleider (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Frauenkleider_Condition;
information = Info_Mod_Melvin_Frauenkleider_Info;
permanent = 0;
important = 0;
description = "Was trägst du denn da?";
};
FUNC INT Info_Mod_Melvin_Frauenkleider_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Hi))
&& (Npc_KnowsInfo(hero, Info_Mod_Elvira_Frauenkleider))
&& (Mod_REL_Frauenkleider == 1)
{
return 1;
};
};
FUNC VOID Info_Mod_Melvin_Frauenkleider_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider_15_00"); //Was trägst du denn da?
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider_29_01"); //Des Diebes neue Kleider. Hübsch, nicht?
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider_15_02"); //Ja, schon, aber die Eigentümerin hätte die Kleider gern zurück.
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider_29_03"); //(entsetzt) Nein! Ich habe sie mir, äh, hart erarbeitet! Das sind jetzt meine!
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider_15_04"); //Meinst du nicht, du machst dich damit zum Gespött der Leute?
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider_29_05"); //Wieso? Sind doch schöne Kleider!
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider_15_06"); //(zu sich selbst) Da fällt mir was ein. Gleich mal notieren.
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider_15_07"); //(laut) Weiß auch nicht, wie ich darauf gekommen bin.
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider_29_08"); //Siehst du. Äh.
B_LogEntry (TOPIC_MOD_KHORATA_FRAUENKLEIDER, "Vielleicht lässt Melvin von den Kleidern, wenn seine Kameraden ihn auslachen.");
};
INSTANCE Info_Mod_Melvin_Frauenkleider2 (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Frauenkleider2_Condition;
information = Info_Mod_Melvin_Frauenkleider2_Info;
permanent = 0;
important = 0;
description = "Brauchst du die Kleider noch?";
};
FUNC INT Info_Mod_Melvin_Frauenkleider2_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Frauenkleider))
&& (Mod_REL_Frauenkleider01 == 1)
&& (Mod_REL_Frauenkleider02 == 1)
&& (Mod_REL_Frauenkleider03 == 1)
{
return 1;
};
};
FUNC VOID Info_Mod_Melvin_Frauenkleider2_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider2_15_00"); //Brauchst du die Kleider noch?
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider2_29_01"); //Ich habe mir überlegt, dass ich, äh, doch lieber wieder 'ne Hose anziehe. Ist irgendwie bequemer.
AI_Output(self, hero, "Info_Mod_Melvin_Frauenkleider2_29_02"); //Mach mit den Kleidern, was du willst.
AI_UnequipArmor (self);
AI_EquipArmor (self, ItAr_BDT_M_01);
B_GiveInvItems (self, hero, ItMi_Kleiderkoffer, 1);
AI_Output(hero, self, "Info_Mod_Melvin_Frauenkleider2_15_03"); //Das werde ich.
B_LogEntry (TOPIC_MOD_KHORATA_FRAUENKLEIDER, "Ich muss Elvira nun ihre Kleider zurückbringen.");
};
INSTANCE Info_Mod_Melvin_Schutzbeduerftig (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Schutzbeduerftig_Condition;
information = Info_Mod_Melvin_Schutzbeduerftig_Info;
permanent = 0;
important = 0;
description = "Du zitterst ja. Ist dir kalt?";
};
FUNC INT Info_Mod_Melvin_Schutzbeduerftig_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Hi))
&& (Npc_KnowsInfo(hero, Info_Mod_Heiler_Endres))
&& (Mod_Jim_Schutz < 2)
{
return TRUE;
};
};
FUNC VOID Info_Mod_Melvin_Schutzbeduerftig_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig_15_00"); //Du zitterst ja. Ist dir kalt?
AI_Output(self, hero, "Info_Mod_Melvin_Schutzbeduerftig_29_01"); //(bibbernd) Kalt? Äh, nein. Du würdest auch b-b-bibbern, wenn du die Nächte hier miterleben würdest.
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig_15_02"); //Was ist denn los?
AI_Output(self, hero, "Info_Mod_Melvin_Schutzbeduerftig_29_03"); //Vom Friedhof her kommt ein Gestöhne und Gejammere, das noch sch-schlimmer ist als bei meiner, äh, Großmutter.
AI_Output(self, hero, "Info_Mod_Melvin_Schutzbeduerftig_29_04"); //Wahrscheinlich brechen die Zombies allesamt aus ihren Gräbern und planen, wie sie uns am besten auffressen können!
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig_15_05"); //Das denke ich auch.
};
INSTANCE Info_Mod_Melvin_Schutzbeduerftig2 (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Schutzbeduerftig2_Condition;
information = Info_Mod_Melvin_Schutzbeduerftig2_Info;
permanent = 0;
important = 0;
description = "Der Friedhof ist wieder still.";
};
FUNC INT Info_Mod_Melvin_Schutzbeduerftig2_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Melvin_Schutzbeduerftig))
&& (Mod_Jim_Schutz == 2)
{
return TRUE;
};
};
FUNC VOID Info_Mod_Melvin_Schutzbeduerftig2_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig2_15_00"); //Der Friedhof ist wieder still.
AI_Output(self, hero, "Info_Mod_Melvin_Schutzbeduerftig2_29_01"); //Ah. Oh. Äh, danke. Hast du die Invasionsarmee aus Zombies ganz allein besiegt?
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig2_15_02"); //Selbstredend.
AI_Output(self, hero, "Info_Mod_Melvin_Schutzbeduerftig2_29_03"); //Respekt, Mann. So einen wie, äh, dich, könnte ich gut in meiner Truppe gebrauchen.
AI_Output(hero, self, "Info_Mod_Melvin_Schutzbeduerftig2_15_04"); //Lass mal gut sein.
B_GivePlayerXP (50);
};
INSTANCE Info_Mod_Melvin_Bierhexen (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Bierhexen_Condition;
information = Info_Mod_Melvin_Bierhexen_Info;
permanent = 0;
important = 0;
description = "Ich hätte da eine kurze Frage an dich.";
};
FUNC INT Info_Mod_Melvin_Bierhexen_Condition()
{
if (Npc_KnowsInfo(hero, Info_Mod_Erhard_Bierhexen2))
{
return TRUE;
};
};
FUNC VOID Info_Mod_Melvin_Bierhexen_Info()
{
var C_NPC Melvin; Melvin = Hlp_GetNpc(Mod_7505_BDT_Melvin_REL);
var C_NPC Raeuber01; Raeuber01 = Hlp_GetNpc(Mod_7510_OUT_Raeuber_REL);
var C_NPC Raeuber02; Raeuber02 = Hlp_GetNpc(Mod_7511_OUT_Raeuber_REL);
var C_NPC Raeuber03; Raeuber03 = Hlp_GetNpc(Mod_7512_OUT_Raeuber_REL);
TRIA_Invite(Raeuber01);
TRIA_Invite(Raeuber02);
TRIA_Invite(Raeuber03);
TRIA_Start();
AI_Output(hero, self, "Info_Mod_Melvin_Bierhexen_15_00"); //Ich hätte da eine kurze Frage an dich.
TRIA_Next(Melvin);
AI_Output(self, hero, "Info_Mod_Melvin_Bierhexen_29_01"); //Na klar, äh, wenn's schnell geht.
AI_Output(hero, self, "Info_Mod_Melvin_Bierhexen_15_02"); //Hat einer von euch auf Erhards Gerste gepinkelt?
AI_Output(self, hero, "Info_Mod_Melvin_Bierhexen_29_03"); //Hä? Ich will das doch klauen, wieso sollte ich dann draufpinkeln?
AI_Output(hero, self, "Info_Mod_Melvin_Bierhexen_15_04"); //Keine Ahnung. Irgendeiner hat's jedenfalls getan.
AI_Output(hero, self, "Info_Mod_Melvin_Bierhexen_15_05"); //Und der Braumeister hat aus dem Korn Bier gebraut.
AI_Output(self, hero, "Info_Mod_Melvin_Bierhexen_29_06"); //Ist ja eklig! Hey, Jungs, hat einer von euch auf die Gerste vom Braumeister gepisst?
TRIA_Next(Raeuber01);
AI_Output(self, hero, "Info_Mod_Raeuber01_Bierhexen_08_07"); //Ich war's nicht!
TRIA_Next(Raeuber02);
AI_Output(self, hero, "Info_Mod_Raeuber02_Bierhexen_06_08"); //Bist du dumm?
TRIA_Next(Raeuber03);
AI_Output(self, hero, "Info_Mod_Raeuber03_Bierhexen_06_09"); //Das war doch Leonhard.
AI_Output(hero, self, "Info_Mod_Raeuber03_Bierhexen_15_10"); //Leonhard?
AI_Output(self, hero, "Info_Mod_Raeuber03_Bierhexen_06_11"); //Hat's mir jedenfalls stolz erzählt. Als ob das so was Besonderes wäre.
AI_Output(hero, self, "Info_Mod_Raeuber03_Bierhexen_15_12"); //Wo finde ich Leonhard?
AI_Output(self, hero, "Info_Mod_Raeuber03_Bierhexen_06_13"); //Der lungert in den Gassen von Khorata rum. Hat halt nicht so ein tolles Versteck wie wir.
B_LogEntry (TOPIC_MOD_KHORATA_BIERHEXEN, "Nach Angaben eines Kumpanen von Melvin ist Leonhard in Khorata der Übeltäter.");
TRIA_Finish();
AI_StopProcessInfos (self);
};
INSTANCE Info_Mod_Melvin_Freudenspender (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Freudenspender_Condition;
information = Info_Mod_Melvin_Freudenspender_Info;
permanent = 0;
important = 0;
description = "Ich hab hier Freudenspender ...";
};
FUNC INT Info_Mod_Melvin_Freudenspender_Condition()
{
if (Npc_HasItems(hero, ItMi_Freudenspender) >= 1)
&& (Mod_Freudenspender < 5)
&& (Npc_KnowsInfo(hero, Info_Mod_Sabine_Hi))
{
return TRUE;
};
};
FUNC VOID Info_Mod_Melvin_Freudenspender_Info()
{
AI_Output(hero, self, "Info_Mod_Melvin_Freudenspender_15_00"); //Ich hab hier Freudenspender ...
AI_Output(self, hero, "Info_Mod_Melvin_Freudenspender_29_01"); //Mensch, wie geil! Ich, äh, würd wohl was nehmen.
B_GiveInvItems (hero, self, ItMi_Freudenspender, 1);
B_GiveInvItems (self, hero, ItMi_Gold, 10);
Mod_Freudenspender += 1;
};
INSTANCE Info_Mod_Melvin_Pickpocket (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_Pickpocket_Condition;
information = Info_Mod_Melvin_Pickpocket_Info;
permanent = 1;
important = 0;
description = Pickpocket_90;
};
FUNC INT Info_Mod_Melvin_Pickpocket_Condition()
{
C_Beklauen (80, ItMi_Gold, 29);
};
FUNC VOID Info_Mod_Melvin_Pickpocket_Info()
{
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
Info_AddChoice (Info_Mod_Melvin_Pickpocket, DIALOG_BACK, Info_Mod_Melvin_Pickpocket_BACK);
Info_AddChoice (Info_Mod_Melvin_Pickpocket, DIALOG_PICKPOCKET, Info_Mod_Melvin_Pickpocket_DoIt);
};
FUNC VOID Info_Mod_Melvin_Pickpocket_BACK()
{
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
};
FUNC VOID Info_Mod_Melvin_Pickpocket_DoIt()
{
if (B_Beklauen() == TRUE)
{
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
}
else
{
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
Info_AddChoice (Info_Mod_Melvin_Pickpocket, DIALOG_PP_BESCHIMPFEN, Info_Mod_Melvin_Pickpocket_Beschimpfen);
Info_AddChoice (Info_Mod_Melvin_Pickpocket, DIALOG_PP_BESTECHUNG, Info_Mod_Melvin_Pickpocket_Bestechung);
Info_AddChoice (Info_Mod_Melvin_Pickpocket, DIALOG_PP_HERAUSREDEN, Info_Mod_Melvin_Pickpocket_Herausreden);
};
};
FUNC VOID Info_Mod_Melvin_Pickpocket_Beschimpfen()
{
B_Say (hero, self, "$PICKPOCKET_BESCHIMPFEN");
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
};
FUNC VOID Info_Mod_Melvin_Pickpocket_Bestechung()
{
B_Say (hero, self, "$PICKPOCKET_BESTECHUNG");
var int rnd; rnd = r_max(99);
if (rnd < 25)
|| ((rnd >= 25) && (rnd < 50) && (Npc_HasItems(hero, ItMi_Gold) < 50))
|| ((rnd >= 50) && (rnd < 75) && (Npc_HasItems(hero, ItMi_Gold) < 100))
|| ((rnd >= 75) && (rnd < 100) && (Npc_HasItems(hero, ItMi_Gold) < 200))
{
B_Say (self, hero, "$DIRTYTHIEF");
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
AI_StopProcessInfos (self);
B_Attack (self, hero, AR_Theft, 1);
}
else
{
if (rnd >= 75)
{
B_GiveInvItems (hero, self, ItMi_Gold, 200);
}
else if (rnd >= 50)
{
B_GiveInvItems (hero, self, ItMi_Gold, 100);
}
else if (rnd >= 25)
{
B_GiveInvItems (hero, self, ItMi_Gold, 50);
};
B_Say (self, hero, "$PICKPOCKET_BESTECHUNG_01");
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
AI_StopProcessInfos (self);
};
};
FUNC VOID Info_Mod_Melvin_Pickpocket_Herausreden()
{
B_Say (hero, self, "$PICKPOCKET_HERAUSREDEN");
if (r_max(99) < Mod_Verhandlungsgeschick)
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_01");
Info_ClearChoices (Info_Mod_Melvin_Pickpocket);
}
else
{
B_Say (self, hero, "$PICKPOCKET_HERAUSREDEN_02");
};
};
INSTANCE Info_Mod_Melvin_EXIT (C_INFO)
{
npc = Mod_7505_BDT_Melvin_REL;
nr = 1;
condition = Info_Mod_Melvin_EXIT_Condition;
information = Info_Mod_Melvin_EXIT_Info;
permanent = 1;
important = 0;
description = DIALOG_ENDE;
};
FUNC INT Info_Mod_Melvin_EXIT_Condition()
{
return 1;
};
FUNC VOID Info_Mod_Melvin_EXIT_Info()
{
AI_StopProcessInfos (self);
};
|
D
|
/**
* Copyright: Copyright (c) 2012 Jacob Carlborg. All rights reserved.
* Authors: Jacob Carlborg
* Version: Initial created: May 3, 2012
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
*/
module mambo.sys.System;
import core.stdc.stdlib : EXIT_SUCCESS, EXIT_FAILURE;
enum ExitCode
{
success = EXIT_SUCCESS,
failure = EXIT_FAILURE
}
|
D
|
/**
* Contains the garbage collector implementation.
*
* Copyright: Copyright Digital Mars 2001 - 2013.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Walter Bright, David Friedman, Sean Kelly
*/
/* Copyright Digital Mars 2005 - 2013.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module gc.gc;
// D Programming Language Garbage Collector implementation
/************** Debugging ***************************/
//debug = PRINTF; // turn on printf's
//debug = COLLECT_PRINTF; // turn on printf's
//debug = PRINTF_TO_FILE; // redirect printf's ouptut to file "gcx.log"
//debug = LOGGING; // log allocations / frees
//debug = MEMSTOMP; // stomp on memory
//debug = SENTINEL; // add underrun/overrrun protection
//debug = PTRCHECK; // more pointer checking
//debug = PTRCHECK2; // thorough but slow pointer checking
//debug = INVARIANT; // enable invariants
//debug = CACHE_HITRATE; // enable hit rate measure
/*************** Configuration *********************/
version = STACKGROWSDOWN; // growing the stack means subtracting from the stack pointer
// (use for Intel X86 CPUs)
// else growing the stack means adding to the stack pointer
/***************************************************/
import gc.bits;
import gc.stats;
import gc.os;
import gc.config;
import rt.util.container.treap;
import cstdlib = core.stdc.stdlib : calloc, free, malloc, realloc;
import core.stdc.string : memcpy, memset, memmove;
import core.bitop;
import core.sync.mutex;
import core.thread;
static import core.memory;
private alias BlkAttr = core.memory.GC.BlkAttr;
private alias BlkInfo = core.memory.GC.BlkInfo;
version (GNU) import gcc.builtins;
debug (PRINTF_TO_FILE) import core.stdc.stdio : fprintf, fopen, fflush, FILE;
else import core.stdc.stdio : printf; // needed to output profiling results
import core.time;
alias currTime = MonoTime.currTime;
debug(PRINTF_TO_FILE)
{
private __gshared MonoTime gcStartTick;
private __gshared FILE* gcx_fh;
private int printf(ARGS...)(const char* fmt, ARGS args) nothrow
{
if (!gcx_fh)
gcx_fh = fopen("gcx.log", "w");
if (!gcx_fh)
return 0;
int len;
if (MonoTime.ticksPerSecond == 0)
{
len = fprintf(gcx_fh, "before init: ");
}
else
{
if (gcStartTick == MonoTime.init)
gcStartTick = MonoTime.currTime;
immutable timeElapsed = MonoTime.currTime - gcStartTick;
immutable secondsAsDouble = timeElapsed.total!"hnsecs" / cast(double)convert!("seconds", "hnsecs")(1);
len = fprintf(gcx_fh, "%10.6lf: ", secondsAsDouble);
}
len += fprintf(gcx_fh, fmt, args);
fflush(gcx_fh);
return len;
}
}
debug(PRINTF) void printFreeInfo(Pool* pool) nothrow
{
uint nReallyFree;
foreach(i; 0..pool.npages) {
if(pool.pagetable[i] >= B_FREE) nReallyFree++;
}
printf("Pool %p: %d really free, %d supposedly free\n", pool, nReallyFree, pool.freepages);
}
// Track total time spent preparing for GC,
// marking, sweeping and recovering pages.
__gshared Duration prepTime;
__gshared Duration markTime;
__gshared Duration sweepTime;
__gshared Duration recoverTime;
__gshared size_t maxPoolMemory;
private
{
enum USE_CACHE = true;
// The maximum number of recursions of mark() before transitioning to
// multiple heap traversals to avoid consuming O(D) stack space where
// D is the depth of the heap graph.
version(Win64)
enum MAX_MARK_RECURSIONS = 32; // stack overflow in fibers
else
enum MAX_MARK_RECURSIONS = 64;
}
private
{
extern (C)
{
// to allow compilation of this module without access to the rt package,
// make these functions available from rt.lifetime
void rt_finalize2(void* p, bool det, bool resetMemory) nothrow;
int rt_hasFinalizerInSegment(void* p, in void[] segment) nothrow;
// Declared as an extern instead of importing core.exception
// to avoid inlining - see issue 13725.
void onInvalidMemoryOperationError() nothrow;
void onOutOfMemoryError() nothrow;
}
enum
{
OPFAIL = ~cast(size_t)0
}
}
alias GC gc_t;
/* ======================= Leak Detector =========================== */
debug (LOGGING)
{
struct Log
{
void* p;
size_t size;
size_t line;
char* file;
void* parent;
void print() nothrow
{
printf(" p = %p, size = %zd, parent = %p ", p, size, parent);
if (file)
{
printf("%s(%u)", file, line);
}
printf("\n");
}
}
struct LogArray
{
size_t dim;
size_t allocdim;
Log *data;
void Dtor() nothrow
{
if (data)
cstdlib.free(data);
data = null;
}
void reserve(size_t nentries) nothrow
{
assert(dim <= allocdim);
if (allocdim - dim < nentries)
{
allocdim = (dim + nentries) * 2;
assert(dim + nentries <= allocdim);
if (!data)
{
data = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof);
if (!data && allocdim)
onOutOfMemoryError();
}
else
{ Log *newdata;
newdata = cast(Log*)cstdlib.malloc(allocdim * Log.sizeof);
if (!newdata && allocdim)
onOutOfMemoryError();
memcpy(newdata, data, dim * Log.sizeof);
cstdlib.free(data);
data = newdata;
}
}
}
void push(Log log) nothrow
{
reserve(1);
data[dim++] = log;
}
void remove(size_t i) nothrow
{
memmove(data + i, data + i + 1, (dim - i) * Log.sizeof);
dim--;
}
size_t find(void *p) nothrow
{
for (size_t i = 0; i < dim; i++)
{
if (data[i].p == p)
return i;
}
return OPFAIL; // not found
}
void copy(LogArray *from) nothrow
{
reserve(from.dim - dim);
assert(from.dim <= allocdim);
memcpy(data, from.data, from.dim * Log.sizeof);
dim = from.dim;
}
}
}
/* ============================ GC =============================== */
const uint GCVERSION = 1; // increment every time we change interface
// to GC.
// This just makes Mutex final to de-virtualize member function calls.
final class GCMutex : Mutex
{
// it doesn't make sense to use Exception throwing functions here, because allocating
// the exception will try to lock the mutex again, probably resulting in stack overflow
// instead we use the Error throwing functions
alias lock = lock_nothrow;
alias unlock = unlock_nothrow;
}
class GC
{
// For passing to debug code (not thread safe)
__gshared size_t line;
__gshared char* file;
uint gcversion = GCVERSION;
Gcx *gcx; // implementation
// We can't allocate a Mutex on the GC heap because we are the GC.
// Store it in the static data segment instead.
__gshared GCMutex gcLock; // global lock
__gshared byte[__traits(classInstanceSize, GCMutex)] mutexStorage;
__gshared Config config;
void initialize()
{
config.initialize();
mutexStorage[] = typeid(GCMutex).init[];
gcLock = cast(GCMutex) mutexStorage.ptr;
gcLock.__ctor();
gcx = cast(Gcx*)cstdlib.calloc(1, Gcx.sizeof);
if (!gcx)
onOutOfMemoryError();
gcx.initialize();
if (config.initReserve)
gcx.reserve(config.initReserve << 20);
if (config.disable)
gcx.disabled++;
}
void Dtor()
{
version (linux)
{
//debug(PRINTF) printf("Thread %x ", pthread_self());
//debug(PRINTF) printf("GC.Dtor()\n");
}
if (gcx)
{
gcx.Dtor();
cstdlib.free(gcx);
gcx = null;
}
}
/**
*
*/
void enable()
{
gcLock.lock();
scope(exit) gcLock.unlock();
assert(gcx.disabled > 0);
gcx.disabled--;
}
/**
*
*/
void disable()
{
gcLock.lock();
scope(exit) gcLock.unlock();
gcx.disabled++;
}
/**
*
*/
uint getAttr(void* p) nothrow
{
if (!p)
{
return 0;
}
uint go() nothrow
{
Pool* pool = gcx.findPool(p);
uint oldb = 0;
if (pool)
{
p = sentinel_sub(p);
auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
oldb = gcx.getBits(pool, biti);
}
return oldb;
}
gcLock.lock();
auto rc = go();
gcLock.unlock();
return rc;
}
/**
*
*/
uint setAttr(void* p, uint mask) nothrow
{
if (!p)
{
return 0;
}
uint go() nothrow
{
Pool* pool = gcx.findPool(p);
uint oldb = 0;
if (pool)
{
p = sentinel_sub(p);
auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
oldb = gcx.getBits(pool, biti);
gcx.setBits(pool, biti, mask);
}
return oldb;
}
gcLock.lock();
auto rc = go();
gcLock.unlock();
return rc;
}
/**
*
*/
uint clrAttr(void* p, uint mask) nothrow
{
if (!p)
{
return 0;
}
uint go() nothrow
{
Pool* pool = gcx.findPool(p);
uint oldb = 0;
if (pool)
{
p = sentinel_sub(p);
auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
oldb = gcx.getBits(pool, biti);
gcx.clrBits(pool, biti, mask);
}
return oldb;
}
gcLock.lock();
auto rc = go();
gcLock.unlock();
return rc;
}
/**
*
*/
void *malloc(size_t size, uint bits = 0, size_t *alloc_size = null, const TypeInfo ti = null) nothrow
{
if (!size)
{
if(alloc_size)
*alloc_size = 0;
return null;
}
void* p = void;
size_t localAllocSize = void;
if(alloc_size is null) alloc_size = &localAllocSize;
// Since a finalizer could launch a new thread, we always need to lock
// when collecting. The safest way to do this is to simply always lock
// when allocating.
{
gcLock.lock();
p = mallocNoSync(size, bits, *alloc_size, ti);
gcLock.unlock();
}
if (!(bits & BlkAttr.NO_SCAN))
{
memset(p + size, 0, *alloc_size - size);
}
return p;
}
//
//
//
private void *mallocNoSync(size_t size, uint bits, ref size_t alloc_size, const TypeInfo ti = null) nothrow
{
assert(size != 0);
void *p = null;
Bins bin;
//debug(PRINTF) printf("GC::malloc(size = %d, gcx = %p)\n", size, gcx);
assert(gcx);
//debug(PRINTF) printf("gcx.self = %x, pthread_self() = %x\n", gcx.self, pthread_self());
if (gcx.running)
onInvalidMemoryOperationError();
size += SENTINEL_EXTRA;
bin = gcx.findBin(size);
Pool *pool;
if (bin < B_PAGE)
{
alloc_size = binsize[bin];
int state = gcx.disabled ? 1 : 0;
bool collected = false;
while (!gcx.bucket[bin] && !gcx.allocPage(bin))
{
switch (state)
{
case 0:
auto freedpages = gcx.fullcollect();
collected = true;
if (freedpages < gcx.npools * ((POOLSIZE / PAGESIZE) / 8))
{ /* Didn't free much, so try allocating more anyway.
* Note: freedpages is not the amount of memory freed, it's the amount
* of full pages freed. Perhaps this should instead be the amount of
* memory freed.
*/
gcx.newPool(1,false);
state = 2;
}
else
state = 1;
continue;
case 1:
gcx.newPool(1, false);
state = 2;
continue;
case 2:
if (collected)
onOutOfMemoryError();
state = 0;
continue;
default:
assert(false);
}
}
p = gcx.bucket[bin];
// Return next item from free list
gcx.bucket[bin] = (cast(List*)p).next;
pool = (cast(List*)p).pool;
//debug(PRINTF) printf("\tmalloc => %p\n", p);
debug (MEMSTOMP) memset(p, 0xF0, size);
}
else
{
p = gcx.bigAlloc(size, &pool, alloc_size);
if (!p)
onOutOfMemoryError();
}
debug (SENTINEL)
{
size -= SENTINEL_EXTRA;
p = sentinel_add(p);
sentinel_init(p, size);
alloc_size = size;
}
gcx.log_malloc(p, size);
if (bits)
{
gcx.setBits(pool, cast(size_t)(sentinel_sub(p) - pool.baseAddr) >> pool.shiftBy, bits);
}
return p;
}
/**
*
*/
void *calloc(size_t size, uint bits = 0, size_t *alloc_size = null, const TypeInfo ti = null) nothrow
{
if (!size)
{
if(alloc_size)
*alloc_size = 0;
return null;
}
size_t localAllocSize = void;
void* p = void;
if(alloc_size is null) alloc_size = &localAllocSize;
// Since a finalizer could launch a new thread, we always need to lock
// when collecting. The safest way to do this is to simply always lock
// when allocating.
{
gcLock.lock();
p = mallocNoSync(size, bits, *alloc_size, ti);
gcLock.unlock();
}
memset(p, 0, size);
if (!(bits & BlkAttr.NO_SCAN))
{
memset(p + size, 0, *alloc_size - size);
}
return p;
}
/**
*
*/
void *realloc(void *p, size_t size, uint bits = 0, size_t *alloc_size = null, const TypeInfo ti = null) nothrow
{
size_t localAllocSize = void;
auto oldp = p;
if(alloc_size is null) alloc_size = &localAllocSize;
// Since a finalizer could launch a new thread, we always need to lock
// when collecting. The safest way to do this is to simply always lock
// when allocating.
{
gcLock.lock();
p = reallocNoSync(p, size, bits, *alloc_size, ti);
gcLock.unlock();
}
if (p !is oldp && !(bits & BlkAttr.NO_SCAN))
{
memset(p + size, 0, *alloc_size - size);
}
return p;
}
//
// bits will be set to the resulting bits of the new block
//
private void *reallocNoSync(void *p, size_t size, ref uint bits, ref size_t alloc_size, const TypeInfo ti = null) nothrow
{
if (gcx.running)
onInvalidMemoryOperationError();
if (!size)
{ if (p)
{ freeNoSync(p);
p = null;
}
alloc_size = 0;
}
else if (!p)
{
p = mallocNoSync(size, bits, alloc_size, ti);
}
else
{ void *p2;
size_t psize;
//debug(PRINTF) printf("GC::realloc(p = %p, size = %zu)\n", p, size);
debug (SENTINEL)
{
sentinel_Invariant(p);
psize = *sentinel_size(p);
if (psize != size)
{
if (psize)
{
Pool *pool = gcx.findPool(p);
if (pool)
{
auto biti = cast(size_t)(sentinel_sub(p) - pool.baseAddr) >> pool.shiftBy;
if (bits)
{
gcx.clrBits(pool, biti, ~BlkAttr.NONE);
gcx.setBits(pool, biti, bits);
}
else
{
bits = gcx.getBits(pool, biti);
}
}
}
p2 = mallocNoSync(size, bits, alloc_size, ti);
if (psize < size)
size = psize;
//debug(PRINTF) printf("\tcopying %d bytes\n",size);
memcpy(p2, p, size);
p = p2;
}
}
else
{
auto pool = gcx.findPool(p);
psize = pool.getSize(p); // get allocated size
if (psize >= PAGESIZE && size >= PAGESIZE)
{
auto psz = psize / PAGESIZE;
auto newsz = (size + PAGESIZE - 1) / PAGESIZE;
if (newsz == psz)
return p;
auto pagenum = pool.pagenumOf(p);
if (newsz < psz)
{ // Shrink in place
debug (MEMSTOMP) memset(p + size, 0xF2, psize - size);
pool.freePages(pagenum + newsz, psz - newsz);
}
else if (pagenum + newsz <= pool.npages)
{ // Attempt to expand in place
foreach (binsz; pool.pagetable[pagenum + psz .. pagenum + newsz])
if (binsz != B_FREE) goto Lfallthrough;
debug (MEMSTOMP) memset(p + psize, 0xF0, size - psize);
debug(PRINTF) printFreeInfo(pool);
memset(&pool.pagetable[pagenum + psz], B_PAGEPLUS, newsz - psz);
pool.freepages -= (newsz - psz);
debug(PRINTF) printFreeInfo(pool);
}
else
goto Lfallthrough; // does not fit into current pool
pool.updateOffsets(pagenum);
if (bits)
{
immutable biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
gcx.clrBits(pool, biti, ~BlkAttr.NONE);
gcx.setBits(pool, biti, bits);
}
alloc_size = newsz * PAGESIZE;
return p;
Lfallthrough:
{}
}
if (psize < size || // if new size is bigger
psize > size * 2) // or less than half
{
if (psize && pool)
{
auto biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
if (bits)
{
gcx.clrBits(pool, biti, ~BlkAttr.NONE);
gcx.setBits(pool, biti, bits);
}
else
{
bits = gcx.getBits(pool, biti);
}
}
p2 = mallocNoSync(size, bits, alloc_size, ti);
if (psize < size)
size = psize;
//debug(PRINTF) printf("\tcopying %d bytes\n",size);
memcpy(p2, p, size);
p = p2;
}
else
alloc_size = psize;
}
}
return p;
}
/**
* Attempt to in-place enlarge the memory block pointed to by p by at least
* minbytes beyond its current capacity, up to a maximum of maxsize. This
* does not attempt to move the memory block (like realloc() does).
*
* Returns:
* 0 if could not extend p,
* total size of entire memory block if successful.
*/
size_t extend(void* p, size_t minsize, size_t maxsize, const TypeInfo ti = null) nothrow
{
gcLock.lock();
auto rc = extendNoSync(p, minsize, maxsize, ti);
gcLock.unlock();
return rc;
}
//
//
//
private size_t extendNoSync(void* p, size_t minsize, size_t maxsize, const TypeInfo ti = null) nothrow
in
{
assert(minsize <= maxsize);
}
body
{
if (gcx.running)
onInvalidMemoryOperationError();
//debug(PRINTF) printf("GC::extend(p = %p, minsize = %zu, maxsize = %zu)\n", p, minsize, maxsize);
debug (SENTINEL)
{
return 0;
}
else
{
auto pool = gcx.findPool(p);
if (!pool)
return 0;
auto psize = pool.getSize(p); // get allocated size
if (psize < PAGESIZE)
return 0; // cannot extend buckets
auto psz = psize / PAGESIZE;
auto minsz = (minsize + PAGESIZE - 1) / PAGESIZE;
auto maxsz = (maxsize + PAGESIZE - 1) / PAGESIZE;
auto pagenum = pool.pagenumOf(p);
size_t sz;
for (sz = 0; sz < maxsz; sz++)
{
auto i = pagenum + psz + sz;
if (i == pool.npages)
break;
if (pool.pagetable[i] != B_FREE)
{ if (sz < minsz)
return 0;
break;
}
}
if (sz < minsz)
return 0;
debug (MEMSTOMP) memset(pool.baseAddr + (pagenum + psz) * PAGESIZE, 0xF0, sz * PAGESIZE);
memset(pool.pagetable + pagenum + psz, B_PAGEPLUS, sz);
pool.updateOffsets(pagenum);
pool.freepages -= sz;
return (psz + sz) * PAGESIZE;
}
}
/**
*
*/
size_t reserve(size_t size) nothrow
{
if (!size)
{
return 0;
}
gcLock.lock();
auto rc = reserveNoSync(size);
gcLock.unlock();
return rc;
}
//
//
//
private size_t reserveNoSync(size_t size) nothrow
{
assert(size != 0);
assert(gcx);
if (gcx.running)
onInvalidMemoryOperationError();
return gcx.reserve(size);
}
/**
*
*/
void free(void *p) nothrow
{
if (!p)
{
return;
}
gcLock.lock();
freeNoSync(p);
gcLock.unlock();
}
//
//
//
private void freeNoSync(void *p) nothrow
{
debug(PRINTF) printf("Freeing %p\n", cast(size_t) p);
assert (p);
if (gcx.running)
onInvalidMemoryOperationError();
Pool* pool;
size_t pagenum;
Bins bin;
size_t biti;
// Find which page it is in
pool = gcx.findPool(p);
if (!pool) // if not one of ours
return; // ignore
pagenum = pool.pagenumOf(p);
debug(PRINTF) printf("pool base = %p, PAGENUM = %d of %d, bin = %d\n", pool.baseAddr, pagenum, pool.npages, pool.pagetable[pagenum]);
debug(PRINTF) if(pool.isLargeObject) printf("Block size = %d\n", pool.bPageOffsets[pagenum]);
bin = cast(Bins)pool.pagetable[pagenum];
// Verify that the pointer is at the beginning of a block,
// no action should be taken if p is an interior pointer
if (bin > B_PAGE) // B_PAGEPLUS or B_FREE
return;
if ((sentinel_sub(p) - pool.baseAddr) & (binsize[bin] - 1))
return;
sentinel_Invariant(p);
p = sentinel_sub(p);
biti = cast(size_t)(p - pool.baseAddr) >> pool.shiftBy;
gcx.clrBits(pool, biti, ~BlkAttr.NONE);
if (bin == B_PAGE) // if large alloc
{ size_t npages;
// Free pages
npages = pool.bPageOffsets[pagenum];
debug (MEMSTOMP) memset(p, 0xF2, npages * PAGESIZE);
pool.freePages(pagenum, npages);
}
else
{ // Add to free list
List *list = cast(List*)p;
debug (MEMSTOMP) memset(p, 0xF2, binsize[bin]);
list.next = gcx.bucket[bin];
list.pool = pool;
gcx.bucket[bin] = list;
}
gcx.log_free(sentinel_add(p));
}
/**
* Determine the base address of the block containing p. If p is not a gc
* allocated pointer, return null.
*/
void* addrOf(void *p) nothrow
{
if (!p)
{
return null;
}
gcLock.lock();
auto rc = addrOfNoSync(p);
gcLock.unlock();
return rc;
}
//
//
//
void* addrOfNoSync(void *p) nothrow
{
if (!p)
{
return null;
}
auto q = gcx.findBase(p);
if (q)
q = sentinel_add(q);
return q;
}
/**
* Determine the allocated size of pointer p. If p is an interior pointer
* or not a gc allocated pointer, return 0.
*/
size_t sizeOf(void *p) nothrow
{
if (!p)
{
return 0;
}
gcLock.lock();
auto rc = sizeOfNoSync(p);
gcLock.unlock();
return rc;
}
//
//
//
private size_t sizeOfNoSync(void *p) nothrow
{
assert (p);
debug (SENTINEL)
{
p = sentinel_sub(p);
size_t size = gcx.findSize(p);
// Check for interior pointer
// This depends on:
// 1) size is a power of 2 for less than PAGESIZE values
// 2) base of memory pool is aligned on PAGESIZE boundary
if (cast(size_t)p & (size - 1) & (PAGESIZE - 1))
size = 0;
return size ? size - SENTINEL_EXTRA : 0;
}
else
{
size_t size = gcx.findSize(p);
// Check for interior pointer
// This depends on:
// 1) size is a power of 2 for less than PAGESIZE values
// 2) base of memory pool is aligned on PAGESIZE boundary
if (cast(size_t)p & (size - 1) & (PAGESIZE - 1))
return 0;
return size;
}
}
/**
* Determine the base address of the block containing p. If p is not a gc
* allocated pointer, return null.
*/
BlkInfo query(void *p) nothrow
{
if (!p)
{
BlkInfo i;
return i;
}
gcLock.lock();
auto rc = queryNoSync(p);
gcLock.unlock();
return rc;
}
//
//
//
BlkInfo queryNoSync(void *p) nothrow
{
assert(p);
BlkInfo info = gcx.getInfo(p);
debug(SENTINEL)
{
if (info.base)
{
info.base = sentinel_add(info.base);
info.size = *sentinel_size(info.base);
}
}
return info;
}
/**
* Verify that pointer p:
* 1) belongs to this memory pool
* 2) points to the start of an allocated piece of memory
* 3) is not on a free list
*/
void check(void *p) nothrow
{
if (!p)
{
return;
}
gcLock.lock();
checkNoSync(p);
gcLock.unlock();
}
//
//
//
private void checkNoSync(void *p) nothrow
{
assert(p);
sentinel_Invariant(p);
debug (PTRCHECK)
{
Pool* pool;
size_t pagenum;
Bins bin;
size_t size;
p = sentinel_sub(p);
pool = gcx.findPool(p);
assert(pool);
pagenum = pool.pagenumOf(p);
bin = cast(Bins)pool.pagetable[pagenum];
assert(bin <= B_PAGE);
size = binsize[bin];
assert((cast(size_t)p & (size - 1)) == 0);
debug (PTRCHECK2)
{
if (bin < B_PAGE)
{
// Check that p is not on a free list
List *list;
for (list = gcx.bucket[bin]; list; list = list.next)
{
assert(cast(void*)list != p);
}
}
}
}
}
/**
* add p to list of roots
*/
void addRoot(void *p) nothrow
{
if (!p)
{
return;
}
gcLock.lock();
gcx.addRoot(p);
gcLock.unlock();
}
/**
* remove p from list of roots
*/
void removeRoot(void *p) nothrow
{
if (!p)
{
return;
}
gcLock.lock();
gcx.removeRoot(p);
gcLock.unlock();
}
/**
*
*/
@property auto rootIter()
{
auto iter(scope int delegate(ref Root) nothrow dg)
{
gcLock.lock();
auto res = gcx.roots.opApply(dg);
gcLock.unlock();
return res;
}
return &iter;
}
/**
* add range to scan for roots
*/
void addRange(void *p, size_t sz, const TypeInfo ti = null) nothrow
{
if (!p || !sz)
{
return;
}
//debug(PRINTF) printf("+GC.addRange(p = %p, sz = 0x%zx), p + sz = %p\n", p, sz, p + sz);
gcLock.lock();
gcx.addRange(p, p + sz, ti);
gcLock.unlock();
//debug(PRINTF) printf("-GC.addRange()\n");
}
/**
* remove range
*/
void removeRange(void *p) nothrow
{
if (!p)
{
return;
}
gcLock.lock();
gcx.removeRange(p);
gcLock.unlock();
}
/**
* run finalizers
*/
void runFinalizers(in void[] segment) nothrow
{
gcLock.lock();
gcx.runFinalizers(segment);
gcLock.unlock();
}
/**
*
*/
@property auto rangeIter()
{
auto iter(scope int delegate(ref Range) nothrow dg)
{
gcLock.lock();
auto res = gcx.ranges.opApply(dg);
gcLock.unlock();
return res;
}
return &iter;
}
/**
* Do full garbage collection.
* Return number of pages free'd.
*/
size_t fullCollect() nothrow
{
debug(PRINTF) printf("GC.fullCollect()\n");
size_t result;
// Since a finalizer could launch a new thread, we always need to lock
// when collecting.
{
gcLock.lock();
result = gcx.fullcollect();
gcLock.unlock();
}
version (none)
{
GCStats stats;
getStats(stats);
debug(PRINTF) printf("poolsize = %zx, usedsize = %zx, freelistsize = %zx\n",
stats.poolsize, stats.usedsize, stats.freelistsize);
}
gcx.log_collect();
return result;
}
/**
* do full garbage collection ignoring roots
*/
void fullCollectNoStack() nothrow
{
// Since a finalizer could launch a new thread, we always need to lock
// when collecting.
{
gcLock.lock();
gcx.noStack++;
gcx.fullcollect();
gcx.noStack--;
gcLock.unlock();
}
}
/**
* minimize free space usage
*/
void minimize() nothrow
{
gcLock.lock();
gcx.minimize();
gcLock.unlock();
}
/**
* Retrieve statistics about garbage collection.
* Useful for debugging and tuning.
*/
void getStats(out GCStats stats) nothrow
{
gcLock.lock();
getStatsNoSync(stats);
gcLock.unlock();
}
//
//
//
private void getStatsNoSync(out GCStats stats) nothrow
{
size_t psize = 0;
size_t usize = 0;
size_t flsize = 0;
size_t n;
size_t bsize = 0;
//debug(PRINTF) printf("getStats()\n");
memset(&stats, 0, GCStats.sizeof);
for (n = 0; n < gcx.npools; n++)
{ Pool *pool = gcx.pooltable[n];
psize += pool.npages * PAGESIZE;
for (size_t j = 0; j < pool.npages; j++)
{
Bins bin = cast(Bins)pool.pagetable[j];
if (bin == B_FREE)
stats.freeblocks++;
else if (bin == B_PAGE)
stats.pageblocks++;
else if (bin < B_PAGE)
bsize += PAGESIZE;
}
}
for (n = 0; n < B_PAGE; n++)
{
//debug(PRINTF) printf("bin %d\n", n);
for (List *list = gcx.bucket[n]; list; list = list.next)
{
//debug(PRINTF) printf("\tlist %p\n", list);
flsize += binsize[n];
}
}
usize = bsize - flsize;
stats.poolsize = psize;
stats.usedsize = bsize - flsize;
stats.freelistsize = flsize;
}
}
/* ============================ Gcx =============================== */
enum
{ PAGESIZE = 4096,
POOLSIZE = (4096*256),
}
enum
{
B_16,
B_32,
B_64,
B_128,
B_256,
B_512,
B_1024,
B_2048,
B_PAGE, // start of large alloc
B_PAGEPLUS, // continuation of large alloc
B_FREE, // free page
B_MAX
}
alias ubyte Bins;
struct List
{
List *next;
Pool *pool;
}
struct Range
{
void *pbot;
void *ptop;
alias pbot this; // only consider pbot for relative ordering (opCmp)
}
struct Root
{
void *proot;
alias proot this;
}
immutable uint[B_MAX] binsize = [ 16,32,64,128,256,512,1024,2048,4096 ];
immutable size_t[B_MAX] notbinsize = [ ~(16-1),~(32-1),~(64-1),~(128-1),~(256-1),
~(512-1),~(1024-1),~(2048-1),~(4096-1) ];
/* ============================ Gcx =============================== */
struct Gcx
{
static if (USE_CACHE){
byte *cached_pool_topAddr;
byte *cached_pool_baseAddr;
Pool *cached_pool;
debug (CACHE_HITRATE)
{
ulong cached_pool_queries;
ulong cached_pool_hits;
}
}
Treap!Root roots;
Treap!Range ranges;
uint noStack; // !=0 means don't scan stack
uint log; // turn on logging
uint anychanges;
uint inited;
uint running;
int disabled; // turn off collections if >0
byte *minAddr; // min(baseAddr)
byte *maxAddr; // max(topAddr)
size_t npools;
Pool **pooltable;
List*[B_MAX]bucket; // free list for each size
void initialize()
{ int dummy;
(cast(byte*)&this)[0 .. Gcx.sizeof] = 0;
log_init();
roots.initialize();
ranges.initialize();
//printf("gcx = %p, self = %x\n", &this, self);
inited = 1;
}
void Dtor()
{
if (GC.config.profile)
{
printf("\tTotal GC prep time: %lld milliseconds\n",
prepTime.total!("msecs"));
printf("\tTotal mark time: %lld milliseconds\n",
markTime.total!("msecs"));
printf("\tTotal sweep time: %lld milliseconds\n",
sweepTime.total!("msecs"));
printf("\tTotal page recovery time: %lld milliseconds\n",
recoverTime.total!("msecs"));
long gcTime = (recoverTime + sweepTime + markTime + prepTime).total!("msecs");
printf("\tGrand total GC time: %lld milliseconds\n", gcTime);
long pauseTime = (markTime + prepTime).total!("msecs");
printf("maxPoolMemory = %lld MB, pause time = %lld ms\n",
cast(long) maxPoolMemory >> 20, pauseTime);
}
debug(CACHE_HITRATE)
{
printf("\tGcx.Pool Cache hits: %llu\tqueries: %llu\n",cached_pool_hits,cached_pool_queries);
}
inited = 0;
for (size_t i = 0; i < npools; i++)
{ Pool *pool = pooltable[i];
pool.Dtor();
cstdlib.free(pool);
}
if (pooltable)
{
cstdlib.free(pooltable);
pooltable = null;
}
roots.removeAll();
ranges.removeAll();
}
void Invariant() const { }
debug(INVARIANT)
invariant()
{
if (inited)
{
//printf("Gcx.invariant(): this = %p\n", &this);
for (size_t i = 0; i < npools; i++)
{ auto pool = pooltable[i];
pool.Invariant();
if (i == 0)
{
assert(minAddr == pool.baseAddr);
}
if (i + 1 < npools)
{
assert(pool.opCmp(pooltable[i + 1]) < 0);
}
else if (i + 1 == npools)
{
assert(maxAddr == pool.topAddr);
}
}
foreach (range; ranges)
{
assert(range.pbot);
assert(range.ptop);
assert(range.pbot <= range.ptop);
}
for (size_t i = 0; i < B_PAGE; i++)
{
for (auto list = cast(List*)bucket[i]; list; list = list.next)
{
}
}
}
}
/**
*
*/
void addRoot(void *p) nothrow
{
roots.insert(Root(p));
}
/**
*
*/
void removeRoot(void *p) nothrow
{
roots.remove(Root(p));
}
/**
*
*/
void addRange(void *pbot, void *ptop, const TypeInfo ti) nothrow
{
//debug(PRINTF) printf("Thread %x ", pthread_self());
debug(PRINTF) printf("%p.Gcx::addRange(%p, %p)\n", &this, pbot, ptop);
ranges.insert(Range(pbot, ptop));
}
/**
*
*/
void removeRange(void *pbot) nothrow
{
//debug(PRINTF) printf("Thread %x ", pthread_self());
debug(PRINTF) printf("Gcx.removeRange(%p)\n", pbot);
ranges.remove(Range(pbot, pbot)); // only pbot is used, see Range.opCmp
// debug(PRINTF) printf("Wrong thread\n");
// This is a fatal error, but ignore it.
// The problem is that we can get a Close() call on a thread
// other than the one the range was allocated on.
//assert(zero);
}
/**
*
*/
void runFinalizers(in void[] segment) nothrow
{
foreach (pool; pooltable[0 .. npools])
{
if (!pool.finals.nbits) continue;
if (pool.isLargeObject)
{
foreach (ref pn; 0 .. pool.npages)
{
Bins bin = cast(Bins)pool.pagetable[pn];
if (bin > B_PAGE) continue;
size_t biti = pn;
auto p = pool.baseAddr + pn * PAGESIZE;
if (!pool.finals.test(biti) ||
!rt_hasFinalizerInSegment(sentinel_add(p), segment))
continue;
rt_finalize2(sentinel_add(p), false, false);
clrBits(pool, biti, ~BlkAttr.NONE);
if (pn < pool.searchStart) pool.searchStart = pn;
debug(COLLECT_PRINTF) printf("\tcollecting big %p\n", p);
log_free(sentinel_add(p));
size_t n = 1;
for (; pn + n < pool.npages; ++n)
if (pool.pagetable[pn + n] != B_PAGEPLUS) break;
debug (MEMSTOMP) memset(pool.baseAddr + pn * PAGESIZE, 0xF3, n * PAGESIZE);
pool.freePages(pn, n);
}
}
else
{
foreach (ref pn; 0 .. pool.npages)
{
Bins bin = cast(Bins)pool.pagetable[pn];
if (bin >= B_PAGE) continue;
immutable size = binsize[bin];
auto p = pool.baseAddr + pn * PAGESIZE;
const ptop = p + PAGESIZE;
auto biti = pn * (PAGESIZE/16);
immutable bitstride = size / 16;
GCBits.wordtype toClear;
size_t clearStart = (biti >> GCBits.BITS_SHIFT) + 1;
size_t clearIndex;
for (; p < ptop; p += size, biti += bitstride, clearIndex += bitstride)
{
if (clearIndex > GCBits.BITS_PER_WORD - 1)
{
if (toClear)
{
Gcx.clrBitsSmallSweep(pool, clearStart, toClear);
toClear = 0;
}
clearStart = (biti >> GCBits.BITS_SHIFT) + 1;
clearIndex = biti & GCBits.BITS_MASK;
}
if (!pool.finals.test(biti) ||
!rt_hasFinalizerInSegment(sentinel_add(p), segment))
continue;
rt_finalize2(sentinel_add(p), false, false);
toClear |= GCBits.BITS_1 << clearIndex;
debug(COLLECT_PRINTF) printf("\tcollecting %p\n", p);
log_free(sentinel_add(p));
debug (MEMSTOMP) memset(p, 0xF3, size);
pool.freebits.set(biti);
}
if (toClear)
{
Gcx.clrBitsSmallSweep(pool, clearStart, toClear);
}
}
}
}
}
/**
* Find Pool that pointer is in.
* Return null if not in a Pool.
* Assume pooltable[] is sorted.
*/
Pool *findPool(bool bypassCache = !USE_CACHE)(void *p) nothrow
{
static if (!bypassCache && USE_CACHE)
{
debug (CACHE_HITRATE) cached_pool_queries++;
if (p < cached_pool_topAddr
&& p >= cached_pool_baseAddr)
{
debug (CACHE_HITRATE) cached_pool_hits++;
return cached_pool;
}
}
if (p >= minAddr && p < maxAddr)
{
if (npools <= 1)
{
return npools == 0 ? null : pooltable[0];
}
/* The pooltable[] is sorted by address, so do a binary search
*/
auto pt = pooltable;
size_t low = 0;
size_t high = npools - 1;
while (low <= high)
{
size_t mid = (low + high) >> 1;
auto pool = pt[mid];
if (p < pool.baseAddr)
high = mid - 1;
else if (p >= pool.topAddr)
low = mid + 1;
else
{
static if (!bypassCache && USE_CACHE)
{
cached_pool_topAddr = pool.topAddr;
cached_pool_baseAddr = pool.baseAddr;
cached_pool = pool;
}
return pool;
}
}
}
return null;
}
/**
* Find base address of block containing pointer p.
* Returns null if not a gc'd pointer
*/
void* findBase(void *p) nothrow
{
Pool *pool;
pool = findPool(p);
if (pool)
{
size_t offset = cast(size_t)(p - pool.baseAddr);
size_t pn = offset / PAGESIZE;
Bins bin = cast(Bins)pool.pagetable[pn];
// Adjust bit to be at start of allocated memory block
if (bin <= B_PAGE)
{
return pool.baseAddr + (offset & notbinsize[bin]);
}
else if (bin == B_PAGEPLUS)
{
auto pageOffset = pool.bPageOffsets[pn];
offset -= pageOffset * PAGESIZE;
pn -= pageOffset;
return pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1)));
}
else
{
// we are in a B_FREE page
assert(bin == B_FREE);
return null;
}
}
return null;
}
/**
* Find size of pointer p.
* Returns 0 if not a gc'd pointer
*/
size_t findSize(void *p) nothrow
{
Pool* pool = findPool(p);
if (pool)
return pool.getSize(p);
return 0;
}
/**
*
*/
BlkInfo getInfo(void* p) nothrow
{
Pool* pool;
BlkInfo info;
pool = findPool(p);
if (pool)
{
size_t offset = cast(size_t)(p - pool.baseAddr);
size_t pn = offset / PAGESIZE;
Bins bin = cast(Bins)pool.pagetable[pn];
////////////////////////////////////////////////////////////////////
// findAddr
////////////////////////////////////////////////////////////////////
if (bin <= B_PAGE)
{
info.base = cast(void*)((cast(size_t)p) & notbinsize[bin]);
}
else if (bin == B_PAGEPLUS)
{
auto pageOffset = pool.bPageOffsets[pn];
offset = pageOffset * PAGESIZE;
pn -= pageOffset;
info.base = pool.baseAddr + (offset & (offset.max ^ (PAGESIZE-1)));
// fix bin for use by size calc below
bin = cast(Bins)pool.pagetable[pn];
}
////////////////////////////////////////////////////////////////////
// findSize
////////////////////////////////////////////////////////////////////
info.size = binsize[bin];
if (bin == B_PAGE)
{
info.size = pool.bPageOffsets[pn] * PAGESIZE;
}
////////////////////////////////////////////////////////////////////
// getBits
////////////////////////////////////////////////////////////////////
// reset the offset to the base pointer, otherwise the bits
// are the bits for the pointer, which may be garbage
offset = cast(size_t)(info.base - pool.baseAddr);
info.attr = getBits(pool, cast(size_t)(offset >> pool.shiftBy));
}
return info;
}
void resetPoolCache() nothrow
{
static if (USE_CACHE){
cached_pool_topAddr = cached_pool_topAddr.init;
cached_pool_baseAddr = cached_pool_baseAddr.init;
cached_pool = cached_pool.init;
}
}
/**
* Compute bin for size.
*/
static Bins findBin(size_t size) nothrow
{
static const byte[2049] binTable = ctfeBins();
return (size <= 2048) ?
(cast(Bins) binTable[size]) :
B_PAGE;
}
static Bins findBinImpl(size_t size) nothrow
{ Bins bin;
if (size <= 256)
{
if (size <= 64)
{
if (size <= 16)
bin = B_16;
else if (size <= 32)
bin = B_32;
else
bin = B_64;
}
else
{
if (size <= 128)
bin = B_128;
else
bin = B_256;
}
}
else
{
if (size <= 1024)
{
if (size <= 512)
bin = B_512;
else
bin = B_1024;
}
else
{
if (size <= 2048)
bin = B_2048;
else
bin = B_PAGE;
}
}
return bin;
}
/**
* Computes the bin table using CTFE.
*/
static byte[2049] ctfeBins() nothrow
{
byte[2049] ret;
for(size_t i = 0; i < 2049; i++)
{
ret[i] = cast(byte) findBinImpl(i);
}
return ret;
}
/**
* Allocate a new pool of at least size bytes.
* Sort it into pooltable[].
* Mark all memory in the pool as B_FREE.
* Return the actual number of bytes reserved or 0 on error.
*/
size_t reserve(size_t size) nothrow
{
size_t npages = (size + PAGESIZE - 1) / PAGESIZE;
// Assume reserve() is for small objects.
Pool* pool = newPool(npages, false);
if (!pool)
return 0;
return pool.npages * PAGESIZE;
}
/**
* Minimizes physical memory usage by returning free pools to the OS.
*/
void minimize() nothrow
{
debug(PRINTF) printf("Minimizing.\n");
static bool isUsed(Pool *pool) nothrow
{
return pool.freepages < pool.npages;
}
// semi-stable partition
for (size_t i = 0; i < npools; ++i)
{
auto pool = pooltable[i];
// find first unused pool
if (isUsed(pool)) continue;
// move used pools before unused ones
size_t j = i + 1;
for (; j < npools; ++j)
{
pool = pooltable[j];
if (!isUsed(pool)) continue;
// swap
pooltable[j] = pooltable[i];
pooltable[i] = pool;
++i;
}
// npooltable[0 .. i] => used
// npooltable[i .. npools] => free
// free unused pools
for (j = i; j < npools; ++j)
{
pool = pooltable[j];
debug(PRINTF) printFreeInfo(pool);
pool.Dtor();
cstdlib.free(pool);
}
npools = i;
}
if (npools)
{
minAddr = pooltable[0].baseAddr;
maxAddr = pooltable[npools - 1].topAddr;
}
else
{
minAddr = maxAddr = null;
}
static if (USE_CACHE){
resetPoolCache();
}
debug(PRINTF) printf("Done minimizing.\n");
}
unittest
{
enum NPOOLS = 6;
enum NPAGES = 10;
Gcx gcx;
void reset()
{
foreach(i, ref pool; gcx.pooltable[0 .. gcx.npools])
pool.freepages = pool.npages;
gcx.minimize();
assert(gcx.npools == 0);
if (gcx.pooltable is null)
gcx.pooltable = cast(Pool**)cstdlib.malloc(NPOOLS * (Pool*).sizeof);
foreach(i; 0 .. NPOOLS)
{
auto pool = cast(Pool*)cstdlib.malloc(Pool.sizeof);
*pool = Pool.init;
gcx.pooltable[i] = pool;
}
gcx.npools = NPOOLS;
}
void usePools()
{
foreach(pool; gcx.pooltable[0 .. NPOOLS])
{
pool.pagetable = cast(ubyte*)cstdlib.malloc(NPAGES);
memset(pool.pagetable, B_FREE, NPAGES);
pool.npages = NPAGES;
pool.freepages = NPAGES / 2;
}
}
// all pools are free
reset();
assert(gcx.npools == NPOOLS);
gcx.minimize();
assert(gcx.npools == 0);
// all pools used
reset();
usePools();
assert(gcx.npools == NPOOLS);
gcx.minimize();
assert(gcx.npools == NPOOLS);
// preserves order of used pools
reset();
usePools();
{
Pool*[NPOOLS] opools = gcx.pooltable[0 .. NPOOLS];
gcx.pooltable[2].freepages = NPAGES;
gcx.minimize();
assert(gcx.npools == NPOOLS - 1);
assert(gcx.pooltable[0] == opools[0]);
assert(gcx.pooltable[1] == opools[1]);
assert(gcx.pooltable[2] == opools[3]);
}
// gcx reduces address span
reset();
usePools();
byte* base, top;
{
byte*[NPOOLS] mem = void;
foreach(i; 0 .. NPOOLS)
mem[i] = cast(byte*)os_mem_map(NPAGES * PAGESIZE);
extern(C) static int compare(in void* p1, in void *p2)
{
return p1 < p2 ? -1 : cast(int)(p2 > p1);
}
cstdlib.qsort(mem.ptr, mem.length, (byte*).sizeof, &compare);
foreach(i, pool; gcx.pooltable[0 .. NPOOLS])
{
pool.baseAddr = mem[i];
pool.topAddr = pool.baseAddr + NPAGES * PAGESIZE;
}
base = gcx.pooltable[0].baseAddr;
top = gcx.pooltable[NPOOLS - 1].topAddr;
}
gcx.minimize();
assert(gcx.npools == NPOOLS);
assert(gcx.minAddr == base);
assert(gcx.maxAddr == top);
gcx.pooltable[NPOOLS - 1].freepages = NPAGES;
gcx.pooltable[NPOOLS - 2].freepages = NPAGES;
gcx.minimize();
assert(gcx.npools == NPOOLS - 2);
assert(gcx.minAddr == base);
assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 3].topAddr);
gcx.pooltable[0].freepages = NPAGES;
gcx.minimize();
assert(gcx.npools == NPOOLS - 3);
assert(gcx.minAddr != base);
assert(gcx.minAddr == gcx.pooltable[0].baseAddr);
assert(gcx.maxAddr == gcx.pooltable[NPOOLS - 4].topAddr);
// free all
foreach(pool; gcx.pooltable[0 .. gcx.npools])
pool.freepages = NPAGES;
gcx.minimize();
assert(gcx.npools == 0);
cstdlib.free(gcx.pooltable);
gcx.pooltable = null;
}
/**
* Allocate a chunk of memory that is larger than a page.
* Return null if out of memory.
*/
void *bigAlloc(size_t size, Pool **poolPtr, ref size_t alloc_size) nothrow
{
debug(PRINTF) printf("In bigAlloc. Size: %d\n", size);
Pool* pool;
size_t npages;
size_t n;
size_t pn;
size_t freedpages;
void* p;
int state;
bool collected = false;
npages = (size + PAGESIZE - 1) / PAGESIZE;
for (state = disabled ? 1 : 0; ; )
{
// This code could use some refinement when repeatedly
// allocating very large arrays.
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
if(!pool.isLargeObject || pool.freepages < npages) continue;
pn = pool.allocPages(npages);
if (pn != OPFAIL)
goto L1;
}
// Failed
switch (state)
{
case 0:
// Try collecting
collected = true;
freedpages = fullcollect();
if (freedpages >= npools * ((POOLSIZE / PAGESIZE) / 4))
{ state = 1;
continue;
}
// Release empty pools to prevent bloat
minimize();
// Allocate new pool
pool = newPool(npages, true);
if (!pool)
{ state = 2;
continue;
}
pn = pool.allocPages(npages);
assert(pn != OPFAIL);
goto L1;
case 1:
// Release empty pools to prevent bloat
minimize();
// Allocate new pool
pool = newPool(npages, true);
if (!pool)
{
if (collected)
goto Lnomemory;
state = 0;
continue;
}
pn = pool.allocPages(npages);
assert(pn != OPFAIL);
goto L1;
case 2:
goto Lnomemory;
default:
assert(false);
}
}
L1:
debug(PRINTF) printFreeInfo(pool);
pool.pagetable[pn] = B_PAGE;
if (npages > 1)
memset(&pool.pagetable[pn + 1], B_PAGEPLUS, npages - 1);
pool.updateOffsets(pn);
pool.freepages -= npages;
debug(PRINTF) printFreeInfo(pool);
p = pool.baseAddr + pn * PAGESIZE;
debug(PRINTF) printf("Got large alloc: %p, pt = %d, np = %d\n", p, pool.pagetable[pn], npages);
debug (MEMSTOMP) memset(p, 0xF1, size);
alloc_size = npages * PAGESIZE;
//debug(PRINTF) printf("\tp = %p\n", p);
*poolPtr = pool;
return p;
Lnomemory:
return null; // let caller handle the error
}
/**
* Allocate a new pool with at least npages in it.
* Sort it into pooltable[].
* Return null if failed.
*/
Pool *newPool(size_t npages, bool isLargeObject) nothrow
{
Pool* pool;
Pool** newpooltable;
size_t newnpools;
size_t i;
//debug(PRINTF) printf("************Gcx::newPool(npages = %d)****************\n", npages);
// Minimum of POOLSIZE
size_t minPages = (GC.config.minPoolSize << 20) / PAGESIZE;
if (npages < minPages)
npages = minPages;
else if (npages > minPages)
{ // Give us 150% of requested size, so there's room to extend
auto n = npages + (npages >> 1);
if (n < size_t.max/PAGESIZE)
npages = n;
}
// Allocate successively larger pools up to 8 megs
if (npools)
{ size_t n;
n = GC.config.minPoolSize + GC.config.incPoolSize * npools;
if (n > GC.config.maxPoolSize)
n = GC.config.maxPoolSize; // cap pool size
n *= (1 << 20) / PAGESIZE; // convert MB to pages
if (npages < n)
npages = n;
}
//printf("npages = %d\n", npages);
pool = cast(Pool *)cstdlib.calloc(1, Pool.sizeof);
if (pool)
{
pool.initialize(npages, isLargeObject);
if (!pool.baseAddr)
goto Lerr;
newnpools = npools + 1;
newpooltable = cast(Pool **)cstdlib.realloc(pooltable, newnpools * (Pool *).sizeof);
if (!newpooltable)
goto Lerr;
// Sort pool into newpooltable[]
for (i = 0; i < npools; i++)
{
if (pool.opCmp(newpooltable[i]) < 0)
break;
}
memmove(newpooltable + i + 1, newpooltable + i, (npools - i) * (Pool *).sizeof);
newpooltable[i] = pool;
pooltable = newpooltable;
npools = newnpools;
minAddr = pooltable[0].baseAddr;
maxAddr = pooltable[npools - 1].topAddr;
}
if (GC.config.profile)
{
size_t gcmem = 0;
for(i = 0; i < npools; i++)
gcmem += pooltable[i].topAddr - pooltable[i].baseAddr;
if(gcmem > maxPoolMemory)
maxPoolMemory = gcmem;
}
return pool;
Lerr:
pool.Dtor();
cstdlib.free(pool);
return null;
}
/**
* Allocate a page of bin's.
* Returns:
* 0 failed
*/
int allocPage(Bins bin) nothrow
{
Pool* pool;
size_t n;
size_t pn;
byte* p;
byte* ptop;
//debug(PRINTF) printf("Gcx::allocPage(bin = %d)\n", bin);
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
if(pool.isLargeObject) continue;
pn = pool.allocPages(1);
if (pn != OPFAIL)
goto L1;
}
return 0; // failed
L1:
pool.pagetable[pn] = cast(ubyte)bin;
pool.freepages--;
// Convert page to free list
size_t size = binsize[bin];
List **b = &bucket[bin];
p = pool.baseAddr + pn * PAGESIZE;
ptop = p + PAGESIZE;
for (; p < ptop; p += size)
{
(cast(List *)p).next = *b;
(cast(List *)p).pool = pool;
*b = cast(List *)p;
}
return 1;
}
/**
* Mark overload for initial mark() call.
*/
void mark(void *pbot, void *ptop) nothrow
{
mark(pbot, ptop, MAX_MARK_RECURSIONS);
}
/**
* Search a range of memory values and mark any pointers into the GC pool.
*/
void mark(void *pbot, void *ptop, int nRecurse) nothrow
{
//import core.stdc.stdio;printf("nRecurse = %d\n", nRecurse);
void **p1 = cast(void **)pbot;
void **p2 = cast(void **)ptop;
size_t pcache = 0;
uint changes = 0;
//printf("marking range: %p -> %p\n", pbot, ptop);
for (; p1 < p2; p1++)
{
auto p = cast(byte *)(*p1);
//if (log) debug(PRINTF) printf("\tmark %p\n", p);
if (p >= minAddr && p < maxAddr)
{
if ((cast(size_t)p & ~cast(size_t)(PAGESIZE-1)) == pcache)
continue;
auto pool = findPool!true(p);
if (pool)
{
size_t offset = cast(size_t)(p - pool.baseAddr);
size_t biti = void;
size_t pn = offset / PAGESIZE;
Bins bin = cast(Bins)pool.pagetable[pn];
void* base = void;
// For the NO_INTERIOR attribute. This tracks whether
// the pointer is an interior pointer or points to the
// base address of a block.
bool pointsToBase = false;
//debug(PRINTF) printf("\t\tfound pool %p, base=%p, pn = %zd, bin = %d, biti = x%x\n", pool, pool.baseAddr, pn, bin, biti);
// Adjust bit to be at start of allocated memory block
if (bin < B_PAGE)
{
// We don't care abou setting pointsToBase correctly
// because it's ignored for small object pools anyhow.
auto offsetBase = offset & notbinsize[bin];
biti = offsetBase >> pool.shiftBy;
base = pool.baseAddr + offsetBase;
//debug(PRINTF) printf("\t\tbiti = x%x\n", biti);
}
else if (bin == B_PAGE)
{
auto offsetBase = offset & notbinsize[bin];
base = pool.baseAddr + offsetBase;
pointsToBase = (base == sentinel_sub(p));
biti = offsetBase >> pool.shiftBy;
//debug(PRINTF) printf("\t\tbiti = x%x\n", biti);
pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1);
}
else if (bin == B_PAGEPLUS)
{
pn -= pool.bPageOffsets[pn];
base = pool.baseAddr + (pn * PAGESIZE);
biti = pn * (PAGESIZE >> pool.shiftBy);
pcache = cast(size_t)p & ~cast(size_t)(PAGESIZE-1);
}
else
{
// Don't mark bits in B_FREE pages
assert(bin == B_FREE);
continue;
}
if(pool.nointerior.nbits && !pointsToBase && pool.nointerior.test(biti))
{
continue;
}
//debug(PRINTF) printf("\t\tmark(x%x) = %d\n", biti, pool.mark.test(biti));
if (!pool.mark.testSet(biti))
{
//if (log) debug(PRINTF) printf("\t\tmarking %p\n", p);
if (!pool.noscan.test(biti))
{
if(nRecurse == 0) {
// Then we've got a really deep heap graph.
// Start marking stuff to be scanned when we
// traverse the heap again next time, to save
// stack space.
pool.scan.set(biti);
changes = 1;
pool.newChanges = true;
} else {
// Directly recurse mark() to prevent having
// to traverse the heap O(D) times where D
// is the max depth of the heap graph.
if (bin < B_PAGE)
{
mark(base, base + binsize[bin], nRecurse - 1);
}
else
{
auto u = pool.bPageOffsets[pn];
mark(base, base + u * PAGESIZE, nRecurse - 1);
}
}
}
debug (LOGGING) log_parent(sentinel_add(pool.baseAddr + (biti << pool.shiftBy)), sentinel_add(pbot));
}
}
}
}
anychanges |= changes;
}
/**
* Return number of full pages free'd.
*/
size_t fullcollect() nothrow
{
size_t n;
Pool* pool;
MonoTime start, stop;
if (GC.config.profile)
{
start = currTime();
}
debug(COLLECT_PRINTF) printf("Gcx.fullcollect()\n");
//printf("\tpool address range = %p .. %p\n", minAddr, maxAddr);
if (running)
onInvalidMemoryOperationError();
running = 1;
thread_suspendAll();
anychanges = 0;
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
pool.mark.zero();
pool.scan.zero();
if(!pool.isLargeObject) pool.freebits.zero();
}
debug(COLLECT_PRINTF) printf("Set bits\n");
// Mark each free entry, so it doesn't get scanned
for (n = 0; n < B_PAGE; n++)
{
for (List *list = bucket[n]; list; list = list.next)
{
pool = list.pool;
assert(pool);
pool.freebits.set(cast(size_t)(cast(byte*)list - pool.baseAddr) / 16);
}
}
debug(COLLECT_PRINTF) printf("Marked free entries.\n");
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
pool.newChanges = false; // Some of these get set to true on stack scan.
if(!pool.isLargeObject)
{
pool.mark.copy(&pool.freebits);
}
}
if (GC.config.profile)
{
stop = currTime();
prepTime += (stop - start);
start = stop;
}
if (!noStack)
{
debug(COLLECT_PRINTF) printf("\tscan stacks.\n");
// Scan stacks and registers for each paused thread
thread_scanAll(&mark);
}
// Scan roots[]
debug(COLLECT_PRINTF) printf("\tscan roots[]\n");
foreach (root; roots)
{
mark(cast(void*)&root.proot, cast(void*)(&root.proot + 1));
}
// Scan ranges[]
debug(COLLECT_PRINTF) printf("\tscan ranges[]\n");
//log++;
foreach (range; ranges)
{
debug(COLLECT_PRINTF) printf("\t\t%p .. %p\n", range.pbot, range.ptop);
mark(range.pbot, range.ptop);
}
//log--;
debug(COLLECT_PRINTF) printf("\tscan heap\n");
int nTraversals;
while (anychanges)
{
//import core.stdc.stdio; printf("nTraversals = %d\n", ++nTraversals);
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
pool.oldChanges = pool.newChanges;
pool.newChanges = false;
}
debug(COLLECT_PRINTF) printf("\t\tpass\n");
anychanges = 0;
for (n = 0; n < npools; n++)
{
pool = pooltable[n];
if(!pool.oldChanges) continue;
auto shiftBy = pool.shiftBy;
auto bbase = pool.scan.base();
auto btop = bbase + pool.scan.nwords;
//printf("\t\tn = %d, bbase = %p, btop = %p\n", n, bbase, btop);
for (auto b = bbase; b < btop;)
{
auto bitm = *b;
if (!bitm)
{ b++;
continue;
}
*b = 0;
auto o = pool.baseAddr + (b - bbase) * ((typeof(bitm).sizeof*8) << shiftBy);
auto firstset = bsf(bitm);
bitm >>= firstset;
o += firstset << shiftBy;
while(bitm)
{
auto pn = cast(size_t)(o - pool.baseAddr) / PAGESIZE;
auto bin = cast(Bins)pool.pagetable[pn];
if (bin < B_PAGE)
{
mark(o, o + binsize[bin]);
}
else if (bin == B_PAGE)
{
auto u = pool.bPageOffsets[pn];
mark(o, o + u * PAGESIZE);
}
bitm >>= 1;
auto nbits = bsf(bitm);
bitm >>= nbits;
o += (nbits + 1) << shiftBy;
}
}
}
}
thread_processGCMarks(&isMarked);
thread_resumeAll();
if (GC.config.profile)
{
stop = currTime();
markTime += (stop - start);
start = stop;
}
// Free up everything not marked
debug(COLLECT_PRINTF) printf("\tfree'ing\n");
size_t freedpages = 0;
size_t freed = 0;
for (n = 0; n < npools; n++)
{ size_t pn;
pool = pooltable[n];
if(pool.isLargeObject)
{
for(pn = 0; pn < pool.npages; pn++)
{
Bins bin = cast(Bins)pool.pagetable[pn];
if(bin > B_PAGE) continue;
size_t biti = pn;
if (!pool.mark.test(biti))
{ byte *p = pool.baseAddr + pn * PAGESIZE;
sentinel_Invariant(sentinel_add(p));
if (pool.finals.nbits && pool.finals.testClear(biti))
rt_finalize2(sentinel_add(p), false, false);
clrBits(pool, biti, ~BlkAttr.NONE ^ BlkAttr.FINALIZE);
debug(COLLECT_PRINTF) printf("\tcollecting big %p\n", p);
log_free(sentinel_add(p));
pool.pagetable[pn] = B_FREE;
if(pn < pool.searchStart) pool.searchStart = pn;
freedpages++;
pool.freepages++;
debug (MEMSTOMP) memset(p, 0xF3, PAGESIZE);
while (pn + 1 < pool.npages && pool.pagetable[pn + 1] == B_PAGEPLUS)
{
pn++;
pool.pagetable[pn] = B_FREE;
// Don't need to update searchStart here because
// pn is guaranteed to be greater than last time
// we updated it.
pool.freepages++;
freedpages++;
debug (MEMSTOMP)
{ p += PAGESIZE;
memset(p, 0xF3, PAGESIZE);
}
}
}
}
}
else
{
for (pn = 0; pn < pool.npages; pn++)
{
Bins bin = cast(Bins)pool.pagetable[pn];
if (bin < B_PAGE)
{
auto size = binsize[bin];
byte *p = pool.baseAddr + pn * PAGESIZE;
byte *ptop = p + PAGESIZE;
size_t biti = pn * (PAGESIZE/16);
size_t bitstride = size / 16;
GCBits.wordtype toClear;
size_t clearStart = (biti >> GCBits.BITS_SHIFT) + 1;
size_t clearIndex;
for (; p < ptop; p += size, biti += bitstride, clearIndex += bitstride)
{
if(clearIndex > GCBits.BITS_PER_WORD - 1)
{
if(toClear)
{
Gcx.clrBitsSmallSweep(pool, clearStart, toClear);
toClear = 0;
}
clearStart = (biti >> GCBits.BITS_SHIFT) + 1;
clearIndex = biti & GCBits.BITS_MASK;
}
if (!pool.mark.test(biti))
{
sentinel_Invariant(sentinel_add(p));
pool.freebits.set(biti);
if (pool.finals.nbits && pool.finals.test(biti))
rt_finalize2(sentinel_add(p), false, false);
toClear |= GCBits.BITS_1 << clearIndex;
List *list = cast(List *)p;
debug(COLLECT_PRINTF) printf("\tcollecting %p\n", list);
log_free(sentinel_add(list));
debug (MEMSTOMP) memset(p, 0xF3, size);
freed += size;
}
}
if(toClear)
{
Gcx.clrBitsSmallSweep(pool, clearStart, toClear);
}
}
}
}
}
if (GC.config.profile)
{
stop = currTime();
sweepTime += (stop - start);
start = stop;
}
// Zero buckets
bucket[] = null;
// Free complete pages, rebuild free list
debug(COLLECT_PRINTF) printf("\tfree complete pages\n");
size_t recoveredpages = 0;
for (n = 0; n < npools; n++)
{ size_t pn;
pool = pooltable[n];
if(pool.isLargeObject) continue;
for (pn = 0; pn < pool.npages; pn++)
{
Bins bin = cast(Bins)pool.pagetable[pn];
size_t biti;
size_t u;
if (bin < B_PAGE)
{
size_t size = binsize[bin];
size_t bitstride = size / 16;
size_t bitbase = pn * (PAGESIZE / 16);
size_t bittop = bitbase + (PAGESIZE / 16);
byte* p;
biti = bitbase;
for (biti = bitbase; biti < bittop; biti += bitstride)
{ if (!pool.freebits.test(biti))
goto Lnotfree;
}
pool.pagetable[pn] = B_FREE;
if(pn < pool.searchStart) pool.searchStart = pn;
pool.freepages++;
recoveredpages++;
continue;
Lnotfree:
p = pool.baseAddr + pn * PAGESIZE;
for (u = 0; u < PAGESIZE; u += size)
{ biti = bitbase + u / 16;
if (pool.freebits.test(biti))
{ List *list;
list = cast(List *)(p + u);
if (list.next != bucket[bin]) // avoid unnecessary writes
list.next = bucket[bin];
list.pool = pool;
bucket[bin] = list;
}
}
}
}
}
if (GC.config.profile)
{
stop = currTime();
recoverTime += (stop - start);
}
debug(COLLECT_PRINTF) printf("\trecovered pages = %d\n", recoveredpages);
debug(COLLECT_PRINTF) printf("\tfree'd %u bytes, %u pages from %u pools\n", freed, freedpages, npools);
running = 0; // only clear on success
return freedpages + recoveredpages;
}
/**
* Returns true if the addr lies within a marked block.
*
* Warning! This should only be called while the world is stopped inside
* the fullcollect function.
*/
int isMarked(void *addr) nothrow
{
// first, we find the Pool this block is in, then check to see if the
// mark bit is clear.
auto pool = findPool!true(addr);
if(pool)
{
auto offset = cast(size_t)(addr - pool.baseAddr);
auto pn = offset / PAGESIZE;
auto bins = cast(Bins)pool.pagetable[pn];
size_t biti = void;
if(bins <= B_PAGE)
{
biti = (offset & notbinsize[bins]) >> pool.shiftBy;
}
else if(bins == B_PAGEPLUS)
{
pn -= pool.bPageOffsets[pn];
biti = pn * (PAGESIZE >> pool.shiftBy);
}
else // bins == B_FREE
{
assert(bins == B_FREE);
return IsMarked.no;
}
return pool.mark.test(biti) ? IsMarked.yes : IsMarked.no;
}
return IsMarked.unknown;
}
/**
*
*/
uint getBits(Pool* pool, size_t biti) nothrow
in
{
assert(pool);
}
body
{
uint bits;
if (pool.finals.nbits &&
pool.finals.test(biti))
bits |= BlkAttr.FINALIZE;
if (pool.noscan.test(biti))
bits |= BlkAttr.NO_SCAN;
if (pool.nointerior.nbits && pool.nointerior.test(biti))
bits |= BlkAttr.NO_INTERIOR;
// if (pool.nomove.nbits &&
// pool.nomove.test(biti))
// bits |= BlkAttr.NO_MOVE;
if (pool.appendable.test(biti))
bits |= BlkAttr.APPENDABLE;
return bits;
}
/**
*
*/
void setBits(Pool* pool, size_t biti, uint mask) nothrow
in
{
assert(pool);
}
body
{
// Calculate the mask and bit offset once and then use it to
// set all of the bits we need to set.
immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT);
immutable bitOffset = biti & GCBits.BITS_MASK;
immutable orWith = GCBits.BITS_1 << bitOffset;
if (mask & BlkAttr.FINALIZE)
{
if (!pool.finals.nbits)
pool.finals.alloc(pool.mark.nbits);
pool.finals.data[dataIndex] |= orWith;
}
if (mask & BlkAttr.NO_SCAN)
{
pool.noscan.data[dataIndex] |= orWith;
}
// if (mask & BlkAttr.NO_MOVE)
// {
// if (!pool.nomove.nbits)
// pool.nomove.alloc(pool.mark.nbits);
// pool.nomove.data[dataIndex] |= orWith;
// }
if (mask & BlkAttr.APPENDABLE)
{
pool.appendable.data[dataIndex] |= orWith;
}
if (pool.isLargeObject && (mask & BlkAttr.NO_INTERIOR))
{
if(!pool.nointerior.nbits)
pool.nointerior.alloc(pool.mark.nbits);
pool.nointerior.data[dataIndex] |= orWith;
}
}
/**
*
*/
void clrBits(Pool* pool, size_t biti, uint mask) nothrow
in
{
assert(pool);
}
body
{
immutable dataIndex = 1 + (biti >> GCBits.BITS_SHIFT);
immutable bitOffset = biti & GCBits.BITS_MASK;
immutable keep = ~(GCBits.BITS_1 << bitOffset);
if (mask & BlkAttr.FINALIZE && pool.finals.nbits)
pool.finals.data[dataIndex] &= keep;
if (mask & BlkAttr.NO_SCAN)
pool.noscan.data[dataIndex] &= keep;
// if (mask & BlkAttr.NO_MOVE && pool.nomove.nbits)
// pool.nomove.data[dataIndex] &= keep;
if (mask & BlkAttr.APPENDABLE)
pool.appendable.data[dataIndex] &= keep;
if (pool.nointerior.nbits && (mask & BlkAttr.NO_INTERIOR))
pool.nointerior.data[dataIndex] &= keep;
}
void clrBitsSmallSweep(Pool* pool, size_t dataIndex, GCBits.wordtype toClear) nothrow
in
{
assert(pool);
}
body
{
immutable toKeep = ~toClear;
if (pool.finals.nbits)
pool.finals.data[dataIndex] &= toKeep;
pool.noscan.data[dataIndex] &= toKeep;
// if (pool.nomove.nbits)
// pool.nomove.data[dataIndex] &= toKeep;
pool.appendable.data[dataIndex] &= toKeep;
if (pool.nointerior.nbits)
pool.nointerior.data[dataIndex] &= toKeep;
}
/***** Leak Detector ******/
debug (LOGGING)
{
LogArray current;
LogArray prev;
void log_init()
{
//debug(PRINTF) printf("+log_init()\n");
current.reserve(1000);
prev.reserve(1000);
//debug(PRINTF) printf("-log_init()\n");
}
void log_malloc(void *p, size_t size) nothrow
{
//debug(PRINTF) printf("+log_malloc(p = %p, size = %zd)\n", p, size);
Log log;
log.p = p;
log.size = size;
log.line = GC.line;
log.file = GC.file;
log.parent = null;
GC.line = 0;
GC.file = null;
current.push(log);
//debug(PRINTF) printf("-log_malloc()\n");
}
void log_free(void *p) nothrow
{
//debug(PRINTF) printf("+log_free(%p)\n", p);
auto i = current.find(p);
if (i == OPFAIL)
{
debug(PRINTF) printf("free'ing unallocated memory %p\n", p);
}
else
current.remove(i);
//debug(PRINTF) printf("-log_free()\n");
}
void log_collect() nothrow
{
//debug(PRINTF) printf("+log_collect()\n");
// Print everything in current that is not in prev
debug(PRINTF) printf("New pointers this cycle: --------------------------------\n");
size_t used = 0;
for (size_t i = 0; i < current.dim; i++)
{
auto j = prev.find(current.data[i].p);
if (j == OPFAIL)
current.data[i].print();
else
used++;
}
debug(PRINTF) printf("All roots this cycle: --------------------------------\n");
for (size_t i = 0; i < current.dim; i++)
{
void* p = current.data[i].p;
if (!findPool!true(current.data[i].parent))
{
auto j = prev.find(current.data[i].p);
debug(PRINTF) printf(j == OPFAIL ? "N" : " ");
current.data[i].print();
}
}
debug(PRINTF) printf("Used = %d-------------------------------------------------\n", used);
prev.copy(¤t);
debug(PRINTF) printf("-log_collect()\n");
}
void log_parent(void *p, void *parent) nothrow
{
//debug(PRINTF) printf("+log_parent()\n");
auto i = current.find(p);
if (i == OPFAIL)
{
debug(PRINTF) printf("parent'ing unallocated memory %p, parent = %p\n", p, parent);
Pool *pool;
pool = findPool!true(p);
assert(pool);
size_t offset = cast(size_t)(p - pool.baseAddr);
size_t biti;
size_t pn = offset / PAGESIZE;
Bins bin = cast(Bins)pool.pagetable[pn];
biti = (offset & notbinsize[bin]);
debug(PRINTF) printf("\tbin = %d, offset = x%x, biti = x%x\n", bin, offset, biti);
}
else
{
current.data[i].parent = parent;
}
//debug(PRINTF) printf("-log_parent()\n");
}
}
else
{
void log_init() nothrow { }
void log_malloc(void *p, size_t size) nothrow { }
void log_free(void *p) nothrow { }
void log_collect() nothrow { }
void log_parent(void *p, void *parent) nothrow { }
}
}
/* ============================ Pool =============================== */
struct Pool
{
byte* baseAddr;
byte* topAddr;
GCBits mark; // entries already scanned, or should not be scanned
GCBits scan; // entries that need to be scanned
GCBits freebits; // entries that are on the free list
GCBits finals; // entries that need finalizer run on them
GCBits noscan; // entries that should not be scanned
GCBits appendable; // entries that are appendable
GCBits nointerior; // interior pointers should be ignored.
// Only implemented for large object pools.
size_t npages;
size_t freepages; // The number of pages not in use.
ubyte* pagetable;
bool isLargeObject;
bool oldChanges; // Whether there were changes on the last mark.
bool newChanges; // Whether there were changes on the current mark.
// This tracks how far back we have to go to find the nearest B_PAGE at
// a smaller address than a B_PAGEPLUS. To save space, we use a uint.
// This limits individual allocations to 16 terabytes, assuming a 4k
// pagesize.
uint* bPageOffsets;
// This variable tracks a conservative estimate of where the first free
// page in this pool is, so that if a lot of pages towards the beginning
// are occupied, we can bypass them in O(1).
size_t searchStart;
void initialize(size_t npages, bool isLargeObject) nothrow
{
this.isLargeObject = isLargeObject;
size_t poolsize;
//debug(PRINTF) printf("Pool::Pool(%u)\n", npages);
poolsize = npages * PAGESIZE;
assert(poolsize >= POOLSIZE);
baseAddr = cast(byte *)os_mem_map(poolsize);
// Some of the code depends on page alignment of memory pools
assert((cast(size_t)baseAddr & (PAGESIZE - 1)) == 0);
if (!baseAddr)
{
//debug(PRINTF) printf("GC fail: poolsize = x%zx, errno = %d\n", poolsize, errno);
//debug(PRINTF) printf("message = '%s'\n", sys_errlist[errno]);
npages = 0;
poolsize = 0;
}
//assert(baseAddr);
topAddr = baseAddr + poolsize;
auto div = this.divisor;
auto nbits = cast(size_t)poolsize / div;
mark.alloc(nbits);
scan.alloc(nbits);
// pagetable already keeps track of what's free for the large object
// pool.
if(!isLargeObject)
{
freebits.alloc(nbits);
}
noscan.alloc(nbits);
appendable.alloc(nbits);
pagetable = cast(ubyte*)cstdlib.malloc(npages);
if (!pagetable)
onOutOfMemoryError();
if(isLargeObject)
{
bPageOffsets = cast(uint*)cstdlib.malloc(npages * uint.sizeof);
if (!bPageOffsets)
onOutOfMemoryError();
}
memset(pagetable, B_FREE, npages);
this.npages = npages;
this.freepages = npages;
}
void Dtor() nothrow
{
if (baseAddr)
{
int result;
if (npages)
{
result = os_mem_unmap(baseAddr, npages * PAGESIZE);
assert(result == 0);
npages = 0;
}
baseAddr = null;
topAddr = null;
}
if (pagetable)
{
cstdlib.free(pagetable);
pagetable = null;
}
if(bPageOffsets)
cstdlib.free(bPageOffsets);
mark.Dtor();
scan.Dtor();
if(isLargeObject)
{
nointerior.Dtor();
}
else
{
freebits.Dtor();
}
finals.Dtor();
noscan.Dtor();
appendable.Dtor();
}
void Invariant() const {}
debug(INVARIANT)
invariant()
{
//mark.Invariant();
//scan.Invariant();
//freebits.Invariant();
//finals.Invariant();
//noscan.Invariant();
//appendable.Invariant();
//nointerior.Invariant();
if (baseAddr)
{
//if (baseAddr + npages * PAGESIZE != topAddr)
//printf("baseAddr = %p, npages = %d, topAddr = %p\n", baseAddr, npages, topAddr);
assert(baseAddr + npages * PAGESIZE == topAddr);
}
if(pagetable !is null)
{
for (size_t i = 0; i < npages; i++)
{
Bins bin = cast(Bins)pagetable[i];
assert(bin < B_MAX);
}
}
}
// The divisor used for determining bit indices.
@property private size_t divisor() nothrow
{
// NOTE: Since this is called by initialize it must be private or
// invariant() will be called and fail.
return isLargeObject ? PAGESIZE : 16;
}
// Bit shift for fast division by divisor.
@property uint shiftBy() nothrow
{
return isLargeObject ? 12 : 4;
}
void updateOffsets(size_t fromWhere) nothrow
{
assert(pagetable[fromWhere] == B_PAGE);
size_t pn = fromWhere + 1;
for(uint offset = 1; pn < npages; pn++, offset++)
{
if(pagetable[pn] != B_PAGEPLUS) break;
bPageOffsets[pn] = offset;
}
// Store the size of the block in bPageOffsets[fromWhere].
bPageOffsets[fromWhere] = cast(uint) (pn - fromWhere);
}
/**
* Allocate n pages from Pool.
* Returns OPFAIL on failure.
*/
size_t allocPages(size_t n) nothrow
{
if(freepages < n) return OPFAIL;
size_t i;
size_t n2;
//debug(PRINTF) printf("Pool::allocPages(n = %d)\n", n);
n2 = n;
for (i = searchStart; i < npages; i++)
{
if (pagetable[i] == B_FREE)
{
if(pagetable[searchStart] < B_FREE)
{
searchStart = i + (!isLargeObject);
}
if (--n2 == 0)
{ //debug(PRINTF) printf("\texisting pn = %d\n", i - n + 1);
return i - n + 1;
}
}
else
{
n2 = n;
if(pagetable[i] == B_PAGE)
{
// Then we have the offset information. We can skip a
// whole bunch of stuff.
i += bPageOffsets[i] - 1;
}
}
}
if(pagetable[searchStart] < B_FREE)
{
searchStart = npages;
}
return OPFAIL;
}
/**
* Free npages pages starting with pagenum.
*/
void freePages(size_t pagenum, size_t npages) nothrow
{
//memset(&pagetable[pagenum], B_FREE, npages);
if(pagenum < searchStart) searchStart = pagenum;
for(size_t i = pagenum; i < npages + pagenum; i++)
{
if(pagetable[i] < B_FREE)
{
freepages++;
}
pagetable[i] = B_FREE;
}
}
/**
* Given a pointer p in the p, return the pagenum.
*/
size_t pagenumOf(void *p) const nothrow
in
{
assert(p >= baseAddr);
assert(p < topAddr);
}
body
{
return cast(size_t)(p - baseAddr) / PAGESIZE;
}
/**
* Get size of pointer p in pool.
*/
size_t getSize(void *p) const nothrow
in
{
assert(p >= baseAddr);
assert(p < topAddr);
}
body
{
size_t pagenum = pagenumOf(p);
Bins bin = cast(Bins)pagetable[pagenum];
size_t size = binsize[bin];
if (bin == B_PAGE)
{
size = bPageOffsets[pagenum] * PAGESIZE;
}
return size;
}
/**
* Used for sorting pooltable[]
*/
int opCmp(const Pool *p2) const nothrow
{
if (baseAddr < p2.baseAddr)
return -1;
else
return cast(int)(baseAddr > p2.baseAddr);
}
}
/* ============================ SENTINEL =============================== */
debug (SENTINEL)
{
const size_t SENTINEL_PRE = cast(size_t) 0xF4F4F4F4F4F4F4F4UL; // 32 or 64 bits
const ubyte SENTINEL_POST = 0xF5; // 8 bits
const uint SENTINEL_EXTRA = 2 * size_t.sizeof + 1;
inout(size_t*) sentinel_size(inout void *p) nothrow { return &(cast(inout size_t *)p)[-2]; }
inout(size_t*) sentinel_pre(inout void *p) nothrow { return &(cast(inout size_t *)p)[-1]; }
inout(ubyte*) sentinel_post(inout void *p) nothrow { return &(cast(inout ubyte *)p)[*sentinel_size(p)]; }
void sentinel_init(void *p, size_t size) nothrow
{
*sentinel_size(p) = size;
*sentinel_pre(p) = SENTINEL_PRE;
*sentinel_post(p) = SENTINEL_POST;
}
void sentinel_Invariant(const void *p) nothrow
{
debug
{
assert(*sentinel_pre(p) == SENTINEL_PRE);
assert(*sentinel_post(p) == SENTINEL_POST);
}
else if(*sentinel_pre(p) != SENTINEL_PRE || *sentinel_post(p) != SENTINEL_POST)
onInvalidMemoryOperationError(); // also trigger in release build
}
void *sentinel_add(void *p) nothrow
{
return p + 2 * size_t.sizeof;
}
void *sentinel_sub(void *p) nothrow
{
return p - 2 * size_t.sizeof;
}
}
else
{
const uint SENTINEL_EXTRA = 0;
void sentinel_init(void *p, size_t size) nothrow
{
}
void sentinel_Invariant(const void *p) nothrow
{
}
void *sentinel_add(void *p) nothrow
{
return p;
}
void *sentinel_sub(void *p) nothrow
{
return p;
}
}
|
D
|
/Users/Shashi/Documents/cunyhackathon/StudyBuddy/build/StudyBuddy.build/Debug-iphonesimulator/StudyBuddy.build/Objects-normal/x86_64/DetailViewController.o : /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/LoginViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/WelcomePageViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/UserData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/DetailViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/User.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/StudySessionsData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/AppDelegate.swift /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/SwiftOnoneSupport.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/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
/Users/Shashi/Documents/cunyhackathon/StudyBuddy/build/StudyBuddy.build/Debug-iphonesimulator/StudyBuddy.build/Objects-normal/x86_64/DetailViewController~partial.swiftmodule : /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/LoginViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/WelcomePageViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/UserData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/DetailViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/User.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/StudySessionsData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/AppDelegate.swift /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/SwiftOnoneSupport.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/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
/Users/Shashi/Documents/cunyhackathon/StudyBuddy/build/StudyBuddy.build/Debug-iphonesimulator/StudyBuddy.build/Objects-normal/x86_64/DetailViewController~partial.swiftdoc : /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/LoginViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/WelcomePageViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/UserData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/DetailViewController.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/User.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/StudySessionsData.swift /Users/Shashi/Documents/cunyhackathon/StudyBuddy/StudyBuddy/AppDelegate.swift /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/SwiftOnoneSupport.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/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
|
D
|
/**
*
* THIS FILE IS AUTO-GENERATED BY ./parse_specs.d FOR MCU atmega3250p WITH ARCHITECTURE avr5
*
*/
module avr.specs.specs_atmega3250p;
enum __AVR_ARCH__ = 5;
enum __AVR_ASM_ONLY__ = false;
enum __AVR_ENHANCED__ = true;
enum __AVR_HAVE_MUL__ = true;
enum __AVR_HAVE_JMP_CALL__ = true;
enum __AVR_MEGA__ = true;
enum __AVR_HAVE_LPMX__ = true;
enum __AVR_HAVE_MOVW__ = true;
enum __AVR_HAVE_ELPM__ = false;
enum __AVR_HAVE_ELPMX__ = false;
enum __AVR_HAVE_EIJMP_EICALL_ = false;
enum __AVR_2_BYTE_PC__ = true;
enum __AVR_3_BYTE_PC__ = false;
enum __AVR_XMEGA__ = false;
enum __AVR_HAVE_RAMPX__ = false;
enum __AVR_HAVE_RAMPY__ = false;
enum __AVR_HAVE_RAMPZ__ = false;
enum __AVR_HAVE_RAMPD__ = false;
enum __AVR_TINY__ = false;
enum __AVR_PM_BASE_ADDRESS__ = 0;
enum __AVR_SFR_OFFSET__ = 32;
enum __AVR_DEVICE_NAME__ = "atmega3250p";
|
D
|
/Users/azimin/Downloads/Hello2/.build/debug/WebSockets.build/Communication/WebSocket+ControlFrames.swift.o : /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+Send.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Frame.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/WebSockets+Hash.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Fragmentation.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameSerializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameDeserializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket+Error.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+ControlFrames.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/WebSockets+Flags.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/WebSocketFormatErrors.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/Headers+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Request+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Client/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/URI.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/HTTP.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/TLS.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/libc.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Core.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Random.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 /Users/azimin/Downloads/Hello2/.build/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Sockets.swiftmodule /Users/azimin/Downloads/Hello2/.build/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/azimin/Downloads/Hello2/.build/debug/Transport.swiftmodule /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/azimin/Downloads/Hello2/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CHTTP.build/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CSQLite.build/module.modulemap
/Users/azimin/Downloads/Hello2/.build/debug/WebSockets.build/WebSocket+ControlFrames~partial.swiftmodule : /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+Send.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Frame.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/WebSockets+Hash.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Fragmentation.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameSerializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameDeserializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket+Error.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+ControlFrames.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/WebSockets+Flags.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/WebSocketFormatErrors.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/Headers+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Request+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Client/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/URI.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/HTTP.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/TLS.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/libc.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Core.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Random.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 /Users/azimin/Downloads/Hello2/.build/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Sockets.swiftmodule /Users/azimin/Downloads/Hello2/.build/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/azimin/Downloads/Hello2/.build/debug/Transport.swiftmodule /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/azimin/Downloads/Hello2/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CHTTP.build/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CSQLite.build/module.modulemap
/Users/azimin/Downloads/Hello2/.build/debug/WebSockets.build/WebSocket+ControlFrames~partial.swiftdoc : /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+Send.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Frame.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/WebSockets+Hash.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/Fragmentation.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameSerializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/FrameDeserializer.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket+Error.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Communication/WebSocket+ControlFrames.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Serialization/WebSockets+Flags.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/WebSocketFormatErrors.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Connection/Headers+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Request+WebSockets.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Model/WebSocket.swift /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/WebSockets/Client/WebSocket+Client.swift /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.apinotesc /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/Foundation.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreText.apinotesc /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/ObjectiveC.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/URI.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/HTTP.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/TLS.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/libc.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Core.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Debugging.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Dispatch.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Random.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 /Users/azimin/Downloads/Hello2/.build/debug/Crypto.swiftmodule /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/CoreGraphics.swiftmodule /Users/azimin/Downloads/Hello2/.build/debug/Sockets.swiftmodule /Users/azimin/Downloads/Hello2/.build/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/azimin/Downloads/Hello2/.build/debug/Transport.swiftmodule /Users/azimin/Downloads/Hello2/.build/checkouts/engine.git-3311994267206676365/Sources/CHTTP/include/http_parser.h /Users/azimin/Downloads/Hello2/.build/checkouts/ctls.git-9210868160426949823/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CHTTP.build/module.modulemap /Users/azimin/Downloads/Hello2/.build/debug/CSQLite.build/module.modulemap
|
D
|
// **************************************************
// EXIT
// **************************************************
INSTANCE DIA_Cup_Exit (C_INFO)
{
npc = RBL_2619_Cup;
nr = 999;
condition = DIA_Cup_Exit_Condition;
information = DIA_Cup_Exit_Info;
permanent = 1;
description = DIALOG_ENDE;
};
FUNC INT DIA_Cup_Exit_Condition()
{
return 1;
};
FUNC VOID DIA_Cup_Exit_Info()
{
B_StopProcessInfos ( self );
};
// **************************************************
// hello
// **************************************************
INSTANCE DIA_Cup_Hello (C_INFO)
{
npc = RBL_2619_Cup;
nr = 1;
condition = DIA_Cup_Hello_Condition;
information = DIA_Cup_Hello_Info;
permanent = 0;
important = 0;
description = "Witaj.";
};
FUNC INT DIA_Cup_Hello_Condition()
{
return 1;
};
FUNC VOID DIA_Cup_Hello_Info()
{
AI_Output (other, self, "DIA_Cup_Hello_15_01"); //Witaj.
AI_Output (self, other, "DIA_Cup_Hello_11_02"); //Nikomu nic nie stawiam, idź naciągnąć kogoś innego!
B_StopProcessInfos ( self );
};
INSTANCE DIA_Cup_What (C_INFO)
{
npc = RBL_2619_Cup;
nr = 1;
condition = DIA_Cup_What_Condition;
information = DIA_Cup_What_Info;
permanent = 0;
important = 0;
description = "Mam dla Ciebie wiadomość.";
};
FUNC INT DIA_Cup_What_Condition()
{
if (Npc_KnowsInfo(other,DIA_Cup_Hello))&&(hark_trial == 1)
{
return TRUE;
};
};
FUNC VOID DIA_Cup_What_Info()
{
AI_Output (other, self, "DIA_Cup_What_15_01"); //Mam dla Ciebie wiadomość od Harka.
AI_Output (self, other, "DIA_Cup_What_11_02"); //Czego chce ten syn cuchnącego capa?
Info_ClearChoices(DIA_Cup_What);
Info_AddChoice (DIA_Cup_What, "Jesteś śmierdzącym tchórzem!" ,DIA_Cup_What_Coward);
Info_AddChoice (DIA_Cup_What, "Twoja matka to dziwka!" ,DIA_Cup_What_Mam);
Info_AddChoice (DIA_Cup_What, "Jesteś cholernym opojem!" ,DIA_Cup_What_Drunk);
};
func void DIA_Cup_What_Mam()
{
B_GiveXP(150);
hark_trial = hark_trial +1;//2
AI_Output (other, self,"DIA_Hark_What_Mam_15_00"); //Twoja matka to dziwka.
AI_Output (self, other,"DIA_Hark_What_Mam_11_01"); //A to cholerny gnojek!
AI_Output (self, other,"DIA_Hark_What_Mam_11_02"); //Powiedz mu, że jego stary wolał owce.
B_LogEntry(CH1_Rbl_Hark, "Kufel faktycznie jest wrażliwy na punkcie swojej rodziny. Teraz dla odmiany on zasugerował, że ojciec Harka wolał owce.");
Info_ClearChoices(DIA_Hark_What);
B_StopProcessInfos (self);
};
func void DIA_Cup_What_Coward()
{
hark_trial = 10;
AI_Output (other, self,"DIA_Hark_What_Coward_15_00"); //Jesteś śmierdzącym tchórzem!
AI_Output (self, other,"DIA_Hark_What_Coward_11_01"); //Tak, to świetnie. Zejdź mi z oczu!
B_LogSetTopicStatus(CH1_Rbl_Hark, LOG_FAILED);
B_LogEntry(CH1_Rbl_Hark, "Nie udało mi się sprowokować Kufla.");
Info_ClearChoices(DIA_Hark_What);
B_StopProcessInfos (self);
};
func void DIA_Cup_What_Drunk()
{
hark_trial = 10;
AI_Output (other, self,"DIA_Hark_What_Drunk_15_00"); //Jesteś cholernym opojem!
AI_Output (self, other,"DIA_Hark_What_Drunk_11_01"); //Akurat o tym to każdy wie. Spadaj.
B_LogSetTopicStatus(CH1_Rbl_Hark, LOG_FAILED);
B_LogEntry(CH1_Rbl_Hark, "Nie udało mi się sprowokować Kufla.");
Info_ClearChoices(DIA_Hark_What);
B_StopProcessInfos (self);
};
INSTANCE DIA_Cup_Again (C_INFO)
{
npc = RBL_2619_Cup;
nr = 1;
condition = DIA_Cup_Again_Condition;
information = DIA_Cup_Again_Info;
permanent = 0;
important = 0;
description = "To Ci się nie spodoba.";
};
FUNC INT DIA_Cup_Again_Condition()
{
if (Npc_KnowsInfo(other,DIA_Hark_Again))&&(hark_trial == 3)
{
return TRUE;
};
};
FUNC VOID DIA_Cup_Again_Info()
{
hark_trial = hark_trial +1;//4
AI_Output (other, self, "DIA_Cup_Again_15_01"); //To Ci się nie spodoba.
AI_Output (self, other, "DIA_Cup_Again_11_02"); //Co ten sukinsyn powiedział?
AI_Output (other, self, "DIA_Cup_Again_15_03"); //Hark powiedział, że to pewnie po tatusiu śmierdzisz i wyglądasz jak ork.
AI_Output (self, other, "DIA_Cup_Again_11_04"); //Tego już za wiele. Idę skopać mu to tłuste dupsko!
var c_npc hark; hark = hlp_getnpc(RBL_2618_HARK);
Npc_SetAivar(self, AIV_BEENATTACKED, 0);
B_StopProcessInfos (self);
B_StartAfterDialogFight(self,hark,false);
B_StartAfterDialogFight(hark,self,false);
};
INSTANCE DIA_Cup_Again1 (C_INFO)
{
npc = RBL_2619_Cup;
nr = 5;
condition = DIA_Cup_Again1_Condition;
information = DIA_Cup_Again1_Info;
permanent = 0;
important = 0;
description = "Warto było?";
};
FUNC INT DIA_Cup_Again1_Condition()
{
if (Npc_KnowsInfo(other,DIA_Hark_Again1))&&(hark_trial == 5)
{
return TRUE;
};
};
FUNC VOID DIA_Cup_Again1_Info()
{
hark_trial = hark_trial +1;//6
AI_Output (other, self, "DIA_Cup_Again1_15_01"); //Warto było?
AI_Output (self, other, "DIA_Cup_Again1_11_02"); //Zejdź mi z oczu cholerny podżegaczu!
B_StopProcessInfos (self);
};
INSTANCE DIA_Cup_Statu (C_INFO)
{
npc = RBL_2619_Cup;
nr = 6;
condition = DIA_Cup_Statu_Condition;
information = DIA_Cup_Statu_Info;
permanent = 0;
important = 0;
description = "Śmierdzisz złodziejem.";
};
FUNC INT DIA_Cup_Statu_Condition()
{
if (Npc_KnowsInfo(other,DIA_Leren_FirstInnos))
{
return TRUE;
};
};
FUNC VOID DIA_Cup_Statu_Info()
{
CreateInvItems (self, poor_sack,1);
AI_Output (other, self, "DIA_Cup_Again1_15_01"); //Śmierdzisz złodziejem.
AI_Output (self, other, "DIA_Cup_Again1_11_02"); //A Co ci do tego łazęgo?
AI_Output (other, self, "DIA_Cup_Again1_15_03"); //Ano to, że nie lubię złodziei!
B_StopProcessInfos (self);
B_StartAfterDialogFight(self,other,false);
};
INSTANCE DIA_Cup_Again12 (C_INFO)
{
npc = RBL_2619_Cup;
nr = 7;
condition = DIA_Cup_Again12_Condition;
information = DIA_Cup_Again12_Info;
permanent = 0;
important = 0;
description = "Warto było?";
};
FUNC INT DIA_Cup_Again12_Condition()
{
if (Npc_KnowsInfo(other,DIA_Cup_Statu))
{
return TRUE;
};
};
FUNC VOID DIA_Cup_Again12_Info()
{
AI_Output (other, self, "DIA_Cup_Again12_15_01"); //Warto było?
AI_Output (self, other, "DIA_Cup_Again12_11_02"); //Zejdź mi z oczu cholerny... złodzieju!
B_StopProcessInfos (self);
};
// **************************************************
INSTANCE DIA_RBL_2619_Cup_Stew (C_INFO)
{
npc = RBL_2619_Cup;
nr = 12;
condition = DIA_RBL_2619_Cup_Stew_Condition;
information = DIA_RBL_2619_Cup_Stew_Info;
permanent = 0;
important = 0;
description = "Masz ochotę coś zjeść?";
};
FUNC INT DIA_RBL_2619_Cup_Stew_Condition()
{
if (Npc_KnowsInfo (hero, DIA_Fox_Camp))&&(NPC_HasItems(other,ItFo_Stew)>=1)
{
return 1;
};
};
FUNC VOID DIA_RBL_2619_Cup_Stew_Info()
{
fox_stew = fox_stew + 1;
AI_Output (other, self, "DIA_RBL_2619_Cup_Stew_15_01"); //Masz ochotę coś zjeść?
AI_Output (self, other, "DIA_RBL_2619_Cup_Stew_11_02"); //Co tak śmierdzi?
AI_Output (other, self, "DIA_RBL_2619_Cup_Stew_15_03"); //Gulasz Snafa.
AI_Output (self, other, "DIA_RBL_2619_Cup_Stew_11_04"); //Cholera, chyba sam zacznę gotować. Daj to paskudztwo, jak się zatka nos to nawet da się zjeść.
B_GiveInvItems (other, self, ItFo_Stew, 1);
B_LogEntry (CH2_Rbl_Food, "Jakoś sobie poradziłem z wepchnięciem gulaszu Kubłowi.");
};
|
D
|
// Written in the D programming language
// Jordan K. Wilson https://wilsonjord.github.io/
/**
This module implements colouring and formatting for a cell.
Author: $(HTTP wilsonjord.github.io, Jordan K. Wilson)
*/
module reportd.cellformat;
import std.typecons;
import std.file;
import std.conv;
/** Controls the horizontal alignment of the cell content. */
enum HAlignment {centre="centre",left="left",right="right"}
/** Controls the vertical alignment of the cell content. */
enum VAlignment {middle="middle",top="top",bottom="bottom"}
/** Controls the weight of a font. */
enum FontWeight {normal="normal",bold="bold"}
/**
A CellFormat object contains information on how a cell looks, using font (type, size, colour, and weight), text alignment, and border colour.
*/
// TODO: upcoming release will see "apply" for Nullable type, investigate if that can simplify use of Nullable below
struct CellFormat {
private:
Nullable!string _fontName;
Nullable!int _fontSize;
Nullable!string _fontColour;
Nullable!FontWeight _fontWeight;
Nullable!string _bgColour;
Nullable!bool _wrap;
Nullable!HAlignment _horizontal;
Nullable!VAlignment _vertical;
public:
@property {
/** Font used to display cell contents. */
auto fontName() { return _fontName; }
void fontName(string newval) { _fontName = newval; }
/** Font size */
auto fontSize() { return _fontSize; }
void fontSize(int newval) { _fontSize = newval; }
/** Font colour
Params:
colour = The font colour of a cell, as a string based hex representation.
Example:
```d
CellFormat style;
style.fontColour = "#0000ff" // blue text
style.fontColour = "#ff0000" // red text```
*/
void fontColour(string colour) { _fontColour = colour; }
///
auto fontColour() { return _fontColour; }
/** Font weight
Params:
weight = The weight of the font
*/
void fontWeight(FontWeight weight) { _fontWeight = weight; }
///
auto fontWeight() { return _fontWeight; }
/** Background colour
Params:
colour = The background colour of a cell, as a string based hex representation.
Example:
```d
CellFormat style;
style.bgColour = "##e8e8e8" // light grey background```
*/
void bgColour(string colour) { _bgColour = colour; }
///
auto bgColour() { return _bgColour; }
auto wrap() { return _wrap; }
void wrap(bool newval) { _wrap = newval; }
auto horizontal() { return _horizontal; }
void horizontal(HAlignment newval) { _horizontal = newval; }
auto vertical() { return _vertical; }
void vertical(VAlignment newval) { _vertical = newval; }
auto isBold() { return _fontWeight==FontWeight.bold; }
}
bool opEquals (in CellFormat a) const {
auto b = cast(CellFormat)a;
if (_fontName.isNull != b.fontName.isNull) return false;
if (_fontSize.isNull != b.fontSize.isNull) return false;
if (_fontColour.isNull != b.fontColour.isNull) return false;
if (_fontWeight.isNull != b.fontWeight.isNull) return false;
if (_bgColour.isNull != b.bgColour.isNull) return false;
if (_wrap.isNull != b.wrap.isNull) return false;
if (_horizontal.isNull != b.horizontal.isNull) return false;
if (_vertical.isNull != b.vertical.isNull) return false;
if (!_fontName.isNull && (_fontName != b.fontName)) return false;
if (!_fontSize.isNull && (_fontSize != b.fontSize)) return false;
if (!_fontColour.isNull && (_fontColour != b.fontColour)) return false;
if (!_fontWeight.isNull && (_fontWeight != b.fontWeight)) return false;
if (!_bgColour.isNull && (_bgColour != b.bgColour)) return false;
if (!_wrap.isNull && (_wrap != b.wrap)) return false;
if (!_horizontal.isNull && (_horizontal != b.horizontal)) return false;
if (!_vertical.isNull && (_vertical != b.vertical)) return false;
return true;
}
int opCmp (CellFormat b) {
if (opEquals(b)) return 0;
if (fontName.isNull != b.fontName.isNull) return (fontName.isNull > b.fontName.isNull) ? 1 : -1;
if (fontSize.isNull != b.fontSize.isNull) return (fontSize.isNull > b.fontSize.isNull) ? 1 : -1;
if (fontColour.isNull != b.fontColour.isNull) return (fontColour.isNull > b.fontColour.isNull) ? 1 : -1;
if (fontWeight.isNull != b.fontWeight.isNull) return (fontWeight.isNull > b.fontWeight.isNull) ? 1 : -1;
if (bgColour.isNull != b.bgColour.isNull) return (bgColour.isNull > b.bgColour.isNull) ? 1 : -1;
if (wrap.isNull != b.wrap.isNull) return (wrap.isNull > b.wrap.isNull) ? 1 : -1;
if (horizontal.isNull != b.horizontal.isNull) return (horizontal.isNull > b.horizontal.isNull) ? 1 : -1;
if (vertical.isNull != b.vertical.isNull) return (vertical.isNull > b.vertical.isNull) ? 1 : -1;
if (!fontName.isNull && (fontName != b.fontName)) return (fontName > b.fontName) ? 1 : -1;
if (!fontSize.isNull && (fontSize != b.fontSize)) return (fontSize > b.fontSize) ? 1 : -1;
if (!fontColour.isNull && (fontColour != b.fontColour)) return (fontColour > b.fontColour) ? 1 : -1;
if (!fontWeight.isNull && (fontWeight != b.fontWeight)) return (fontWeight > b.fontWeight) ? 1 : -1;
if (!bgColour.isNull && (bgColour != b.bgColour)) return (bgColour > b.bgColour) ? 1 : -1;
if (!wrap.isNull && (wrap != b.wrap)) return (wrap > b.wrap) ? 1 : -1;
if (!horizontal.isNull && (horizontal != b.horizontal)) return (horizontal > b.horizontal) ? 1 : -1;
if (!vertical.isNull && (vertical != b.vertical)) return (vertical > b.vertical) ? 1 : -1;
assert(false);
}
string toString(){
return (!fontName.isNull ? fontName.to!string : "") ~ " " ~
(!fontSize.isNull ? fontSize.to!string : "") ~ " " ~
(!fontColour.isNull ? fontColour.to!string : "") ~ " " ~
(!fontWeight.isNull ? fontWeight.to!string : "") ~ " ";
}
}
/**
Function to merge the formats of two different cells.
The resultant cell format will be the result of overlaying the null fields of the first cell with the second cell, and
overlaying the null fields of the second cell with the first cell.
*/
void mergeCellFormat (ref CellFormat a, ref CellFormat b) {
a.fontName = (b.fontName.isNull) ? a.fontName : b.fontName;
a.fontSize = (b.fontSize.isNull) ? a.fontSize : b.fontSize;
a.fontColour = (b.fontColour.isNull) ? a.fontColour : b.fontColour;
a.fontWeight = (b.fontWeight.isNull) ? a.fontWeight : b.fontWeight;
a.bgColour = (b.bgColour.isNull) ? a.bgColour : b.bgColour;
a.wrap = (b.wrap.isNull) ? a.wrap : b.wrap;
a.horizontal = (b.horizontal.isNull) ? a.horizontal : b.horizontal;
a.vertical = (b.vertical.isNull) ? a.vertical : b.vertical;
}
alias ConditionalFormat = Tuple!(string,"condition",CellFormat,"cellFormat",string,"branchContains",string,"overrideText");
string getCellFormatName (ref CellFormat[string] formats, CellFormat format) {
foreach (formatName, formatValue; formats){
if (formatValue == format) return formatName;
}
return "";
}
alias FormatProperty = Tuple!(string,"name",string,"value");
struct FormatStyle {
private:
string[string] _properties;
string[string][] _conditions;
public:
@property {
auto properties() { return _properties;}
void properties(string[string] newval) { _properties=newval;}
auto conditions() {return _conditions;}
void conditions(string[string][] newval) {_conditions=newval;}
}
void addProperty (string name, string value) {
_properties[name] = value;
}
void addCondition (string[string] conditionMap) {
_conditions ~= conditionMap;
}
string getProperty (string name) {
auto ptr = name in _properties;
if (ptr is null) return null;
return *ptr;
}
bool opEquals (FormatStyle a) {
//auto fsa = cast(FormatStyle)a;
auto fsa = a;
return (properties == fsa.properties) && (conditions == fsa.conditions);
}
}
struct FormatStyles {
private:
FormatStyle[string] _styles;
int index=0;
public:
@property styles() { return _styles; }
string addStyle (FormatStyle fs){
foreach (key; _styles.keys){
if (fs == _styles[key]) return key;
}
string id;
do {
import std.format;
id = format("NS%s",index);
index++;
} while (id in _styles);
_styles[id] = fs;
return id;
}
bool getStyle (string name, ref FormatStyle fs ) @nogc {
auto ptr = name in _styles;
if (ptr is null) return false;
fs = *ptr;
return true;
}
}
|
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.builder.SQLUpdateBuilder;
import hunt.sql.builder.SQLBuilder;
abstract class SQLUpdateBuilder : SQLBuilder {
SQLBuilder select(string[] column...)
{
return this;
}
SQLBuilder selectWithAlias(string column, string _alias)
{
return this;
}
SQLBuilder from(string table)
{
return this;
}
SQLBuilder from(string table, string _alias)
{
return this;
}
SQLBuilder orderBy(string[] columns...)
{
return this;
}
SQLBuilder groupBy(string expr)
{
return this;
}
SQLBuilder having(string expr)
{
return this;
}
SQLBuilder into(string expr)
{
return this;
}
SQLBuilder limit(int rowCount)
{
return this;
}
SQLBuilder offset(int offset)
{
return this;
}
SQLBuilder limit(int rowCount, int offset)
{
return this;
}
SQLBuilder where(string sql)
{
return this;
}
SQLBuilder whereAnd(string sql)
{
return this;
}
SQLBuilder whereOr(string sql)
{
return this;
}
SQLBuilder join(string table , string _alias = null, string cond = null)
{
return this;
}
SQLBuilder innerJoin(string table , string _alias = null, string cond = null)
{
return this;
}
SQLBuilder leftJoin(string table , string _alias = null, string cond = null)
{
return this;
}
SQLBuilder rightJoin(string table , string _alias = null, string cond = null)
{
return this;
}
override string toString()
{
return "SQLUpdateBuilder";
}
SQLUpdateBuilder set(string[] items...)
{
return this;
}
}
|
D
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.