diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-10-24 15:17:24 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-10-24 15:17:24 -0200 |
commit | e78cf96c971234ea25e35a9672ef00ea389d843f (patch) | |
tree | 57dc00fb747c26730acb13a087afb9bc7dcd3216 /lfunc.c | |
parent | 0cb38439560fc2b912d41d3116d2d74c030d13af (diff) | |
download | lua-e78cf96c971234ea25e35a9672ef00ea389d843f.tar.gz lua-e78cf96c971234ea25e35a9672ef00ea389d843f.tar.bz2 lua-e78cf96c971234ea25e35a9672ef00ea389d843f.zip |
first version of Cclosures.
Diffstat (limited to 'lfunc.c')
-rw-r--r-- | lfunc.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 1.3 1997/10/16 10:59:34 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 1.4 1997/10/23 16:26:37 roberto Exp roberto $ |
3 | ** Lua Funcion auxiliar | 3 | ** Lua Funcion auxiliar |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -23,10 +23,20 @@ Closure *luaF_newclosure (int nelems) | |||
23 | Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); | 23 | Closure *c = (Closure *)luaM_malloc(sizeof(Closure)+nelems*sizeof(TObject)); |
24 | luaO_insertlist(&luaF_rootcl, (GCnode *)c); | 24 | luaO_insertlist(&luaF_rootcl, (GCnode *)c); |
25 | luaO_nblocks += gcsizeclosure(c); | 25 | luaO_nblocks += gcsizeclosure(c); |
26 | c->nelems = nelems; | ||
26 | return c; | 27 | return c; |
27 | } | 28 | } |
28 | 29 | ||
29 | 30 | ||
31 | void luaF_simpleclosure (TObject *o) | ||
32 | { | ||
33 | Closure *c = luaF_newclosure(0); | ||
34 | c->consts[0] = *o; | ||
35 | ttype(o) = LUA_T_FUNCTION; | ||
36 | clvalue(o) = c; | ||
37 | } | ||
38 | |||
39 | |||
30 | TProtoFunc *luaF_newproto (void) | 40 | TProtoFunc *luaF_newproto (void) |
31 | { | 41 | { |
32 | TProtoFunc *f = luaM_new(TProtoFunc); | 42 | TProtoFunc *f = luaM_new(TProtoFunc); |