mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-27 04:43:52 +01:00
this
This commit is contained in:
@@ -49,6 +49,7 @@ function data_handle(data) end
|
||||
---@param b integer
|
||||
---@param c integer
|
||||
---@param d integer
|
||||
---@return boolean generated
|
||||
---@return integer b
|
||||
---@return integer c
|
||||
---@return integer d
|
||||
|
||||
@@ -643,17 +643,17 @@ void run_lua(char *str, char *cmd_output) {
|
||||
pthread_mutex_unlock(&lua_mutex);
|
||||
}
|
||||
|
||||
int lua_group(RDSGroup* group) {
|
||||
int lua_group(RDSGroup* group, const char grp) {
|
||||
pthread_mutex_lock(&lua_mutex);
|
||||
lua_getglobal(L, "group");
|
||||
|
||||
if (lua_isfunction(L, -1)) {
|
||||
lua_pushstring(L, "L");
|
||||
lua_pushstring(L, &grp);
|
||||
lua_pushinteger(L, group->b);
|
||||
lua_pushinteger(L, group->c);
|
||||
lua_pushinteger(L, group->d);
|
||||
if (lua_pcall(L, 4, 3, 0) == LUA_OK) {
|
||||
if (!lua_isinteger(L, -1)) {
|
||||
if (lua_pcall(L, 4, 4, 0) == LUA_OK) {
|
||||
if (!lua_isboolean(L, -1)) {
|
||||
pthread_mutex_unlock(&lua_mutex);
|
||||
return 0;
|
||||
}
|
||||
@@ -665,10 +665,18 @@ int lua_group(RDSGroup* group) {
|
||||
pthread_mutex_unlock(&lua_mutex);
|
||||
return 0;
|
||||
}
|
||||
group->d = luaL_checkinteger(L, -1);
|
||||
group->c = luaL_checkinteger(L, -2);
|
||||
group->b = luaL_checkinteger(L, -3);
|
||||
lua_pop(L, 2);
|
||||
if (!lua_isinteger(L, -4)) {
|
||||
pthread_mutex_unlock(&lua_mutex);
|
||||
return 0;
|
||||
}
|
||||
if(lua_toboolean(L, -1) == 0) {
|
||||
pthread_mutex_unlock(&lua_mutex);
|
||||
return 0;
|
||||
}
|
||||
group->d = luaL_checkinteger(L, -2);
|
||||
group->c = luaL_checkinteger(L, -3);
|
||||
group->b = luaL_checkinteger(L, -4);
|
||||
lua_pop(L, 3);
|
||||
} else fprintf(stderr, "Lua error: %s at 'group'\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1);
|
||||
} else lua_pop(L, 1);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
void init_lua(RDSModulator* rds_mod);
|
||||
void run_lua(char *str, char *cmd_output);
|
||||
int lua_group(RDSGroup* group);
|
||||
int lua_group(RDSGroup* group, const char grp);
|
||||
void lua_call_function(const char* function);
|
||||
void lua_group_ref(RDSGroup* group, int ref);
|
||||
void destroy_lua();
|
||||
@@ -26,7 +26,7 @@ void get_rds_ertplus_group(RDSEncoder* enc, RDSGroup *group);
|
||||
void get_rds_eon_group(RDSEncoder* enc, RDSGroup *group);
|
||||
uint8_t get_rds_custom_groups(RDSEncoder* enc, RDSGroup *group);
|
||||
uint8_t get_rds_custom_groups2(RDSEncoder* enc, RDSGroup *group);
|
||||
int get_rdsp_lua_group(RDSGroup *group);
|
||||
int get_rdsp_lua_group(RDSGroup *group, const char grp);
|
||||
void get_rds_user_oda_group(RDSEncoder* enc, RDSGroup *group);
|
||||
int get_rds_user_oda_group_content(RDSEncoder* enc, RDSGroup *group);
|
||||
|
||||
@@ -105,11 +105,12 @@ static void get_rds_sequence_group(RDSEncoder* enc, RDSGroup *group, char* grp,
|
||||
get_rds_fasttuning_group(enc, group);
|
||||
break;
|
||||
case 'L':
|
||||
if(get_rdsp_lua_group(group) == 0) get_rds_ps_group(enc, group);
|
||||
if(get_rdsp_lua_group(group, *grp) == 0) get_rds_ps_group(enc, group);
|
||||
break;
|
||||
case 'O':
|
||||
get_rds_user_oda_group(enc, group);
|
||||
break;
|
||||
case 'S':
|
||||
case 'K':
|
||||
if(get_rds_user_oda_group_content(enc, group) == 0) get_rds_ps_group(enc, group);
|
||||
break;
|
||||
|
||||
@@ -343,8 +343,8 @@ uint8_t get_rds_custom_groups2(RDSEncoder* enc, RDSGroup *group) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int get_rdsp_lua_group(RDSGroup *group) {
|
||||
int generated = lua_group(group);
|
||||
int get_rdsp_lua_group(RDSGroup *group, const char grp) {
|
||||
int generated = lua_group(group, grp);
|
||||
if(generated) group->is_type_b = (IS_TYPE_B(group->b) != 0);
|
||||
return generated;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user