[Scummvm-cvs-logs] scummvm master -> c82f1174886b0182683856bef6066da05d2e1715

fingolfin max at quendi.de
Tue May 24 00:21:10 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
94122f7afb SWORD25: Remove unused Lua print stuff
c82f117488 COMMON: Add putc(har) and getc(har) to forbidden symbols


Commit: 94122f7afbcd1226cf4286bf322568d7f2426fc4
    https://github.com/scummvm/scummvm/commit/94122f7afbcd1226cf4286bf322568d7f2426fc4
Author: Max Horn (max at quendi.de)
Date: 2011-05-23T15:19:31-07:00

Commit Message:
SWORD25: Remove unused Lua print stuff

Changed paths:
  R engines/sword25/util/lua/print.cpp
    engines/sword25/module.mk
    engines/sword25/util/lua/lundump.h



diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index 968f21c..e87707d 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -82,7 +82,6 @@ MODULE_OBJS := \
 	util/lua/lundump.o \
 	util/lua/lvm.o \
 	util/lua/lzio.o \
-	util/lua/print.o \
 	util/lua/scummvm_file.o \
 	util/pluto/pdep.o \
 	util/pluto/pluto.o \
diff --git a/engines/sword25/util/lua/lundump.h b/engines/sword25/util/lua/lundump.h
index f791a4f..c293c56 100644
--- a/engines/sword25/util/lua/lundump.h
+++ b/engines/sword25/util/lua/lundump.h
@@ -19,11 +19,6 @@ LUAI_FUNC void luaU_header (char* h);
 /* dump one chunk; from ldump.c */
 LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
 
-#ifdef luac_c
-/* print one chunk; from print.c */
-LUAI_FUNC void luaU_print (const Proto* f, int full);
-#endif
-
 /* for header of binary files -- this is Lua 5.1 */
 #define LUAC_VERSION		0x51
 
