BEAST/BSE - Better Audio System and Sound Engine  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sfiutils.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __SFI_UTILS_H__
3 #define __SFI_UTILS_H__
4 
5 #include <math.h>
6 #include <bse/gsldefs.hh>
7 #include <sfi/sfi.hh>
8 
9 G_BEGIN_DECLS
10 
11 typedef struct
12 {
13  guint line_number;
14  guint n_fields;
15  gchar **fields;
17 
18 typedef struct
19 {
20  guint n_entries;
21  SfiUtilFileEntry *entries;
22  guint n_formats;
23  gchar **formats;
24  gpointer free1, free2;
26 
27 /* value extraction from formats:
28  * # <something> -> value is <something>
29  * <num> -> value is <num> word of line
30  * <num> n <nth> -> <nth> number found in word <num>
31  * <num> b <nth> -> <nth> number found in basename(word <num>)
32  */
33 SfiUtilFileList* sfi_util_file_list_read (gint fd);
34 SfiUtilFileList* sfi_util_file_list_read_simple (const gchar *file_name,
35  guint n_formats,
36  const gchar *formats);
37 void sfi_util_file_list_free (SfiUtilFileList *text);
38 const gchar* sfi_util_file_entry_get_field (SfiUtilFileEntry *entry,
39  const gchar **format_p);
40 gchar* sfi_util_file_entry_get_string (SfiUtilFileEntry *entry,
41  const gchar *format,
42  const gchar *dflt);
43 gdouble sfi_util_file_entry_get_num (SfiUtilFileEntry *line,
44  const gchar *format,
45  gdouble dflt);
46 
47 
48 gchar* sfi_util_file_name_subst_ext (const gchar *file_name,
49  const gchar *new_extension);
50 
51 typedef struct {
52  gchar short_opt;
53  gchar *long_opt;
54  const gchar **value_p;
55  guint takes_arg : 1;
56 } SfiArgument;
57 void sfi_arguments_parse (gint *argc_p,
58  gchar ***argv_p,
59  guint n_options,
60  const SfiArgument *options);
61 SfiRing* sfi_arguments_parse_list (gint *argc_p,
62  gchar ***argv_p,
63  guint n_options,
64  const SfiArgument *options);
65 void sfi_arguments_collapse (gint *argc_p,
66  gchar ***argv_p);
67 
68 /* format for value extraction:
69  * # <something> -> string is <something>
70  * n <nth> -> <nth> number found in string
71  * b <nth> -> <nth> number found in basename(string)
72  * c [*<num>] -> counter (with optional multiplication)
73  * if <nth>==0, number may not be preceeded by non-digit chars
74  */
75 gdouble sfi_arguments_extract_num (const gchar *string,
76  const gchar *format,
77  gdouble *counter,
78  gdouble dflt);
79 gboolean sfi_arguments_read_num (const gchar **option,
80  gdouble *num);
81 guint sfi_arguments_read_all_nums (const gchar *option,
82  gdouble *first,
83  ...) G_GNUC_NULL_TERMINATED;
84 
85 G_END_DECLS
86 
87 #endif /* __SFI_UTILS_H__ */
Definition: sfiutils.hh:51
Definition: sfiutils.hh:11
Definition: sfiring.hh:23
Definition: sfiutils.hh:18