bin: factor the calls to set_program_name().
* src/bin/common_setup.cc, src/bin/common_setup.hh: New files. * src/bin/Makefile.am: Add them. * src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlfilt.cc, src/bin/randltl.cc: Adjust.
This commit is contained in:
parent
ecca4ba53e
commit
489f719dc1
8 changed files with 73 additions and 35 deletions
|
|
@ -40,6 +40,8 @@ libcommon_a_SOURCES = \
|
||||||
common_range.hh \
|
common_range.hh \
|
||||||
common_r.cc \
|
common_r.cc \
|
||||||
common_r.hh \
|
common_r.hh \
|
||||||
|
common_setup.cc \
|
||||||
|
common_setup.hh \
|
||||||
common_sys.hh
|
common_sys.hh
|
||||||
|
|
||||||
bin_PROGRAMS = ltlfilt genltl randltl ltl2tgba ltl2tgta
|
bin_PROGRAMS = ltlfilt genltl randltl ltl2tgba ltl2tgta
|
||||||
|
|
|
||||||
31
src/bin/common_setup.cc
Normal file
31
src/bin/common_setup.cc
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
|
||||||
|
// l'Epita (LRDE).
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Spot; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
// 02111-1307, USA.
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
|
|
||||||
|
void
|
||||||
|
setup(char** argv)
|
||||||
|
{
|
||||||
|
// Simplify the program name, because argp() uses it to report
|
||||||
|
// errors and display help text.
|
||||||
|
set_program_name(argv[0]);
|
||||||
|
argv[0] = const_cast<char*>(program_name);
|
||||||
|
}
|
||||||
30
src/bin/common_setup.hh
Normal file
30
src/bin/common_setup.hh
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
// -*- coding: utf-8 -*-
|
||||||
|
// Copyright (C) 2012 Laboratoire de Recherche et Développement de
|
||||||
|
// l'Epita (LRDE).
|
||||||
|
//
|
||||||
|
// This file is part of Spot, a model checking library.
|
||||||
|
//
|
||||||
|
// Spot is free software; you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
// License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Spot; see the file COPYING. If not, write to the Free
|
||||||
|
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
// 02111-1307, USA.
|
||||||
|
|
||||||
|
#ifndef SPOT_BIN_COMMON_SETUP_HH
|
||||||
|
#define SPOT_BIN_COMMON_SETUP_HH
|
||||||
|
|
||||||
|
#include "common_sys.hh"
|
||||||
|
#include "progname.h"
|
||||||
|
|
||||||
|
void setup(char** progname);
|
||||||
|
|
||||||
|
#endif // SPOT_BIN_COMMON_SETUP_HH
|
||||||
|
|
@ -74,10 +74,10 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include "progname.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
#include "common_output.hh"
|
#include "common_output.hh"
|
||||||
#include "common_range.hh"
|
#include "common_range.hh"
|
||||||
|
|
||||||
|
|
@ -201,16 +201,6 @@ const struct argp_child children[] =
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
// static int
|
|
||||||
// to_int(const char* s)
|
|
||||||
// {
|
|
||||||
// char* endptr;
|
|
||||||
// int res = strtol(s, &endptr, 10);
|
|
||||||
// if (*endptr)
|
|
||||||
// error(2, 0, "failed to parse '%s' as an integer.", s);
|
|
||||||
// return res;
|
|
||||||
// }
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enqueue_job(int pattern, const char* range_str)
|
enqueue_job(int pattern, const char* range_str)
|
||||||
{
|
{
|
||||||
|
|
@ -858,10 +848,7 @@ run_jobs()
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
set_program_name(argv[0]);
|
setup(argv);
|
||||||
// Simplify the program name, because argp() uses it to report errors
|
|
||||||
// and display help text.
|
|
||||||
argv[0] = const_cast<char*>(program_name);
|
|
||||||
|
|
||||||
const argp ap = { options, parse_opt, 0, argp_program_doc,
|
const argp ap = { options, parse_opt, 0, argp_program_doc,
|
||||||
children, 0, 0 };
|
children, 0, 0 };
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include "progname.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
#include "common_r.hh"
|
#include "common_r.hh"
|
||||||
#include "common_cout.hh"
|
#include "common_cout.hh"
|
||||||
#include "common_finput.hh"
|
#include "common_finput.hh"
|
||||||
|
|
@ -246,10 +246,7 @@ namespace
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
set_program_name(argv[0]);
|
setup(argv);
|
||||||
// Simplify the program name, because argp() uses it to report errors
|
|
||||||
// and display help text.
|
|
||||||
argv[0] = const_cast<char*>(program_name);
|
|
||||||
|
|
||||||
const argp ap = { options, parse_opt, "[FORMULA...]",
|
const argp ap = { options, parse_opt, "[FORMULA...]",
|
||||||
argp_program_doc, children, 0, 0 };
|
argp_program_doc, children, 0, 0 };
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include "progname.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
#include "common_r.hh"
|
#include "common_r.hh"
|
||||||
#include "common_cout.hh"
|
#include "common_cout.hh"
|
||||||
#include "common_finput.hh"
|
#include "common_finput.hh"
|
||||||
|
|
@ -251,10 +251,7 @@ namespace
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
set_program_name(argv[0]);
|
setup(argv);
|
||||||
// Simplify the program name, because argp() uses it to report errors
|
|
||||||
// and display help text.
|
|
||||||
argv[0] = const_cast<char*>(program_name);
|
|
||||||
|
|
||||||
const argp ap = { options, parse_opt, "[FORMULA...]",
|
const argp ap = { options, parse_opt, "[FORMULA...]",
|
||||||
argp_program_doc, children, 0, 0 };
|
argp_program_doc, children, 0, 0 };
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,9 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "progname.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
#include "common_finput.hh"
|
#include "common_finput.hh"
|
||||||
#include "common_output.hh"
|
#include "common_output.hh"
|
||||||
#include "common_cout.hh"
|
#include "common_cout.hh"
|
||||||
|
|
@ -501,10 +501,7 @@ namespace
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
set_program_name(argv[0]);
|
setup(argv);
|
||||||
// Simplify the program name, because argp() uses it to report errors
|
|
||||||
// and display help text.
|
|
||||||
argv[0] = const_cast<char*>(program_name);
|
|
||||||
|
|
||||||
const argp ap = { options, parse_opt, "[FILENAME...]",
|
const argp ap = { options, parse_opt, "[FILENAME...]",
|
||||||
argp_program_doc, children, 0, 0 };
|
argp_program_doc, children, 0, 0 };
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,9 @@
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include "progname.h"
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include "common_setup.hh"
|
||||||
#include "common_output.hh"
|
#include "common_output.hh"
|
||||||
#include "common_range.hh"
|
#include "common_range.hh"
|
||||||
#include "common_r.hh"
|
#include "common_r.hh"
|
||||||
|
|
@ -252,10 +252,7 @@ parse_opt(int key, char* arg, struct argp_state*)
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
set_program_name(argv[0]);
|
setup(argv);
|
||||||
// Simplify the program name, because argp() uses it to report errors
|
|
||||||
// and display help text.
|
|
||||||
argv[0] = const_cast<char*>(program_name);
|
|
||||||
|
|
||||||
const argp ap = { options, parse_opt, "PROP...", argp_program_doc,
|
const argp ap = { options, parse_opt, "PROP...", argp_program_doc,
|
||||||
children, 0, 0 };
|
children, 0, 0 };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue