Mercurial > hg > Members > anatofuz > MoarVM
diff 3rdparty/dyncall/dyncallback/dyncall_callback_mips.c @ 0:2cf249471370
convert mercurial for git
author | Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 May 2018 16:09:12 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/dyncall/dyncallback/dyncall_callback_mips.c Tue May 08 16:09:12 2018 +0900 @@ -0,0 +1,61 @@ +/* + + Package: dyncall + Library: dyncallback + File: dyncallback/dyncall_callback_mips.c + Description: Callback - Implementation Header for MIPS + License: + + Copyright (c) 2013 Daniel Adler <dadler@uni-goettingen.de>, + Tassilo Philipp <tphilipp@potion-studios.com> + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +*/ + +#include "dyncall_callback.h" +#include "dyncall_callback_mips.h" + +void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata) +{ + const char* ptr; + char ch; + + pcb->handler = handler; + pcb->userdata = userdata; +} + +extern void dcCallbackThunkEntry(); + +DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) +{ + DCCallback* pcb; + int err = dcAllocWX(sizeof(DCCallback), (void**)&pcb); + if (err != 0) return 0; + + dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); + dcbInitCallback(pcb, signature, handler, userdata); + + return pcb; +} + +void dcbFreeCallback(DCCallback* pcb) +{ + dcFreeWX(pcb, sizeof(DCCallback)); +} + +void* dcbGetUserData(DCCallback* pcb) +{ + return pcb->userdata; +} +