settings.c

Thu, 02 Feb 2012 14:17:35 +0100

author
Mike Becker <universe@uap-core.de>
date
Thu, 02 Feb 2012 14:17:35 +0100
changeset 28
72a98cbcb9f1
parent 27
95a958e3de88
child 30
d642fdb6745e
permissions
-rw-r--r--

added regex parser

10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * settings.c
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 * Created on: 15.09.2011
20
43725438ac50 Changed author comments + added signatures for upcomming bfile heuristics
Mike Becker <universe@uap-core.de>
parents: 19
diff changeset
5 * Author: Mike
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 */
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 #include "settings.h"
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 settings_t* new_settings_t() {
11
06cbd0ec003d Merge with 1dd63a32ffc486b71399045cf8443ec6ac9d7bf5
Mike Becker <universe@uap-core.de>
parents: 10
diff changeset
11 settings_t *settings = malloc(sizeof(settings_t));
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 if (settings != NULL) {
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 #ifdef _WIN32
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 settings->fileSeparator = '\\';
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 #else
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 settings->fileSeparator = '/';
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 #endif /* _WIN32 */
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 settings->recursive = false;
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 settings->includeSuffixes = false;
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 settings->matchesOnly = false;
19
8bac9fd0629d generalized suffix_list to string_list
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
21 settings->suffixList = new_string_list_t();
16
bc9a0fefd892 fixed makefile to run safely on compile errors + added -V option to cline
Mike Becker <universe@uap-core.de>
parents: 11
diff changeset
22 settings->verbose = true;
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
23 settings->bfileHeuristics = new_bfile_heuristics_t();
27
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
24 settings->confusing_lnlen = false;
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
25 settings->regex = new_regex_parser_t();
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 }
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 return settings;
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 }
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 void destroy_settings_t(settings_t* settings) {
27
95a958e3de88 added regexp_parser struct and compile function
Mike Becker <universe@uap-core.de>
parents: 25
diff changeset
32 destroy_regex_parser_t(settings->regex);
19
8bac9fd0629d generalized suffix_list to string_list
Mike Becker <universe@uap-core.de>
parents: 17
diff changeset
33 destroy_string_list_t(settings->suffixList);
21
91e0890464b0 implemented bfile heuristics option + TODO: implement algorithm
Mike Becker <universe@uap-core.de>
parents: 20
diff changeset
34 destroy_bfile_heuristics_t(settings->bfileHeuristics);
10
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 free(settings);
ecf787666f44 refactored sources
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 }

mercurial