souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
67 CmdOptions(
const char* s,
const char*
id,
const char* od,
bool pe,
const char* pfn,
size_t nj)
116 bool parse(
int argc,
char** argv) {
118 std::string exec_name =
"analysis";
128 option longOptions[] = {{
"facts",
true,
nullptr,
'F'}, {
"output",
true,
nullptr,
'D'},
129 {
"profile",
true,
nullptr,
'p'}, {
"jobs",
true,
nullptr,
'j'}, {
"index",
true,
nullptr,
'i'},
131 {
nullptr,
false,
nullptr, 0}};
137 while ((c = getopt_long(argc, argv,
"D:F:hp:j:i:", longOptions,
nullptr)) != EOF) {
142 printf(
"Fact directory %s does not exists!\n", optarg);
150 printf(
"Output directory %s does not exists!\n", optarg);
157 std::cerr <<
"\nError: profiling was not enabled in compilation\n\n";
165 if (std::string(optarg) ==
"auto") {
168 int num = atoi(optarg);
172 std::cerr <<
"Invalid number of jobs [-j]: " << optarg <<
"\n";
177 std::cerr <<
"\nWarning: OpenMP was not enabled in compilation\n\n";
197 std::cerr <<
"====================================================================\n";
198 std::cerr <<
" Datalog Program: " <<
src <<
"\n";
199 std::cerr <<
" Usage: " << exec_name <<
" [OPTION]\n\n";
200 std::cerr <<
" Options:\n";
201 std::cerr <<
" -D <DIR>, --output=<DIR> -- Specify directory for output relations\n";
202 std::cerr <<
" (default: " <<
output_dir <<
")\n";
203 std::cerr <<
" (suppress output with \"\")\n";
204 std::cerr <<
" -F <DIR>, --facts=<DIR> -- Specify directory for fact files\n";
205 std::cerr <<
" (default: " <<
input_dir <<
")\n";
207 std::cerr <<
" -p <file>, --profile=<file> -- Specify filename for profiling\n";
211 std::cerr <<
" -j <NUM>, --jobs=<NUM> -- Specify number of threads\n";
213 std::cerr <<
" (default: " <<
num_jobs <<
")\n";
215 std::cerr <<
" (default: auto)\n";
218 std::cerr <<
" -h -- prints this help page.\n";
219 std::cerr <<
"--------------------------------------------------------------------\n";
220 std::cout <<
" Copyright (c) 2016-20 The Souffle Developers." << std::endl;
221 std::cout <<
" Copyright (c) 2013-16 Oracle and/or its affiliates." << std::endl;
222 std::cerr <<
" All rights reserved.\n";
223 std::cerr <<
"====================================================================\n";
229 inline bool existFile(
const std::string& name)
const {
231 if (stat(name.c_str(), &buffer) == 0) {
232 if ((buffer.st_mode & S_IFREG) != 0) {
242 bool existDir(
const std::string& name)
const {
244 if (stat(name.c_str(), &buffer) == 0) {
245 if ((buffer.st_mode & S_IFDIR) != 0) {
A functor representing the identity function for a generic type T.
size_t getNumJobs() const
get number of jobs
bool existFile(const std::string &name) const
Check whether a file exists in the file system.
bool parse(int argc, char **argv)
Parses the given command line parameters, handles -h help requests or errors and returns whether the ...
std::string profile_name
profile filename
const std::string & getProfileName() const
get filename of profile
size_t num_jobs
number of threads
const std::string & getInputFileDir() const
get input directory
std::string src
source file
const std::string & getSourceFileName() const
get source code name
std::string output_dir
output directory
bool profiling
profiling flag
std::string input_dir
fact directory
const std::string & getOutputFileDir() const
get output directory
bool existDir(const std::string &name) const
Check whether a directory exists in the file system.
void printHelpPage(const std::string &exec_name) const
Prints the help page if it has been requested or there was a typo in the command line arguments.
bool isProfiling() const
is profiling switched on
CmdOptions(const char *s, const char *id, const char *od, bool pe, const char *pfn, size_t nj)