Ignore:
Timestamp:
Jun 30, 2009, 5:57:27 AM (12 years ago)
Author:
Peter Johansson
Message:

refs #388

Create a sub-directory 'lib/yat' in which files from yat are
placed. The files may be updated via 'make fetch', see file README for
more details on how to change which files are updated/copied through
this mechanism.

The reason we do not use subversion's external mechanism is that we
don't want the files to be synchronised with yat automatically. We
want the update to be moderated by some developer.

I chose to fetch files using the svn client rather than wget because
the svn allows us to get an Id string with information from the yat
repository. 'wget' would just download the file as it appears on the
server that is the string is not expanded.

The file 'config_public.h' is created by configure just as in
yat. This implies that automake adds $(top_builddir)/lib/yat to the
include path so unless in a VPATH build $(top_srcdir)/lib/yat is in
the include path. As we have already added $(top_srcdir)/lib to the
include path, and there are both a lib/utility.h and a
lib/yat/utility.h it is not obvious which file is included when having
'include "utility.h"'. For this reason, when being in bin/ and test/
it is needed to include "../lib/utility.h" rather than "utility.h"
when we want to include 'lib/utility.h'.

Location:
trunk/lib/yat
Files:
1 added
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/lib/yat/CommandLine.h

    • Property svn:keywords deleted
    r792 r795  
    1 #ifndef _theplu_svndigest_commandline_
    2 #define _theplu_svndigest_commandline_
     1#ifndef _theplu_yat_utility_commandline_
     2#define _theplu_yat_utility_commandline_
    33
    4 //$Id$
     4//$Id: CommandLine.h 1954 2009-05-07 15:30:58Z jari $
    55
    66/*
    7   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2008 Peter Johansson
     7  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2009 Peter Johansson
    99
    10   This file is part of svndigest, http://dev.thep.lu.se/svndigest
     10  This file is part of the yat library, http://dev.thep.lu.se/yat
    1111
    12   svndigest is free software; you can redistribute it and/or modify it
    13   under the terms of the GNU General Public License as published by
    14   the Free Software Foundation; either version 3 of the License, or
    15   (at your option) any later version.
     12  The yat library is free software; you can redistribute it and/or
     13  modify it under the terms of the GNU General Public License as
     14  published by the Free Software Foundation; either version 3 of the
     15  License, or (at your option) any later version.
    1616
    17   svndigest is distributed in the hope that it will be useful, but
    18   WITHOUT ANY WARRANTY; without even the implied warranty of
     17  The yat library is distributed in the hope that it will be useful,
     18  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1919  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    2020  General Public License for more details.
    2121
    2222  You should have received a copy of the GNU General Public License
    23   along with svndigest. If not, see <http://www.gnu.org/licenses/>.
     23  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
    2525
     
    3535
    3636namespace theplu {
    37 namespace svndigest {
     37namespace yat {
     38namespace utility {
    3839
    3940  class Option;
     
    5051 
    5152     CommandLine cmd;
    52      OptionArg<std::string> dir(cmd, "d,dir", "output directory");
    5353     OptionHelp help(cmd);
     54     OptionInFile in(cmd, "i,in",
     55                     "Read input from file (rather than standard input)");
     56     OptionOutFile out(cmd, "o,out", "Place the output to file");
    5457     OptionSwitch target(cmd, "T,target", "treat DEST as a normal file", true);
    5558     OptionSwitch verbose(cmd, "v,verbose", "explain what is being done");
    5659     OptionSwitch version(cmd, "version", "output version and exit");
     60     std::stringstream copyright;
     61     copyright << "example 1.0\n"
     62               << "Copyright (C) 2007 Peter Johansson\n\n"
     63               << "This is free software see the source for copying "
     64               << "conditions. There is NO\nwarranty; not even for "
     65               << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
    5766     try {
    5867       cmd.parse(argc, argv);
     
    6069     catch (cmd_error& e){
    6170       if (version.present()){
    62          std::cout << cmd.program_name() << " 1.0\n"
    63                    << "Copyright (C) 2007 Peter Johansson\n\n"
    64                    << "This is free software see the source for copying "
    65                    << "conditions. There is NO\nwarranty; not even for "
    66                    << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
    67          exit(0);
     71         std::cout << copyright.str();     
     72         return EXIT_SUCCESS;
    6873       }
    69        std::cout << e.what() << std::endl;
    70        return 1;
     74       std::cerr << e.what() << std::endl;
     75       return EXIT_FAILURE;
    7176     } 
     77     if (version.present()){
     78       std::cout << copyright.str();     
     79       return EXIT_SUCCESS;
     80     }
    7281     ...
    7382     \endcode
     
    126135
    127136    /**
     137       \brief has the commandline been parsed already
     138
     139       \return true if parse function has already been called
     140
     141       \since New in yat 0.5
     142    */
     143    bool parsed(void) const;
     144
     145    /**
    128146       @return Name of more; more specifically argv[0] is
    129147       stripped so only string after the last '/' remains.
     
    150168    std::map<char, Option*> short_options_;
    151169    std::map<std::string, Option*> long_options_;
     170    bool parsed_;
    152171    std::string program_name_;
    153172  };
     
    168187     Option::print(void) function.
    169188     \see OptionHelp
     189
     190     \relates CommandLine
    170191  */
    171192  std::ostream& operator<<(std::ostream&, const CommandLine&);
    172193
    173 }} // end of namespace svndigest and theplu
     194}}} // end of namespace utility, yat, and theplu
    174195
    175196#endif
Note: See TracChangeset for help on using the changeset viewer.