From 8e7451512f01a89b4230be65cf086f7c1d41d2e2 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 14 Oct 1999 17:46:57 -0200 Subject: [PATCH] some more `const's --- ldo.c | 7 ++++--- ldo.h | 4 ++-- lfunc.c | 5 +++-- lfunc.h | 5 +++-- lvm.c | 6 +++--- lvm.h | 4 ++-- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ldo.c b/ldo.c index 788cfedb..2bbfdd5f 100644 --- a/ldo.c +++ b/ldo.c @@ -1,5 +1,5 @@ /* -** $Id: ldo.c,v 1.48 1999/10/04 17:51:04 roberto Exp roberto $ +** $Id: ldo.c,v 1.49 1999/10/14 17:53:35 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -101,7 +101,7 @@ void luaD_lineHook (int line) { } -void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn) { +void luaD_callHook (StkId base, const TProtoFunc *tf, int isreturn) { struct C_Lua_Stack oldCLS = L->Cstack; StkId old_top = L->Cstack.lua2C = L->Cstack.base = L->stack.top-L->stack.stack; L->Cstack.num = 0; @@ -143,7 +143,8 @@ static StkId callC (lua_CFunction f, StkId base) { } -static StkId callCclosure (struct Closure *cl, lua_CFunction f, StkId base) { +static StkId callCclosure (const struct Closure *cl, + lua_CFunction f, StkId base) { TObject *pbase; int nup = cl->nelems; /* number of upvalues */ luaD_checkstack(nup); diff --git a/ldo.h b/ldo.h index 5deb5005..f3f19cd8 100644 --- a/ldo.h +++ b/ldo.h @@ -1,5 +1,5 @@ /* -** $Id: ldo.h,v 1.7 1999/08/16 20:52:00 roberto Exp roberto $ +** $Id: ldo.h,v 1.8 1999/10/04 17:51:04 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -34,7 +34,7 @@ void luaD_init (void); void luaD_adjusttop (StkId newtop); void luaD_openstack (int nelems); void luaD_lineHook (int line); -void luaD_callHook (StkId base, TProtoFunc *tf, int isreturn); +void luaD_callHook (StkId base, const TProtoFunc *tf, int isreturn); void luaD_calln (int nArgs, int nResults); void luaD_callTM (const TObject *f, int nParams, int nResults); int luaD_protectedrun (void); diff --git a/lfunc.c b/lfunc.c index ea8a9a42..fc97c0a3 100644 --- a/lfunc.c +++ b/lfunc.c @@ -1,5 +1,5 @@ /* -** $Id: lfunc.c,v 1.11 1999/08/16 20:52:00 roberto Exp roberto $ +** $Id: lfunc.c,v 1.12 1999/10/04 17:51:04 roberto Exp roberto $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -62,7 +62,8 @@ void luaF_freeclosure (Closure *c) { ** Look for n-th local variable at line "line" in function "func". ** Returns NULL if not found. */ -const char *luaF_getlocalname (TProtoFunc *func, int local_number, int line) { +const char *luaF_getlocalname (const TProtoFunc *func, + int local_number, int line) { int count = 0; const char *varname = NULL; LocVar *lv = func->locvars; diff --git a/lfunc.h b/lfunc.h index f4109dc1..5681db43 100644 --- a/lfunc.h +++ b/lfunc.h @@ -1,5 +1,5 @@ /* -** $Id: lfunc.h,v 1.6 1999/08/16 20:52:00 roberto Exp roberto $ +** $Id: lfunc.h,v 1.7 1999/10/04 17:51:04 roberto Exp roberto $ ** Lua Function structures ** See Copyright Notice in lua.h */ @@ -17,7 +17,8 @@ Closure *luaF_newclosure (int nelems); void luaF_freeproto (TProtoFunc *f); void luaF_freeclosure (Closure *c); -const char *luaF_getlocalname (TProtoFunc *func, int local_number, int line); +const char *luaF_getlocalname (const TProtoFunc *func, + int local_number, int line); #endif diff --git a/lvm.c b/lvm.c index 69044464..a2bb09e4 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.62 1999/09/17 16:53:54 roberto Exp roberto $ +** $Id: lvm.c,v 1.63 1999/10/14 19:13:31 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -35,7 +35,7 @@ -static TaggedString *strconc (TaggedString *l, TaggedString *r) { +static TaggedString *strconc (const TaggedString *l, const TaggedString *r) { long nl = l->u.s.len; long nr = r->u.s.len; char *buffer = luaL_openspace(nl+nr); @@ -296,7 +296,7 @@ static void adjust_varargs (StkId first_extra_arg) { ** [stack+base,top). Returns n such that the the results are between ** [stack+n,top). */ -StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base) { +StkId luaV_execute (const Closure *cl, const TProtoFunc *tf, StkId base) { struct Stack *S = &L->stack; /* to optimize */ register const Byte *pc = tf->code; const TObject *consts = tf->consts; diff --git a/lvm.h b/lvm.h index a0a3fc51..bef28ba8 100644 --- a/lvm.h +++ b/lvm.h @@ -1,5 +1,5 @@ /* -** $Id: lvm.h,v 1.8 1999/02/08 17:07:59 roberto Exp roberto $ +** $Id: lvm.h,v 1.9 1999/08/16 20:52:00 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -26,7 +26,7 @@ void luaV_settable (const TObject *t); void luaV_rawsettable (const TObject *t); void luaV_getglobal (TaggedString *ts); void luaV_setglobal (TaggedString *ts); -StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base); +StkId luaV_execute (const Closure *cl, const TProtoFunc *tf, StkId base); void luaV_closure (int nelems); void luaV_comparison (lua_Type ttype_less, lua_Type ttype_equal, lua_Type ttype_great, IMS op);