diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-04-22 15:00:37 -0300 |
commit | 0ef5cf22891c9d34a88ccc5d89eb0ed82b004471 (patch) | |
tree | 1a095acefa978d5a41f32ff7d0fef58a642aa66c /lua.h | |
parent | fed9408ab51a4be5ff84450ad47d1e0cdaed97bc (diff) | |
download | lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.gz lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.tar.bz2 lua-0ef5cf22891c9d34a88ccc5d89eb0ed82b004471.zip |
lock mechanism seperseded by the REFERENCE mechanism.
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -2,7 +2,7 @@ | |||
2 | ** LUA - Linguagem para Usuarios de Aplicacao | 2 | ** LUA - Linguagem para Usuarios de Aplicacao |
3 | ** Grupo de Tecnologia em Computacao Grafica | 3 | ** Grupo de Tecnologia em Computacao Grafica |
4 | ** TeCGraf - PUC-Rio | 4 | ** TeCGraf - PUC-Rio |
5 | ** $Id: lua.h,v 3.24 1996/03/19 22:28:37 roberto Exp roberto $ | 5 | ** $Id: lua.h,v 3.25 1996/03/21 21:30:29 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
@@ -80,17 +80,20 @@ lua_Object lua_getsubscript (void); | |||
80 | 80 | ||
81 | int lua_type (lua_Object object); | 81 | int lua_type (lua_Object object); |
82 | 82 | ||
83 | int lua_lock (void); | 83 | |
84 | lua_Object lua_getlocked (int ref); | 84 | typedef int lua_Reference; |
85 | void lua_pushlocked (int ref); | 85 | |
86 | void lua_unlock (int ref); | 86 | lua_Reference lua_ref (int lock); |
87 | lua_Object lua_getref (lua_Reference ref); | ||
88 | void lua_pushref (lua_Reference ref); | ||
89 | void lua_unref (lua_Reference ref); | ||
87 | 90 | ||
88 | lua_Object lua_createtable (void); | 91 | lua_Object lua_createtable (void); |
89 | 92 | ||
90 | 93 | ||
91 | /* some useful macros */ | 94 | /* some useful macros */ |
92 | 95 | ||
93 | #define lua_lockobject(o) (lua_pushobject(o), lua_lock()) | 96 | #define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l)) |
94 | 97 | ||
95 | #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n)) | 98 | #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n)) |
96 | 99 | ||
@@ -99,6 +102,12 @@ lua_Object lua_createtable (void); | |||
99 | 102 | ||
100 | /* for compatibility with old versions. Avoid using these macros */ | 103 | /* for compatibility with old versions. Avoid using these macros */ |
101 | 104 | ||
105 | #define lua_lockobject(o) lua_refobject(o,1) | ||
106 | #define lua_lock() lua_ref(1) | ||
107 | #define lua_getlocked lua_getref | ||
108 | #define lua_pushlocked lua_pushref | ||
109 | #define lua_unlock lua_unref | ||
110 | |||
102 | #define lua_pushliteral(o) lua_pushstring(o) | 111 | #define lua_pushliteral(o) lua_pushstring(o) |
103 | 112 | ||
104 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript()) | 113 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript()) |