Advertisement
C4Cypher

That almost looks like C code.

Aug 17th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Prolog 0.48 KB | None | 0 0
  1. register_module(Name, Pred, L, !IO) :-
  2.  
  3.     ( semipure ready(L) ; impure init(L) ),
  4.      
  5.     semipure (ref(Ref) = function(Pred)
  6.         ; unexpected($module, $pred,
  7.         "function/1 did not return a ref.").
  8.     ),
  9.     impure lua_getregistry(L, LUA_RIDX_MR_MODULE), /* table -3 */
  10.     impure lua_pushstring(L, N), /* key -2 */
  11.     impure luaMR_pushref(L, R), /* value -1 */
  12.     impure lua_settable(L, -3), /* table -1 */
  13.     impure lua_pop(L, 1). /* empty stack */
  14.      
  15. :- pragma promise_pure(register_module/5).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement