- Timestamp:
- 06/13/10 15:52:27 (3 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
core/conf.c (modified) (1 diff)
-
core/luascript.c (modified) (2 diffs)
-
include/conf.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/conf.c
r305 r335 629 629 630 630 //------------------------------------------------------------------- 631 int conf_getValue(unsigned short id, int _default) { 632 unsigned short i; 633 int ret=_default; 634 for(i=0; i<CONF_NUM; ++i) { 635 if(conf_info[i].id==id && conf_info[i].type==CONF_DEF_VALUE) { 636 ret=*(int*)conf_info[i].var; 637 break; 638 } 639 } 640 return ret; 641 } 642 643 //------------------------------------------------------------------- 644 int conf_setValue(unsigned short id, int value) { 645 unsigned short i; 646 int ret=0; 647 for(i=0; i<CONF_NUM; ++i) { 648 if(conf_info[i].id==id && conf_info[i].type==CONF_DEF_VALUE) { 649 *(int*)conf_info[i].var=value; 650 ret=1; 651 break; 652 } 653 } 654 return ret; 655 } 656 657 //------------------------------------------------------------------- -
trunk/core/luascript.c
r305 r335 1324 1324 1325 1325 #endif // OPT_LUA_CALL_NATIVE 1326 1326 1327 static int luaCB_get_config_value( lua_State* L ) { 1328 unsigned int argc = lua_gettop(L); 1329 unsigned int id; 1330 int _default; 1331 1332 if(argc>=2) { 1333 id=luaL_checknumber(L,1); 1334 _default=luaL_checknumber(L,2); 1335 lua_pushnumber(L, conf_getValue(id,_default)); 1336 } else lua_pushnil(L); 1337 return 1; 1338 } 1339 1340 static int luaCB_set_config_value( lua_State* L ) { 1341 unsigned int argc = lua_gettop(L); 1342 unsigned int id; 1343 int value; 1344 1345 if(argc>=2) { 1346 id=luaL_checknumber(L,1); 1347 value=luaL_checknumber(L,2); 1348 lua_pushboolean(L, conf_setValue(id,value)); 1349 } else lua_pushboolean(L,0); 1350 return 1; 1351 } 1352 1353 1327 1354 void register_lua_funcs( lua_State* L ) 1328 1355 { … … 1489 1516 FUNC(call_func_ptr); 1490 1517 #endif 1491 } 1518 FUNC(get_config_value); 1519 FUNC(set_config_value); 1520 } -
trunk/include/conf.h
r305 r335 311 311 extern int shutter_int; 312 312 extern void conf_change_dng(void); 313 extern int conf_getValue(unsigned short id, int _default); 314 extern int conf_setValue(unsigned short id, int value); 313 315 314 316 // reyalp: putting these in conf, since the conf values are lookups for them
Note: See TracChangeset
for help on using the changeset viewer.