#ifndef ARGUMENTS_H #define ARGUMENTS_H #include #include /** * The supported Levenshtein implementations */ typedef enum { /// Single-threaded lev_serial, /// Threads calculate concurrently one row at time lev_pthreads_byrows, /// Threads calculate concurrently one row at time using (Guo et al. 2013) algorithm lev_pthreads_guo, /// Threads calculate concurrently one diagonal at time lev_pthreads_diagonal } lev_impl_t; /** * Record containing the result of analyzing arguments */ typedef struct { /// True if arguments do not have errors bool error; /// True if user asked for help bool help_asked; /// True if user asked for software version bool version_asked; /// Number of directories given by user int dir_count; /// True if files should be found recursively bool recursive; /// Number of workers (threads) to use size_t workers; /// True if performance statistics should be not printed bool quiet; /// True if all standard output must be silenced bool silent; /// True if files to compare must be read in Unicode bool unicode; /// Levenshtein implementation to use lev_impl_t lev_impl; } arguments_t; /** * Initialize the given record with default values * * @param arguments Pointer to the record to be initialized * @return Pointer to the same arguments record */ arguments_t* arguments_init(arguments_t* arguments); /** * Analyze the arguments given by user and returns a copy of a record * containing the results of the analysis. * * @param argc Argument count provided from the `main()` function. * @param argv Argument vector provided from the `main()` function. * @return A copy of a record containing the results of the analysis. */ arguments_t arguments_analyze(int argc, char* argv[]); /** * @brief Print help about valid arguments in standard output * @return Success exit code (0) */ int arguments_print_usage(void); /** * @brief Print version information about this software in standard output * @return Success exit code (0) */ int arguments_print_version(void); #endif // ARGUMENTS_H