Skip to content

Instantly share code, notes, and snippets.

@MrSmith33
Created October 10, 2017 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrSmith33/29125fa3538bb03637d0aebab6ccff7c to your computer and use it in GitHub Desktop.
Save MrSmith33/29125fa3538bb03637d0aebab6ccff7c to your computer and use it in GitHub Desktop.
unresolved external symbol internal
module chunkedrange;
struct ChunkedRange(T) { size_t itemsLeft; }
// dmd -m64 -lib -of="lib.lib" -debug -g -w -I="./" chunkedrange.d textbuffer.d texteditor.d
// dmd -m64 -of="app.exe" -debug -g -w -I="./" lib.lib main.d
import texteditor;
void main() {}
module textbuffer;
private struct Piece { size_t bufferOffset; }
struct PieceRestoreRange {}
private struct PieceStorage
{
Piece* sentinel = new Piece;
PieceRestoreRange insertAt(Piece* newPiece, size_t insertPos)
{
return PieceRestoreRange();
}
}
struct PieceTable
{
PieceStorage pieces;
Range!char opSlice(size_t x, size_t y) { return Range!char(); }
size_t length() @property { return 0; }
}
private struct Range(T)
{
import chunkedrange;
ChunkedRange!char toChunkedRange() { return ChunkedRange!char(); }
}
module texteditor;
import chunkedrange;
import textbuffer;
class EditorTextModel
{
TextEditor* editor;
ChunkedRange!char opSlice(ulong from, ulong to) { return editor.textData[from..to].toChunkedRange; }
void replaceSelection(const(char)[] str) { editor.replaceSelection(str); }
}
struct TextEditor
{
private PieceTable textData;
mixin ReadHelpers!();
mixin WriteHelpers!();
}
mixin template ReadHelpers()
{
import std.datetime : MonoTime;
}
mixin template WriteHelpers()
{
void replaceSelection(const(char)[] str) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment