summary refs log tree commit diff stats
path: root/tests/stdlib/texitprocs.nim
blob: 9d5378fe822fb098ead11606b421951c3160de2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
discard """
targets: "c cpp js"
output: '''
ok4
ok3
ok2
ok1
'''
"""

import std/exitprocs

proc fun1() {.noconv.} = echo "ok1"
proc fun2() = echo "ok2"
proc fun3() {.noconv.} = echo "ok3"
proc fun4() = echo "ok4"

addExitProc(fun1)
addExitProc(fun2)
addExitProc(fun3)
addExitProc(fun4)
defined in io.h and the * timeout management is done with the timeout.h interface. \*=========================================================================*/ #include "luasocket.h" #include "io.h" #include "timeout.h" /* buffer size in bytes */ #define BUF_SIZE 8192 /* buffer control structure */ typedef struct t_buffer_ { double birthday; /* throttle support info: creation time, */ size_t sent, received; /* bytes sent, and bytes received */ p_io io; /* IO driver used for this buffer */ p_timeout tm; /* timeout management for this buffer */ size_t first, last; /* index of first and last bytes of stored data */ char data[BUF_SIZE]; /* storage space for buffer data */ } t_buffer; typedef t_buffer *p_buffer; #ifndef _WIN32 #pragma GCC visibility push(hidden) #endif int buffer_open(lua_State *L); void buffer_init(p_buffer buf, p_io io, p_timeout tm); int buffer_meth_getstats(lua_State *L, p_buffer buf); int buffer_meth_setstats(lua_State *L, p_buffer buf); int buffer_meth_send(lua_State *L, p_buffer buf); int buffer_meth_receive(lua_State *L, p_buffer buf); int buffer_isempty(p_buffer buf); #ifndef _WIN32 #pragma GCC visibility pop #endif #endif /* BUF_H */