Some Crystal code to work on bindings.
This commit is contained in:
parent
6fa8f31dd4
commit
e6ad0ce65c
9
zig-impl/crystal/some-crystal-app/makefile
Normal file
9
zig-impl/crystal/some-crystal-app/makefile
Normal file
@ -0,0 +1,9 @@
|
||||
LDPATH ?= /tmp/libipc/zig-impl/build
|
||||
SRC ?= ./bin/some-crystal-app
|
||||
|
||||
VG_OPTS = --leak-check=full -v
|
||||
VG_OPTS += --suppressions=valgrind.suppressions
|
||||
VG_OPTS += --gen-suppressions=all
|
||||
|
||||
valgrind:
|
||||
LD_LIBRARY_PATH=$(LDPATH) valgrind $(VG_OPTS) $(SRC)
|
13
zig-impl/crystal/some-crystal-app/shard.yml
Normal file
13
zig-impl/crystal/some-crystal-app/shard.yml
Normal file
@ -0,0 +1,13 @@
|
||||
name: some-crystal-app
|
||||
version: 0.1.0
|
||||
|
||||
authors:
|
||||
- Philippe Pittoli <karchnu@karchnu.fr>
|
||||
|
||||
targets:
|
||||
some-crystal-app:
|
||||
main: src/some-crystal-app.cr
|
||||
|
||||
crystal: 1.7.1
|
||||
|
||||
license: MIT
|
53
zig-impl/crystal/some-crystal-app/src/some-crystal-app.cr
Normal file
53
zig-impl/crystal/some-crystal-app/src/some-crystal-app.cr
Normal file
@ -0,0 +1,53 @@
|
||||
@[Link("ipc")]
|
||||
lib LibIPC
|
||||
# enum EventType
|
||||
# Error # Self explanatory.
|
||||
# Connection # New user.
|
||||
# Disconnection # User disconnected.
|
||||
# MessageRx # Message received.
|
||||
# MessageTx # Message sent.
|
||||
# Timer # Timeout in the poll(2) function.
|
||||
# External # Message received from a non IPC socket.
|
||||
# SwitchRx # Switch subsystem: message received.
|
||||
# SwitchTx # Switch subsystem: message send.
|
||||
# end
|
||||
|
||||
fun init = ipc_context_init (Pointer(Pointer(Void))) : LibC::Int
|
||||
fun deinit = ipc_context_deinit (Pointer(Void)) : Void
|
||||
|
||||
# # Connection functions.
|
||||
# # Context is allocated, ipcd is requested and the connection/initialisation is performed.
|
||||
# fun service_init = ipc_service_init (Pointer(Void), LibC::Int*, LibC::Char*, LibC::UInt16) : LibC::Int
|
||||
# fun connect_service = ipc_connect_service(Pointer(Void), LibC::Int*, LibC::Char*, LibC::UInt16) : LibC::Int
|
||||
#
|
||||
# # Closing connections.
|
||||
# fun ipc_close(Pointer(Void), index : LibC::UInt64T) : LibC::Int
|
||||
# fun ipc_close_all(Pointer(Void)) : LibC::Int
|
||||
#
|
||||
# # Loop function.
|
||||
# fun ipc_wait_event(Ctx*, Event*, LibC::Int*) : LibC::Int
|
||||
#
|
||||
# # Adding and removing file discriptors to read.
|
||||
# fun ipc_add(Ctx*, Connection*, Pollfd*) : LibC::Int
|
||||
# fun ipc_del(Ctx*, LibC::UInt) : LibC::Int
|
||||
# fun ipc_add_fd(Ctx*, LibC::Int) : LibC::Int
|
||||
# fun ipc_del_fd(Ctx*, LibC::Int) : LibC::Int
|
||||
#
|
||||
# # Sending a message (will wait the fd to become available for IO operations).
|
||||
# fun ipc_write(Ctx*, Message*) : LibC::Int
|
||||
# fun ipc_schedule(Pointer(Void), ) : LibC::Int
|
||||
#
|
||||
# # Sending a message NOW.
|
||||
# # WARNING: unbuffered send do not wait the fd to become available.
|
||||
# fun ipc_write_fd(Int32, Message*) : LibC::Int
|
||||
end
|
||||
|
||||
# TODO: Write documentation for `Some::Crystal::App`
|
||||
module Some::Crystal::App
|
||||
VERSION = "0.1.0"
|
||||
|
||||
# TODO: Put your code here
|
||||
ctx : Pointer(Void) = Pointer(Void).null
|
||||
LibIPC.init (pointerof(ctx))
|
||||
LibIPC.deinit (ctx)
|
||||
end
|
229
zig-impl/crystal/some-crystal-app/valgrind.suppressions
Normal file
229
zig-impl/crystal/some-crystal-app/valgrind.suppressions
Normal file
@ -0,0 +1,229 @@
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Addr1
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_init_linux_data_start
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_push_all_eager
|
||||
fun:GC_with_callee_saves_pushed
|
||||
fun:GC_push_roots
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_push_all_eager
|
||||
fun:GC_with_callee_saves_pushed
|
||||
fun:GC_push_roots
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: definite
|
||||
fun:memalign
|
||||
fun:posix_memalign
|
||||
obj:/tmp/libipc/zig-impl/build/libipc.so.0.1.0
|
||||
fun:*Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: definite
|
||||
fun:malloc
|
||||
fun:*Signal::setup_segfault_handler:(Int32 | Nil)
|
||||
fun:*Exception::CallStack::setup_crash_handler:(Int32 | Nil)
|
||||
fun:__crystal_main
|
||||
fun:*Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_push_all_eager
|
||||
fun:GC_with_callee_saves_pushed
|
||||
fun:GC_push_roots
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Addr1
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_init_linux_data_start
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_push_all_eager
|
||||
fun:GC_with_callee_saves_pushed
|
||||
fun:GC_push_roots
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
||||
{
|
||||
<insert_a_suppression_name_here>
|
||||
Memcheck:Cond
|
||||
fun:GC_mark_from
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_mark_some
|
||||
obj:/usr/lib/libgc.so.1.5.0
|
||||
fun:GC_try_to_collect_inner
|
||||
fun:GC_init
|
||||
fun:*GC::init:Nil
|
||||
fun:*Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
|
||||
fun:main
|
||||
}
|
Reference in New Issue
Block a user