📄 values.c
字号:
/*************************************************************************** values.c - Outsourced functions to change the values ------------------- begin : 2003-04-01 authors : Linus Gasser emails : linus.gasser@epfl.ch ***************************************************************************//*************************************************************************** Changes ------- date - name - description 03/05/07 - ineiti - added checking of type with swr_sdb_[gs]et_(config|stats)* 03/07/24 - ineiti - added SYMBOL_COMPLEX **************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#define DBG_LVL 4#include "system.h"#include "sdb.h"#include "debugging.h"#define GET_VAL_STATS(id,name,t,offset,type) {\ int param; \ t value; \ param = swr_sdb_get_stats_parameter_nbr( id, name ) + offset; \ if ( param < 0 ){ \ PR_DBG( 1, "No such stats-parameter. sdb-id:%i, name:%s\n", id, name ); \ memset( &value, 0, sizeof( t ) ); \ return value; \ } \ if ( swr_sdb_get_stats_parameter_type( id, param ) != type ){ \ PR_DBG( 0, "Type %i instead of %i in sdb-id:%i, name:%s\n", \ type, swr_sdb_get_stats_parameter_type( id, param ), \ id, name ); \ memset( &value, 0, sizeof( t ) ); \ return value; \ } \ swr_sdb_get_stats_parameter_value( id, param, &value ); \ return value; \}#define GET_VAL_CONFIG(id,name,t,offset,type) {\ int param; \ t value; \ param = swr_sdb_get_config_parameter_nbr( id, name ) + offset; \ if ( param < 0 ){ \ PR_DBG( 1, "No such config-parameter. sdb-id:%i, name:%s\n", id, name ); \ memset( &value, 0, sizeof( t ) ); \ return value; \ } \ if ( swr_sdb_get_config_parameter_type( id, param ) != type ){ \ PR_DBG( 0, "Type %i instead of %i in sdb-id:%i, name:%s\n", \ type, swr_sdb_get_config_parameter_type( id, param ), \ id, name ); \ memset( &value, 0, sizeof( t ) ); \ return value; \ } \ swr_sdb_get_config_parameter_value( id, param, &value ); \ return value; \}#define SET_VAL_STATS(id,name,value,offset,type) {\ int param; \ param = swr_sdb_get_stats_parameter_nbr( id, name ) + offset; \ if ( param < 0 ){ \ PR_DBG( 1, "No such stats-parameter. sdb-id:%i, name:%s\n", id, name ); \ return -1; \ } \ if ( swr_sdb_get_stats_parameter_type( id, param ) != type ){ \ PR_DBG( 0, "Type %i instead of %i in sdb-id:%i, name:%s\n", \ type, swr_sdb_get_stats_parameter_type( id, param ), \ id, name); \ return -1; \ } \ return swr_sdb_set_stats_parameter_value( id, param, &value ); \}#define SET_VAL_CONFIG(id,name,value,offset,type) {\ int param; \ param = swr_sdb_get_config_parameter_nbr( id, name ) + offset; \ if ( param < 0 ){ \ PR_DBG( 1, "No such config-parameter. sdb-id:%i, name:%s\n", id, name ); \ return -1; \ } \ if ( swr_sdb_get_config_parameter_type( id, param ) != type ){ \ PR_DBG( 0, "Type %i instead of %i in sdb-id:%i, name:%s\n", \ type, swr_sdb_get_config_parameter_type( id, param ), \ id, name ); \ return -1; \ } \ return swr_sdb_set_config_parameter_value( id, param, &value ); \}/** * short Gets a config/stats pointer,int,double */void* swr_sdb_get_config_pointer( swr_sdb_id id, char *name ) { GET_VAL_CONFIG(id,name,void*,0,POINTER);}int swr_sdb_get_config_int( swr_sdb_id id, char *name ) { GET_VAL_CONFIG(id,name,int,0,INT);}double swr_sdb_get_config_double( swr_sdb_id id, char *name ) { GET_VAL_CONFIG(id,name,double,0,DOUBLE);}complex double swr_sdb_get_config_complex( swr_sdb_id id, char *name ) { GET_VAL_CONFIG(id,name,complex double,0,DOUBLE_COMPLEX);}SYMBOL_COMPLEX swr_sdb_get_config_symbol( swr_sdb_id id, char *name ) { GET_VAL_CONFIG(id,name,SYMBOL_COMPLEX,0,COMPLEX);}void* swr_sdb_get_stats_pointer( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,void*,0,POINTER);}int swr_sdb_get_stats_int( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,int,0,INT);}complex double swr_sdb_get_stats_complex( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,complex double,0,DOUBLE_COMPLEX);}double swr_sdb_get_stats_double( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,double,0,DOUBLE);}block_t swr_sdb_get_stats_block( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,block_t,0,BLOCK);}image_t swr_sdb_get_stats_image( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,image_t,0,IMAGE);}SYMBOL_COMPLEX swr_sdb_get_stats_symbol( swr_sdb_id id, char *name ) { GET_VAL_STATS(id,name,SYMBOL_COMPLEX,0,COMPLEX);}/** * short Sets a config/stats pointer,int,double */int swr_sdb_set_config_pointer( swr_sdb_id id, char *name, void *value ) { SET_VAL_CONFIG(id,name,value,0,POINTER);}int swr_sdb_set_config_int( swr_sdb_id id, char *name, int value ) { SET_VAL_CONFIG(id,name,value,0,INT);}int swr_sdb_set_config_complex( swr_sdb_id id, char *name, complex double value ) { SET_VAL_CONFIG(id,name,value,0,DOUBLE_COMPLEX);}int swr_sdb_set_config_double( swr_sdb_id id, char *name, double value ) { SET_VAL_CONFIG(id,name,value,0,DOUBLE);}int swr_sdb_set_config_symbol( swr_sdb_id id, char *name, SYMBOL_COMPLEX value ) { SET_VAL_CONFIG(id,name,value,0,COMPLEX);}int swr_sdb_set_stats_pointer( swr_sdb_id id, char *name, void *value ) { SET_VAL_STATS(id,name,value,0,POINTER);}int swr_sdb_set_stats_int( swr_sdb_id id, char *name, int value ) { SET_VAL_STATS(id,name,value,0,INT);}int swr_sdb_set_stats_complex( swr_sdb_id id, char *name, complex double value ) { SET_VAL_STATS(id,name,value,0,DOUBLE_COMPLEX);}int swr_sdb_set_stats_double( swr_sdb_id id, char *name, double value ) { SET_VAL_STATS(id,name,value,0,DOUBLE);}int swr_sdb_set_stats_symbol( swr_sdb_id id, char *name, SYMBOL_COMPLEX value ) { SET_VAL_STATS(id,name,value,0,COMPLEX);}/** * short Gets a config/stats pointer,int,double with an offset */void* swr_sdb_get_config_pointer_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_CONFIG(id,name,void*,offset,POINTER);}int swr_sdb_get_config_int_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_CONFIG(id,name,int,offset,INT);}double swr_sdb_get_config_double_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_CONFIG(id,name,double,offset,DOUBLE);}complex double swr_sdb_get_config_complex_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_CONFIG(id,name,double,offset,DOUBLE_COMPLEX);}SYMBOL_COMPLEX swr_sdb_get_config_symbol_array( swr_sdb_id id, char *name, int offset) { GET_VAL_CONFIG(id,name,SYMBOL_COMPLEX,offset,COMPLEX);}void* swr_sdb_get_stats_pointer_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_STATS(id,name,void*,offset,POINTER);}int swr_sdb_get_stats_int_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_STATS(id,name,int,offset,INT);}double swr_sdb_get_stats_double_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_STATS(id,name,double,offset,DOUBLE);}complex double swr_sdb_get_stats_complex_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_STATS(id,name,double,offset,DOUBLE_COMPLEX);}SYMBOL_COMPLEX swr_sdb_get_stats_symbol_array( swr_sdb_id id, char *name, int offset ) { GET_VAL_STATS(id,name,SYMBOL_COMPLEX,offset,COMPLEX);}/** * short Sets a config/stats pointer,int,double with an offset */int swr_sdb_set_config_pointer_array( swr_sdb_id id, char *name, int offset, void *value ) { SET_VAL_CONFIG(id,name,value,offset,POINTER);}int swr_sdb_set_config_int_array( swr_sdb_id id, char *name, int offset, int value ) { SET_VAL_CONFIG(id,name,value,offset,INT);}int swr_sdb_set_config_double_array( swr_sdb_id id, char *name, int offset, double value ) { SET_VAL_CONFIG(id,name,value,offset,DOUBLE);}int swr_sdb_set_config_complex_array( swr_sdb_id id, char *name, int offset, complex double value ) { SET_VAL_CONFIG(id,name,value,offset,DOUBLE_COMPLEX);}int swr_sdb_set_config_symbol_array( swr_sdb_id id, char *name, int offset, SYMBOL_COMPLEX value ) { SET_VAL_CONFIG(id,name,value,offset,COMPLEX);}int swr_sdb_set_stats_pointer_array( swr_sdb_id id, char *name, int offset, void *value ) { SET_VAL_STATS(id,name,value,offset,POINTER);}int swr_sdb_set_stats_int_array( swr_sdb_id id, char *name, int offset, int value ) { SET_VAL_STATS(id,name,value,offset,INT);}int swr_sdb_set_stats_double_array( swr_sdb_id id, char *name, int offset, double value ) { SET_VAL_STATS(id,name,value,offset,DOUBLE);}int swr_sdb_set_stats_complex_array( swr_sdb_id id, char *name, int offset, complex double value ) { SET_VAL_STATS(id,name,value,offset,DOUBLE_COMPLEX);}int swr_sdb_set_stats_symbol_array( swr_sdb_id id, char *name, int offset, SYMBOL_COMPLEX value ) { SET_VAL_STATS(id,name,value,offset,COMPLEX);}EXPORT_SYMBOL(swr_sdb_get_config_int);EXPORT_SYMBOL(swr_sdb_get_config_complex);EXPORT_SYMBOL(swr_sdb_get_config_double);EXPORT_SYMBOL(swr_sdb_get_config_pointer);EXPORT_SYMBOL(swr_sdb_get_config_symbol);EXPORT_SYMBOL(swr_sdb_get_stats_int);EXPORT_SYMBOL(swr_sdb_get_stats_complex);EXPORT_SYMBOL(swr_sdb_get_stats_double);EXPORT_SYMBOL(swr_sdb_get_stats_pointer);EXPORT_SYMBOL(swr_sdb_get_stats_block);EXPORT_SYMBOL(swr_sdb_get_stats_image);EXPORT_SYMBOL(swr_sdb_get_stats_symbol);EXPORT_SYMBOL(swr_sdb_set_config_int);EXPORT_SYMBOL(swr_sdb_set_config_pointer);EXPORT_SYMBOL(swr_sdb_set_config_complex);EXPORT_SYMBOL(swr_sdb_set_config_double);EXPORT_SYMBOL(swr_sdb_set_config_symbol);EXPORT_SYMBOL(swr_sdb_set_stats_int);EXPORT_SYMBOL(swr_sdb_set_stats_complex);EXPORT_SYMBOL(swr_sdb_set_stats_double);EXPORT_SYMBOL(swr_sdb_set_stats_pointer);EXPORT_SYMBOL(swr_sdb_set_stats_symbol);EXPORT_SYMBOL(swr_sdb_get_config_int_array);EXPORT_SYMBOL(swr_sdb_get_config_double_array);EXPORT_SYMBOL(swr_sdb_get_config_complex_array);EXPORT_SYMBOL(swr_sdb_get_config_symbol_array);EXPORT_SYMBOL(swr_sdb_get_config_pointer_array);EXPORT_SYMBOL(swr_sdb_get_stats_int_array);EXPORT_SYMBOL(swr_sdb_get_stats_double_array);EXPORT_SYMBOL(swr_sdb_get_stats_complex_array);EXPORT_SYMBOL(swr_sdb_get_stats_symbol_array);EXPORT_SYMBOL(swr_sdb_get_stats_pointer_array);EXPORT_SYMBOL(swr_sdb_set_config_int_array);EXPORT_SYMBOL(swr_sdb_set_config_double_array);EXPORT_SYMBOL(swr_sdb_set_config_complex_array);EXPORT_SYMBOL(swr_sdb_set_config_symbol_array);EXPORT_SYMBOL(swr_sdb_set_config_pointer_array);EXPORT_SYMBOL(swr_sdb_set_stats_int_array);EXPORT_SYMBOL(swr_sdb_set_stats_double_array);EXPORT_SYMBOL(swr_sdb_set_stats_complex_array);EXPORT_SYMBOL(swr_sdb_set_stats_symbol_array);EXPORT_SYMBOL(swr_sdb_set_stats_pointer_array);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -