00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _RA_PRIV_H
00020 #define _RA_PRIV_H
00021
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025
00026
00027 #include <libintl.h>
00028 #define _(String) gettext (String)
00029 #define gettext_noop(String) String
00030 #define N_(String) gettext_noop (String)
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include <ra_defines.h>
00040
00041
00042 #include <ra_eval.h>
00043
00044 #include <ra_pl_comm.h>
00045
00046
00047
00048
00049
00050
00051 extern int ra_print_debug_infos;
00052
00053
00054 #define MAX_I18N_LEN 250
00055 extern char ra_i18n_codeset[MAX_I18N_LEN];
00056
00057
00058
00059
00060 #define LOAD_PLUGIN_FUNC "load_ra_plugin"
00061 #define INIT_PLUGIN_FUNC "init_ra_plugin"
00062 #define FINI_PLUGIN_FUNC "fini_ra_plugin"
00063
00064
00065 #define LICENSE_GPL 0
00066 #define LICENSE_LGPL 1
00067 #define LICENSE_PROPRIETARY 2
00068 #define LICENSE_NOT_CHOOSEN 3
00069
00070 #define _ra_set_error(h, nr, str) _ra_set_error_int(h, nr, str, __FILE__, __LINE__)
00071
00072
00073
00074
00075 struct librasch;
00076 struct ra_meas;
00077
00089 struct ra_rec
00090 {
00091 unsigned short handle_id;
00092
00093 struct ra_rec *next;
00094 struct ra_rec *prev;
00095 struct ra_rec *child;
00096 struct ra_rec *parent;
00097
00098 struct ra_meas *meas;
00099
00100 void *private_data;
00101 };
00102
00103
00111 struct ra_session
00112 {
00113 char name[RA_VALUE_NAME_MAX];
00114 char desc[RA_VALUE_DESC_MAX];
00115
00116 struct ra_rec *root_rec;
00117 };
00118
00119
00128 struct find_meas
00129 {
00130 unsigned short handle_id;
00131
00132 int num;
00133 int curr;
00134
00135 char **names;
00136 };
00137
00138
00159 struct plugin_infos
00160 {
00161 char name[RA_VALUE_NAME_MAX];
00162 char desc[RA_VALUE_DESC_MAX];
00163 char file[MAX_PATH_RA];
00164
00165 int use_plugin;
00166
00167 unsigned long type;
00168
00169 char version[10];
00170 char build_ts[50];
00171 int license;
00172
00173 long num_options;
00174 struct ra_option_infos *opt;
00175
00176 long num_results;
00177 struct ra_result_infos *res;
00178
00179 long num_create_class;
00180 struct ra_auto_create_class *create_class;
00181
00182 long num_create_prop;
00183 struct ra_auto_create_prop *create_prop;
00184 };
00185
00186
00219 struct plugin_access_func
00220 {
00221
00222 int (*check_meas) (const char *name);
00223
00224 int (*find_meas) (const char *dir, struct find_meas * f);
00225
00226 meas_handle (*open_meas) (ra_handle ra, const char *name);
00227 meas_handle (*new_meas) (const char *dir, const char *name);
00228 int (*save_meas) (meas_handle mh);
00229 int (*close_meas) (meas_handle mh);
00230
00231 int (*get_info_id) (any_handle h, int id, value_handle vh);
00232 int (*get_info_idx) (any_handle h, int info_type, int idx, value_handle vh);
00233
00234 int (*set_info) (any_handle h, value_handle vh);
00235
00236 rec_handle (*rec_add)(meas_handle mh, rec_handle parent);
00237 int (*dev_add)(rec_handle rh);
00238 int (*ch_add)(rec_handle rh);
00239
00240 int (*session_new)(meas_handle mh);
00241
00242 size_t(*add_raw)(meas_handle mh, int channel, value_handle vh);
00243
00244 size_t(*get_raw) (meas_handle mh, rec_handle rh, int ch, size_t start, size_t num_data, DWORD *data, DWORD *data_high);
00245 size_t(*get_raw_unit) (meas_handle mh, rec_handle rh, int ch, size_t start, size_t num_data, double *data);
00246
00247 int (*get_eval_info)(meas_handle mh, value_handle vh_name, value_handle vh_desc);
00248 long (*get_class_num)(meas_handle mh);
00249 int (*get_class_info)(meas_handle mh, long class_num, value_handle vh_id, value_handle vh_name, value_handle vh_desc);
00250 long (*get_prop_num)(class_handle clh);
00251 int (*get_prop_info)(class_handle clh, long prop_num, value_handle vh_id, value_handle vh_type,
00252 value_handle vh_len, value_handle vh_name, value_handle vh_desc, value_handle vh_unit,
00253 value_handle vh_use_minmax, value_handle vh_min, value_handle vh_max);
00254 int (*get_ev_info)(prop_handle ph, value_handle vh_start, value_handle vh_end);
00255 int (*get_ev_value)(prop_handle ph, long event, value_handle vh_value, value_handle vh_ch);
00256
00257 long (*get_sum_num)(class_handle clh);
00258 int (*get_sum_info)(class_handle clh, long sum_num, value_handle vh_id, value_handle vh_ch,
00259 value_handle vh_name, value_handle vh_desc);
00260 int (*get_sum_ch_info)(class_handle clh, long sum_num, long ch, value_handle vh_fid_offset,
00261 value_handle vh_dim_unit, value_handle vh_dim_name);
00262 int (*get_sum_events)(sum_handle sh, value_handle vh_events);
00263 int (*get_sum_part_data)(sum_handle sh, long ch, long dim, value_handle vh);
00264 };
00265
00266
00275 struct plugin_process_func
00276 {
00277 int (*get_info_id) (int id, value_handle vh);
00278
00279 proc_handle (*get_proc_handle)(plugin_handle pl);
00280 void (*free_proc_handle)(proc_handle proc);
00281
00282 int (*do_processing)(proc_handle proc);
00283 };
00284
00285
00293 struct plugin_view_func
00294 {
00295 int (*check_channels) (rec_handle rh, long ch);
00296 int (*check_plugin_usage) (const char *pl_name);
00297
00298 int (*get_view) (view_handle vh);
00299 };
00300
00301
00319 struct plugin_struct
00320 {
00321 unsigned short handle_id;
00322
00323 struct plugin_struct *next;
00324 struct plugin_struct *prev;
00325 void *dl;
00326
00327 ra_handle ra;
00328
00329 struct plugin_infos info;
00330
00331
00332 struct plugin_access_func access;
00333 struct plugin_process_func proc;
00334 struct plugin_view_func view;
00335
00336
00337
00338 int (*call_gui) (any_handle h);
00339
00340
00341 void (*handle_signal) (meas_handle mh, dest_handle dh, const char *sig_name, int num_para, struct comm_para * p);
00342
00343
00344
00345 int (*set_option) (proc_handle proc, char *opt_name, value_handle vh);
00346 int (*get_option) (proc_handle proc, char *opt_name, value_handle vh);
00347 };
00348
00349
00355 struct plugin_helpers
00356 {
00357 struct plugin_struct *(*get_plugin)(struct librasch *ra, const char *name);
00358 };
00359
00360
00367 struct config_info
00368 {
00369 char plugin_dir[MAX_PATH_RA];
00370 char po_dir[MAX_PATH_RA];
00371 };
00372
00373
00386 struct librasch
00387 {
00388 unsigned short handle_id;
00389
00390 struct config_info config;
00391 struct plugin_struct *pl_head;
00392 struct plugin_helpers hf;
00393
00394
00395
00396
00397 long error_number;
00398
00399
00400 char *error_from;
00401 long err_number_lib;
00402 char *err_desc_lib;
00403 };
00404
00405
00413 struct eval_info
00414 {
00415 char filename[MAX_PATH_RA];
00416
00417 struct eval_attribute *attribute;
00418
00419 struct eval *evaluations;
00420 };
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00447 struct ra_meas
00448 {
00449 unsigned short handle_id;
00450
00451 struct librasch *ra;
00452
00453 struct plugin_struct *p;
00454
00455
00456 void *priv;
00457
00458 int num_sessions;
00459 struct ra_session *sessions;
00460
00461 struct eval_info eval;
00462
00463 struct plugin_comm plc;
00464
00465
00466
00467
00468 long num_ch;
00469 double *x_scale;
00470 double max_samplerate;
00471 };
00472
00473
00474
00475
00485 struct ra_option_infos
00486 {
00487 char *name;
00488 char *desc;
00489 long type;
00490 long offset;
00491
00492
00493
00494 long num_offset;
00495 };
00496
00497
00506 struct ra_result_infos
00507 {
00508 char *name;
00509 char *desc;
00510 int type;
00511 int def;
00512 };
00513
00514
00530 struct proc_info
00531 {
00532 unsigned short handle_id;
00533
00534 plugin_handle plugin;
00535
00536 ra_handle ra;
00537 meas_handle mh;
00538 rec_handle rh;
00539
00540 void (*callback) (const char *text, int percent);
00541
00542 long num_options;
00543 void *options;
00544
00545 long num_result_sets;
00546 long num_results;
00547 value_handle *results;
00548 };
00549
00550
00551
00552
00553
00554 LIBRAAPI void _ra_set_error_int(any_handle h, long error, const char *error_from, const char *src_file, int src_line);
00555
00556 LIBRAAPI int ra_eval_save_result(eval_handle eh, class_handle clh, prop_handle ph, proc_handle proc, long res_set);
00557
00558 void get_error_text(long err, char *text, int len);
00559
00560 void get_error_text_ra(long err, char *text, int len);
00561
00562 void set_endian_type();
00563 LIBRAAPI int get_endian_type();
00564
00565 void init_i18n(struct librasch *ra);
00566 LIBRAAPI int local_to_utf8(const char *src, char *dest, size_t dest_size);
00567 LIBRAAPI int local_to_utf8_inplace(char *string, size_t buf_size);
00568 LIBRAAPI int utf8_to_local(const char *src, char *dest, size_t dest_size);
00569 LIBRAAPI int utf8_to_local_inplace(char *string, size_t buf_size);
00570
00571 int read_config(struct librasch *ra);
00572 void init_config(struct config_info *conf);
00573 #ifdef WIN32
00574 int read_win32_registry(struct librasch *ra);
00575 #endif
00576 int find_config_file(char *fn);
00577 int read_modules(struct librasch *ra);
00578 int dload_module(struct librasch *ra, char *file);
00579 void close_modules(struct librasch *ra);
00580 struct plugin_struct *get_plugin(struct librasch *ra, int index);
00581 struct plugin_struct *get_plugin_by_name(struct librasch *r, const char *name);
00582 int calc_x_scales(struct ra_meas *meas);
00583
00584 int check_handle_type(any_handle h, int id);
00585 int get_lib_info(ra_handle ra, int id, value_handle vh);
00586 int get_plugin_info(plugin_handle pl, int id, value_handle vh);
00587 int get_meas_general_info(meas_handle meas, int id, value_handle vh);
00588 int get_session_info(any_handle h, int id, value_handle vh);
00589 int get_proc_info(any_handle h, int id, value_handle vh);
00590
00591 struct plugin_struct *get_plugin_from_handle(any_handle h);
00592
00593 void free_mem(struct ra_value *v);
00594
00595 int find_option(const char *name, struct ra_option_infos *infos, int num_opt);
00596 int get_option(void *options, struct ra_option_infos *opt_info, value_handle vh, long num_offset);
00597 int set_option(void *options, struct ra_option_infos *opt_info, value_handle vh, long num_offset);
00598
00599 int valid_value_handle(value_handle vh, int line_num);
00600 LIBRAAPI int set_meta_info(value_handle vh, const char *name, const char *desc, int id);
00601
00602 int copy_move_meas(meas_handle mh, const char *dest_dir, int copy);
00603
00604 int create_auto_class(eval_handle eh, struct ra_auto_create_class *acc, value_handle *res, long res_offset);
00605 int create_auto_prop(eval_handle eh, class_handle clh, struct proc_info *pi, struct ra_auto_create_class *acc,
00606 struct ra_auto_create_prop *acp, value_handle *res, long res_offset);
00607
00608 #ifdef __cplusplus
00609 }
00610 #endif
00611
00612 #endif