New calling conventions, start on print.cpp
This commit is contained in:
46
luprex/core/cpp/print.hpp
Normal file
46
luprex/core/cpp/print.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
// Pretty-print routine.
|
||||
//
|
||||
// The pretty-printer can be called from C++ or Lua.
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PRINT_HPP
|
||||
#define PRINT_HPP
|
||||
|
||||
#include "luastack.hpp"
|
||||
|
||||
// This file provides these functions for lua.
|
||||
//
|
||||
// They direct all output to std::cout
|
||||
//
|
||||
extern "C" {
|
||||
void luai_writestring(const char *s, size_t len);
|
||||
void luai_writeline();
|
||||
}
|
||||
|
||||
// Pretty print to a stream.
|
||||
//
|
||||
// If indent is >=0, the output is indented. If indent<0, then
|
||||
// the output is emitted without newlines or indentation.
|
||||
//
|
||||
// Maxlen specifies the maximum number of characters output. If
|
||||
// this is exceeded, then the printout is truncated.
|
||||
//
|
||||
void pprint(LuaStack &LS, LuaSlot val, int indent, int maxlen, std::ostream *os);
|
||||
|
||||
// The following lua interfaces to this code are included:
|
||||
//
|
||||
// pprint(expr)
|
||||
//
|
||||
// - pretty print the specified expression to stdout.
|
||||
//
|
||||
// string.pprint(expr, indent, maxlen)
|
||||
//
|
||||
// - pretty print the specified expression, return the result as a string.
|
||||
//
|
||||
void pprint_pprint(lua_State *L);
|
||||
void string_pprint(lua_State *L);
|
||||
|
||||
#endif // PRINT_HPP
|
||||
Reference in New Issue
Block a user