diff --git a/engines/sword25/util/lua/print.cpp b/engines/sword25/util/lua/print.cpp
deleted file mode 100644
index 70c6081..0000000
--- a/engines/sword25/util/lua/print.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
-** $Id$
-** print bytecodes
-** See Copyright Notice in lua.h
-*/
-
-// FIXME
-#define FORBIDDEN_SYMBOL_EXCEPTION_printf
-
-#include <ctype.h>
-#include <stdio.h>
-
-#define luac_c
-#define LUA_CORE
-
-#include "ldebug.h"
-#include "lobject.h"
-#include "lopcodes.h"
-#include "lundump.h"
-
-#define PrintFunction	luaU_print
-
-#define Sizeof(x)	((int)sizeof(x))
-#define VOID(p)		((const void*)(p))
-
-static void PrintString(const TString* ts)
-{
- const char* s=getstr(ts);
- size_t i,n=ts->tsv.len;
- putchar('"');
- for (i=0; i<n; i++)
- {
-  int c=s[i];
-  switch (c)
-  {
-   case '"': printf("\\\""); break;
-   case '\\': printf("\\\\"); break;
-   case '\a': printf("\\a"); break;
-   case '\b': printf("\\b"); break;
-   case '\f': printf("\\f"); break;
-   case '\n': printf("\\n"); break;
-   case '\r': printf("\\r"); break;
-   case '\t': printf("\\t"); break;
-   case '\v': printf("\\v"); break;
-   default:	if (isprint((unsigned char)c))
-   			putchar(c);
-		else
-			printf("\\%03u",(unsigned char)c);
-  }
- }
- putchar('"');
-}
-
-static void PrintConstant(const Proto* f, int i)
-{
- const TValue* o=&f->k[i];
- switch (ttype(o))
- {
-  case LUA_TNIL:
-	printf("nil");
-	break;
-  case LUA_TBOOLEAN:
-	printf(bvalue(o) ? "true" : "false");
-	break;
-  case LUA_TNUMBER:
-	printf(LUA_NUMBER_FMT,nvalue(o));
-	break;
-  case LUA_TSTRING:
-	PrintString(rawtsvalue(o));
-	break;
-  default:				/* cannot happen */
-	printf("? type=%d",ttype(o));
-	break;
- }
-}
-
-static void PrintCode(const Proto* f)
-{
- const Instruction* code=f->code;
- int pc,n=f->sizecode;
- for (pc=0; pc<n; pc++)
- {
-  Instruction i=code[pc];
-  OpCode o=GET_OPCODE(i);
-  int a=GETARG_A(i);
-  int b=GETARG_B(i);
-  int c=GETARG_C(i);
-  int bx=GETARG_Bx(i);
-  int sbx=GETARG_sBx(i);
-  int line=getline(f,pc);
-  printf("\t%d\t",pc+1);
-  if (line>0) printf("[%d]\t",line); else printf("[-]\t");
-  printf("%-9s\t",luaP_opnames[o]);
-  switch (getOpMode(o))
-  {
-   case iABC:
-    printf("%d",a);
-    if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b);
-    if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c);
-    break;
-   case iABx:
-    if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx);
-    break;
-   case iAsBx:
-    if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx);
-    break;
-  }
-  switch (o)
-  {
-   case OP_LOADK:
-    printf("\t; "); PrintConstant(f,bx);
-    break;
-   case OP_GETUPVAL:
-   case OP_SETUPVAL:
-    printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-");
-    break;
-   case OP_GETGLOBAL:
-   case OP_SETGLOBAL:
-    printf("\t; %s",svalue(&f->k[bx]));
-    break;
-   case OP_GETTABLE:
-   case OP_SELF:
-    if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); }
-    break;
-   case OP_SETTABLE:
-   case OP_ADD:
-   case OP_SUB:
-   case OP_MUL:
-   case OP_DIV:
-   case OP_POW:
-   case OP_EQ:
-   case OP_LT:
-   case OP_LE:
-    if (ISK(b) || ISK(c))
-    {
-     printf("\t; ");
-     if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-");
-     printf(" ");
-     if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-");
-    }
-    break;
-   case OP_JMP:
-   case OP_FORLOOP:
-   case OP_FORPREP:
-    printf("\t; to %d",sbx+pc+2);
-    break;
-   case OP_CLOSURE:
-    printf("\t; %p",VOID(f->p[bx]));
-    break;
-   case OP_SETLIST:
-    if (c==0) printf("\t; %d",(int)code[++pc]);
-    else printf("\t; %d",c);
-    break;
-   default:
-    break;
-  }
-  printf("\n");
- }
-}
-
-#define SS(x)	(x==1)?"":"s"
-#define S(x)	x,SS(x)
-
-static void PrintHeader(const Proto* f)
-{
- const char* s=getstr(f->source);
- if (*s=='@' || *s=='=')
-  s++;
- else if (*s==LUA_SIGNATURE[0])
-  s="(bstring)";
- else
-  s="(string)";
- printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n",
- 	(f->linedefined==0)?"main":"function",s,
-	f->linedefined,f->lastlinedefined,
-	S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f));
- printf("%d%s param%s, %d slot%s, %d upvalue%s, ",
-	f->numparams,f->is_vararg?"+":"",SS(f->numparams),
-	S(f->maxstacksize),S(f->nups));
- printf("%d local%s, %d constant%s, %d function%s\n",
-	S(f->sizelocvars),S(f->sizek),S(f->sizep));
-}
-
-static void PrintConstants(const Proto* f)
-{
- int i,n=f->sizek;
- printf("constants (%d) for %p:\n",n,VOID(f));
- for (i=0; i<n; i++)
- {
-  printf("\t%d\t",i+1);
-  PrintConstant(f,i);
-  printf("\n");
- }
-}
-
-static void PrintLocals(const Proto* f)
-{
- int i,n=f->sizelocvars;
- printf("locals (%d) for %p:\n",n,VOID(f));
- for (i=0; i<n; i++)
- {
-  printf("\t%d\t%s\t%d\t%d\n",
-  i,getstr(f->locvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1);
- }
-}
-
-static void PrintUpvalues(const Proto* f)
-{
- int i,n=f->sizeupvalues;
- printf("upvalues (%d) for %p:\n",n,VOID(f));
- if (f->upvalues==NULL) return;
- for (i=0; i<n; i++)
- {
-  printf("\t%d\t%s\n",i,getstr(f->upvalues[i]));
- }
-}
-
-void PrintFunction(const Proto* f, int full)
-{
- int i,n=f->sizep;
- PrintHeader(f);
- PrintCode(f);
- if (full)
- {
-  PrintConstants(f);
-  PrintLocals(f);
-  PrintUpvalues(f);
- }
- for (i=0; i<n; i++) PrintFunction(f->p[i],full);
-}


Commit: c82f1174886b0182683856bef6066da05d2e1715
    https://github.com/scummvm/scummvm/commit/c82f1174886b0182683856bef6066da05d2e1715
Author: Max Horn (max at quendi.de)
Date: 2011-05-23T15:19:32-07:00

Commit Message:
COMMON: Add putc(har) and getc(har) to forbidden symbols

Sorry, buildbot...

Changed paths:
    common/forbidden.h



diff --git a/common/forbidden.h b/common/forbidden.h
index f127983..c551110 100644
--- a/common/forbidden.h
+++ b/common/forbidden.h
@@ -125,6 +125,27 @@
 #endif
 
 
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_getc
+#undef getc
+#define getc(a)	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_getchar
+#undef getchar
+#define getchar()	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_putc
+#undef putc
+#define putc(a,b)	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+#ifndef FORBIDDEN_SYMBOL_EXCEPTION_putchar
+#undef putchar
+#define putchar(a)	FORBIDDEN_SYMBOL_REPLACEMENT
+#endif
+
+
 #ifndef FORBIDDEN_SYMBOL_EXCEPTION_setjmp
 #undef setjmp
 #define setjmp(a)	FORBIDDEN_SYMBOL_REPLACEMENT






More information about the Scummvm-git-logs mailing list