Skip to content

Instantly share code, notes, and snippets.

@pkazmier
Created April 22, 2013 21:20
Show Gist options
  • Save pkazmier/5438644 to your computer and use it in GitHub Desktop.
Save pkazmier/5438644 to your computer and use it in GitHub Desktop.
\documentclass[10pt,]{book}
\usepackage{listings}
\begin{document}
Globally initialize some things. Module can depend on this being done.
Why can this page not be rendered? What am I doing wrong?
\begin{lstlisting}
function initialize ()
require("lib")
require("clib_h")
require("snabb_h")
end
function command_line_args()
local args = {}
for i = 1, C.argc - 1 do
args[i] = ffi.string(C.argv[i])
end
return args
end
function handler (reason)
print(reason)
print(debug.traceback())
if debug_on_error then debug.debug() end
os.exit(1)
end
xpcall(main, handler)
\end{lstlisting}
\section{\lstinline$snabb_lib_init.c$: Customized Lua initialization}
\begin{lstlisting}
#include "lualib.h"
#include "lj_arch.h"
static const luaL_Reg lj_lib_load[] = {
{ "", luaopen_base },
{ LUA_LOADLIBNAME, luaopen_package },
{ LUA_TABLIBNAME, luaopen_table },
{ LUA_IOLIBNAME, luaopen_io },
{ LUA_OSLIBNAME, luaopen_os },
{ LUA_STRLIBNAME, luaopen_string },
{ LUA_MATHLIBNAME, luaopen_math },
{ LUA_DBLIBNAME, luaopen_debug },
{ LUA_BITLIBNAME, luaopen_bit },
{ LUA_JITLIBNAME, luaopen_jit },
{ NULL, NULL }
};
\end{lstlisting}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment