WIP: C pong client.
This commit is contained in:
parent
298657cb9f
commit
5f756f722f
1 changed files with 18 additions and 27 deletions
|
|
@ -1,32 +1,23 @@
|
||||||
// pub const CBEvent = @import("./callback.zig").CBEvent;
|
// Example of a `pong` client using the C bindings.
|
||||||
// pub const Connection = @import("./connection.zig").Connection;
|
|
||||||
// pub const Message = @import("./message.zig").Message;
|
|
||||||
// pub const Event = @import("./event.zig").Event;
|
|
||||||
// pub const Switch = @import("./switch.zig").Switch;
|
|
||||||
//
|
|
||||||
// pub const Messages = @import("./message.zig").Messages;
|
|
||||||
// pub const Switches = @import("./switch.zig").Switches;
|
|
||||||
// pub const Connections = @import("./connection.zig").Connections;
|
|
||||||
// pub const Context = @import("./context.zig").Context;
|
|
||||||
//
|
|
||||||
// pub const util = @import("./util.zig");
|
|
||||||
// pub const hexdump = @import("./hexdump.zig");
|
|
||||||
// pub const exchangefd = @import("./exchange-fd.zig");
|
|
||||||
|
|
||||||
// PING source code
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
// const libipc = @import("libipc");
|
|
||||||
|
// Only bindings are available.
|
||||||
|
const libipc = @cImport({
|
||||||
|
@cInclude("stdio.h"); // Required to have types such as `size_t`.
|
||||||
|
@cInclude("../../../libipc.h");
|
||||||
|
});
|
||||||
|
|
||||||
|
const service_name = "pong";
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main() !void {
|
||||||
// Prints to stderr, ignoring potential errors.
|
// Prints to stderr, ignoring potential errors.
|
||||||
std.debug.print("All your {s} are belong to us.\n", .{"codebase"});
|
std.debug.print("{s} service.\n", .{service_name});
|
||||||
}
|
var ctx : *anyopaque = undefined;
|
||||||
|
var ret : c_int = 0;
|
||||||
|
ret = libipc.ipc_context_init (@ptrCast(&ctx));
|
||||||
|
|
||||||
test {
|
if (ret != 0) {
|
||||||
_ = @import("./callback.zig");
|
std.debug.print("oops\n", .{});
|
||||||
_ = @import("./connection.zig");
|
return;
|
||||||
_ = @import("./context.zig");
|
}
|
||||||
_ = @import("./event.zig");
|
|
||||||
_ = @import("./message.zig");
|
|
||||||
_ = @import("./switch.zig");
|
|
||||||
_ = @import("./util.zig");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue