Skip to content

Instantly share code, notes, and snippets.

@rikkimax
rikkimax / app.d
Last active January 23, 2016 12:13
import std.stdio;
import std.experimental.allocator : IAllocator, processAllocator;
import memmgr;
void main() {
writeln("START1");
func();
writeln("END2");
}

Macro Preprocessor

Syntax

  • #define Identifier Literal
    • Modifies the translation unit
    • Identifier#1 is replaced by Literal#1
  • #undef Identifier
    • Behaves as #define Identifier#1 $empty
  • #ifdef Identifier

{pagebreak}

ModRM/SIB encoding

Below is the structure of the ModRM byte:

7, 6 5, 4, 3 2, 1, 0
Mod Reg Reg/Mem

{pagebreak}

Add with Carry

Variations
Mnemonic Opcode Valid/Requires 64bit? Description
ADC AL, imm8 14 ib Valid Add imm8 to AL + CF
ADC AX, imm16 15 iw Valid Add imm16 to AX + CF
int callbackGetWindows(HWND hwnd, LPARAM lParam) nothrow {
import std.experimental.ui.internal.window;
GetWindows* ctx = cast(GetWindows*)lParam;
if (!IsWindowVisible(hwnd))
return true;
RECT rect;
GetWindowRect(hwnd, &rect);
module dcf.phase1;
import std.range.interfaces : InputRange;
final class DCFPhase1 : InputRange!char {
private {
InputRange!char source;
char next;
byte bufLeft;
module diff;
struct Diff {
import std.utf : validate;
import std.experimental.allocator : IAllocator, dispose, makeArray, expandArray;
bool treatingAsBinary;
ubyte[] diff;
Building package alphacodegen:lang_d in /home/rikki/projects/alphacodegen/
Performing "unittest" build using dmd for x86_64.
pegged 0.3.2: target for configuration "library" is up to date.
alphacodegen:lang_d ~master: building configuration "application"...
Linking...
var color;
def init(myColor) {
color = myColor;
}
def draw() {
var startx, starty, endx, endy;
startx = Widget.x;
starty = Widget.y;
struct Experiments {
Experiment[] sets;
}
struct Experiment {
string fileName;
string endCondition;
Variation[] variations;
bool doesTurtlesMove;
}