[Scummvm-cvs-logs] SF.net SVN: scummvm:[33382] residual/trunk/engine/lua

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Mon Jul 28 21:23:09 CEST 2008


Revision: 33382
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33382&view=rev
Author:   aquadran
Date:     2008-07-28 19:23:08 +0000 (Mon, 28 Jul 2008)

Log Message:
-----------
formatting code

Modified Paths:
--------------
    residual/trunk/engine/lua/lauxlib.cpp
    residual/trunk/engine/lua/lauxlib.h

Modified: residual/trunk/engine/lua/lauxlib.cpp
===================================================================
--- residual/trunk/engine/lua/lauxlib.cpp	2008-07-28 19:15:36 UTC (rev 33381)
+++ residual/trunk/engine/lua/lauxlib.cpp	2008-07-28 19:23:08 UTC (rev 33382)
@@ -9,119 +9,105 @@
 ** Any function declared here could be written as an application
 ** function. With care, these functions can be used by other libraries.
 */
-#include "lauxlib.h"
-#include "lua.h"
-#include "luadebug.h"
-#include "lmem.h"
 
+#include "engine/lua/lauxlib.h"
+#include "engine/lua/lua.h"
+#include "engine/lua/luadebug.h"
+#include "engine/lua/lmem.h"
 
-int32 luaL_findstring (const char *name, const char *list[]) {
-  int32 i;
-  for (i=0; list[i]; i++)
-    if (strcmp(list[i], name) == 0)
-      return i;
-  return -1;  /* name not found */
+int32 luaL_findstring(const char *name, const char *list[]) {
+	int32 i;
+	for (i = 0; list[i]; i++)
+		if (strcmp(list[i], name) == 0)
+			return i;
+	return -1;  // name not found
 }
 
-void luaL_argerror (int32 numarg, const char *extramsg)
-{
-  const char *funcname;
-  lua_getobjname(lua_stackedfunction(0), &funcname);
-  if (funcname == NULL)
-    funcname = "???";
-  if (extramsg == NULL)
-    luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
-  else
-    luaL_verror("bad argument #%d to function `%.50s' (%.100s)",
-                    numarg, funcname, extramsg);
+void luaL_argerror(int32 numarg, const char *extramsg) {
+	const char *funcname;
+	lua_getobjname(lua_stackedfunction(0), &funcname);
+	if (!funcname)
+		funcname = "???";
+	if (!extramsg)
+		luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
+	else
+		luaL_verror("bad argument #%d to function `%.50s' (%.100s)", numarg, funcname, extramsg);
 }
 
-const char *luaL_check_lstr (int32 numArg, int32 *len)
-{
-  lua_Object o = lua_getparam(numArg);
-  luaL_arg_check(lua_isstring(o), numArg, "string expected");
-  if (len) *len = lua_strlen(o);
-  return lua_getstring(o);
+const char *luaL_check_lstr(int32 numArg, int32 *len) {
+	lua_Object o = lua_getparam(numArg);
+	luaL_arg_check(lua_isstring(o), numArg, "string expected");
+	if (len)
+		*len = lua_strlen(o);
+	return lua_getstring(o);
 }
 
-const char *luaL_opt_lstr (int32 numArg, const char *def, int32 *len)
-{
-  return (lua_getparam(numArg) == LUA_NOOBJECT) ? def :
-                              luaL_check_lstr(numArg, len);
+const char *luaL_opt_lstr(int32 numArg, const char *def, int32 *len) {
+	return (lua_getparam(numArg) == LUA_NOOBJECT) ? def : luaL_check_lstr(numArg, len);
 }
 
-double luaL_check_number (int32 numArg)
-{
-  lua_Object o = lua_getparam(numArg);
-  luaL_arg_check(lua_isnumber(o), numArg, "number expected");
-  return lua_getnumber(o);
+double luaL_check_number(int32 numArg) {
+	lua_Object o = lua_getparam(numArg);
+	luaL_arg_check(lua_isnumber(o), numArg, "number expected");
+	return lua_getnumber(o);
 }
 
-
-double luaL_opt_number (int32 numArg, double def)
-{
-  return (lua_getparam(numArg) == LUA_NOOBJECT) ? def :
-                              luaL_check_number(numArg);
+double luaL_opt_number(int32 numArg, double def) {
+	return (lua_getparam(numArg) == LUA_NOOBJECT) ? def : luaL_check_number(numArg);
 }  
 
-
-lua_Object luaL_tablearg (int32 arg)
-{
-  lua_Object o = lua_getparam(arg);
-  luaL_arg_check(lua_istable(o), arg, "table expected");
-  return o;
+lua_Object luaL_tablearg(int32 arg) {
+	lua_Object o = lua_getparam(arg);
+	luaL_arg_check(lua_istable(o), arg, "table expected");
+	return o;
 }
 
-lua_Object luaL_functionarg (int32 arg)
-{
-  lua_Object o = lua_getparam(arg);
-  luaL_arg_check(lua_isfunction(o), arg, "function expected");
-  return o;
+lua_Object luaL_functionarg(int32 arg) {
+	lua_Object o = lua_getparam(arg);
+	luaL_arg_check(lua_isfunction(o), arg, "function expected");
+	return o;
 }
 
-lua_Object luaL_nonnullarg (int32 numArg)
-{
-  lua_Object o = lua_getparam(numArg);
-  luaL_arg_check(o != LUA_NOOBJECT, numArg, "value expected");
-  return o;
+lua_Object luaL_nonnullarg(int32 numArg) {
+	lua_Object o = lua_getparam(numArg);
+	luaL_arg_check(o != LUA_NOOBJECT, numArg, "value expected");
+	return o;
 }
 
 luaL_libList *list_of_libs = NULL;
 
 void luaL_addlibtolist(luaL_reg *l, int32 n) {
-  luaL_libList *list = (luaL_libList *)luaM_malloc(sizeof(luaL_libList));
-  list->list = l;
-  list->number = n;
-  list->next = list_of_libs;
-  list_of_libs = list;
+	luaL_libList *list = (luaL_libList *)luaM_malloc(sizeof(luaL_libList));
+	list->list = l;
+	list->number = n;
+	list->next = list_of_libs;
+	list_of_libs = list;
 }
 
-void lua_removelibslists(void) {
-  luaL_libList *list = list_of_libs;
-  while (list) {
-    luaL_libList *nextList = list->next;
-    luaM_free(list);
-    list = nextList;
-  }
+void lua_removelibslists() {
+	luaL_libList *list = list_of_libs;
+	while (list) {
+		luaL_libList *nextList = list->next;
+		luaM_free(list);
+		list = nextList;
+	}
 }
 
-void luaL_openlib (struct luaL_reg *l, int32 n)
-{
-  int32 i;
-  lua_open();  /* make sure lua is already open */
-  for (i=0; i<n; i++)
-    lua_register(l[i].name, l[i].func);
-  luaL_addlibtolist(l, n);
+void luaL_openlib(luaL_reg *l, int32 n) {
+	int32 i;
+	lua_open();  // make sure lua is already open
+	for (i = 0; i < n; i++)
+		lua_register(l[i].name, l[i].func);
+	luaL_addlibtolist(l, n);
 }
 
+void luaL_verror(const char *fmt, ...) {
+	char buff[500];
+	va_list argp;
 
-void luaL_verror (const char *fmt, ...)
-{
-  char buff[500];
-  va_list argp;
-  va_start(argp, fmt);
-  vsprintf(buff, fmt, argp);
-  va_end(argp);
-  lua_error(buff);
+	va_start(argp, fmt);
+	vsprintf(buff, fmt, argp);
+	va_end(argp);
+	lua_error(buff);
 }
 

Modified: residual/trunk/engine/lua/lauxlib.h
===================================================================
--- residual/trunk/engine/lua/lauxlib.h	2008-07-28 19:15:36 UTC (rev 33381)
+++ residual/trunk/engine/lua/lauxlib.h	2008-07-28 19:23:08 UTC (rev 33382)
@@ -9,47 +9,47 @@
 #define auxlib_h
 
 
-#include "lua.h"
+#include "engine/lua/lua.h"
 
 
 struct luaL_reg {
-  const char *name;
-  lua_CFunction func;
+	const char *name;
+	lua_CFunction func;
 };
 
 struct luaL_libList {
-  luaL_reg *list;
-  int32 number;
-  luaL_libList *next;
+	luaL_reg *list;
+	int32 number;
+	luaL_libList *next;
 };
 
 extern luaL_libList *list_of_libs;
 
-#define luaL_arg_check(cond,numarg,extramsg) if (!(cond)) \
-                                               luaL_argerror(numarg,extramsg)
+#define luaL_arg_check(cond, numarg, extramsg) if (!(cond)) \
+	luaL_argerror(numarg,extramsg)
+#define luaL_check_string(n)	(luaL_check_lstr((n), NULL))
+#define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL))
 
-void luaL_openlib (struct luaL_reg *l, int32 n);
+void luaL_openlib(luaL_reg *l, int32 n);
 void luaL_addlibtolist(luaL_reg *l, int32 n);
-void luaL_argerror (int32 numarg, const char *extramsg);
-#define luaL_check_string(n)  (luaL_check_lstr((n), NULL))
-const char *luaL_check_lstr (int32 numArg, int32 *len);
-#define luaL_opt_string(n, d) (luaL_opt_lstr((n), (d), NULL))
-const char *luaL_opt_lstr (int32 numArg, const char *def, int32 *len);
-double luaL_check_number (int32 numArg);
-double luaL_opt_number (int32 numArg, double def);
-lua_Object luaL_functionarg (int32 arg);
-lua_Object luaL_tablearg (int32 arg);
-lua_Object luaL_nonnullarg (int32 numArg);
-void luaL_verror (const char *fmt, ...);
-char *luaL_openspace (int32 size);
-void luaL_resetbuffer (void);
-void luaL_addchar (int32 c);
-int32 luaL_getsize (void);
-void luaL_addsize (int32 n);
-int32 luaL_newbuffer (int32 size);
-void luaL_oldbuffer (int32 old);
-char *luaL_buffer (void);
-int32 luaL_findstring (const char *name, const char *list[]);
+void luaL_argerror(int32 numarg, const char *extramsg);
+const char *luaL_check_lstr(int32 numArg, int32 *len);
+const char *luaL_opt_lstr(int32 numArg, const char *def, int32 *len);
+double luaL_check_number(int32 numArg);
+double luaL_opt_number(int32 numArg, double def);
+lua_Object luaL_functionarg(int32 arg);
+lua_Object luaL_tablearg(int32 arg);
+lua_Object luaL_nonnullarg(int32 numArg);
+void luaL_verror(const char *fmt, ...);
+char *luaL_openspace(int32 size);
+void luaL_resetbuffer();
+void luaL_addchar(int32 c);
+int32 luaL_getsize();
+void luaL_addsize(int32 n);
+int32 luaL_newbuffer(int32 size);
+void luaL_oldbuffer(int32 old);
+char *luaL_buffer();
+int32 luaL_findstring(const char *name, const char *list[]);
 
 
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list