Skip to content

Instantly share code, notes, and snippets.

@jpf91
jpf91 / gist:938547
Created April 23, 2011 11:17
Swig4D Bug 2
%module bug;
//Use swig2.0 -Wall -d -d2 -c++ bug.i
//Then in the generated files:
//in Test/Test.d:
//"class AttachedPictureFrame : Test.Frame {"
//should be
//"class AttachedPictureFrame : Test.Test.Frame {"
namespace Test {
import std.datetime;
import std.array;
import std.conv;
import std.string;
import std.algorithm;
struct PackageVersion
{
enum VersionType
{
/**
* Original libev documentation:
* $(LINK2 http://pod.tst.eu/http://cvs.schmorp.de/_libev/ev.pod?pathrev=rel-3__9, version 3.9)
* $(LINK2 http://pod.tst.eu/http://cvs.schmorp.de/_libev/ev.pod?pathrev=rel-4__04, version 4.04)
* $(LINK2 http://pod.tst.eu/http://cvs.schmorp.de/_libev/ev.pod, most recent version)
*/
module jpf.c.libev;
/*
* libev native API header
struct File
{
private struct Impl
{
uint refs = uint.max / 2;
//Other 'by-reference' members ...
this(uint r)
{
refs = r;
}
struct File
{
private struct Impl
{
uint refs = uint.max / 2;
//Other 'by-reference' members ...
this(uint r)
{
refs = r;
}
import std.stdio;
import std.typecons;
void main()
{
auto wrap1 = Wrapper(1);
}
void free(ref int _payload)
{
detach()
{
if (!RefCounted._store) return;
assert(RefCounted._store._count > 0);
if (--RefCounted._store._count)
{
debug(RefCounted) if (RefCounted.debugging)
writeln(typeof(this).stringof,
"@", cast(void*)RefCounted._store,
": decrement refcount to ", RefCounted._store._count);
import std.socket, std.exception, std.stdio, std.random, std.range;
void main(string args[])
{
enforce(args.length == 2);
if(args[1] == "--server")
{
auto sock = new Socket(AddressFamily.INET, SocketType.STREAM);
sock.bind(new InternetAddress("localhost", 9870));
sock.listen(0);
import std.datetime, std.concurrency, std.stdio, core.sys.posix.unistd;
import std.exception;
enum BUFFER_SIZE = 1 * 1024 * 1024UL;
void main(string[] args)
{
assert(args.length == 4);
ubyte[BUFFER_SIZE] buf;
auto sw = StopWatch();
import std.datetime, std.concurrency, std.stdio, core.sys.posix.unistd;
import std.exception;
enum BUFFER_SIZE = 1 * 1024 * 1024UL;
void main(string[] args)
{
assert(args.length == 3);
auto sw = StopWatch();