Initial commit (added Sapphire to source control)

This commit is contained in:
apio 2022-03-11 17:00:09 +01:00
commit 1ba46c44cf
343 changed files with 33325 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build/
.vscode

31
CMakeLists.txt Normal file
View File

@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.8...3.22)
project(sapphire-compiler LANGUAGES CXX)
set(CXX_STANDARD_REQUIRED 17)
add_executable(
sapphirec
src/sapphire.cpp
src/Lexer.cpp
src/Lexer.h
src/Token.h
src/Token.cpp
src/Location.h
src/Location.cpp
src/Error.h
src/Error.cpp
src/StringConversion.h
src/StringConversion.cpp
src/FormatString/FormatString.hpp
src/FileIO.h
src/FileIO.cpp
src/Importer.cpp
src/Importer.h
src/Arguments.cpp
src/Arguments.h
src/Normalizer.cpp
src/Normalizer.h
)
target_include_directories(sapphirec PUBLIC src)
target_include_directories(sapphirec PUBLIC src/tclap-1.2.5/include)

View File

@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md

View File

@ -0,0 +1,9 @@
# Change Log
All notable changes to the "sapphirelang" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

View File

@ -0,0 +1,65 @@
# sapphirelang README
This is the README for your extension "sapphirelang". After writing up a brief description, we recommend including the following sections.
## Features
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
For example if there is an image subfolder under your extension project workspace:
\!\[feature X\]\(images/feature-x.png\)
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
## Requirements
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
## Extension Settings
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
For example:
This extension contributes the following settings:
* `myExtension.enable`: enable/disable this extension
* `myExtension.thing`: set to `blah` to do something
## Known Issues
Calling out known issues can help limit users opening duplicate issues against your extension.
## Release Notes
Users appreciate release notes as you update your extension.
### 1.0.0
Initial release of ...
### 1.0.1
Fixed issue #.
### 1.1.0
Added features X, Y, and Z.
-----------------------------------------------------------------------------------------------------------
## Working with Markdown
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets
### For more information
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
**Enjoy!**

View File

@ -0,0 +1,23 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//"
},
// symbols used as brackets
"brackets": [
["{", "}"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["(", ")"],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["(", ")"],
["'", "'"]
]
}

View File

@ -0,0 +1,25 @@
{
"name": "sapphirelang",
"displayName": "SapphireLang",
"description": "Syntax support for Sapphire",
"version": "0.0.1",
"engines": {
"vscode": "^1.64.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "sapphire",
"aliases": ["Sapphire", "sapphire"],
"extensions": [".sp"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "sapphire",
"scopeName": "source.sp",
"path": "./syntaxes/sapphire.tmLanguage.json"
}]
}
}

View File

@ -0,0 +1,64 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Sapphire",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#types"
},
{
"include": "#functions"
},
{
"include": "#variables"
}
],
"repository": {
"keywords": {
"patterns": [{
"name": "keyword.control.sapphire",
"match": "\\b(out|var|import|ret|asm)\\b"
}]
},
"types": {
"patterns": [{
"name": "entity.name.type",
"match": "\\b(u8|u16|u32|u64|i8|i16|i32|i64|ptr8|ptr16|ptr32|ptr64|str|void)\\b"
}]
},
"strings": {
"name": "string.quoted.sapphire",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.sapphire",
"match": "\\\\."
}
]
},
"comments": {
"name": "comment.line",
"begin": "//",
"end": "\n"
},
"functions": {
"name": "support.function",
"begin": "@",
"end": "(\\s|\\{|\\()"
},
"variables": {
"name": "variable.name",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
}
},
"scopeName": "source.sp"
}

View File

@ -0,0 +1,29 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/sapphire.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
## Get up and running straight away
* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.
## Make changes
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Add more language features
* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
## Install your extension
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

5
exit.sp Normal file
View File

@ -0,0 +1,5 @@
import idk;
@hey {
out 'bye';
}

1
exp.asm Normal file
View File

@ -0,0 +1 @@
div rdx, rax

BIN
hi Executable file

Binary file not shown.

2
hi.sp Normal file
View File

@ -0,0 +1,2 @@
import test;
@main() {''; idk; out;}

6
idk.sp Normal file
View File

@ -0,0 +1,6 @@
import hi;
@main (smth);

1
import.sp Normal file
View File

@ -0,0 +1 @@
*#

6
new.sp Normal file
View File

@ -0,0 +1,6 @@
import new;
@main {
out 'Tokenizing is great';
cmp 3 == 5;
}

BIN
sapphire Executable file

Binary file not shown.

857
sapphire.cpp Normal file
View File

@ -0,0 +1,857 @@
#include <iostream>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <regex>
#include <array>
#include <sstream>
#include <fstream>
#define IMPORT_MAX_DEEP 100
#define STRLEN "strlen: ; -- length of null-terminated string in rdi --\n xor rax, rax\n mov rcx, -1\n cld\n repne scasb\n mov rax, rcx\n add rax, 2\n neg rax\n ret\n"
#define PRINT "print: ; -- print null-terminated string in rdi --\n mov rsi, rdi\n call strlen\n mov rdx, rax\n mov rdi, 1\n mov rax, 1\n syscall\n ret\n"
#define __FASM
#ifdef __FASM
#define ASM_HEADER "format ELF64 executable 3\n"
#define ASM_TEXT_SECTION "segment readable executable\n"
#define ASM_DATA_SECTION "segment readable writable\n"
#define ASM_BSS_SECTION ""
#define ASM_ENTRY "entry start\n"
#define ASM_ENTRY_DECL "start:\n"
#elif defined(__NASM)
#define ASM_HEADER "BITS 64\n"
#define ASM_TEXT_SECTION "section .text\n"
#define ASM_DATA_SECTION "section .data\n"
#define ASM_BSS_SECTION "section .bss\n"
#define ASM_ENTRY "global _start\n"
#define ASM_ENTRY_DECL "_start:\n"
#else
#endif
std::regex letter("[a-zA-Z_]");
std::regex identifier("[a-zA-Z0-9_]");
std::regex number("[0-9]");
std::regex whitespace("[\t \n]");
int g_importCount = 0;
std::string g_current_line;
std::vector<std::string> imported_files;
enum TokenType
{
TT_Identifier,
TT_Number,
TT_Float,
TT_Keyword,
TT_String,
TT_Plus,
TT_Minus,
TT_Mul,
TT_Div,
TT_At,
TT_Equal,
TT_LessThan,
TT_GreaterThan,
TT_LParen,
TT_RParen,
TT_LBracket,
TT_RBracket,
TT_Semicolon,
TT_LoadedString,
TT_EOF,
TT_Null
};
static std::string token_strings[] = {
"TT_IDENTIFIER",
"TT_NUMBER",
"TT_FLOAT",
"TT_KEYWORD",
"TT_STRING",
"TT_PLUS",
"TT_MINUS",
"TT_MUL",
"TT_DIV",
"TT_AT",
"TT_EQUAL",
"TT_LESSTHAN",
"TT_GREATERTHAN",
"TT_LPAREN",
"TT_RPAREN",
"TT_LBRACKET",
"TT_RBRACKET",
"TT_SEMICOLON",
"TT_LOADEDSTRING",
"TT_EOF",
"TT_NULL"
};
struct Token
{
TokenType tk_type;
int int_value;
std::string string_value;
float float_value;
int line;
int column;
std::string fname;
std::string line_ctx;
Token(const TokenType& type, const int& lineno, const int& colno, const std::string& name)
: tk_type(type), line(lineno), column(colno), fname(name)
{
line_ctx = g_current_line;
}
Token(const TokenType& type, const int& val, const int& lineno, const int& colno, const std::string& name)
: tk_type(type), int_value(val), line(lineno), column(colno), fname(name)
{
line_ctx = g_current_line;
}
Token(const TokenType& type, const std::string& val, const int& lineno, const int& colno, const std::string& name)
: tk_type(type), string_value(val), line(lineno), column(colno), fname(name)
{
line_ctx = g_current_line;
}
Token(const TokenType& type, const float& val, const int& lineno, const int& colno, const std::string& name)
: tk_type(type), float_value(val), line(lineno), column(colno), fname(name)
{
line_ctx = g_current_line;
}
std::string to_string() const
{
char linestr[32];
sprintf(linestr,"%d",line);
char colstr[32];
sprintf(colstr,"%d",column);
if(tk_type == TT_Number)
{
char num[32];
sprintf(num,"%d",int_value);
return "INT:" + std::string(num) + " (" + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
} else if (tk_type == TT_Float)
{
char num[64];
sprintf(num,"%f",float_value);
return "FLOAT:" + std::string(num) + " (" + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
}
else if (tk_type == TT_Identifier){
return "ID:" + string_value + " (" + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
} else if (tk_type == TT_Keyword){
return "KEYWORD:" + string_value + " (" + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
} else if (tk_type == TT_String)
{
return "STRING:" + std::string("\'") + string_value + std::string("\'") + " (" + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
}
std::string details = std::string(" (") + fname + ":" + std::string(linestr) + ":" + std::string(colstr) + ")";
switch(tk_type)
{
case TT_EOF:
return "EOF" + details;
case TT_Plus:
return "PLUS" + details;
case TT_Minus:
return "MINUS" + details;
case TT_Mul:
return "MUL" + details;
case TT_Div:
return "DIV" + details;
case TT_At:
return "AT" + details;
case TT_Equal:
return "EQUAL" + details;
case TT_LessThan:
return "LESSTHAN" + details;
case TT_GreaterThan:
return "GREATERTHAN" + details;
case TT_LParen:
return "LPAREN" + details;
case TT_RParen:
return "RPAREN" + details;
case TT_LBracket:
return "LBRACKET" + details;
case TT_RBracket:
return "RBRACKET" + details;
case TT_Semicolon:
return "SEMICOLON" + details;
case TT_LoadedString:
return "LDSTRING" + details;
}
return "";
}
};
std::string tokentype_as_string(const TokenType& type)
{
return token_strings[type];
}
struct Sentence
{
std::string type_name;
};
struct Function : public Sentence
{
std::string type_name = "function";
std::vector<Token> fun_tokens;
Function(std::vector<Token> tokens) : fun_tokens(tokens){}
};
struct DeclVar : public Sentence
{
std::string type_name = "decl";
std::vector<Token> vtokens;
DeclVar(std::vector<Token> tokens) : vtokens(tokens){}
};
struct Variable
{
int size;
std::string identifier;
Variable(int _size, std::string _identifier) : size(_size), identifier(_identifier){}
};
struct StringLiteral
{
std::string data;
std::string identifier;
StringLiteral(std::string _data, std::string _identifier) : data(_data), identifier(_identifier){}
};
std::array<std::string, 3> keywords{"out", "var","import"};
std::vector<Variable> registered_vars;
std::vector<StringLiteral> registered_strings;
std::string make_asm_string(StringLiteral str);
std::vector<Token> lex_tokens(const std::string&, const std::string&);
std::vector<Token> evaluate_imports(const std::string& text, const std::vector<Token>& tokens);
std::string read_file(const std::string&);
void compiler_error(const std::string& text, const int& line, const int& column, const std::string& fname, const std::string& details);
void compiler_warning(const std::string& text, const int& line, const int& column, const std::string& fname, const std::string& details);
std::vector<Sentence> parse_tokens(const std::vector<Token>& tokens);
int main(int argc, char** argv)
{
std::string fname;
if(argc < 2)
{
fname = "test.sp";
}
else fname = (const char*)argv[1];
std::string command = read_file(fname);
std::vector<Token> main_tokens = lex_tokens(command,fname);
imported_files.push_back(fname.substr(0,fname.find_last_of('.')));
main_tokens = evaluate_imports(command,main_tokens);
parse_tokens(main_tokens);
std::string assembly;
assembly += ASM_HEADER;
assembly += "; Assembly generated by the Sapphire compiler.\n";
assembly += ASM_TEXT_SECTION;
assembly += ASM_ENTRY;
assembly += STRLEN;
assembly += PRINT;
assembly += ASM_ENTRY_DECL;
assembly += "; -- exit with code 0 --\n";
assembly += " mov rax, 60\n";
assembly += " xor rdi, rdi\n";
assembly += " syscall\n";
if(registered_strings.size() != 0)
{
assembly += "\n";
assembly += ASM_DATA_SECTION;
for(auto asm_string : registered_strings)
{
assembly += make_asm_string(asm_string);
}
}
std::string outfile_basename = fname.substr(0,fname.find_last_of('.'));
std::ofstream outfile(outfile_basename + ".asm");
outfile << assembly;
outfile.close();
#ifdef __NASM
system(std::string("nasm -f elf64 " + outfile_basename + ".asm -o" + outfile_basename + ".o").c_str());
system(std::string("ld " + outfile_basename + ".o -o" + outfile_basename).c_str());
#else
system(std::string("fasm " + outfile_basename + ".asm").c_str());
system((std::string("chmod +x ") + outfile_basename).c_str());
#endif
std::cout << fname + " > " + std::string(outfile_basename) + "\n";
}
Token construct_identifier(const std::string&, int& , int&, int&, const std::string&);
Token construct_number(const std::string&, int&, int&, int&, const std::string&);
Token construct_string(const std::string&, int&, int&, int&, const std::string&);
std::string read_file(const std::string& fname)
{
std::ifstream main_file;
main_file.open(fname);
if(!main_file.is_open()) return "";
std::vector<char> file_chars;
char fchar;
while ( main_file ) {
fchar = main_file.get();
if(fchar != -1 ) file_chars.push_back(fchar);
}
main_file.close();
return std::string(file_chars.begin(),file_chars.end());
}
std::string recalculate_current_line(const std::string& text, int index)
{
std::string final_str;
++index;
while(index != text.size() && text[index] != '\n')
{
final_str += text[index];
++index;
}
return final_str;
}
std::string rewind_current_line(const std::string& text, int index)
{
--index;
while(text[index] != '\n')
{
--index;
if(index == 0)
{
return recalculate_current_line(text,-1);
}
}
return recalculate_current_line(text,index);
}
std::vector<Token> lex_tokens(const std::string& text, const std::string& fname)
{
int line = 1;
int column = 0;
int index = -1;
std::vector<Token> result;
bool comment = false;
g_current_line = recalculate_current_line(text,-1);
while(index < (int)text.size())
{
++index;
++column;
if(text[index] == '\n')
{
++line;
column = 0;
g_current_line = recalculate_current_line(text,index);
comment = false;
}
if(comment) continue;
char cstyle_char[2]{text[index],'\0'};
const char* character = (const char*)cstyle_char;
if(std::regex_match(character,whitespace))
{
continue;
}
else if(std::regex_match(character,letter))
{
result.push_back(construct_identifier(text,index,line,column,fname));
}
else if(std::regex_match(character,number))
{
result.push_back(construct_number(text,index,line,column,fname));
} else if (text[index] == '\'')
{
result.push_back(construct_string(text,index,line,column,fname));
} else if(index == text.size())
{
result.push_back(Token(TT_EOF,line,column,fname));
} else switch(text[index])
{
case '+':
result.push_back(Token(TT_Plus,line,column,fname));
break;
case '-':
result.push_back(Token(TT_Minus,line,column,fname));
break;
case '*':
result.push_back(Token(TT_Mul,line,column,fname));
break;
case '/':
if(index != text.size())
{
if(text[index+1] == '/')
{
comment = true;
break;
}
}
result.push_back(Token(TT_Div,line,column,fname));
break;
case '@':
result.push_back(Token(TT_At,line,column,fname));
break;
case '=':
result.push_back(Token(TT_Equal,line,column,fname));
break;
case '<':
result.push_back(Token(TT_LessThan,line,column,fname));
break;
case '>':
result.push_back(Token(TT_GreaterThan,line,column,fname));
break;
case '(':
result.push_back(Token(TT_LParen,line,column,fname));
break;
case ')':
result.push_back(Token(TT_RParen,line,column,fname));
break;
case '{':
result.push_back(Token(TT_LBracket,line,column,fname));
break;
case '}':
result.push_back(Token(TT_RBracket,line,column,fname));
break;
case ';':
result.push_back(Token(TT_Semicolon,line,column,fname));
break;
default:
compiler_error(g_current_line,line,column,fname,"unknown character");
break;
}
}
return result;
}
std::string get_line(const std::string&, int);
Token construct_identifier(const std::string& text, int& index, int& line, int& column, const std::string& fname)
{
std::vector<char> id_symbols;
int prev_column = column * 1;
int prev_line = line * 1;
char cstyle_char[2]{text[index],'\0'};
const char* character = (const char*)cstyle_char;
if(std::regex_match(character,identifier))
{
id_symbols.push_back(text[index]);
} else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
column = get_line(text,line-1).size() + 1;
g_current_line = rewind_current_line(text,index);
}
std::string identifier(id_symbols.begin(), id_symbols.end());
std::string* location = std::find(keywords.begin(),keywords.end(),identifier);
if(location != keywords.end())
{
return Token(TT_Keyword,identifier,prev_line,prev_column,fname);
}
return Token(TT_Identifier,identifier,prev_line,prev_column,fname);
}
while(index < text.size() || index == -1)
{
++index;
++column;
if(text[index] == '\n')
{
++line;
g_current_line = recalculate_current_line(text,index);
column = 0;
}
char cstyle_char[2]{text[index],'\0'};
const char* character = (const char*)cstyle_char;
if(std::regex_match(character,identifier))
{
id_symbols.push_back(text[index]);
} else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
column = get_line(text,line-1).size() + 1;
g_current_line = rewind_current_line(text,index);
}
std::string identifier(id_symbols.begin(), id_symbols.end());
std::string* location = std::find(keywords.begin(),keywords.end(),identifier);
if(location != keywords.end())
{
return Token(TT_Keyword,identifier,prev_line,prev_column,fname);
}
return Token(TT_Identifier,identifier,prev_line,prev_column,fname);
}
}
std::string identifier(id_symbols.begin(), id_symbols.end());
std::string* location = std::find(keywords.begin(),keywords.end(),identifier);
if(location != keywords.end())
{
return Token(TT_Keyword,identifier,prev_line,prev_column,fname);
}
return Token(TT_Identifier,identifier,prev_line,prev_column,fname);
}
Token construct_number(const std::string& text, int& index, int& line, int& column, const std::string& fname)
{
std::vector<char> num_symbols;
int dot_count = 0;
int prev_column = column * 1;
int prev_line = line * 1;
char cstyle_char[2]{text[index],'\0'};
const char* character = (const char*)cstyle_char;
if(std::regex_match(character,number))
{
num_symbols.push_back(text[index]);
} else if (text[index] == '.')
{
if (dot_count == 0)
{
num_symbols.push_back(text[index]);
++dot_count;
} else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
g_current_line = rewind_current_line(text,index);
column = get_line(text,line-1).size() + 1;
}
float tk_value = std::stof(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Float,tk_value,prev_line,prev_column,fname);
}
}else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
column = get_line(text,line-1).size() + 1;
g_current_line = rewind_current_line(text,index);
}
if(dot_count != 0)
{
float tk_value = std::stof(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Float,tk_value,prev_line,prev_column,fname);
}
int tk_value = atoi(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Number,tk_value,prev_line,prev_column,fname);
}
while(index < text.size() || index == -1)
{
++index;
++column;
if(text[index] == '\n')
{
++line;
column = 0;
g_current_line = recalculate_current_line(text,index);
}
char cstyle_char[2]{text[index],'\0'};
const char* character = (const char*)cstyle_char;
if(std::regex_match(character,number))
{
num_symbols.push_back(text[index]);
} else if (text[index] == '.')
{
if (dot_count == 0)
{
num_symbols.push_back(text[index]);
++dot_count;
} else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
g_current_line = rewind_current_line(text,index);
column = get_line(text,line-1).size() + 1;
}
float tk_value = std::stof(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Float,tk_value,prev_line,prev_column,fname);
}
}else
{
--index;
--column;
if(text[index] == '\n')
{
--line;
column = get_line(text,line-1).size() + 1;
g_current_line = rewind_current_line(text,index);
}
if(dot_count != 0)
{
float tk_value = std::stof(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Float,tk_value,prev_line,prev_column,fname);
}
int tk_value = atoi(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Number,tk_value,prev_line,prev_column,fname);
}
}
--index;
--column;
if(text[index] == '\n')
{
--line;
column = get_line(text,line-1).size() + 1;
g_current_line = rewind_current_line(text,index);
}
if(dot_count != 0)
{
float tk_value = std::stof(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Float,tk_value,prev_line,prev_column,fname);
}
int tk_value = atoi(std::string(num_symbols.begin(), num_symbols.end()).c_str());
return Token(TT_Number,tk_value,prev_line,prev_column,fname);
}
Token construct_string(const std::string& text, int& index, int& line, int& column, const std::string& fname)
{
std::vector<char> string_chars;
int prev_column = column * 1;
int prev_line = line * 1;
while(index < text.size())
{
++index;
++column;
if(text[index] == '\n')
{
compiler_error(g_current_line,line,column,fname,"expected \', but got a newline");
}
if(text[index] == '\'')
{
return Token(TT_String,std::string(string_chars.begin(),string_chars.end()),prev_line,prev_column,fname);
}
if(text[index] == '\\')
{
if(index + 1 == text.size())
{
compiler_error(g_current_line,line,column,fname,"unfinished escape sequence");
}
switch(text[index+1])
{
case 'n':
string_chars.push_back('\n');
break;
case '\'':
string_chars.push_back('\'');
break;
case '\\':
string_chars.push_back('\\');
break;
default:
compiler_error(g_current_line,line,column,fname,"unknown escape sequence");
}
++index;
++column;
continue;
}
string_chars.push_back(text[index]);
}
compiler_error(text,line,column,fname,"expected \', but got EOF");
exit(127);
}
std::string get_spaces(int);
void compiler_error(const std::string& text, const int& line, const int& column, const std::string& fname, const std::string& details)
{
char linestr[32];
sprintf(linestr,"%d",line);
char colstr[32];
sprintf(colstr,"%d",column);
std::cerr << "\033[1;1m";
std::cerr << fname;
std::cerr << ":";
std::cerr << linestr;
std::cerr << ":";
std::cerr << colstr;
std::cerr << ": ";
std::cerr << "\033[31;49m";
std::cerr << "error: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
std::cerr << linestr;
std::cerr << get_spaces(4);
std::cerr << text;
std::cerr << std::endl;
std::cerr << get_spaces(4 + std::string(linestr).size());
std::cerr << get_spaces(column - 1);
std::cerr << "\033[31;49m";
std::cerr << "^";
std::cerr << "\033[0;0m";
std::cerr << std::endl;
exit(1);
}
void compiler_warning(const std::string& text, const int& line, const int& column, const std::string& fname, const std::string& details)
{
char linestr[32];
sprintf(linestr,"%d",line);
char colstr[32];
sprintf(colstr,"%d",column);
std::cout << "\033[1;1m";
std::cout << fname;
std::cout << ":";
std::cout << linestr;
std::cout << ":";
std::cout << colstr;
std::cout << ": ";
std::cout << "\033[33;49m";
std::cout << "warning: ";
std::cout << "\033[0;0m";
std::cout << details;
std::cout << std::endl;
std::cout << linestr;
std::cout << get_spaces(4);
std::cout << text;
std::cout << std::endl;
std::cout << get_spaces(4 + std::string(linestr).size());
std::cout << get_spaces(column - 1);
std::cout << "\033[33;49m";
std::cout << "^";
std::cout << "\033[0;0m";
std::cout << std::endl;
}
std::string get_line(const std::string& str, int line_no)
{
std::string line;
std::istringstream stream(str);
while (line_no-- >= 0)
std::getline(stream, line);
return line;
}
std::string get_spaces(int spacenum)
{
std::string output = "";
for(int i = 0; i < spacenum; i++)
{
output += " ";
}
return output;
}
std::string make_asm_string(StringLiteral str)
{
std::string result;
result += str.identifier;
result += ": ; -- string literal -- \n";
result += " db ";
char code_point[4];
sprintf(code_point,"%d",str.data[0]);
result += std::string(code_point);
for(int i = 1; i < str.data.size(); i++)
{
char code_point[4];
sprintf(code_point,"%d",str.data[i]);
result += (", " + std::string(code_point));
}
result += ", 0";
result += "\n";
return result;
}
std::vector<Token> evaluate_imports(const std::string& text, const std::vector<Token>& tokens)
{
int i = 0;
std::vector<Token> ret_tk = tokens;
std::vector<Token> new_tokens;
while(tokens[i].tk_type != TT_EOF)
{
if (g_importCount > IMPORT_MAX_DEEP) {
compiler_error(tokens[i].line_ctx,tokens[i].line,tokens[i].column,tokens[i].fname,"import tree too deep");
}
if(tokens[i].tk_type == TT_Keyword && tokens[i].string_value == keywords[2])
{
if(tokens[i+1].tk_type == TT_EOF) {compiler_error(text,tokens[i].line,tokens[i].column,tokens[i].fname,"did not expect EOF after 'import' keyword");}
if(tokens[i+1].tk_type == TT_Identifier)
{
if(std::find(imported_files.begin(), imported_files.end(), tokens[i+1].string_value) != imported_files.end()) {
compiler_error(tokens[i+2].line_ctx,tokens[i+2].line,tokens[i+2].column,tokens[i+2].fname,"file already imported");
}
if(tokens[i+2].tk_type != TT_Semicolon) {compiler_error(text,tokens[i+2].line,tokens[i+2].column,tokens[i+2].fname,"expected a semicolon after import statement");}
std::ifstream ifile(tokens[i+1].string_value + ".sp");
if (!ifile.good()) {
compiler_error(tokens[i+1].line_ctx,tokens[i+1].line,tokens[i+1].column,tokens[i+1].fname,"file '" + tokens[i+1].string_value + ".sp' not found");
}
ifile.close();
std::string imported_file_contents = read_file(tokens[i+1].string_value + ".sp");
std::vector<Token> imported_tokens = lex_tokens(imported_file_contents,tokens[i+1].string_value + ".sp");
imported_tokens.pop_back(); // remove EOF at end of token stream
new_tokens.insert(new_tokens.end(),imported_tokens.begin(),imported_tokens.end());
ret_tk[i] = Token(TT_Null,ret_tk[i].line,ret_tk[i].column,ret_tk[i].fname); // remove import data
ret_tk[i+1] = Token(TT_Null,ret_tk[i+1].line,ret_tk[i+1].column,ret_tk[i+1].fname); // remove import data
ret_tk[i+2] = Token(TT_Null,ret_tk[i+2].line,ret_tk[i+2].column,ret_tk[i+2].fname); // remove import data
imported_files.push_back(tokens[i+1].string_value);
} else {
compiler_error(tokens[i+1].line_ctx,tokens[i+1].line,tokens[i+1].column,tokens[i+1].fname,"import statement must use an identifier");
}
}
++i;
}
if(new_tokens.size() != 0)
{
new_tokens.insert(new_tokens.end(),ret_tk.begin(),ret_tk.end());
++g_importCount;
return evaluate_imports(text,new_tokens);
}
return ret_tk;
}
std::vector<Sentence> parse_tokens(const std::vector<Token>& tokens)
{
int i = 0;
while(i < tokens.size())
{
if(tokens[i].tk_type == TT_Null)
{
++i;
continue;
}
std::cout << tokens[i].to_string() << std::endl;
++i;
}
return std::vector<Sentence>();
}

34
src/Arguments.cpp Normal file
View File

@ -0,0 +1,34 @@
#include "Arguments.h"
#include "Error.h"
#include "tclap/CmdLine.h"
std::string Arguments::input_fname;
std::string Arguments::output_fname;
bool Arguments::wimport;
void Arguments::parse(int argc, char **argv)
{
try {
TCLAP::CmdLine command_line("The Sapphire compiler.",' ',"0.1");
TCLAP::UnlabeledValueArg<std::string> input_fname_arg("file","Input file.",true,"test.sp","filename");
TCLAP::ValueArg<std::string> output_fname_arg("o","output","Output file.",false,"sp-output","output");
TCLAP::SwitchArg wimport_arg("","wimport","Show a warning when trying to import an already imported file.");
command_line.add(wimport_arg);
command_line.add(input_fname_arg);
command_line.add(output_fname_arg);
command_line.parse(argc,argv);
input_fname = input_fname_arg.getValue();
output_fname = output_fname_arg.getValue();
wimport = wimport_arg.getValue();
} catch (TCLAP::ArgException &e) {
Error::throw_error_without_location(e.error());
}
}

12
src/Arguments.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#include <string>
struct Arguments
{
static void parse(int argc, char** argv);
static std::string input_fname;
static std::string output_fname;
static bool wimport;
};

124
src/Error.cpp Normal file
View File

@ -0,0 +1,124 @@
#include "Error.h"
#include "StringConversion.h"
#include "Importer.h"
#include <iostream>
#include <algorithm>
std::string Error::get_spaces(const int& num)
{
std::string output;
for(int i = 0; i < num; i++) { output += " "; }
return output;
}
void Error::show_import_line(const Location& loc, std::ostream& output_stream)
{
output_stream << "in file included from ";
output_stream << "\033[1;1m";
output_stream << loc.to_string();
output_stream << ": ";
output_stream << "\033[0;0m";
output_stream << std::endl;
}
void Error::show_import_lines(const Location& loc, void(*import_line_printer)(const Location&, std::ostream&), std::ostream& stream)
{
std::vector<Location> locations;
Location scanned_loc = loc;
while(scanned_loc.parent)
{
locations.push_back(*scanned_loc.parent.get());
scanned_loc = *scanned_loc.parent.get();
}
std::reverse(locations.begin(),locations.end());
for(const auto& location : locations)
{
import_line_printer(location,stream);
}
}
void Error::throw_error(const Location& loc, const std::string line_text, const std::string& details)
{
show_import_lines(loc,show_import_line,std::cerr);
std::string linestr = int_to_string(loc.line);
std::cerr << "\033[1;1m";
std::cerr << loc.to_string();
std::cerr << ": ";
std::cerr << "\033[31;49m";
std::cerr << "error: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
std::cerr << linestr;
std::cerr << get_spaces(4);
std::cerr << line_text;
std::cerr << std::endl;
std::cerr << get_spaces(4 + linestr.size() + loc.column - 1);
std::cerr << "\033[31;49m";
std::cerr << "^";
std::cerr << "\033[0;0m";
std::cerr << std::endl;
exit(1);
}
void Error::throw_error_without_location(const std::string& details)
{
std::cerr << "\033[1;1m";
std::cerr << "\033[31;49m";
std::cerr << "error: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
exit(1);
}
void Error::throw_warning(const Location& loc, const std::string line_text, const std::string& details)
{
show_import_lines(loc,show_import_line,std::cout);
std::string linestr = int_to_string(loc.line);
std::cout << "\033[1;1m";
std::cout << loc.to_string();
std::cout << ": ";
std::cout << "\033[33;49m";
std::cout << "warning: ";
std::cout << "\033[0;0m";
std::cout << details;
std::cout << std::endl;
std::cout << linestr;
std::cout << get_spaces(4);
std::cout << line_text;
std::cout << std::endl;
std::cout << get_spaces(4 + linestr.size() + loc.column - 1);
std::cout << "\033[33;49m";
std::cout << "^";
std::cout << "\033[0;0m";
std::cout << std::endl;
}

17
src/Error.h Normal file
View File

@ -0,0 +1,17 @@
#pragma once
#include "Location.h"
namespace Error
{
void show_import_line(const Location& loc, std::ostream& output_stream);
void throw_error(const Location& loc, const std::string line_text, const std::string& details);
void throw_error_without_location(const std::string& details);
void throw_warning(const Location& loc, const std::string line_text, const std::string& details);
void show_import_lines(const Location& loc, void(*import_line_printer)(const Location&, std::ostream&), std::ostream& stream);
std::string get_spaces(const int& num);
}

24
src/FileIO.cpp Normal file
View File

@ -0,0 +1,24 @@
#include "FileIO.h"
#include <fstream>
#include <vector>
std::string FileIO::read_all(const std::string& filename)
{
std::ifstream file(filename);
if(!file.is_open()) return "";
std::vector<char> file_chars;
char fchar;
while (file) {
fchar = file.get();
if(fchar != -1 ) file_chars.push_back(fchar);
}
file.close();
return std::string(file_chars.begin(),file_chars.end());
}
void FileIO::write_all(const std::string& filename, const std::string& contents)
{
std::ofstream file(filename);
file << contents;
file.close();
}

8
src/FileIO.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
#include <string>
namespace FileIO // namespaces are just so neat
{
std::string read_all(const std::string& filename);
void write_all(const std::string& filename, const std::string& contents);
}

View File

@ -0,0 +1,44 @@
// Taken from https://github.com/InversePalindrome/Blog/blob/master/FormatString/FormatString.hpp
/*
Copyright (c) 2019 Inverse Palindrome
Blog - FormatString.hpp
https://inversepalindrome.com/
*/
#pragma once
#include <memory>
#include <string>
#include <cstdio>
template<typename T>
auto convert(T&& t)
{
if constexpr (std::is_same<std::remove_cv_t<std::remove_reference_t<T>>, std::string>::value)
{
return std::forward<T>(t).c_str();
}
else
{
return std::forward<T>(t);
}
}
template<typename... Args>
std::string format_string_internal(const std::string& format, Args&& ... args)
{
const auto size = std::snprintf(nullptr, 0, format.c_str(), std::forward<Args>(args)...) + 1;
const auto buffer = std::make_unique<char[]>(size);
std::snprintf(buffer.get(), size, format.c_str(), std::forward<Args>(args)...);
return std::string(buffer.get(), buffer.get() + size - 1);
}
template<typename... Args>
std::string format_string(const std::string& format, Args&& ... args)
{
return format_string_internal(format, convert(std::forward<Args>(args))...);
}

21
src/FormatString/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Inverse Palindrome
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

109
src/Importer.cpp Normal file
View File

@ -0,0 +1,109 @@
#include "Importer.h"
#include "Error.h"
#include "FileIO.h"
#include "Arguments.h"
#include <algorithm>
#include <fstream>
#include <iostream>
#define MAX_IMPORTS 100
int Importer::import_count = 0;
std::vector<std::shared_ptr<Location>> Importer::import_stack;
std::vector<std::string> Importer::imported_files;
TokenStream Importer::evaluate(const TokenStream& original)
{
int i = 0;
auto ret_tk = original;
TokenStream new_tokens;
while(original[i].tk_type != TT_EOF)
{
Token current_token = original[i];
if(current_token.tk_type == TT_Keyword && current_token.string_value == Lexer::keywords[1])
{
Token next_token = original[i+1];
if(next_token.tk_type == TT_EOF)
Error::throw_error(current_token.loc,current_token.line(),"did not expect EOF after import statement");
if(next_token.tk_type == TT_Identifier) // TODO: add support for strings
{
Token last_token = original[i+2];
if(last_token.tk_type != TT_Semicolon)
Error::throw_error(last_token.loc,last_token.line(),"expected a semicolon");
if(std::find(imported_files.begin(),imported_files.end(),next_token.string_value) != imported_files.end())
{
if(Arguments::wimport)
Error::throw_warning(next_token.loc,next_token.line(),"file already imported, skipping");
Token::erase(ret_tk[i]);
Token::erase(ret_tk[i+1]);
Token::erase(ret_tk[i+2]);
++i;
continue;
}
if(import_count > MAX_IMPORTS)
Error::throw_error(current_token.loc,current_token.line(),"maximum import depth exceeded");
std::string input_file_name = next_token.string_value + ".sp";
std::ifstream input_file(input_file_name); // only used to check if it exists, thus closed afterwards
if(!input_file.good())
Error::throw_error(next_token.loc,next_token.line(),"file not found");
input_file.close();
auto file_contents = FileIO::read_all(input_file_name);
auto top_location = std::make_shared<Location>(current_token.loc.line,current_token.loc.column,current_token.loc.fname);
top_location.get()->parent = current_token.loc.parent;
import_stack.push_back(top_location); // Keep ref_count above 0, just in case
auto import_lexer = Lexer::make_lexer(input_file_name);
Lexer::assign_parent_location(import_lexer,top_location);
TokenStream imported_tokens = import_lexer->lex(file_contents);
imported_tokens.pop_back(); // remove EOF at end of token stream
for(auto& tk : imported_tokens)
{
tk.loc.parent = top_location;
}
imported_files.push_back(next_token.string_value);
new_tokens.insert(new_tokens.end(),imported_tokens.begin(),imported_tokens.end());
Token::erase(ret_tk[i]);
Token::erase(ret_tk[i+1]);
Token::erase(ret_tk[i+2]);
} else
Error::throw_error(next_token.loc,next_token.line(),"import keyword should be followed by an identifier");
}
++i;
}
if(new_tokens.size() != 0)
{
new_tokens.insert(new_tokens.end(),ret_tk.begin(),ret_tk.end());
import_count++;
return evaluate(new_tokens);
}
return ret_tk;
}
void Importer::init(std::string init_file)
{
imported_files.push_back(init_file);
}

12
src/Importer.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#include "Token.h"
#include "Lexer.h"
namespace Importer
{
extern int import_count;
extern std::vector<std::shared_ptr<Location>> import_stack;
extern std::vector<std::string> imported_files;
TokenStream evaluate(const TokenStream& original);
void init(std::string init_file);
}

303
src/Lexer.cpp Normal file
View File

@ -0,0 +1,303 @@
#include "Lexer.h"
#include "Error.h"
#include <algorithm>
#define WHITESPACE "\t \n"
#define LETTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ_"
#define IDENTIFIERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ_0123456789"
#define DIGITS "0123456789"
const std::array<std::string,KEYWORD_COUNT> Lexer::keywords = {"var","import","out"};
Lexer::Lexer(const std::string& fname)
: loc(1,0,fname), index(-1), prev_loc(1,0,fname)
{
}
Lexer::~Lexer()
{
}
int Lexer::advance()
{
prev_loc = loc;
++index;
loc.advance();
if(index == current_lexed_text.size()) return 0;
current_char = current_lexed_text[index];
loc.pos_from_char(current_char);
if(current_char == '\n')
{
previous_line_text = current_line_text;
current_line_text = this->recalculate_current_line(current_lexed_text);
}
return 1;
}
int Lexer::rewind()
{
loc = prev_loc;
--index;
if(index == -1) return 0;
if(current_char == '\n')
{
current_line_text = previous_line_text;
}
current_char = current_lexed_text[index];
return 1;
}
std::string Lexer::recalculate_current_line(const std::string& text)
{
int idx = index;
std::string final_str;
++idx;
while(idx != text.size() && text[idx] != '\n')
{
final_str += text[idx];
++idx;
}
return final_str;
}
std::shared_ptr<Lexer> Lexer::make_lexer(const std::string& fname)
{
return std::shared_ptr<Lexer>(new Lexer(fname)); // not using make_shared because the constructor is private
}
void Lexer::assign_parent_location(std::shared_ptr<Lexer>& lexer, const std::shared_ptr<Location>& loc)
{
lexer->loc.parent = loc;
}
bool Lexer::is_in_string(const std::string& string, const char& character)
{
return string.find(character) != std::string::npos;
}
TokenStream Lexer::lex(const std::string& text)
{
TokenStream result;
bool comment = false;
current_lexed_text = text;
current_line_text = this->recalculate_current_line(current_lexed_text);
while(this->advance())
{
if(this->current_char == '\n') comment = false;
if(comment) continue;
if(is_in_string(WHITESPACE,current_char)) continue;
else if(is_in_string(LETTERS,current_char))
{
result.push_back(create_identifier());
}
else if(is_in_string(DIGITS,current_char))
{
result.push_back(create_number());
}
else if(current_char == '\'')
{
result.push_back(create_string());
}
else switch(current_char)
{
case '/':
if(index + 1 != current_lexed_text.size())
{
if(current_lexed_text[index+1] == '/')
{
comment = true;
break;
}
}
result.push_back(Token::make_with_line({TT_Div,loc},current_line_text));
break;
case '+':
result.push_back(Token::make_with_line({TT_Plus,loc},current_line_text));
break;
case '-':
result.push_back(Token::make_with_line({TT_Minus,loc},current_line_text));
break;
case '*':
result.push_back(Token::make_with_line({TT_Mul,loc},current_line_text));
break;
case '@':
result.push_back(Token::make_with_line({TT_At,loc},current_line_text));
break;
case '=':
result.push_back(Token::make_with_line({TT_Equal,loc},current_line_text));
break;
case '>':
result.push_back(Token::make_with_line({TT_GreaterThan,loc},current_line_text));
break;
case '<':
result.push_back(Token::make_with_line({TT_LessThan,loc},current_line_text));
break;
case '(':
result.push_back(Token::make_with_line({TT_LParen,loc},current_line_text));
break;
case ')':
result.push_back(Token::make_with_line({TT_RParen,loc},current_line_text));
break;
case '{':
result.push_back(Token::make_with_line({TT_RBracket,loc},current_line_text));
break;
case '}':
result.push_back(Token::make_with_line({TT_LBracket,loc},current_line_text));
break;
case ';':
result.push_back(Token::make_with_line({TT_Semicolon,loc},current_line_text));
break;
default:
Error::throw_error(loc,current_line_text,"unknown character");
}
}
result.push_back(Token(TT_EOF,loc));
return result;
}
Token Lexer::create_identifier()
{
std::vector<char> characters;
int prev_line = loc.line;
int prev_column = loc.column;
characters.push_back(current_char);
while(this->advance())
{
if(is_in_string(IDENTIFIERS,current_char))
{
characters.push_back(current_char);
}
else
{
this->rewind();
std::string identifier(characters.begin(), characters.end());
auto location = std::find(keywords.begin(),keywords.end(),identifier);
if(location != keywords.end())
{
return Token::make_with_line({TT_Keyword,identifier,{prev_line,prev_column,loc.fname}},current_line_text);
}
return Token::make_with_line({TT_Identifier,identifier,{prev_line,prev_column,loc.fname}},current_line_text);
}
}
std::string identifier(characters.begin(), characters.end());
auto location = std::find(keywords.begin(),keywords.end(),identifier);
if(location != keywords.end())
{
return Token::make_with_line({TT_Keyword,identifier,{prev_line,prev_column,loc.fname}},current_line_text);
}
return Token::make_with_line({TT_Identifier,identifier,{prev_line,prev_column,loc.fname}},current_line_text);
}
Token Lexer::create_number()
{
std::vector<char> characters;
int prev_line = loc.line;
int prev_column = loc.column;
int dot_count = 0;
characters.push_back(current_char);
while(this->advance())
{
if(is_in_string(DIGITS,current_char))
{
characters.push_back(current_char);
}
else if (current_char == '.')
{
if(dot_count == 0)
{
characters.push_back(current_char);
++dot_count;
}
else {
Error::throw_warning(loc,current_line_text,"floats can only have one dot");
this->rewind();
float tk_value = std::stof(std::string(characters.begin(), characters.end()).c_str());
return Token::make_with_line({TT_Float,tk_value,{prev_line,prev_column,loc.fname}},current_line_text);
}
}
else
{
this->rewind();
if(dot_count != 0)
{
float tk_value = std::stof(std::string(characters.begin(), characters.end()).c_str());
return Token::make_with_line({TT_Float,tk_value,{prev_line,prev_column,loc.fname}},current_line_text);
}
int tk_value = atoi(std::string(characters.begin(), characters.end()).c_str());
return Token::make_with_line({TT_Number,tk_value,{prev_line,prev_column,loc.fname}},current_line_text);
}
}
if(dot_count != 0)
{
float tk_value = std::stof(std::string(characters.begin(), characters.end()).c_str());
return Token::make_with_line({TT_Float,tk_value,{prev_line,prev_column,loc.fname}},current_line_text);
}
int tk_value = atoi(std::string(characters.begin(), characters.end()).c_str());
return Token::make_with_line({TT_Number,tk_value,{prev_line,prev_column,loc.fname}},current_line_text);
}
Token Lexer::create_string()
{
std::vector<char> characters;
int prev_line = loc.line;
int prev_column = loc.column;
while(this->advance())
{
if(current_char == '\n')
{
this->rewind();
Error::throw_error(loc,current_line_text,"expected end of string but got newline");
}
if(current_char == '\'')
{
std::string identifier(characters.begin(), characters.end());
return Token::make_with_line({TT_String,identifier,{prev_line,prev_column,loc.fname}},current_line_text);
}
if(current_char == '\\')
{
if(index + 1 == current_lexed_text.size())
{
Error::throw_error(loc,current_line_text,"unfinished escape sequence");
}
switch(current_lexed_text[index+1])
{
case 'n':
characters.push_back('\n');
break;
case '\'':
characters.push_back('\'');
break;
case '\\':
characters.push_back('\\');
break;
default:
Error::throw_error(loc,current_line_text,"unknown escape sequence");
}
++index;
++loc.column;
continue;
}
characters.push_back(current_char);
}
this->rewind();
Error::throw_error(loc,current_line_text,"expected end of string but got EOF");
return Token(TT_Null,loc); // unreachable since Error::throw_error calls exit()
}

45
src/Lexer.h Normal file
View File

@ -0,0 +1,45 @@
#pragma once
#include "Token.h"
#include <memory>
#include <vector>
#include <string>
#include <array>
typedef std::vector<Token> TokenStream;
#define KEYWORD_COUNT 3
class Lexer
{
private:
Location loc;
Location prev_loc;
int advance();
int rewind();
char current_char;
int index;
Lexer(const std::string& fname);
std::string current_line_text;
std::string previous_line_text;
std::string current_lexed_text;
std::string recalculate_current_line(const std::string& text);
Token create_string();
Token create_number();
Token create_identifier();
bool is_in_string(const std::string& string, const char& character);
public:
static const std::array<std::string,KEYWORD_COUNT> keywords;
~Lexer();
TokenStream lex(const std::string& text);
static std::shared_ptr<Lexer> make_lexer(const std::string& fname);
static void assign_parent_location(std::shared_ptr<Lexer>& lexer, const std::shared_ptr<Location>& loc);
};

55
src/Location.cpp Normal file
View File

@ -0,0 +1,55 @@
#include "Location.h"
#include "StringConversion.h"
#include <sstream>
Location::Location(int ln, int col, std::string file)
: line(ln), column(col), fname(file)
{
}
Location::~Location()
{
}
std::string Location::to_string() const
{
std::ostringstream ss;
ss << fname;
ss << ":";
ss << int_to_string(line);
ss << ":";
ss << int_to_string(column);
return ss.str();
}
std::string Location::to_parenthesized_string() const
{
return "(" + this->to_string() + ")";
}
void Location::advance()
{
++column;
}
void Location::pos_from_char(const char& character)
{
if(character == '\n')
{
++line;
column = 0;
}
}
void Location::operator=(const Location &other)
{
this->parent = other.parent;
this->line = other.line;
this->column = other.column;
this->fname.assign(other.fname.c_str());
}
void Location::copy(const Location &other)
{
this->operator=(other);
}

24
src/Location.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#include <string>
#include <memory>
struct Location
{
int line;
int column;
std::string fname;
std::shared_ptr<Location> parent = nullptr;
Location(int ln, int col, std::string file);
~Location();
std::string to_string() const;
std::string to_parenthesized_string() const;
void advance();
void pos_from_char(const char& character);
void operator=(const Location& other);
void copy(const Location& other);
};

66
src/Normalizer.cpp Normal file
View File

@ -0,0 +1,66 @@
#include "Normalizer.h"
TokenStream Normalizer::normalize(const TokenStream& input)
{
TokenStream result;
int i = 0;
while (i < input.size())
{
Token current = input[i];
if(current.tk_type == TT_Null)
{
i++;
continue;
}
if(current.tk_type == TT_Equal)
{
if(i+1 != input.size())
{
if(input[i+1].tk_type == TT_Equal)
{
i += 2;
result.push_back(current.copy_with_new_type(TT_Equals));
continue;
}
}
i++;
result.push_back(current);
continue;
}
if(current.tk_type == TT_GreaterThan)
{
if(i+1 != input.size())
{
if(input[i+1].tk_type == TT_Equal)
{
i += 2;
result.push_back(current.copy_with_new_type(TT_GTE));
continue;
}
}
i++;
result.push_back(current);
continue;
}
if(current.tk_type == TT_LessThan)
{
if(i+1 != input.size())
{
if(input[i+1].tk_type == TT_Equal)
{
i += 2;
result.push_back(current.copy_with_new_type(TT_LTE));
continue;
}
}
i++;
result.push_back(current);
continue;
}
i++;
result.push_back(current);
continue;
}
return result;
}

10
src/Normalizer.h Normal file
View File

@ -0,0 +1,10 @@
// Normalizer: take token stream and remove NULL tokens + convert > and = into >= and similar
#pragma once
#include "Token.h"
#include "Lexer.h" // for TokenStream
namespace Normalizer
{
TokenStream normalize(const TokenStream& input);
}

16
src/StringConversion.cpp Normal file
View File

@ -0,0 +1,16 @@
#include "StringConversion.h"
#include <cstdio>
std::string int_to_string(const int& value)
{
char buffer[12];
sprintf(buffer,"%d",value);
return {buffer};
}
std::string float_to_string(const float& value)
{
char buffer[50];
sprintf(buffer,"%f",value);
return {buffer};
}

6
src/StringConversion.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
#include <string>
std::string int_to_string(const int& value);
std::string float_to_string(const float& value);

190
src/Token.cpp Normal file
View File

@ -0,0 +1,190 @@
#include "Token.h"
#include "StringConversion.h"
#include "FormatString/FormatString.hpp"
const std::string token_strings[] = {
"TT_IDENTIFIER",
"TT_NUMBER",
"TT_FLOAT",
"TT_KEYWORD",
"TT_STRING",
"TT_PLUS",
"TT_MINUS",
"TT_MUL",
"TT_DIV",
"TT_AT",
"TT_EQUAL",
"TT_LESSTHAN",
"TT_GREATERTHAN",
"TT_LPAREN",
"TT_RPAREN",
"TT_LBRACKET",
"TT_RBRACKET",
"TT_SEMICOLON",
"TT_LOADEDSTRING",
"TT_EOF",
"TT_NULL",
"TT_EQUALS",
"TT_GTE",
"TT_LTE",
};
Token::Token(const TokenType& type)
: tk_type(type), loc(0,0,"")
{
}
Token::Token(const TokenType& type, const Location& location)
: tk_type(type), loc(location)
{
}
Token::Token(const TokenType& type, const std::string& val)
: tk_type(type), loc(0,0,""), string_value(val)
{
}
Token::Token(const TokenType& type, const int& val, const Location& location)
: tk_type(type), int_value(val), loc(location)
{
}
Token::Token(const TokenType& type, const std::string& val, const Location& location)
: tk_type(type), string_value(val), loc(location)
{
}
Token::Token(const TokenType& type, const float& val, const Location& location)
: tk_type(type), float_value(val), loc(location)
{
}
Token::~Token()
{
}
Token Token::copy_with_new_type(const TokenType& type)
{
Token result(type,loc);
result.int_value = int_value;
result.float_value = float_value;
result.string_value = string_value;
result.line_text = line_text;
return result;
}
std::string Token::to_string() const
{
std::string details = loc.to_parenthesized_string();
if(tk_type == TT_Number)
{
return format_string("INT:%d %s",int_value,details);
}
else if (tk_type == TT_Float)
{
return format_string("FLOAT:%f %s",float_value,details);
}
else if (tk_type == TT_Identifier)
{
return format_string("ID:%s %s",string_value,details);
}
else if (tk_type == TT_Keyword)
{
return format_string("KEYWORD:%s %s",string_value,details);
}
else if (tk_type == TT_String)
{
return format_string("STRING:'%s' %s",string_value,details);
}
switch(tk_type)
{
case TT_EOF:
return "EOF " + details;
case TT_Plus:
return "PLUS " + details;
case TT_Minus:
return "MINUS " + details;
case TT_Mul:
return "MUL " + details;
case TT_Div:
return "DIV " + details;
case TT_At:
return "AT " + details;
case TT_Equal:
return "EQUAL " + details;
case TT_LessThan:
return "LESSTHAN " + details;
case TT_GreaterThan:
return "GREATERTHAN " + details;
case TT_LParen:
return "LPAREN " + details;
case TT_RParen:
return "RPAREN " + details;
case TT_LBracket:
return "LBRACKET " + details;
case TT_RBracket:
return "RBRACKET " + details;
case TT_Semicolon:
return "SEMICOLON " + details;
case TT_LoadedString:
return "LDSTRING " + details;
case TT_Equals:
return "EQUALS " + details;
case TT_GTE:
return "GTE " + details;
case TT_LTE:
return "LTE " + details;
}
return "";
}
std::string Token::line() const
{
return this->line_text;
}
// Return a copy of the original token, but adding the contents of the line where
// the token was located.
Token Token::make_with_line(const Token& origin, const std::string& line_text)
{
Token result(origin.tk_type,origin.loc);
result.int_value = origin.int_value;
result.float_value = origin.float_value;
result.string_value = origin.string_value;
result.line_text = line_text;
return result;
}
void Token::operator=(const Token& other)
{
tk_type = other.tk_type;
int_value = other.int_value;
string_value = other.string_value;
float_value = other.float_value;
line_text = other.line_text;
}
void Token::erase(Token& tk)
{
tk.tk_type = TT_Null;
}
bool Token::match_token_types(const TokenStream& a, const TokenStream& b, int count)
{
int size = [](int a, int b){ return a > b ? b : a; }(a.size() - count,b.size());
for(int i = 0; i < size; ++i)
{
if(a[i+count].tk_type != b[i].tk_type)
{
return false;
}
}
return true;
}

78
src/Token.h Normal file
View File

@ -0,0 +1,78 @@
#pragma once
#include "Location.h"
#include <string>
#include <vector>
enum TokenType
{
TT_Identifier,
TT_Number,
TT_Float,
TT_Keyword,
TT_String,
TT_Plus,
TT_Minus,
TT_Mul,
TT_Div,
TT_At,
TT_Equal,
TT_LessThan,
TT_GreaterThan,
TT_LParen,
TT_RParen,
TT_LBracket,
TT_RBracket,
TT_Semicolon,
TT_LoadedString,
TT_EOF,
TT_Null,
TT_Equals,
TT_GTE,
TT_LTE
};
extern const std::string token_strings[];
struct Token
{
TokenType tk_type;
int int_value;
std::string string_value;
float float_value;
Location loc;
Token(const TokenType& type);
Token(const TokenType& type, const Location& location);
Token(const TokenType& type, const int& val, const Location& location);
Token(const TokenType& type, const std::string& val, const Location& location);
Token(const TokenType& type, const std::string& val);
Token(const TokenType& type, const float& val, const Location& location);
~Token();
std::string to_string() const;
std::string line() const;
static Token make_with_line(const Token& origin, const std::string& line_text);
void operator=(const Token& other);
static void erase(Token& tk);
Token copy_with_new_type(const TokenType& type);
static bool match_token_types(const TokenStream& a, const TokenStream& b, int count);
private:
std::string line_text;
};
typedef std::vector<Token> TokenStream;

65
src/TopLevelParser.cpp Normal file
View File

@ -0,0 +1,65 @@
#include "TopLevelParser.h"
#include "Error.h"
TopLevelParseNode::TopLevelParseNode(const ParseContext& ctx, const TokenStream& tk_stream)
: context(ctx), tokens(tk_stream)
{
}
TopLevelParseNode::~TopLevelParseNode()
{
}
TopLevelParser::TopLevelParser()
{
}
TopLevelParser::~TopLevelParser()
{
}
std::vector<TopLevelParseNode> TopLevelParser::ParseTokenStream(const TokenStream& stream)
{
current = stream;
index = -1;
std::vector<TopLevelParseNode> result;
while(index < current.size())
{
++index;
if(current[index].tk_type == TT_Keyword)
{
if(current[index].string_value == "var")
{
result.push_back(ParseGlobalVariable());
} else {
Error::throw_error(current[index].loc,current[index].line(),"global sections must start with var or @");
}
}
else if (current[index].tk_type == TT_At)
{
result.push_back(ParseFunctionDefinition());
} else {
Error::throw_error(current[index].loc,current[index].line(),"global sections must start with var or @");
}
}
return result;
}
TopLevelParseNode TopLevelParser::ParseGlobalVariable()
{
int prev_index = index;
if(!Token::match_token_types(current,{
{TT_Keyword},
{TT_Identifier},
{TT_LParen},
{TT_Identifier},
{TT_RParen}
},index))
{
Error::throw_error(current[index].loc,current[index].line(),"invalid syntax");
}
index += 5;
}

28
src/TopLevelParser.h Normal file
View File

@ -0,0 +1,28 @@
#pragma once
#include "Token.h"
#include "Lexer.h" //for TokenStream
enum ParseContext {
ParseContext_GlobalVariable,
ParseContext_FunctionDefinition
};
struct TopLevelParseNode {
ParseContext context;
TokenStream tokens;
TopLevelParseNode(const ParseContext& ctx, const TokenStream& tk_stream);
~TopLevelParseNode();
};
class TopLevelParser
{
private:
TokenStream current;
int index;
TopLevelParseNode ParseGlobalVariable();
TopLevelParseNode ParseFunctionDefinition();
public:
std::vector<TopLevelParseNode> ParseTokenStream(const TokenStream& stream);
TopLevelParser();
~TopLevelParser();
};

25
src/sapphire.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "Lexer.h"
#include "FileIO.h"
#include "Importer.h"
#include "Arguments.h"
#include "Normalizer.h"
#include <iostream>
int main(int argc, char** argv)
{
Arguments::parse(argc,argv);
std::string fname = Arguments::input_fname;
std::string contents = FileIO::read_all(fname);
TokenStream res = Lexer::make_lexer(fname)->lex(contents);
Importer::init(fname.substr(0,fname.find_last_of('.')));
res = Importer::evaluate(res);
res = Normalizer::normalize(res);
for(int i = 0; i < res.size(); i++)
{
std::cout << res[i].to_string() << std::endl;
}
std::cout << "Output filename: " << Arguments::output_fname << std::endl;
}

6
src/tclap-1.2.5/AUTHORS Normal file
View File

@ -0,0 +1,6 @@
original author: Michael E. Smoot
current maintainer: Daniel Aarno
more contributions: Erik Zeek
more contributions: Fabien Carmagnac (Tinbergen-AM)
outstanding editing: Carol Smoot

27
src/tclap-1.2.5/COPYING Normal file
View File

@ -0,0 +1,27 @@
Copyright (c) 2003 Michael E. Smoot
Copyright (c) 2004 Daniel Aarno
Copyright (c) 2017 Google Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

1786
src/tclap-1.2.5/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

182
src/tclap-1.2.5/INSTALL Normal file
View File

@ -0,0 +1,182 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -0,0 +1,10 @@
ACLOCAL_AMFLAGS = -I config
SUBDIRS = include examples docs tests msc config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(PACKAGE).pc
EXTRA_DIST = $(PACKAGE).pc.in
DISTCLEANFILES = $(PACKAGE).pc

830
src/tclap-1.2.5/Makefile.in Normal file
View File

@ -0,0 +1,830 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES = tclap.pc
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
DATA = $(pkgconfig_DATA)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/tclap.pc.in \
$(top_srcdir)/config/install-sh $(top_srcdir)/config/missing \
$(top_srcdir)/config/mkinstalldirs AUTHORS COPYING ChangeLog \
INSTALL NEWS README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
# Exists only to be overridden by the user if desired.
AM_DISTCHECK_DVI_TARGET = dvi
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@
WARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I config
SUBDIRS = include examples docs tests msc config
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(PACKAGE).pc
EXTRA_DIST = $(PACKAGE).pc.in
DISTCLEANFILES = $(PACKAGE).pc
all: all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
tclap.pc: $(top_builddir)/config.status $(srcdir)/tclap.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-zstd: distdir
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
*.tar.zst*) \
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
esac
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile $(DATA)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-pkgconfigDATA
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-pkgconfigDATA
.MAKE: $(am__recursive_targets) install-am install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
dist-zstd distcheck distclean distclean-generic distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgconfigDATA install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
uninstall-am uninstall-pkgconfigDATA
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

0
src/tclap-1.2.5/NEWS Normal file
View File

12
src/tclap-1.2.5/README Normal file
View File

@ -0,0 +1,12 @@
TCLAP - Templatized Command Line Argument Parser
This is a simple C++ library that facilitates parsing command line
arguments in a type independent manner. It doesn't conform exactly
to either the GNU or POSIX standards, although it is close. See
docs/manual.html for descriptions of how things work or look at the
simple examples in the examples dir.
To find out what the latest changes are read the NEWS file in this
directory.
Any and all feedback is welcome at https://sf.net/p/tclap/discussion/

1134
src/tclap-1.2.5/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
EXTRA_DIST = ac_cxx_have_sstream.m4\
ac_cxx_have_strstream.m4\
ac_cxx_namespaces.m4\
bb_enable_doxygen.m4

View File

@ -0,0 +1,494 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = config
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
config.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in depcomp \
install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@
WARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = ac_cxx_have_sstream.m4\
ac_cxx_have_strstream.m4\
ac_cxx_namespaces.m4\
bb_enable_doxygen.m4
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu config/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu config/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
config.h: stamp-h1
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config/config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile config.h
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: all install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
cscopelist-am ctags ctags-am distclean distclean-generic \
distclean-hdr distclean-tags distdir dvi dvi-am html html-am \
info info-am install install-am install-data install-data-am \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,19 @@
dnl @synopsis AC_CXX_HAVE_LONG_LONG
dnl
dnl If the C++ implementation have a long long type
dnl
AC_DEFUN([AC_CXX_HAVE_LONG_LONG],
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([],[long long x = 1; return 0;],
ac_cv_cxx_have_long_long=yes, ac_cv_cxx_have_long_long=no)
if test "$ac_cv_cxx_have_long_long" = yes; then
AC_DEFINE(HAVE_LONG_LONG, 1,
[define if the C++ implementation have long long])
else
AC_DEFINE(HAVE_LONG_LONG, 0,
[define if the C++ implementation have long long])
fi
AC_LANG_RESTORE
])

View File

@ -0,0 +1,25 @@
dnl @synopsis AC_CXX_HAVE_SSTREAM
dnl
dnl If the C++ library has a working stringstream, define HAVE_SSTREAM.
dnl
dnl @author Ben Stanley
dnl @version $Id: ac_cxx_have_sstream.m4,v 1.2 2006/02/22 02:10:28 zeekec Exp $
dnl
AC_DEFUN([AC_CXX_HAVE_SSTREAM],
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(sstream)
AC_CACHE_CHECK([whether the STL defines stringstream],
[ac_cv_cxx_have_sstream],
[AC_TRY_COMPILE([#include <sstream>
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[stringstream message; message << "Hello"; return 0;],
ac_cv_cxx_have_sstream=yes, ac_cv_cxx_have_sstream=no)
])
if test "$ac_cv_cxx_have_sstream" = yes; then
AC_DEFINE(HAVE_SSTREAM,1,[define if the compiler has stringstream])
fi
AC_LANG_RESTORE
])

View File

@ -0,0 +1,28 @@
dnl @synopsis AC_CXX_HAVE_STRSTREAM
dnl
dnl If the C++ library has a working strstream, define HAVE_CLASS_STRSTREAM.
dnl
dnl Adapted from ac_cxx_have_sstream.m4 by Steve Robbins
dnl
AC_DEFUN([AC_CXX_HAVE_STRSTREAM],
[AC_REQUIRE([AC_CXX_NAMESPACES])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_CHECK_HEADERS(strstream)
AC_CACHE_CHECK([whether the STL defines strstream],
[ac_cv_cxx_have_class_strstream],
[AC_TRY_COMPILE([#if HAVE_STRSTREAM
# include <strstream>
#else
# include <strstream.h>
#endif
#ifdef HAVE_NAMESPACES
using namespace std;
#endif],[ostrstream message; message << "Hello"; return 0;],
ac_cv_cxx_have_class_strstream=yes, ac_cv_cxx_have_class_strstream=no)
])
if test "$ac_cv_cxx_have_class_strstream" = yes; then
AC_DEFINE(HAVE_CLASS_STRSTREAM,1,[define if the library defines strstream])
fi
AC_LANG_RESTORE
])

View File

@ -0,0 +1,22 @@
dnl @synopsis AC_CXX_NAMESPACES
dnl
dnl If the compiler can prevent names clashes using namespaces, define
dnl HAVE_NAMESPACES.
dnl
dnl @version $Id: ac_cxx_namespaces.m4,v 1.1 2003/03/19 02:40:00 mes5k Exp $
dnl @author Luc Maisonobe
dnl
AC_DEFUN([AC_CXX_NAMESPACES],
[AC_CACHE_CHECK(whether the compiler implements namespaces,
ac_cv_cxx_namespaces,
[AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}],
[using namespace Outer::Inner; return i;],
ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no)
AC_LANG_RESTORE
])
if test "$ac_cv_cxx_namespaces" = yes; then
AC_DEFINE(HAVE_NAMESPACES,1,[define to 1 if the compiler implements namespaces])
fi
])

View File

@ -0,0 +1,31 @@
dnl HAVE_WARN_EFFECTIVE_CXX
dnl ----------------------
dnl
dnl If the C++ compiler accepts the `-Weffc++' flag,
dnl set output variable `WARN_EFFECTIVE_CXX' to `-Weffc++' and
dnl `WARN_NO_EFFECTIVE_CXX' to `-Wno-effc++'. Otherwise,
dnl leave both empty.
dnl
AC_DEFUN([HAVE_WARN_EFFECTIVE_CXX],
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING([whether the C++ compiler (${CXX}) accepts -Weffc++])
AC_CACHE_VAL([_cv_warn_effective_cxx],
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
save_cxxflags="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Weffc++"
AC_TRY_COMPILE([],[main();],
[_cv_warn_effective_cxx=yes], [_cv_warn_effective_cxx=no])
CXXFLAGS="$save_cxxflags"
AC_LANG_RESTORE
])
AC_MSG_RESULT([$_cv_warn_effective_cxx])
if test "$_cv_warn_effective_cxx" = yes; then
WARN_EFFECTIVE_CXX=-Weffc++
WARN_NO_EFFECTIVE_CXX=-Wno-effc++
fi
AC_SUBST([WARN_EFFECTIVE_CXX])
AC_SUBST([WARN_NO_EFFECTIVE_CXX])
])

View File

@ -0,0 +1,18 @@
AC_DEFUN([BB_ENABLE_DOXYGEN],
[
AC_ARG_ENABLE(doxygen, [--enable-doxygen enable documentation generation with doxygen (auto)])
if test "x$enable_doxygen" = xno; then
enable_doc=no
else
AC_PATH_PROG(DOXYGEN, doxygen, , $PATH)
if test x$DOXYGEN = x; then
if test "x$enable_doxygen" = xyes; then
AC_MSG_ERROR([could not find doxygen])
fi
enable_doc=no
else
enable_doc=yes
fi
fi
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
])

View File

@ -0,0 +1,72 @@
/* config/config.h.in. Generated from configure.ac by autoheader. */
/* define if the library defines strstream */
#undef HAVE_CLASS_STRSTREAM
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* define if the C++ implementation have long long */
#undef HAVE_LONG_LONG
/* define to 1 if the compiler implements namespaces */
#undef HAVE_NAMESPACES
/* define if the compiler has stringstream */
#undef HAVE_SSTREAM
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <strstream> header file. */
#undef HAVE_STRSTREAM
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION

411
src/tclap-1.2.5/config/depcomp Executable file
View File

@ -0,0 +1,411 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
# Copyright 1999, 2000 Free Software Foundation, Inc.
# This program 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, or (at your option)
# any later version.
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# `libtool' can also be set to `yes' or `no'.
depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. This file always lives in the current directory.
# Also, the AIX compiler puts `$object:' at the start of each line;
# $object doesn't have directory information.
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
outname="$stripped.o"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 AIX compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
tmpdepfile1="$object.d"
tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'`
if test "$libtool" = yes; then
"$@" -Wc,-MD
else
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
if test -f "$tmpdepfile1"; then
tmpdepfile="$tmpdepfile1"
else
tmpdepfile="$tmpdepfile2"
fi
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a space and a tab in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
test -z "$dashmflag" && dashmflag=-M
( IFS=" "
case " $* " in
*" --mode=compile "*) # this is libtool, let us make it quiet
for arg
do # cycle over the arguments
case "$arg" in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
# X makedepend
(
shift
cleared=no
for arg in "$@"; do
case $cleared in no)
set ""; shift
cleared=yes
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift;;
-*)
;;
*)
set fnord "$@" "$arg"; shift;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tail +3 "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the proprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
( IFS=" "
case " $* " in
*" --mode=compile "*)
for arg
do # cycle over the arguments
case $arg in
"--mode=compile")
# insert --quiet before "--mode=compile"
set fnord "$@" --quiet
shift # fnord
;;
esac
set fnord "$@" "$arg"
shift # fnord
shift # "$arg"
done
;;
esac
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
) &
proc=$!
"$@"
stat=$?
wait "$proc"
if test "$stat" != 0; then exit $stat; fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0

251
src/tclap-1.2.5/config/install-sh Executable file
View File

@ -0,0 +1,251 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

283
src/tclap-1.2.5/config/missing Executable file
View File

@ -0,0 +1,283 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program 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, or (at your option)
# any later version.
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing 0.3 - GNU automake"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar ${1+"$@"} && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar ${1+"$@"} && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2003/04/03 18:13:41 mes5k Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

View File

@ -0,0 +1,153 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
#
# This program 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, or (at your option)
# any later version.
#
# This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name NAME --log-file PATH --trs-file PATH
[--expect-failure {yes|no}] [--color-tests {yes|no}]
[--enable-hard-errors {yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
See the GNU Automake documentation for information.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here. We create the file first, then append to it,
# to ameliorate tests themselves also writing to the log file. Our tests
# don't, but others can (automake bug#35762).
: >"$log_file"
"$@" >>"$log_file" 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

5687
src/tclap-1.2.5/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
AC_INIT([tclap],[1.2.5])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR([examples/test1.cpp])
AM_CONFIG_HEADER(config/config.h)
AM_INIT_AUTOMAKE
AC_PROG_CXX
AC_CXX_HAVE_SSTREAM
AC_CXX_HAVE_STRSTREAM
AC_CXX_HAVE_LONG_LONG
AC_CHECK_PROG(DOT,dot,YES,NO)
AC_PROG_RANLIB
AC_PROG_INSTALL
BB_ENABLE_DOXYGEN
HAVE_WARN_EFFECTIVE_CXX
CXXFLAGS="$CXXFLAGS $WARN_EFFECTIVE_CXX"
AM_CONDITIONAL([HAVE_GNU_COMPILERS], [test x$ac_cv_cxx_compiler_gnu = xyes])
AC_CONFIG_FILES([ Makefile \
tclap.pc \
examples/Makefile \
include/Makefile \
include/tclap/Makefile \
config/Makefile \
docs/Makefile \
docs/Doxyfile \
msc/Makefile \
msc/examples/Makefile \
tests/Makefile])
AC_CONFIG_COMMANDS([default],[\
chmod a+x $ac_top_srcdir/tests/*.sh],[])
AC_OUTPUT

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
.NOTPARALLEL:
if DOC
all:
@DOXYGEN@ Doxyfile
manual: manual.xml
xsltproc -o $(abs_builddir)/manual.html --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl $(abs_srcdir)/manual.xml
else
all:
endif
EXTRA_DIST = manual.xml
dist_doc_DATA = index.html manual.html style.css
docdir = ${datadir}/doc/${PACKAGE}
install-data-local :
$(mkdir_p) $(DESTDIR)$(docdir)
cp -R html $(DESTDIR)$(docdir)
uninstall-local :
chmod -R o+w $(DESTDIR)$(docdir)/html
rm -rf $(DESTDIR)$(docdir)/html
dist-hook :
$(mkdir_p) $(distdir)
cp -R $(abs_builddir)/html $(distdir)
clean-local:
$(RM) -rf $(abs_builddir)/html/*
$(RM) -rf $(abs_builddir)/doxygen_sqlite3.db

View File

@ -0,0 +1,498 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = docs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(dist_doc_DATA) \
$(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES = Doxyfile
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(docdir)"
DATA = $(dist_doc_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__DIST_COMMON = $(srcdir)/Doxyfile.in $(srcdir)/Makefile.in \
$(top_srcdir)/config/mkinstalldirs README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@
WARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = ${datadir}/doc/${PACKAGE}
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = manual.xml
dist_doc_DATA = index.html manual.html style.css
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu docs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
Doxyfile: $(top_builddir)/config.status $(srcdir)/Doxyfile.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-dist_docDATA: $(dist_doc_DATA)
@$(NORMAL_INSTALL)
@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
done
uninstall-dist_docDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
tags TAGS:
ctags CTAGS:
cscope cscopelist:
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
for dir in "$(DESTDIR)$(docdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-local mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-data-local install-dist_docDATA
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_docDATA uninstall-local
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-local \
cscopelist-am ctags-am dist-hook distclean distclean-generic \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-data-local \
install-dist_docDATA install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags-am uninstall uninstall-am \
uninstall-dist_docDATA uninstall-local
.PRECIOUS: Makefile
.NOTPARALLEL:
@DOC_TRUE@all:
@DOC_TRUE@ @DOXYGEN@ Doxyfile
@DOC_TRUE@manual: manual.xml
@DOC_TRUE@ xsltproc -o $(abs_builddir)/manual.html --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl $(abs_srcdir)/manual.xml
@DOC_FALSE@all:
install-data-local :
$(mkdir_p) $(DESTDIR)$(docdir)
cp -R html $(DESTDIR)$(docdir)
uninstall-local :
chmod -R o+w $(DESTDIR)$(docdir)/html
rm -rf $(DESTDIR)$(docdir)/html
dist-hook :
$(mkdir_p) $(distdir)
cp -R $(abs_builddir)/html $(distdir)
clean-local:
$(RM) -rf $(abs_builddir)/html/*
$(RM) -rf $(abs_builddir)/doxygen_sqlite3.db
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,5 @@
To generate the manual from the docbook xml you need and xslt processor
and an xsl file that defines the output. For example:
xsltproc --stringparam html.stylesheet style.css /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl manual.xml > manual.html

View File

@ -0,0 +1,109 @@
<!--
-
- file: index.html
-
- Copyright (c) 2003,2006 Michael E. Smoot .
- All rights reverved.
-
- See the file COPYING in the top directory of this distribution for
- more information.
-
- THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 1st August 2004), see www.w3.org" />
<title>tclap -- Templatized C++ Command Line Parser Library</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<table summary="Title and Sourceforge logo.">
<tr>
<td align="left">
<h1>Templatized C++ Command Line Parser Library</h1>
</td>
<td align="right">
<a href="http://sourceforge.net/projects/tclap"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=76645&amp;type=15" width="150" height="40" alt="Get Templatized C++ Command Line Parser at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</td>
</tr>
</table>
<div class="links">
<h3>Links</h3>
<ul class="menu">
<li><a href="http://sourceforge.net/project/showfiles.php?group_id=76645">Download</a> the source</li><br/>
<li>Read the <a href="manual.html">Manual</a></li><br/>
<li>Read the <a href="html/index.html">API documentation</a></li><br/>
<li>Visit the
<a href="http://sourceforge.net/projects/tclap/">SourceForge project page</a></li><br/>
<li>Send <a href="https://sourceforge.net/p/tclap/_list/tickets">feedback, comments, patches, etc.</a></li></br>
</ul>
<h3>Branch 1.2</h3>
Windows <img src="https://dev.azure.com/danielaarno/tclap/_apis/build/status/tclap-CI-WIN%20(1.2)"
alt="Windows build status"><br>
Linux <img src="https://dev.azure.com/danielaarno/tclap/_apis/build/status/tclap-CI%20(1.2)"
alt="Linux build status"><br>
Mac <img src="https://dev.azure.com/danielaarno/tclap/_apis/build/status/tclap-CI-Mac%20(1.2)"
alt="Mac build status"><br>
</div>
<div class="main">
<p style="background-color:powderblue;">
<b>NOTE: </b>The current development version of TCLAP
is <A HREF="http://tclap.sourceforge.net/index.html">1.4</a>,
it is recommended for use by new projects.
</p>
<p>
<em>TCLAP</em> is a small, flexible library that provides a simple interface for
defining and accessing command line arguments. It was initially
inspired by the user friendly <a href=
"http://www.cs.bgu.ac.il/~cgproj/CLAP/">CLAP</a> library. The
difference is that this library is templatized, so the argument
class is type independent. Type independence avoids identical-except-for-type
objects, such as IntArg, FloatArg, and StringArg. While the library is
not strictly compliant with the GNU or POSIX standards, it is
close.
</p>
<p>
<em>TCLAP</em> is written in ANSI C++ and is meant to be compatible with any
standards-compliant C++ compiler. It is known to work on Linux, MacOS X,
Windows, and Solaris platforms. The library is implemented
entirely in header files making it easy to use and distribute with other
software. It is licensed under the
<a href="http://opensource.org/licenses/mit-license.php">MIT License</a>
for worry free distribution.
</p>
<p>
<em>TCLAP</em> is now a mature, stable, and feature rich package.
Unless I get <i>really</i> bored, it probably won't see much further
development aside from bug fixes and compatibility updates.
Please don't let any apparent project inactivity discourage you
from using the software!
</p>
<p>
Don't hesitate to <a href="https://sourceforge.net/p/tclap/_list/tickets">
send us your feedback</a>!
</p>
<p>
<em>Happy coding!</em>
</p>
</div>
</body>
</html>

View File

@ -0,0 +1,984 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Templatized C++ Command Line Parser Manual</title><link rel="stylesheet" type="text/css" href="style.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book"><div class="titlepage"><div><div><h1 class="title"><a name="idm1"></a>Templatized C++ Command Line Parser Manual</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Michael</span> <span class="othername">E</span> <span class="surname">Smoot</span></h3></div></div><div><p class="copyright">Copyright © 2003,2004,2005,2006,2009,2011,2012 Michael E. Smoot</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="chapter"><a href="#BASIC_USAGE">1. Basic Usage</a></span></dt><dd><dl><dt><span class="sect1"><a href="#OVERVIEW">Overview</a></span></dt><dt><span class="sect1"><a href="#EXAMPLE">Example</a></span></dt><dd><dl><dt><span class="sect2"><a href="#LIBRARY_PROPERTIES">Library Properties</a></span></dt><dt><span class="sect2"><a href="#ARG_PROPERTIES">Common Argument Properties</a></span></dt></dl></dd><dt><span class="sect1"><a href="#COMPILING">Compiling</a></span></dt></dl></dd><dt><span class="chapter"><a href="#FUNDAMENTAL_CLASSES">2. Fundamental Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="#COMMAND_LINE"><code class="classname">CmdLine</code></a></span></dt><dt><span class="sect1"><a href="#SWITCH_ARG"><code class="classname">SwitchArg</code></a></span></dt><dt><span class="sect1"><a href="#VALUE_ARG"><code class="classname">ValueArg</code></a></span></dt><dt><span class="sect1"><a href="#MULTI_ARG"><code class="classname">MultiArg</code></a></span></dt><dt><span class="sect1"><a href="#MULTI_SWITCH_ARG"><code class="classname">MultiSwitchArg</code></a></span></dt><dt><span class="sect1"><a href="#UNLABELED_VALUE_ARG"><code class="classname">UnlabeledValueArg</code></a></span></dt><dt><span class="sect1"><a href="#UNLABELED_MULTI_ARG"><code class="classname">UnlabeledMultiArg</code></a></span></dt></dl></dd><dt><span class="chapter"><a href="#COMPLICATIONS">3. Complications</a></span></dt><dd><dl><dt><span class="sect1"><a href="#COMBINE_SWITCHES">I want to combine multiple switches into one argument...</a></span></dt><dt><span class="sect1"><a href="#XOR">I want one argument or the other, but not both...</a></span></dt><dt><span class="sect1"><a href="#NO_FLAG">I have more arguments than single flags make sense for...</a></span></dt><dt><span class="sect1"><a href="#CONSTRAINT">I want to constrain the values allowed for a particular
argument...</a></span></dt><dt><span class="sect1"><a href="#ARG_ADD_CMDLINE">I want the Args to add themselves to the CmdLine...</a></span></dt><dt><span class="sect1"><a href="#CHANGE_OUTPUT">I want different output than what is provided...</a></span></dt><dt><span class="sect1"><a href="#NO_HELP_VERSION">I don't want the --help and --version switches to be created automatically...</a></span></dt><dt><span class="sect1"><a href="#IGNORE_ARGS">I want to ignore certain arguments...</a></span></dt><dt><span class="sect1"><a href="#IGNORE_UNMATCHED">I want to ignore unmatched arguments...</a></span></dt><dt><span class="sect1"><a href="#READING_HEX_INTEGERS">I want to read hex integers as arguments...</a></span></dt><dt><span class="sect1"><a href="#USING_ARGTRAITS">I want to use different types...</a></span></dt><dt><span class="sect1"><a href="#CHANGING_STARTSTRINGS">I want to use Windows-style flags like "/x" and "/y"...</a></span></dt></dl></dd><dt><span class="chapter"><a href="#NOTES">4. Notes</a></span></dt><dd><dl><dt><span class="sect1"><a href="#DESCRIPTION_EXCEPTIONS">Type Descriptions</a></span></dt><dt><span class="sect1"><a href="#VISITORS">Visitors</a></span></dt><dt><span class="sect1"><a href="#MORE_INFO">More Information</a></span></dt></dl></dd></dl></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="BASIC_USAGE"></a>Chapter 1. Basic Usage</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="#OVERVIEW">Overview</a></span></dt><dt><span class="sect1"><a href="#EXAMPLE">Example</a></span></dt><dd><dl><dt><span class="sect2"><a href="#LIBRARY_PROPERTIES">Library Properties</a></span></dt><dt><span class="sect2"><a href="#ARG_PROPERTIES">Common Argument Properties</a></span></dt></dl></dd><dt><span class="sect1"><a href="#COMPILING">Compiling</a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="OVERVIEW"></a>Overview</h2></div></div></div><p>
<span class="emphasis"><em>TCLAP</em></span> has a few key classes to be aware of.
The first is the
<code class="classname">CmdLine</code> (command line) class. This class parses
the command line passed to it according to the arguments that it
contains. Arguments are separate objects that are added to the
<code class="classname">CmdLine</code> object one at a time. The six
argument classes are: <code class="classname">ValueArg</code>,
<code class="classname">UnlabeledValueArg</code>,
<code class="classname">SwitchArg</code>, <code class="classname">MultiSwitchArg</code>,
<code class="classname">MultiArg</code> and
<code class="classname">UnlabeledMultiArg</code>.
These classes are templatized, which means they can be defined to parse
a value of any <a class="link" href="#USING_ARGTRAITS" title="I want to use different types..."> type</a>. Once you add the
arguments to the <code class="classname">CmdLine</code> object, it parses the
command line
and assigns the data it finds to the specific argument objects it
contains. Your program accesses the values parsed by
calls to the <code class="methodname">getValue()</code> methods of the
argument objects.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="EXAMPLE"></a>Example</h2></div></div></div><p>
Here is a simple <a class="ulink" href="test1.cpp" target="_top"> example</a> ...
</p><pre class="programlisting">
#include &lt;string&gt;
#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include &lt;tclap/CmdLine.h&gt;
int main(int argc, char** argv)
{
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object, and insert a message
// that describes the program. The "Command description message"
// is printed last in the help text. The second argument is the
// delimiter (usually space) and the last one is the version number.
// The CmdLine object parses the argv array based on the Arg objects
// that it contains.
TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
// Define a value argument and add it to the command line.
// A value arg defines a flag and a type of value that it expects,
// such as "-n Bishop".
TCLAP::ValueArg&lt;std::string&gt; nameArg("n","name","Name to print",true,"homer","string");
// Add the argument nameArg to the CmdLine object. The CmdLine object
// uses this Arg to parse the command line.
cmd.add( nameArg );
// Define a switch and add it to the command line.
// A switch arg is a boolean argument and only defines a flag that
// indicates true or false. In this example the SwitchArg adds itself
// to the CmdLine object as part of the constructor. This eliminates
// the need to call the cmd.add() method. All args have support in
// their constructors to add themselves directly to the CmdLine object.
// It doesn't matter which idiom you choose, they accomplish the same thing.
TCLAP::SwitchArg reverseSwitch("r","reverse","Print name backwards", cmd, false);
// Parse the argv array.
cmd.parse( argc, argv );
// Get the value parsed by each arg.
std::string name = nameArg.getValue();
bool reverseName = reverseSwitch.getValue();
// Do what you intend.
if ( reverseName )
{
std::reverse(name.begin(),name.end());
std::cout &lt;&lt; "My name (spelled backwards) is: " &lt;&lt; name &lt;&lt; std::endl;
}
else
std::cout &lt;&lt; "My name is: " &lt;&lt; name &lt;&lt; std::endl;
} catch (TCLAP::ArgException &amp;e) // catch exceptions
{ std::cerr &lt;&lt; "error: " &lt;&lt; e.error() &lt;&lt; " for arg " &lt;&lt; e.argId() &lt;&lt; std::endl; }
}
</pre><p>
The output should look like:
</p><pre class="programlisting">
% test1 -n mike
My name is: mike
% test1 -n mike -r
My name (spelled backwards) is: ekim
% test1 -r -n mike
My name (spelled backwards) is: ekim
% test1 -r
PARSE ERROR:
One or more required arguments missing!
Brief USAGE:
test1 [-r] -n &lt;string&gt; [--] [-v] [-h]
For complete USAGE and HELP type:
test1 --help
% test1 --help
USAGE:
test1 [-r] -n &lt;string&gt; [--] [-v] [-h]
Where:
-r, --reverse
Print name backwards
-n &lt;string&gt; --name &lt;string&gt;
(required) (value required) Name to print
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
Command description message
</pre><p>
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="LIBRARY_PROPERTIES"></a>Library Properties</h3></div></div></div><p>
This example shows a number of different properties of the
library...
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Arguments can appear in any order (...mostly,
<a class="link" href="#COMPLICATIONS" title="Chapter 3. Complications"> more</a> on this later).</li><li class="listitem">The <em class="parameter"><code>help</code></em>, <em class="parameter"><code>version</code></em>
and <em class="parameter"><code>--</code></em><code class="classname">SwitchArg</code>s
are specified automatically. Using either the <em class="parameter"><code>-h</code></em> or
<em class="parameter"><code>--help</code></em> flag will cause the USAGE message to be displayed,
<em class="parameter"><code>-v</code></em> or <em class="parameter"><code>--version</code></em> will cause
any version information to
be displayed, and <em class="parameter"><code>--</code></em> or
<em class="parameter"><code>--ignore_rest</code></em> will cause the
remaining labeled arguments to be ignored. These switches are
included by default on every command line. You can disable this functionality if desired (although we don't recommend it).
How we generate the behavior behind these flags is described
<a class="link" href="#VISITORS" title="Visitors"> later</a>.
</li><li class="listitem">If there is an error parsing the command line (e.g. a required
argument isn't provided), the program exits and displays a brief
USAGE and an error message.</li><li class="listitem">The program name is assumed to always be argv[0], so it isn't
specified directly.</li><li class="listitem">A value delimiter character can be specified. This means that if you
prefer arguments of the style <em class="parameter"><code>-s=asdf</code></em> instead of
<em class="parameter"><code>-s asdf</code></em>, you can do so.</li><li class="listitem"><span class="emphasis"><em>Always wrap everything in a try block that catches
ArgExceptions!</em></span> Any problems found in constructing the
<code class="classname">CmdLine</code>, constructing the <code class="classname">Arg</code>s,
or parsing the command line will throw an
<code class="classname">ArgException</code>.</li></ul></div><p>
</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="ARG_PROPERTIES"></a>Common Argument Properties</h3></div></div></div><p>
Arguments, whatever their type, have a few common properties.
These properties are set in the constructors of the arguments.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">First is the flag or the character preceded by a dash(-) that
signals the beginning of the argument on the command line.</li><li class="listitem">Arguments also have names, which can also be used
as an alternative flag on the command line, this time preceded by two dashes
(--) [like the familiar <code class="function">getopt_long()</code>].</li><li class="listitem">Next is the description of the argument. This is a short
description of the argument displayed in the help/usage message
when needed.</li><li class="listitem">The following parameters in the constructors vary depending on
the type of argument. Some possible values include:
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem">A boolean value indicating whether the Arg is required or not. </li><li class="listitem">A default value.</li><li class="listitem">A <a class="link" href="#DESCRIPTION_EXCEPTIONS" title="Type Descriptions">description</a> of the type of value expected.</li><li class="listitem">A <a class="link" href="#CONSTRAINT" title="I want to constrain the values allowed for a particular argument...">constraint</a> on the value expected.</li><li class="listitem">The CmdLine instance that the Arg should be added to.</li><li class="listitem">A <a class="link" href="#VISITORS" title="Visitors">Visitor</a>.</li></ul></div></li><li class="listitem">See the <a class="ulink" href="html/index.html" target="_top">API Documentation</a> for more detail.</li></ul></div><p>
</p></div></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="COMPILING"></a>Compiling</h2></div></div></div><p>
<span class="emphasis"><em>TCLAP</em></span> is implemented entirely in header files
which means you only need to include CmdLine.h to use the library.
</p><pre class="programlisting">
#include &lt;tclap/CmdLine.h&gt;
</pre><p>
You'll need to make sure that your compiler can see the header
files. If you do the usual "make install" then your compiler should
see the files by default. Alternatively, you can use the -I
complier argument to specify the exact location of the libraries.
</p><pre class="programlisting">
c++ -o my_program -I /some/place/tclap-1.X/include my_program.cpp
</pre><p>
Where /some/place/tclap-1.X is the place you have unpacked the
distribution.
</p><p>
Finally, if you want to include <span class="emphasis"><em>TCLAP</em></span> as part of
your software
(which is perfectly OK, even encouraged) then simply copy the
contents of /some/place/tclap-1.X/include (the tclap directory and
all of the header files it contains) into your include
directory. The necessary m4 macros for proper configuration are included
in the config directory.
</p><p>
<span class="emphasis"><em>TCLAP</em></span> was developed on Linux and MacOSX systems.
It is also known
to work on Windows, Sun and Alpha platforms. We've made every
effort to keep the library compliant with the ANSI C++ standard so
if your compiler meets the standard, then this library should work
for you. Please let us know if this is not the case!
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="WINDOWS_NOTE"></a>Windows Note</h3></div></div></div><p>
As we understand things, Visual C++ does not have the file
<code class="filename">config.h</code> which is used to make platform
specific definitions. In this situation, we assume that you
have access to <code class="classname">sstream</code>. Our understanding is that
this should not be a problem for VC++ 7.x. However, if this
is not the case and you need to use <code class="classname">strstream</code>,
then simply tell your compiler to define the variable
<code class="constant">HAVE_STRSTREAM</code> and undefine
<code class="constant">HAVE_SSTREAM</code> That
<span class="emphasis"><em>should</em></span> work. We think. Alternatively, just edit
the files <code class="filename">ValueArg.h</code> and <code class="filename">MultiArg.h</code>.
</p></div><p>
</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="RANDOM_NOTE"></a>Random Note</h3></div></div></div><p>
If your compiler doesn't support the <code class="methodname">using</code> syntax used
in <code class="classname">UnlabeledValueArg</code> and
<code class="classname">UnlabeledMultiArg</code> to support two stage name lookup,
then you have two options. Either comment out the statements if you don't
need two stage name lookup, or do a bunch of search and replace and use
the <code class="methodname">this</code> pointer syntax: e.g.
<code class="methodname">this-&gt;_ignoreable</code> instead
of just <code class="methodname">_ignorable</code> (do this for each variable
or method referenced by <code class="methodname">using</code>).
</p></div><p>
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="FUNDAMENTAL_CLASSES"></a>Chapter 2. Fundamental Classes</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="#COMMAND_LINE"><code class="classname">CmdLine</code></a></span></dt><dt><span class="sect1"><a href="#SWITCH_ARG"><code class="classname">SwitchArg</code></a></span></dt><dt><span class="sect1"><a href="#VALUE_ARG"><code class="classname">ValueArg</code></a></span></dt><dt><span class="sect1"><a href="#MULTI_ARG"><code class="classname">MultiArg</code></a></span></dt><dt><span class="sect1"><a href="#MULTI_SWITCH_ARG"><code class="classname">MultiSwitchArg</code></a></span></dt><dt><span class="sect1"><a href="#UNLABELED_VALUE_ARG"><code class="classname">UnlabeledValueArg</code></a></span></dt><dt><span class="sect1"><a href="#UNLABELED_MULTI_ARG"><code class="classname">UnlabeledMultiArg</code></a></span></dt></dl></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="COMMAND_LINE"></a><code class="classname">CmdLine</code></h2></div></div></div><p>
The <code class="classname">CmdLine</code> class contains the arguments that define
the command line and manages the parsing of the command line. The
<code class="classname">CmdLine</code> doesn't parse the command line itself it only
manages the parsing. The actual parsing of individual arguments occurs within
the arguments themselves. The <code class="classname">CmdLine</code> keeps track of
of the required arguments, <a class="link" href="#XOR" title="I want one argument or the other, but not both...">relationships</a>
between arguments, and <a class="link" href="#CHANGE_OUTPUT" title="I want different output than what is provided...">output</a> generation.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="SWITCH_ARG"></a><code class="classname">SwitchArg</code></h2></div></div></div><p><code class="classname">SwitchArg</code>s are what the name implies:
simple, on/off, boolean switches. Use <code class="classname">SwitchArg</code>s
anytime you want to turn
some sort of system property on or off. <code class="classname">SwitchArg</code>s
don't parse a value. They return <code class="constant">TRUE</code> or
<code class="constant">FALSE</code>, depending on whether the switch has been found
on the command line and what the default value was defined as.</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="VALUE_ARG"></a><code class="classname">ValueArg</code></h2></div></div></div><p><code class="classname">ValueArg</code>s are arguments that read a
value of some type
from the command line. Any time you need a file name, a number,
etc. use a <code class="classname">ValueArg</code> or one of its variants.
All <code class="classname">ValueArg</code>s are
<a class="link" href="#USING_ARGTRAITS" title="I want to use different types..."> templatized</a> and will attempt to parse
the string its flag matches on the command line as the type it is
specified as. <code class="classname">ValueArg&lt;int&gt;</code>
will attempt to parse an
int, <code class="classname">ValueArg&lt;float&gt;</code> will attempt to
parse a float, etc. If <code class="methodname">operator&gt;&gt;</code>
for the specified type doesn't
recognize the string on the command line as its defined type, then
an exception will be thrown.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="MULTI_ARG"></a><code class="classname">MultiArg</code></h2></div></div></div><p>
A <code class="classname">MultiArg</code> is a <code class="classname">ValueArg</code> that
can be specified more than once on a command line and instead of returning
a single value, returns a <code class="classname">vector</code> of values.
</p><p>
Imagine a compiler that allows you to specify multiple directories
to search for libraries...
</p><pre class="programlisting">
% fooCompiler -L /dir/num1 -L /dir/num2 file.foo
</pre><p>
Exceptions will occur if you try to do this
with a <code class="classname">ValueArg</code> or a <code class="classname">SwitchArg</code>.
In situations like this, you will want to use a
<code class="classname">MultiArg</code>. A
<code class="classname">MultiArg</code> is essentially a
<code class="classname">ValueArg</code> that appends any
value that it matches and parses onto a vector of values. When the
<code class="methodname">getValue()</code> method is called, a vector of
values, instead of a single value is returned. A
<code class="classname">MultiArg</code> is declared much like
a <code class="classname">ValueArg</code>:
</p><pre class="programlisting">
MultiArg&lt;int&gt; itest("i", "intTest", "multi int test", false,"int" );
cmd.add( itest );
</pre><p>
Note that <code class="classname">MultiArg</code>s can be added to the
<code class="classname">CmdLine</code> in any order (unlike
<a class="link" href="#UNLABELED_MULTI_ARG" title="UnlabeledMultiArg"> UnlabeledMultiArg</a>).
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="MULTI_SWITCH_ARG"></a><code class="classname">MultiSwitchArg</code></h2></div></div></div><p>
A <code class="classname">MultiSwitchArg</code> is a <code class="classname">SwitchArg</code>
that can be specified more than once on a command line.
This can be useful
when command lines are constructed automatically from within other applications
or when a switch occurring
more than once indicates a value (-V means a little verbose -V -V -V means a lot
verbose), You can use a <code class="classname">MultiSwitchArg</code>.
The call
to <code class="methodname">getValue()</code> for a <code class="classname">MultiSwitchArg</code> returns the number (int) of times
the switch has been found on the command line in addition to the default value.
Here is an example using the default initial value of 0:
</p><pre class="programlisting">
MultiSwitchArg quiet("q","quiet","Reduce the volume of output");
cmd.add( quiet );
</pre><p>
Alternatively, you can specify your own initial value:
</p><pre class="programlisting">
MultiSwitchArg quiet("q","quiet","Reduce the volume of output",5);
cmd.add( quiet );
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="UNLABELED_VALUE_ARG"></a><code class="classname">UnlabeledValueArg</code></h2></div></div></div><p>
An <code class="classname">UnlabeledValueArg</code> is a <code class="classname">ValueArg</code> that is not identified by a flag on the command line. Instead
<code class="classname">UnlabeledValueArg</code>s are identified by their position in
the argv array.
</p><p>
To this point all of our arguments have had labels (flags)
identifying them on the command line, but there are some
situations where flags are burdensome and not worth the effort. One
example might be if you want to implement a magical command we'll
call <span class="command"><strong>copy</strong></span>. All <span class="command"><strong>copy</strong></span> does is
copy the file specified
in the first argument to the file specified in the second argument.
We can do this using <code class="classname">UnlabeledValueArg</code>s which are pretty
much just <code class="classname">ValueArg</code>s without the flag specified,
which tells
the <code class="classname">CmdLine</code> object to treat them accordingly.
The code would look like this:
</p><pre class="programlisting">
UnlabeledValueArg&lt;float&gt; nolabel( "name", "unlabeled test", true, 3.14,
"nameString" );
cmd.add( nolabel );
</pre><p>
Everything else is handled identically to what is seen above. The
only difference to be aware of, and this is important: <span class="emphasis"><em>the order
that UnlabeledValueArgs are added to the <code class="classname">CmdLine</code>
is the order that they will be parsed!!!!</em></span>
This is <span class="emphasis"><em>not</em></span> the case for normal
<code class="classname">SwitchArg</code>s and <code class="classname">ValueArg</code>s.
What happens internally is the first argument that the
<code class="classname">CmdLine</code> doesn't recognize is assumed to be
the first <code class="classname">UnlabeledValueArg</code> and
parses it as such. Note that you are allowed to intersperse labeled
args (SwitchArgs and ValueArgs) in between
<code class="classname">UnlabeledValueArgs</code> (either on the command line
or in the declaration), but the <code class="classname">UnlabeledValueArgs</code>
will still be parsed in the order they are added. Just remember that order is
important for unlabeled arguments.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="UNLABELED_MULTI_ARG"></a><code class="classname">UnlabeledMultiArg</code></h2></div></div></div><p>
An <code class="classname">UnlabeledMultiArg</code> is an <code class="classname">UnlabeledValueArg</code> that allows more than one value to be specified. Only one
<code class="classname">UnlabeledMultiArg</code> can be specified per command line.
The <code class="classname">UnlabeledMultiArg</code> simply reads the remaining
values from argv up until -- or the end of the array is reached.
</p><p>
Say you want a strange command
that searches each file specified for a given string (let's call it
<span class="command"><strong>grep</strong></span>), but you don't want to have to type in all of the file
names or write a script to do it for you. Say,
</p><pre class="programlisting">
% grep pattern *.txt
</pre><p>
First remember that the <span class="emphasis"><em>*</em></span> is handled by the shell and
expanded accordingly, so what the program <span class="command"><strong>grep</strong></span> sees is
really something like:
</p><pre class="programlisting">
% grep pattern file1.txt file2.txt fileZ.txt
</pre><p>
To handle situations where multiple, unlabeled arguments are needed,
we provide the <code class="classname">UnlabeledMultiArg</code>.
<code class="classname">UnlabeledMultiArg</code>s
are declared much like everything else, but with only a description
of the arguments. By default, if an <code class="classname">UnlabeledMultiArg</code>
is specified, then at least one is required to be present or an
exception will be thrown. The most important thing to remember is,
that like <code class="classname">UnlabeledValueArg</code>s: order matters!
In fact, <span class="emphasis"><em>an UnlabeledMultiArg must be the last argument added to the
CmdLine!</em></span>. Here is what a declaration looks like:
</p><pre class="programlisting">
//
// UnlabeledMultiArg must be the LAST argument added!
//
UnlabeledMultiArg&lt;string&gt; multi("file names");
cmd.add( multi );
cmd.parse(argc, argv);
vector&lt;string&gt; fileNames = multi.getValue();
</pre><p>
You must only ever specify one (1) <code class="classname">UnlabeledMultiArg</code>.
One <code class="classname">UnlabeledMultiArg</code> will read every unlabeled
Arg that wasn't already processed by a
<code class="classname">UnlabeledValueArg</code> into a
<code class="classname">vector</code> of type T. Any
<code class="classname">UnlabeledValueArg</code> or other
<code class="classname">UnlabeledMultiArg</code> specified after the first
<code class="classname">UnlabeledMultiArg</code> will be ignored, and if
they are required,
exceptions will be thrown. When you call the
<code class="methodname">getValue()</code>
method of the <code class="classname">UnlabeledValueArg</code> argument,
a <code class="classname">vector</code>
will be returned. If you can imagine a situation where there will
be multiple args of multiple types (stings, ints, floats, etc.)
then just declare the <code class="classname">UnlabeledMultiArg</code> as type
<code class="classname">string</code> and parse the different values yourself or use
several <code class="classname">UnlabeledValueArg</code>s.
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="COMPLICATIONS"></a>Chapter 3. Complications</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="#COMBINE_SWITCHES">I want to combine multiple switches into one argument...</a></span></dt><dt><span class="sect1"><a href="#XOR">I want one argument or the other, but not both...</a></span></dt><dt><span class="sect1"><a href="#NO_FLAG">I have more arguments than single flags make sense for...</a></span></dt><dt><span class="sect1"><a href="#CONSTRAINT">I want to constrain the values allowed for a particular
argument...</a></span></dt><dt><span class="sect1"><a href="#ARG_ADD_CMDLINE">I want the Args to add themselves to the CmdLine...</a></span></dt><dt><span class="sect1"><a href="#CHANGE_OUTPUT">I want different output than what is provided...</a></span></dt><dt><span class="sect1"><a href="#NO_HELP_VERSION">I don't want the --help and --version switches to be created automatically...</a></span></dt><dt><span class="sect1"><a href="#IGNORE_ARGS">I want to ignore certain arguments...</a></span></dt><dt><span class="sect1"><a href="#IGNORE_UNMATCHED">I want to ignore unmatched arguments...</a></span></dt><dt><span class="sect1"><a href="#READING_HEX_INTEGERS">I want to read hex integers as arguments...</a></span></dt><dt><span class="sect1"><a href="#USING_ARGTRAITS">I want to use different types...</a></span></dt><dt><span class="sect1"><a href="#CHANGING_STARTSTRINGS">I want to use Windows-style flags like "/x" and "/y"...</a></span></dt></dl></div><p>
Naturally, what we have seen to this point doesn't satisfy all of
our needs.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="COMBINE_SWITCHES"></a>I want to combine multiple switches into one argument...</h2></div></div></div><p>
Multiple <code class="classname">SwitchArg</code>s can be combined into a
single argument on the command line. If you have switches -a, -b and -c
it is valid to do either:
</p><pre class="programlisting">
% command -a -b -c
</pre><p>
<span class="emphasis"><em>or</em></span>
</p><pre class="programlisting">
% command -abc
</pre><p>
<span class="emphasis"><em>or</em></span>
</p><pre class="programlisting">
% command -ba -c
</pre><p>
This is to make this library more in line with the POSIX and GNU
standards (as I understand them).
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="XOR"></a>I want one argument or the other, but not both...</h2></div></div></div><p>
Suppose you have a command that must read input from one of two
possible locations, either a local file or a URL. The command
<span class="emphasis"><em>must</em></span> read something, so <span class="emphasis"><em>one</em></span>
argument is required, but
not both, yet neither argument is strictly necessary by itself.
This is called "exclusive or" or "XOR". To accommodate this
situation, there is now an option to add two or more
<code class="classname">Arg</code>s to
a <code class="classname">CmdLine</code> that are exclusively or'd with one another:
<code class="methodname">xorAdd()</code>. This means that exactly one of the
<code class="classname">Arg</code>s must be set and no more.
</p><p>
<code class="methodname">xorAdd()</code> comes in two flavors, either
<code class="methodname">xorAdd(Arg&amp; a, Arg&amp; b)</code>
to add just two <code class="classname">Arg</code>s to be xor'd and
<code class="methodname">xorAdd( vector&lt;Arg*&gt; xorList )</code>
to add more than two <code class="classname">Arg</code>s.
</p><pre class="programlisting">
ValueArg&lt;string&gt; fileArg("f","file","File name to read",true,"/dev/null", "filename");
ValueArg&lt;string&gt; urlArg("u","url","URL to load",true, "http://example.com", "URL");
cmd.xorAdd( fileArg, urlArg );
cmd.parse(argc, argv);
</pre><p>
Once one <code class="classname">Arg</code> in the xor list is matched on the
<code class="classname">CmdLine</code> then the others in the xor list will be
marked as set. The question then, is how to determine which of the
<code class="classname">Arg</code>s has been set? This is accomplished by calling the
isSet() method for each <code class="classname">Arg</code>. If the
<code class="classname">Arg</code> has been
matched on the command line, the <code class="methodname">isSet()</code> will return
<code class="constant">TRUE</code>, whereas if the <code class="classname">Arg</code>
has been set as a result of matching the other <code class="classname">Arg</code>
that was xor'd <code class="methodname">isSet()</code> will
return <code class="constant">FALSE</code>.
(Of course, if the <code class="classname">Arg</code> was not xor'd and
wasn't matched, it will also return <code class="constant">FALSE</code>.)
</p><pre class="programlisting">
if ( fileArg.isSet() )
readFile( fileArg.getValue() );
else if ( urlArg.isSet() )
readURL( urlArg.getValue() );
else
// Should never get here because TCLAP will note that one of the
// required args above has not been set.
throw("Very bad things...");
</pre><p>
It is helpful to note that <code class="classname">Arg</code>s of any type can be xor'd together.
This means that you can xor a <code class="classname">SwitchArg</code> with a <code class="classname">ValueArg</code>.
This is helpful in situations where one of several options is necessary and one of the options
requires additional information.
</p><pre class="programlisting">
SwitchArg stdinArg("s", "stdin", "Read from STDIN", false);
ValueArg&lt;string&gt; fileArg("f","file","File name to read",true,"/dev/null", "filename");
ValueArg&lt;string&gt; urlArg("u","url","URL to load",true, "http://example.com", "URL");
vector&lt;Arg*&gt; xorlist;
xorlist.push_back(&amp;stdinArg);
xorlist.push_back(&amp;fileArg);
xorlist.push_back(&amp;urlArg);
cmd.xorAdd( xorlist );
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="NO_FLAG"></a>I have more arguments than single flags make sense for...</h2></div></div></div><p>
Some commands have so many options that single flags no longer map
sensibly to the available options. In this case, it is desirable to
specify <code class="classname">Arg</code>s using only long options. This one is easy to
accomplish, just make the flag value blank in the <code class="classname">Arg</code>
constructor. This will tell the <code class="classname">Arg</code> that only the long
option should be matched and will force users to specify the long
option on the command line. The help output is updated accordingly.
</p><pre class="programlisting">
ValueArg&lt;string&gt; fileArg("","file","File name",true,"homer","filename");
SwitchArg caseSwitch("","upperCase","Print in upper case",false);
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="CONSTRAINT"></a>I want to constrain the values allowed for a particular
argument...</h2></div></div></div><p>
<span class="emphasis"><em>Interface Change!!!</em></span> Sorry folks, but we've changed
the interface since version 1.0.X for constraining <code class="classname">Arg</code>s.
Constraints are now hidden behind the <code class="classname">Constraint</code>
interface. To
constrain an <code class="classname">Arg</code> simply implement the interface
and specify the new class in the constructor as before.
</p><p>
You can still constrain <code class="classname">Arg</code>s based on
a list of values. Instead of adding a <code class="classname">vector</code> of
allowed values to the <code class="classname">Arg</code> directly,
create a <code class="classname">ValuesConstraint</code> object
with a <code class="classname">vector</code> of values and add that to the
<code class="classname">Arg</code>. The <code class="classname">Arg</code> constructors
have been modified accordingly.
</p><p>
When the value for the
<code class="classname">Arg</code> is parsed,
it is checked against the list of values specified in the
<code class="classname">ValuesConstraint</code>.
If the value is in the list then it is accepted. If
not, then an exception is thrown. Here is a simple example:
</p><pre class="programlisting">
vector&lt;string&gt; allowed;
allowed.push_back("homer");
allowed.push_back("marge");
allowed.push_back("bart");
allowed.push_back("lisa");
allowed.push_back("maggie");
ValuesConstraint&lt;string&gt; allowedVals( allowed );
ValueArg&lt;string&gt; nameArg("n","name","Name to print",true,"homer",&amp;allowedVals);
cmd.add( nameArg );
</pre><p>
When a <code class="classname">ValuesConstraint</code> is specified,
instead of a type description being specified in the
<code class="classname">Arg</code>, a
type description is created by concatenating the values in the
allowed list using operator&lt;&lt; for the specified type. The
help/usage for the <code class="classname">Arg</code> therefore lists the
allowable values. Because of this, you might want to keep the list
relatively small, however there is no limit on this.
</p><p>
Obviously, a list of allowed values isn't always the best way to
constrain things. For instance, one might wish to allow only
integers greater than 0. In this case, simply create a class that
implements the <code class="classname">Constraint&lt;int&gt;</code> interface and
checks whether the value parsed is greater than 0 (done in the
<code class="methodname">check()</code> method) and create your
<code class="classname">Arg</code> with your new <code class="classname">Constraint</code>.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ARG_ADD_CMDLINE"></a>I want the Args to add themselves to the CmdLine...</h2></div></div></div><p>
New constructors have been added for each <code class="classname">Arg</code>
that take a <code class="classname">CmdLine</code> object as an argument.
Each <code class="classname">Arg</code> then
<code class="methodname">add</code>s itself to the <code class="classname">CmdLine</code>
object. There is no difference in how the <code class="classname">Arg</code>
is handled between this method and calling the
<code class="methodname">add()</code> method directly. At the moment, there is
no way to do an <code class="methodname">xorAdd()</code> from the constructor. Here
is an example:
</p><pre class="programlisting">
// Create the command line.
CmdLine cmd("this is a message", '=', "0.99" );
// Note that the following args take the "cmd" object as arguments.
SwitchArg btest("B","existTestB", "exist Test B", cmd, false );
ValueArg&lt;string&gt; stest("s", "stringTest", "string test", true, "homer",
"string", cmd );
UnlabeledValueArg&lt;string&gt; utest("unTest1","unlabeled test one",
"default","string", cmd );
// NO add() calls!
// Parse the command line.
cmd.parse(argc,argv);
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="CHANGE_OUTPUT"></a>I want different output than what is provided...</h2></div></div></div><p>
It is straightforward to change the output generated by
<span class="emphasis"><em>TCLAP</em></span>. Either subclass the
<code class="classname">StdOutput</code> class and re-implement the methods you choose,
or write your own class that implements the
<code class="classname">CmdLineOutput</code> interface. Once you have done this,
then use the <code class="classname">CmdLine</code> <code class="methodname">setOutput</code>
method to tell the <code class="classname">CmdLine</code> to use your new output
class. Here is a simple example:
</p><pre class="programlisting">
class MyOutput : public StdOutput
{
public:
virtual void failure(CmdLineInterface&amp; c, ArgException&amp; e)
{
cerr &lt;&lt; "My special failure message for: " &lt;&lt; endl
&lt;&lt; e.what() &lt;&lt; endl;
exit(1);
}
virtual void usage(CmdLineInterface&amp; c)
{
cout &lt;&lt; "my usage message:" &lt;&lt; endl;
list&lt;Arg*&gt; args = c.getArgList();
for (ArgListIterator it = args.begin(); it != args.end(); it++)
cout &lt;&lt; (*it)-&gt;longID()
&lt;&lt; " (" &lt;&lt; (*it)-&gt;getDescription() &lt;&lt; ")" &lt;&lt; endl;
}
virtual void version(CmdLineInterface&amp; c)
{
cout &lt;&lt; "my version message: 0.1" &lt;&lt; endl;
}
};
int main(int argc, char** argv)
{
CmdLine cmd("this is a message", ' ', "0.99" );
// set the output
MyOutput my;
cmd.setOutput( &amp;my );
// proceed normally ...
</pre><p>
See <code class="filename">test4.cpp</code> in the examples directory for the full
example. <span class="emphasis"><em>NOTE</em></span>: if you supply your own Output object, we
will not delete it in the <code class="classname">CmdLine</code> destructor. This
could lead to a (very small) memory leak if you don't take care of the object
yourself. Also note that the <code class="methodname">failure</code> method is
now responsible for exiting the application (assuming that is the desired
behavior).
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="NO_HELP_VERSION"></a>I don't want the --help and --version switches to be created automatically...</h2></div></div></div><p>
Help and version information is useful for nearly all command line applications
and as such we generate flags that provide those options automatically.
However, there are situations when these flags are undesirable. For these
cases we've added we've added a forth parameter to the
<code class="classname">CmdLine</code> constructor. Making this boolean parameter
false will disable automatic help and version generation.
</p><pre class="programlisting">
CmdLine cmd("this is a message", ' ', "0.99", false );
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="IGNORE_ARGS"></a>I want to ignore certain arguments...</h2></div></div></div><p>
The <em class="parameter"><code>--</code></em> flag is automatically included in the
<code class="classname">CmdLine</code>.
As (almost) per POSIX and GNU standards, any argument specified
after the <em class="parameter"><code>--</code></em> flag is ignored.
<span class="emphasis"><em>Almost</em></span> because if an
<code class="classname">UnlabeledValueArg</code> that has not been set or an
<code class="classname">UnlabeledMultiArg</code> has been specified, by default
we will assign any arguments beyond the <em class="parameter"><code>--</code></em>
to the those arguments as
per the rules above. This is primarily useful if you want to pass
in arguments with a dash as the first character of the argument. It
should be noted that even if the <em class="parameter"><code>--</code></em> flag is
passed on the command line, the <code class="classname">CmdLine</code> will
<span class="emphasis"><em>still</em></span> test to make sure all of the required
arguments are present.
</p><p>
Of course, this isn't how POSIX/GNU handle things, they explicitly
ignore arguments after the <em class="parameter"><code>--</code></em>. To accommodate this,
we can make both <code class="classname">UnlabeledValueArg</code>s and
<code class="classname">UnlabeledMultiArg</code>s ignoreable in their constructors.
See the <a class="ulink" href="html/index.html" target="_top"> API Documentation</a> for details.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="IGNORE_UNMATCHED"></a>I want to ignore unmatched arguments...</h2></div></div></div><p>
By default, if <span class="emphasis"><em>TCLAP</em></span> sees an argument that doesn't
match a specified <code class="classname">Arg</code>, it will produce an exception.
This strict handling provides some assurance that all input to a program
is controlled. However, there are times when
this strict handling of arguments might not be desirable.
<span class="emphasis"><em>TCLAP</em></span> provides two alternatives. The first is to
add an <code class="classname">UnlabeledMultiArg</code> to the command line. If
this is done, all unmatched arguments will get added to this arg.
The second option is that
that <span class="emphasis"><em>TCLAP</em></span> can simply ignore any unmatched
arguments on the command line. This is accomplished by calling the
<code class="methodname">ignoreUnmatched</code> method with
<em class="parameter"><code>true</code></em> on the
<code class="classname">CmdLine</code> object that's been constructed.
</p><pre class="programlisting">
// Define the command line object.
CmdLine cmd("Command description message", ' ', "0.9");
// Tell the command line to ignore any unmatched args.
cmd.ignoreUnmatched(true);
// Define a value argument and add it to the command line.
ValueArg&lt;string&gt; nameArg("n","name","Name to print",true,"homer","string");
cmd.add( nameArg );
// Parse the args.
cmd.parse( argc, argv );
</pre><p>
Given the program above, if a user were to type:
</p><pre class="programlisting">
% command -n Mike something to ignore
</pre><p>
The program would succeed and the name <code class="classname">ValueArg</code>
would be populated with "Mike" but
the strings "something", "to", and "ignore" would simply be ignored by the
parser.
</p><p>
<span class="emphasis"><em>NOTE:</em></span> If both <code class="methodname">ignoreUnmatched</code>
is set to true and an <code class="classname">UnlabeledMultiArg</code> is added to
the command line, then the <code class="classname">UnlabeledMultiArg</code> will
"win" and all extra arguments will be added to it rather than be ignored.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="READING_HEX_INTEGERS"></a>I want to read hex integers as arguments...</h2></div></div></div><p>
Sometimes it's desirable to read integers formatted in decimal, hexadecimal,
and octal format. This is now possible by #defining the <em class="parameter"><code>TCLAP_SETBASE_ZERO</code></em>
directive. Simply define this directive in your code and integer arguments will be parsed
in each base.
</p><pre class="programlisting">
#define TCLAP_SETBASE_ZERO 1
#include "tclap/CmdLine.h"
#include &lt;iostream&gt;
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
try {
CmdLine cmd("this is a message", ' ', "0.99" );
ValueArg&lt;int&gt; itest("i", "intTest", "integer test", true, 5, "int");
cmd.add( itest );
//
// Parse the command line.
//
cmd.parse(argc,argv);
//
// Set variables
//
int _intTest = itest.getValue();
cout &lt;&lt; "found int: " &lt;&lt; _intTest &lt;&lt; endl;
} catch ( ArgException&amp; e )
{ cout &lt;&lt; "ERROR: " &lt;&lt; e.error() &lt;&lt; " " &lt;&lt; e.argId() &lt;&lt; endl; }
}
</pre><p>
</p><p>
The reason that this behavior is not the default behavior for <span class="emphasis"><em>TCLAP</em></span> is that the use of
<code class="methodname">setbase(0)</code> appears to be something of a side effect and is not necessarily how
<code class="methodname">setbase()</code> is meant to be used. So while we're making this functionality
available, we're not turning it on by default for fear of bad things happening in different compilers.
If you know otherwise, please let us know.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="USING_ARGTRAITS"></a>I want to use different types...</h2></div></div></div><p>
The usual C++ types (int, long, bool, etc.) are supported by <span class="emphasis"><em>TCLAP</em></span> out
of the box. As
long as operator&gt;&gt; and operator&lt;&lt; are supported, other types should work fine
too, you'll just need to specify the <code class="classname">ArgTraits</code> which
tells <span class="emphasis"><em>TCLAP</em></span> how you expect the type to be handled.
</p><p>
For example, assume that you'd like to read one argument on the
command line in as a <code class="classname">std::pair</code> object. You need
to tell <span class="emphasis"><em>TCLAP</em></span> whether to treat
<code class="classname">std::pair</code> as a String or Value (default).
StringLike means to treat the string on the command line as a string
and use it directly (by assignment operator), whereas ValueLike means
that a value object should be extracted from the string using
operator&gt;&gt;. For <code class="classname">std::pair</code> we'll choose
ValueLike. Here is an example of how to do this for int,double pair
(see <code class="filename">test30.cpp</code>):
</p><pre class="programlisting">
#include "tclap/CmdLine.h"
#include &lt;iostream&gt;
#include &lt;utility&gt;
using namespace TCLAP;
// We need to tell TCLAP how to parse our pair, we assume it will be
// given as two arguments separated by whitespace.
std::istream &amp;operator&gt;&gt;(std::istream &amp;is, std::pair&lt;int, double&gt; &amp;p) {
return is &gt;&gt; p.first &gt;&gt; p.second;
}
// Make it easy to print values of our type.
std::ostream &amp;operator&lt;&lt;(std::ostream &amp;os, const std::pair&lt;int, double&gt; &amp;p) {
return os &lt;&lt; p.first &lt;&lt; ' ' &lt;&lt; p.second;
}
// Our pair can now be used as any other type.
int main(int argc, char **argv) {
CmdLine cmd("test pair argument");
ValueArg&lt;std::pair&lt;int, double&gt; &gt; parg("p", "pair", "int,double pair",
true,
std::make_pair(0, 0.0),
"int,double",
cmd);
cmd.parse(argc, argv);
std::cout &lt;&lt; parg.getValue() &lt;&lt; std::endl;
}
</pre><p>
<span class="emphasis"><em>Important:</em></span> When specifying the argument on the command line it
needs to be given as a single argument, that is by quoting it. For
example, <code class="code">./test30 -p "1 2.3"</code>.
</p><p>
If you do not want to provide operator&gt;&gt;, you can instead use
operator= by defining the type as
<code class="classname">StringLike</code>. A complete example is given in
<code class="filename">test11.cpp</code>, but the main difference is you need
to tell TCLAP to assign to the type using operator=. This is done by
defining it as <code class="classname">StringLike</code> as shown below:
</p><pre class="programlisting">
namespace TCLAP {
template&lt;&gt;
struct ArgTraits&lt;Vect3D&gt; {
typedef StringLike ValueCategory;
};
}
</pre><p>
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="CHANGING_STARTSTRINGS"></a>I want to use Windows-style flags like "/x" and "/y"...</h2></div></div></div><p>
It is traditional in Posix environments that the "-" and "--" strings are used to signify
the beginning of argument flags and long argument names. However, other environments,
namely Windows, use different strings. <span class="emphasis"><em>TCLAP</em></span> allows you to
control which strings are used with <code class="methodname">#define</code> directives. This allows
you to use different strings based on your operating environment. Here is an example:
</p><pre class="programlisting">
//
// This illustrates how to change the flag and name start strings for
// Windows, otherwise the defaults are used.
//
// Note that these defines need to happen *before* tclap is included!
//
#ifdef WINDOWS
#define TCLAP_NAMESTARTSTRING "~~"
#define TCLAP_FLAGSTARTSTRING "/"
#endif
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
// Everything else is identical!
...
</pre><p>
</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="NOTES"></a>Chapter 4. Notes</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="#DESCRIPTION_EXCEPTIONS">Type Descriptions</a></span></dt><dt><span class="sect1"><a href="#VISITORS">Visitors</a></span></dt><dt><span class="sect1"><a href="#MORE_INFO">More Information</a></span></dt></dl></div><p>
Like all good rules, there are many exceptions....
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="DESCRIPTION_EXCEPTIONS"></a>Type Descriptions</h2></div></div></div><p>
Ideally this library would use RTTI to return a human readable name
of the type declared for a particular argument. Unfortunately, at
least for <span class="command"><strong>g++</strong></span>, the names returned aren't
particularly useful.
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="VISITORS"></a>Visitors</h2></div></div></div><p>
Disclaimer: Almost no one will have any use for
<code class="classname">Visitor</code>s, they were
added to provide special handling for default arguments. Nothing
that <code class="classname">Visitor</code>s do couldn't be accomplished
by the user after the
command line has been parsed. If you're still interested, keep
reading...
</p><p>
Some of you may be wondering how we get the <em class="parameter"><code>--help</code></em>,
<em class="parameter"><code>--version</code></em> and <em class="parameter"><code>--</code></em>
arguments to do their thing without mucking up the
<code class="classname">CmdLine</code> code with lots of <span class="emphasis"><em>if</em></span>
statements and type checking. This is accomplished by using a
variation on the Visitor Pattern. Actually, it may not be a Visitor
Pattern at all, but that's what inspired me.
</p><p>
If we want some argument to do some sort of special handling,
besides simply parsing a value, then we add a <code class="classname">Visitor</code>
pointer to the <code class="classname">Arg</code>. More specifically, we add a
<span class="emphasis"><em>subclass</em></span> of the <code class="classname">Visitor</code>
class. Once the argument has been successfully parsed, the
<code class="classname">Visitor</code> for that argument is
called. Any data that needs to be operated on is declared in the
<code class="classname">Visitor</code> constructor and then operated on in the
<code class="methodname">visit()</code> method. A <code class="classname">Visitor</code>
is added to an <code class="classname">Arg</code> as the last argument in its
declaration. This may sound
complicated, but it is pretty straightforward. Let's see an
example.
</p><p>
Say you want to add an <em class="parameter"><code>--authors</code></em> flag to a program that
prints the names of the authors when present. First subclass
<code class="classname">Visitor</code>:
</p><pre class="programlisting">
#include "Visitor.h"
#include &lt;string&gt;
#include &lt;iostream&gt;
class AuthorVisitor : public Visitor
{
protected:
string _author;
public:
AuthorVisitor(const string&amp; name ) : Visitor(), _author(name) {} ;
void visit() { cout &lt;&lt; "AUTHOR: " &lt;&lt; _author &lt;&lt; endl; exit(0); };
};
</pre><p>
Now include this class definition somewhere and go about creating
your command line. When you create the author switch, add the
<code class="classname">AuthorVisitor</code> pointer as follows:
</p><pre class="programlisting">
SwitchArg author("a","author","Prints author name", false,
new AuthorVisitor("Homer J. Simpson") );
cmd.add( author );
</pre><p>
Now, any time the <em class="parameter"><code>-a</code></em> or
<em class="parameter"><code>--author</code></em> flag is specified,
the program will print the author name, Homer J. Simpson and exit
without processing any further (as specified in the
<code class="methodname">visit()</code> method).
</p></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="MORE_INFO"></a>More Information</h2></div></div></div><p>
For more information, look at the <a class="ulink" href="html/index.html" target="_top">
API Documentation</a> and the examples included with the
distribution.
</p><p>
<span class="emphasis"><em>Happy coding!</em></span>
</p></div></div></div></body></html>

File diff suppressed because it is too large Load Diff

117
src/tclap-1.2.5/docs/style.css Executable file
View File

@ -0,0 +1,117 @@
/*
color:#ffffff; white
color:#e0e0e0; light gray
color:#f8f8f8; light gray
color:#003366; dark blue
color:#555555; gray
color:#ff9933; light orange
color:#cc3300; red/brown/orange
color:#660066; purple
color:#669900; green
*/
a {
color:#003366;
text-decoration:underline;
}
a:hover {
color:#ff9933;
}
body {
font-family: verdana, tahoma, helvetica, arial, sans-serif;
font-size: 90%;
background-color:#ffffff;
margin: 1em;
}
pre {
font-family: courier, serif;
background-color:#f8f8f8;
margin: 1.5em;
font-size:90%;
}
ul {
list-style: circle outside;
font-stretch:extra-expanded;
/* font-size:90%;*/
}
ul.menu { /* inherits from ul */
padding-left: 1em;
}
em {
color:#ff9933;
font-size:110%;
}
h1,h2,h3{
color:#ff9933;
}
h1 {
border-color:#d0d0d0;
border-style:solid;
border-width:1px;
font-weight:bold;
padding: 0.2em;
background-color:#f8f8f8
}
h2 {
font-size:120%;
font-weight:bold;
border-bottom-style:solid;
border-bottom-width:1px;
border-bottom-color:#d0d0d0;
}
h3 {
font-size:110%;
font-weight:bold;
font-style:italic;
}
tt {
font-family: courier, serif;
}
tt.classname {
font-weight:bold;
}
tt.constant {
font-weight:bold;
}
p {
line-height: 1.5em;
}
div.links{
float: left;
clear: left;
width: 12em;
background-color:#f8f8f8;
border-style:solid;
border-width:1px;
border-color:#d0d0d0;
margin-bottom: 0.5em;
padding: 0.5em 0.5em 0.5em 0.5em;
margin: 0.5em 0.5em 0em 0em;
}
div.main{
border-style:solid;
border-width:1px;
border-color:#d0d0d0;
margin: 0.5em 0em 0.5em 14em;
padding: 0.5em 0.5em 0.5em 0.5em;
}

View File

@ -0,0 +1,42 @@
noinst_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \
test10 test11 test12 test13 test14 test15 test16 \
test17 test18 test19 test20 test21 test22 test23 test24 \
test25 test26 test27 test28 test29 test30
test1_SOURCES = test1.cpp
test2_SOURCES = test2.cpp
test3_SOURCES = test3.cpp
test4_SOURCES = test4.cpp
test5_SOURCES = test5.cpp
test6_SOURCES = test6.cpp
test7_SOURCES = test7.cpp
test8_SOURCES = test8.cpp
test9_SOURCES = test9.cpp
test10_SOURCES = test10.cpp
test11_SOURCES = test11.cpp
test12_SOURCES = test12.cpp
test13_SOURCES = test13.cpp
test14_SOURCES = test14.cpp
test15_SOURCES = test15.cpp
test16_SOURCES = test16.cpp
test17_SOURCES = test-hard-1.cpp test-hard-2.cpp
test18_SOURCES = test18.cpp
test19_SOURCES = test19.cpp
test20_SOURCES = test20.cpp
test21_SOURCES = test21.cpp
test22_SOURCES = test22.cpp
test23_SOURCES = test23.cpp
test24_SOURCES = test24.cpp
test25_SOURCES = test25.cpp
test26_SOURCES = test26.cpp
test27_SOURCES = test27.cpp
test28_SOURCES = test28.cpp
test29_SOURCES = test29.cpp
test30_SOURCES = test30.cpp
AM_CPPFLAGS = -I$(top_srcdir)/include
if HAVE_GNU_COMPILERS
AM_CXXFLAGS = -Wall -Wextra
endif

View File

@ -0,0 +1,902 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
noinst_PROGRAMS = test1$(EXEEXT) test2$(EXEEXT) test3$(EXEEXT) \
test4$(EXEEXT) test5$(EXEEXT) test6$(EXEEXT) test7$(EXEEXT) \
test8$(EXEEXT) test9$(EXEEXT) test10$(EXEEXT) test11$(EXEEXT) \
test12$(EXEEXT) test13$(EXEEXT) test14$(EXEEXT) \
test15$(EXEEXT) test16$(EXEEXT) test17$(EXEEXT) \
test18$(EXEEXT) test19$(EXEEXT) test20$(EXEEXT) \
test21$(EXEEXT) test22$(EXEEXT) test23$(EXEEXT) \
test24$(EXEEXT) test25$(EXEEXT) test26$(EXEEXT) \
test27$(EXEEXT) test28$(EXEEXT) test29$(EXEEXT) \
test30$(EXEEXT)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_cxx_have_long_long.m4 \
$(top_srcdir)/config/ac_cxx_have_sstream.m4 \
$(top_srcdir)/config/ac_cxx_have_strstream.m4 \
$(top_srcdir)/config/ac_cxx_namespaces.m4 \
$(top_srcdir)/config/ac_cxx_warn_effective_cxx.m4 \
$(top_srcdir)/config/bb_enable_doxygen.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_test1_OBJECTS = test1.$(OBJEXT)
test1_OBJECTS = $(am_test1_OBJECTS)
test1_LDADD = $(LDADD)
am_test10_OBJECTS = test10.$(OBJEXT)
test10_OBJECTS = $(am_test10_OBJECTS)
test10_LDADD = $(LDADD)
am_test11_OBJECTS = test11.$(OBJEXT)
test11_OBJECTS = $(am_test11_OBJECTS)
test11_LDADD = $(LDADD)
am_test12_OBJECTS = test12.$(OBJEXT)
test12_OBJECTS = $(am_test12_OBJECTS)
test12_LDADD = $(LDADD)
am_test13_OBJECTS = test13.$(OBJEXT)
test13_OBJECTS = $(am_test13_OBJECTS)
test13_LDADD = $(LDADD)
am_test14_OBJECTS = test14.$(OBJEXT)
test14_OBJECTS = $(am_test14_OBJECTS)
test14_LDADD = $(LDADD)
am_test15_OBJECTS = test15.$(OBJEXT)
test15_OBJECTS = $(am_test15_OBJECTS)
test15_LDADD = $(LDADD)
am_test16_OBJECTS = test16.$(OBJEXT)
test16_OBJECTS = $(am_test16_OBJECTS)
test16_LDADD = $(LDADD)
am_test17_OBJECTS = test-hard-1.$(OBJEXT) test-hard-2.$(OBJEXT)
test17_OBJECTS = $(am_test17_OBJECTS)
test17_LDADD = $(LDADD)
am_test18_OBJECTS = test18.$(OBJEXT)
test18_OBJECTS = $(am_test18_OBJECTS)
test18_LDADD = $(LDADD)
am_test19_OBJECTS = test19.$(OBJEXT)
test19_OBJECTS = $(am_test19_OBJECTS)
test19_LDADD = $(LDADD)
am_test2_OBJECTS = test2.$(OBJEXT)
test2_OBJECTS = $(am_test2_OBJECTS)
test2_LDADD = $(LDADD)
am_test20_OBJECTS = test20.$(OBJEXT)
test20_OBJECTS = $(am_test20_OBJECTS)
test20_LDADD = $(LDADD)
am_test21_OBJECTS = test21.$(OBJEXT)
test21_OBJECTS = $(am_test21_OBJECTS)
test21_LDADD = $(LDADD)
am_test22_OBJECTS = test22.$(OBJEXT)
test22_OBJECTS = $(am_test22_OBJECTS)
test22_LDADD = $(LDADD)
am_test23_OBJECTS = test23.$(OBJEXT)
test23_OBJECTS = $(am_test23_OBJECTS)
test23_LDADD = $(LDADD)
am_test24_OBJECTS = test24.$(OBJEXT)
test24_OBJECTS = $(am_test24_OBJECTS)
test24_LDADD = $(LDADD)
am_test25_OBJECTS = test25.$(OBJEXT)
test25_OBJECTS = $(am_test25_OBJECTS)
test25_LDADD = $(LDADD)
am_test26_OBJECTS = test26.$(OBJEXT)
test26_OBJECTS = $(am_test26_OBJECTS)
test26_LDADD = $(LDADD)
am_test27_OBJECTS = test27.$(OBJEXT)
test27_OBJECTS = $(am_test27_OBJECTS)
test27_LDADD = $(LDADD)
am_test28_OBJECTS = test28.$(OBJEXT)
test28_OBJECTS = $(am_test28_OBJECTS)
test28_LDADD = $(LDADD)
am_test29_OBJECTS = test29.$(OBJEXT)
test29_OBJECTS = $(am_test29_OBJECTS)
test29_LDADD = $(LDADD)
am_test3_OBJECTS = test3.$(OBJEXT)
test3_OBJECTS = $(am_test3_OBJECTS)
test3_LDADD = $(LDADD)
am_test30_OBJECTS = test30.$(OBJEXT)
test30_OBJECTS = $(am_test30_OBJECTS)
test30_LDADD = $(LDADD)
am_test4_OBJECTS = test4.$(OBJEXT)
test4_OBJECTS = $(am_test4_OBJECTS)
test4_LDADD = $(LDADD)
am_test5_OBJECTS = test5.$(OBJEXT)
test5_OBJECTS = $(am_test5_OBJECTS)
test5_LDADD = $(LDADD)
am_test6_OBJECTS = test6.$(OBJEXT)
test6_OBJECTS = $(am_test6_OBJECTS)
test6_LDADD = $(LDADD)
am_test7_OBJECTS = test7.$(OBJEXT)
test7_OBJECTS = $(am_test7_OBJECTS)
test7_LDADD = $(LDADD)
am_test8_OBJECTS = test8.$(OBJEXT)
test8_OBJECTS = $(am_test8_OBJECTS)
test8_LDADD = $(LDADD)
am_test9_OBJECTS = test9.$(OBJEXT)
test9_OBJECTS = $(am_test9_OBJECTS)
test9_LDADD = $(LDADD)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/test-hard-1.Po \
./$(DEPDIR)/test-hard-2.Po ./$(DEPDIR)/test1.Po \
./$(DEPDIR)/test10.Po ./$(DEPDIR)/test11.Po \
./$(DEPDIR)/test12.Po ./$(DEPDIR)/test13.Po \
./$(DEPDIR)/test14.Po ./$(DEPDIR)/test15.Po \
./$(DEPDIR)/test16.Po ./$(DEPDIR)/test18.Po \
./$(DEPDIR)/test19.Po ./$(DEPDIR)/test2.Po \
./$(DEPDIR)/test20.Po ./$(DEPDIR)/test21.Po \
./$(DEPDIR)/test22.Po ./$(DEPDIR)/test23.Po \
./$(DEPDIR)/test24.Po ./$(DEPDIR)/test25.Po \
./$(DEPDIR)/test26.Po ./$(DEPDIR)/test27.Po \
./$(DEPDIR)/test28.Po ./$(DEPDIR)/test29.Po \
./$(DEPDIR)/test3.Po ./$(DEPDIR)/test30.Po \
./$(DEPDIR)/test4.Po ./$(DEPDIR)/test5.Po ./$(DEPDIR)/test6.Po \
./$(DEPDIR)/test7.Po ./$(DEPDIR)/test8.Po ./$(DEPDIR)/test9.Po
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(test1_SOURCES) $(test10_SOURCES) $(test11_SOURCES) \
$(test12_SOURCES) $(test13_SOURCES) $(test14_SOURCES) \
$(test15_SOURCES) $(test16_SOURCES) $(test17_SOURCES) \
$(test18_SOURCES) $(test19_SOURCES) $(test2_SOURCES) \
$(test20_SOURCES) $(test21_SOURCES) $(test22_SOURCES) \
$(test23_SOURCES) $(test24_SOURCES) $(test25_SOURCES) \
$(test26_SOURCES) $(test27_SOURCES) $(test28_SOURCES) \
$(test29_SOURCES) $(test3_SOURCES) $(test30_SOURCES) \
$(test4_SOURCES) $(test5_SOURCES) $(test6_SOURCES) \
$(test7_SOURCES) $(test8_SOURCES) $(test9_SOURCES)
DIST_SOURCES = $(test1_SOURCES) $(test10_SOURCES) $(test11_SOURCES) \
$(test12_SOURCES) $(test13_SOURCES) $(test14_SOURCES) \
$(test15_SOURCES) $(test16_SOURCES) $(test17_SOURCES) \
$(test18_SOURCES) $(test19_SOURCES) $(test2_SOURCES) \
$(test20_SOURCES) $(test21_SOURCES) $(test22_SOURCES) \
$(test23_SOURCES) $(test24_SOURCES) $(test25_SOURCES) \
$(test26_SOURCES) $(test27_SOURCES) $(test28_SOURCES) \
$(test29_SOURCES) $(test3_SOURCES) $(test30_SOURCES) \
$(test4_SOURCES) $(test5_SOURCES) $(test6_SOURCES) \
$(test7_SOURCES) $(test8_SOURCES) $(test9_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/config/depcomp \
$(top_srcdir)/config/mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CPPFLAGS = @CPPFLAGS@
CSCOPE = @CSCOPE@
CTAGS = @CTAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOT = @DOT@
DOXYGEN = @DOXYGEN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WARN_EFFECTIVE_CXX = @WARN_EFFECTIVE_CXX@
WARN_NO_EFFECTIVE_CXX = @WARN_NO_EFFECTIVE_CXX@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
test1_SOURCES = test1.cpp
test2_SOURCES = test2.cpp
test3_SOURCES = test3.cpp
test4_SOURCES = test4.cpp
test5_SOURCES = test5.cpp
test6_SOURCES = test6.cpp
test7_SOURCES = test7.cpp
test8_SOURCES = test8.cpp
test9_SOURCES = test9.cpp
test10_SOURCES = test10.cpp
test11_SOURCES = test11.cpp
test12_SOURCES = test12.cpp
test13_SOURCES = test13.cpp
test14_SOURCES = test14.cpp
test15_SOURCES = test15.cpp
test16_SOURCES = test16.cpp
test17_SOURCES = test-hard-1.cpp test-hard-2.cpp
test18_SOURCES = test18.cpp
test19_SOURCES = test19.cpp
test20_SOURCES = test20.cpp
test21_SOURCES = test21.cpp
test22_SOURCES = test22.cpp
test23_SOURCES = test23.cpp
test24_SOURCES = test24.cpp
test25_SOURCES = test25.cpp
test26_SOURCES = test26.cpp
test27_SOURCES = test27.cpp
test28_SOURCES = test28.cpp
test29_SOURCES = test29.cpp
test30_SOURCES = test30.cpp
AM_CPPFLAGS = -I$(top_srcdir)/include
@HAVE_GNU_COMPILERS_TRUE@AM_CXXFLAGS = -Wall -Wextra
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu examples/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
test1$(EXEEXT): $(test1_OBJECTS) $(test1_DEPENDENCIES) $(EXTRA_test1_DEPENDENCIES)
@rm -f test1$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test1_OBJECTS) $(test1_LDADD) $(LIBS)
test10$(EXEEXT): $(test10_OBJECTS) $(test10_DEPENDENCIES) $(EXTRA_test10_DEPENDENCIES)
@rm -f test10$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test10_OBJECTS) $(test10_LDADD) $(LIBS)
test11$(EXEEXT): $(test11_OBJECTS) $(test11_DEPENDENCIES) $(EXTRA_test11_DEPENDENCIES)
@rm -f test11$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test11_OBJECTS) $(test11_LDADD) $(LIBS)
test12$(EXEEXT): $(test12_OBJECTS) $(test12_DEPENDENCIES) $(EXTRA_test12_DEPENDENCIES)
@rm -f test12$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test12_OBJECTS) $(test12_LDADD) $(LIBS)
test13$(EXEEXT): $(test13_OBJECTS) $(test13_DEPENDENCIES) $(EXTRA_test13_DEPENDENCIES)
@rm -f test13$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test13_OBJECTS) $(test13_LDADD) $(LIBS)
test14$(EXEEXT): $(test14_OBJECTS) $(test14_DEPENDENCIES) $(EXTRA_test14_DEPENDENCIES)
@rm -f test14$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test14_OBJECTS) $(test14_LDADD) $(LIBS)
test15$(EXEEXT): $(test15_OBJECTS) $(test15_DEPENDENCIES) $(EXTRA_test15_DEPENDENCIES)
@rm -f test15$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test15_OBJECTS) $(test15_LDADD) $(LIBS)
test16$(EXEEXT): $(test16_OBJECTS) $(test16_DEPENDENCIES) $(EXTRA_test16_DEPENDENCIES)
@rm -f test16$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test16_OBJECTS) $(test16_LDADD) $(LIBS)
test17$(EXEEXT): $(test17_OBJECTS) $(test17_DEPENDENCIES) $(EXTRA_test17_DEPENDENCIES)
@rm -f test17$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test17_OBJECTS) $(test17_LDADD) $(LIBS)
test18$(EXEEXT): $(test18_OBJECTS) $(test18_DEPENDENCIES) $(EXTRA_test18_DEPENDENCIES)
@rm -f test18$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test18_OBJECTS) $(test18_LDADD) $(LIBS)
test19$(EXEEXT): $(test19_OBJECTS) $(test19_DEPENDENCIES) $(EXTRA_test19_DEPENDENCIES)
@rm -f test19$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test19_OBJECTS) $(test19_LDADD) $(LIBS)
test2$(EXEEXT): $(test2_OBJECTS) $(test2_DEPENDENCIES) $(EXTRA_test2_DEPENDENCIES)
@rm -f test2$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test2_OBJECTS) $(test2_LDADD) $(LIBS)
test20$(EXEEXT): $(test20_OBJECTS) $(test20_DEPENDENCIES) $(EXTRA_test20_DEPENDENCIES)
@rm -f test20$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test20_OBJECTS) $(test20_LDADD) $(LIBS)
test21$(EXEEXT): $(test21_OBJECTS) $(test21_DEPENDENCIES) $(EXTRA_test21_DEPENDENCIES)
@rm -f test21$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test21_OBJECTS) $(test21_LDADD) $(LIBS)
test22$(EXEEXT): $(test22_OBJECTS) $(test22_DEPENDENCIES) $(EXTRA_test22_DEPENDENCIES)
@rm -f test22$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test22_OBJECTS) $(test22_LDADD) $(LIBS)
test23$(EXEEXT): $(test23_OBJECTS) $(test23_DEPENDENCIES) $(EXTRA_test23_DEPENDENCIES)
@rm -f test23$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test23_OBJECTS) $(test23_LDADD) $(LIBS)
test24$(EXEEXT): $(test24_OBJECTS) $(test24_DEPENDENCIES) $(EXTRA_test24_DEPENDENCIES)
@rm -f test24$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test24_OBJECTS) $(test24_LDADD) $(LIBS)
test25$(EXEEXT): $(test25_OBJECTS) $(test25_DEPENDENCIES) $(EXTRA_test25_DEPENDENCIES)
@rm -f test25$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test25_OBJECTS) $(test25_LDADD) $(LIBS)
test26$(EXEEXT): $(test26_OBJECTS) $(test26_DEPENDENCIES) $(EXTRA_test26_DEPENDENCIES)
@rm -f test26$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test26_OBJECTS) $(test26_LDADD) $(LIBS)
test27$(EXEEXT): $(test27_OBJECTS) $(test27_DEPENDENCIES) $(EXTRA_test27_DEPENDENCIES)
@rm -f test27$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test27_OBJECTS) $(test27_LDADD) $(LIBS)
test28$(EXEEXT): $(test28_OBJECTS) $(test28_DEPENDENCIES) $(EXTRA_test28_DEPENDENCIES)
@rm -f test28$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test28_OBJECTS) $(test28_LDADD) $(LIBS)
test29$(EXEEXT): $(test29_OBJECTS) $(test29_DEPENDENCIES) $(EXTRA_test29_DEPENDENCIES)
@rm -f test29$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test29_OBJECTS) $(test29_LDADD) $(LIBS)
test3$(EXEEXT): $(test3_OBJECTS) $(test3_DEPENDENCIES) $(EXTRA_test3_DEPENDENCIES)
@rm -f test3$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test3_OBJECTS) $(test3_LDADD) $(LIBS)
test30$(EXEEXT): $(test30_OBJECTS) $(test30_DEPENDENCIES) $(EXTRA_test30_DEPENDENCIES)
@rm -f test30$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test30_OBJECTS) $(test30_LDADD) $(LIBS)
test4$(EXEEXT): $(test4_OBJECTS) $(test4_DEPENDENCIES) $(EXTRA_test4_DEPENDENCIES)
@rm -f test4$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test4_OBJECTS) $(test4_LDADD) $(LIBS)
test5$(EXEEXT): $(test5_OBJECTS) $(test5_DEPENDENCIES) $(EXTRA_test5_DEPENDENCIES)
@rm -f test5$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test5_OBJECTS) $(test5_LDADD) $(LIBS)
test6$(EXEEXT): $(test6_OBJECTS) $(test6_DEPENDENCIES) $(EXTRA_test6_DEPENDENCIES)
@rm -f test6$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test6_OBJECTS) $(test6_LDADD) $(LIBS)
test7$(EXEEXT): $(test7_OBJECTS) $(test7_DEPENDENCIES) $(EXTRA_test7_DEPENDENCIES)
@rm -f test7$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test7_OBJECTS) $(test7_LDADD) $(LIBS)
test8$(EXEEXT): $(test8_OBJECTS) $(test8_DEPENDENCIES) $(EXTRA_test8_DEPENDENCIES)
@rm -f test8$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test8_OBJECTS) $(test8_LDADD) $(LIBS)
test9$(EXEEXT): $(test9_OBJECTS) $(test9_DEPENDENCIES) $(EXTRA_test9_DEPENDENCIES)
@rm -f test9$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(test9_OBJECTS) $(test9_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-hard-1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-hard-2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test1.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test10.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test11.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test12.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test13.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test14.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test15.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test16.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test18.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test19.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test2.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test20.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test21.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test22.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test23.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test24.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test25.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test26.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test27.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test28.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test29.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test3.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test30.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test4.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test5.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test6.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test7.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test8.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test9.Po@am__quote@ # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/test-hard-1.Po
-rm -f ./$(DEPDIR)/test-hard-2.Po
-rm -f ./$(DEPDIR)/test1.Po
-rm -f ./$(DEPDIR)/test10.Po
-rm -f ./$(DEPDIR)/test11.Po
-rm -f ./$(DEPDIR)/test12.Po
-rm -f ./$(DEPDIR)/test13.Po
-rm -f ./$(DEPDIR)/test14.Po
-rm -f ./$(DEPDIR)/test15.Po
-rm -f ./$(DEPDIR)/test16.Po
-rm -f ./$(DEPDIR)/test18.Po
-rm -f ./$(DEPDIR)/test19.Po
-rm -f ./$(DEPDIR)/test2.Po
-rm -f ./$(DEPDIR)/test20.Po
-rm -f ./$(DEPDIR)/test21.Po
-rm -f ./$(DEPDIR)/test22.Po
-rm -f ./$(DEPDIR)/test23.Po
-rm -f ./$(DEPDIR)/test24.Po
-rm -f ./$(DEPDIR)/test25.Po
-rm -f ./$(DEPDIR)/test26.Po
-rm -f ./$(DEPDIR)/test27.Po
-rm -f ./$(DEPDIR)/test28.Po
-rm -f ./$(DEPDIR)/test29.Po
-rm -f ./$(DEPDIR)/test3.Po
-rm -f ./$(DEPDIR)/test30.Po
-rm -f ./$(DEPDIR)/test4.Po
-rm -f ./$(DEPDIR)/test5.Po
-rm -f ./$(DEPDIR)/test6.Po
-rm -f ./$(DEPDIR)/test7.Po
-rm -f ./$(DEPDIR)/test8.Po
-rm -f ./$(DEPDIR)/test9.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/test-hard-1.Po
-rm -f ./$(DEPDIR)/test-hard-2.Po
-rm -f ./$(DEPDIR)/test1.Po
-rm -f ./$(DEPDIR)/test10.Po
-rm -f ./$(DEPDIR)/test11.Po
-rm -f ./$(DEPDIR)/test12.Po
-rm -f ./$(DEPDIR)/test13.Po
-rm -f ./$(DEPDIR)/test14.Po
-rm -f ./$(DEPDIR)/test15.Po
-rm -f ./$(DEPDIR)/test16.Po
-rm -f ./$(DEPDIR)/test18.Po
-rm -f ./$(DEPDIR)/test19.Po
-rm -f ./$(DEPDIR)/test2.Po
-rm -f ./$(DEPDIR)/test20.Po
-rm -f ./$(DEPDIR)/test21.Po
-rm -f ./$(DEPDIR)/test22.Po
-rm -f ./$(DEPDIR)/test23.Po
-rm -f ./$(DEPDIR)/test24.Po
-rm -f ./$(DEPDIR)/test25.Po
-rm -f ./$(DEPDIR)/test26.Po
-rm -f ./$(DEPDIR)/test27.Po
-rm -f ./$(DEPDIR)/test28.Po
-rm -f ./$(DEPDIR)/test29.Po
-rm -f ./$(DEPDIR)/test3.Po
-rm -f ./$(DEPDIR)/test30.Po
-rm -f ./$(DEPDIR)/test4.Po
-rm -f ./$(DEPDIR)/test5.Po
-rm -f ./$(DEPDIR)/test6.Po
-rm -f ./$(DEPDIR)/test7.Po
-rm -f ./$(DEPDIR)/test8.Po
-rm -f ./$(DEPDIR)/test9.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-noinstPROGRAMS cscopelist-am ctags \
ctags-am distclean distclean-compile distclean-generic \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,3 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <tclap/CmdLine.h>

View File

@ -0,0 +1,5 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <tclap/CmdLine.h>
int main() { }

View File

@ -0,0 +1,48 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <string>
#include <iostream>
#include <algorithm>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object.
CmdLine cmd("Command description message", ' ', "0.9");
// Define a value argument and add it to the command line.
ValueArg<string> nameArg("n","name","Name to print",true,"homer","string");
cmd.add( nameArg );
// Define a switch and add it to the command line.
SwitchArg reverseSwitch("r","reverse","Print name backwards", false);
cmd.add( reverseSwitch );
// Parse the args.
cmd.parse( argc, argv );
// Get the value parsed by each arg.
string name = nameArg.getValue();
bool reverseName = reverseSwitch.getValue();
// Do what you intend too...
if ( reverseName )
{
reverse(name.begin(),name.end());
cout << "My name (spelled backwards) is: " << name << endl;
}
else
cout << "My name is: " << name << endl;
} catch (ArgException &e) // catch any exceptions
{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
}

View File

@ -0,0 +1,28 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
// Test only makes sure we can use different argv types for the
// parser. Don't run, just compile.
#include "tclap/CmdLine.h"
using namespace TCLAP;
int main()
{
char *argv5[] = {(char*)"Foo", 0};
const char *argv6[] = {"Foo", 0};
const char * const argv7[] = {"Foo", 0};
char **argv1 = argv5;
const char **argv2 = argv6;
const char * const * argv3 = argv7;
const char * const * const argv4 = argv7;
CmdLine cmd("Command description message", ' ', "0.9");
cmd.parse(0, argv1);
cmd.parse(0, argv2);
cmd.parse(0, argv3);
cmd.parse(0, argv4);
cmd.parse(0, argv5);
cmd.parse(0, argv6);
cmd.parse(0, argv7);
}

View File

@ -0,0 +1,56 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iterator>
#include <sstream>
using namespace TCLAP;
// Define a simple 3D vector type
struct Vect3D {
double v[3];
// operator= will be used to assign to the vector
Vect3D& operator=(const std::string &str)
{
std::istringstream iss(str);
if (!(iss >> v[0] >> v[1] >> v[2]))
throw TCLAP::ArgParseException(str + " is not a 3D vector");
return *this;
}
std::ostream& print(std::ostream &os) const
{
std::copy(v, v + 3, std::ostream_iterator<double>(os, " "));
return os;
}
};
// Create an ArgTraits for the 3D vector type that declares it to be
// of string like type
namespace TCLAP {
template<>
struct ArgTraits<Vect3D> {
typedef StringLike ValueCategory;
};
}
int main(int argc, char *argv[])
{
CmdLine cmd("Command description message", ' ', "0.9");
ValueArg<Vect3D> vec("v", "vect", "vector",
true, Vect3D(), "3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
vec.getValue().print(std::cout);
std::cout << std::endl;
}

View File

@ -0,0 +1,72 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iterator>
#include <algorithm>
#include <sstream>
using namespace TCLAP;
// Define a simple 3D vector type
struct Vect3D {
double v[3];
// operator= will be used to assign to the vector
Vect3D& operator=(const std::string &str)
{
std::istringstream iss(str);
if (!(iss >> v[0] >> v[1] >> v[2]))
throw TCLAP::ArgParseException(str + " is not a 3D vector");
return *this;
}
std::ostream& print(std::ostream &os) const
{
std::copy(v, v + 3, std::ostream_iterator<double>(os, " "));
return os;
}
};
std::ostream& operator<<(std::ostream &os, const Vect3D &v)
{
return v.print(os);
}
// Create an ArgTraits for the 3D vector type that declares it to be
// of string like type
namespace TCLAP {
template<>
struct ArgTraits<Vect3D> {
typedef StringLike ValueCategory;
};
}
int main(int argc, char *argv[])
{
CmdLine cmd("Command description message", ' ', "0.9");
MultiArg<Vect3D> vec("v", "vect", "vector",
true, "3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
std::copy(vec.begin(), vec.end(),
std::ostream_iterator<Vect3D>(std::cout, "\n"));
std::cout << "REVERSED" << std::endl;
// use alt. form getValue()
std::vector<Vect3D> v(vec.getValue());
std::reverse(v.begin(), v.end());
std::copy(v.begin(), v.end(),
std::ostream_iterator<Vect3D>(std::cout, "\n"));
}

View File

@ -0,0 +1,59 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <iostream>
#include <string>
#include <tclap/CmdLine.h>
using namespace TCLAP;
//
// This file tests that we can parse args from a vector
// of strings rather than argv. This also tests a bug
// where a single element in the vector contains both
// the flag and value AND the value contains the flag
// from another switch arg. This would fool the parser
// into thinking that the string was a combined switches
// string rather than a flag value combo.
//
// This should not print an error
//
// Contributed by Nico Lugil.
//
int main()
{
try
{
CmdLine cmd("Test", ' ', "not versioned",true);
MultiArg<std::string> Arg("X","fli","fli module",false,"string");
cmd.add(Arg);
MultiSwitchArg ArgMultiSwitch("d","long_d","example");
cmd.add(ArgMultiSwitch);
std::vector<std::string> in;
in.push_back("prog name");
in.push_back("-X module");
cmd.parse(in);
std::vector<std::string> s = Arg.getValue();
for(unsigned int i = 0 ; i < s.size() ; i++)
{
std::cout << s[i] << "\n";
}
std::cout << "MultiSwtichArg was found " << ArgMultiSwitch.getValue() << " times.\n";
}
catch (ArgException &e) // catch any exceptions
{
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
}
std::cout << "done...\n";
return 0;
}

View File

@ -0,0 +1,60 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iterator>
#include <algorithm>
#include <sstream>
// Define a simple 3D vector type
template<typename T, size_t LEN>
struct Vect : public TCLAP::StringLikeTrait {
//typedef TCLAP::StringLike ValueCategory;
T v[LEN];
// operator= will be used to assign to the vector
Vect& operator=(const std::string &str)
{
std::istringstream iss(str);
for (size_t n = 0; n < LEN; n++) {
if (!(iss >> v[n])) {
std::ostringstream oss;
oss << " is not a vector of size " << LEN;
throw TCLAP::ArgParseException(str + oss.str());
}
}
if (!iss.eof()) {
std::ostringstream oss;
oss << " is not a vector of size " << LEN;
throw TCLAP::ArgParseException(str + oss.str());
}
return *this;
}
std::ostream& print(std::ostream &os) const
{
std::copy(v, v + LEN, std::ostream_iterator<T>(os, ", "));
return os;
}
};
int main(int argc, char *argv[])
{
TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
TCLAP::ValueArg< Vect<double, 3> > vec("v", "vect", "vector",
true, Vect<double, 3>(),
"3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
vec.getValue().print(std::cout);
std::cout << std::endl;
}

View File

@ -0,0 +1,60 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iterator>
#include <algorithm>
#include <sstream>
// Define a simple 3D vector type
template<typename T, size_t LEN>
struct Vect {
typedef TCLAP::StringLike ValueCategory;
T v[LEN];
// operator= will be used to assign to the vector
Vect& operator=(const std::string &str)
{
std::istringstream iss(str);
for (size_t n = 0; n < LEN; n++) {
if (!(iss >> v[n])) {
std::ostringstream oss;
oss << " is not a vector of size " << LEN;
throw TCLAP::ArgParseException(str + oss.str());
}
}
if (!iss.eof()) {
std::ostringstream oss;
oss << " is not a vector of size " << LEN;
throw TCLAP::ArgParseException(str + oss.str());
}
return *this;
}
std::ostream& print(std::ostream &os) const
{
std::copy(v, v + LEN, std::ostream_iterator<T>(os, " "));
return os;
}
};
int main(int argc, char *argv[])
{
TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
TCLAP::ValueArg< Vect<double, 3> > vec("v", "vect", "vector",
true, Vect<double, 3>(),
"3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
vec.getValue().print(std::cout);
std::cout << std::endl;
}

View File

@ -0,0 +1,45 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iterator>
#include <algorithm>
#include <sstream>
namespace TCLAP {
template<>
struct ArgTraits< std::vector<double> > {
typedef StringLike ValueCategory;
};
template<>
void SetString< std::vector<double> >(std::vector<double> &v,
const std::string &s)
{
std::istringstream iss(s);
while (iss) {
double tmp;
iss >> tmp;
v.push_back(tmp);
}
}
}
int main(int argc, char *argv[])
{
TCLAP::CmdLine cmd("Command description message", ' ', "0.9");
TCLAP::ValueArg< std::vector<double> > vec("v", "vect", "vector",
true, std::vector<double>(),
"3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
const std::vector<double> &v = vec.getValue();
std::copy(v.begin(), v.end(),
std::ostream_iterator<double>(std::cout, "\n"));
std::cout << std::endl;
}

View File

@ -0,0 +1,29 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <string>
#include <iostream>
#include <algorithm>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
try {
CmdLine cmd("Command description message", ' ', "0.9", true);
cmd.setExceptionHandling(false);
cmd.parse(argc, argv);
} catch (ArgException &e) { // catch any exceptions
cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
return 1;
} catch (ExitException &e) { // catch any exceptions
cerr << "Exiting on ExitException." << endl;
return e.getExitStatus();
}
}

View File

@ -0,0 +1,41 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#define TCLAP_SETBASE_ZERO 1
#include "tclap/CmdLine.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
try {
CmdLine cmd("this is a message", ' ', "0.99" );
ValueArg<int> itest("i", "intTest", "integer test", true, 5, "int");
cmd.add( itest );
//
// Parse the command line.
//
cmd.parse(argc,argv);
//
// Set variables
//
int _intTest = itest.getValue();
cout << "found int: " << _intTest << endl;
} catch ( ArgException& e )
{ cout << "ERROR: " << e.error() << " " << e.argId() << endl; }
}

View File

@ -0,0 +1,97 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
int _intTest;
float _floatTest;
bool _boolTestA;
bool _boolTestB;
bool _boolTestC;
string _stringTest;
string _utest;
void parseOptions(int argc, char** argv);
int main(int argc, char** argv)
{
parseOptions(argc,argv);
cout << "for float we got : " << _floatTest << endl
<< "for int we got : " << _intTest<< endl
<< "for string we got : " << _stringTest<< endl
<< "for ulabeled we got : " << _utest << endl
<< "for bool A we got : " << _boolTestA << endl
<< "for bool B we got : " << _boolTestB << endl
<< "for bool C we got : " << _boolTestC << endl;
}
void parseOptions(int argc, char** argv)
{
try {
CmdLine cmd("this is a message", ' ', "0.99" );
//
// Define arguments
//
SwitchArg btest("B","existTestB", "tests for the existence of B", false);
cmd.add( btest );
SwitchArg ctest("C","existTestC", "tests for the existence of C", false);
cmd.add( ctest );
SwitchArg atest("A","existTestA", "tests for the existence of A", false);
cmd.add( atest );
ValueArg<string> stest("s","stringTest","string test",true,"homer",
"string");
cmd.add( stest );
ValueArg<int> itest("i", "intTest", "integer test", true, 5, "int");
cmd.add( itest );
ValueArg<double> ftest("f", "floatTest", "float test", false, 3.7, "float");
cmd.add( ftest );
UnlabeledValueArg<string> utest("unTest","unlabeld test", true,
"default","string");
cmd.add( utest );
UnlabeledMultiArg<string> mtest("fileName", "file names", false, "string");
cmd.add( mtest );
//
// Parse the command line.
//
cmd.parse(argc,argv);
//
// Set variables
//
_intTest = itest.getValue();
_floatTest = ftest.getValue();
_stringTest = stest.getValue();
_boolTestB = btest.getValue();
_boolTestC = ctest.getValue();
_boolTestA = atest.getValue();
_utest = utest.getValue();
vector<string> v = mtest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < v.size(); i++ )
cout << i << " " << v[i] << endl;
} catch ( ArgException& e )
{ cout << "ERROR: " << e.error() << " " << e.argId() << endl; }
}

View File

@ -0,0 +1,29 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include <string>
#include <iostream>
#include <algorithm>
#include <tclap/CmdLine.h>
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object.
CmdLine cmd("Command description message", '=', "0.9");
SwitchArg atmcSwitch("a", "atmc", "aContinuous time semantics", false);
SwitchArg btmcSwitch("b", "btmc", "bDiscrete time semantics", false);
cmd.xorAdd(atmcSwitch, btmcSwitch);
// Parse the args.
cmd.parse( argc, argv );
} catch (ArgException &e) // catch any exceptions
{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
}

View File

@ -0,0 +1,54 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
// This illustrates how to change the flag and name start strings.
// Note that these defines need to happen *before* tclap is included!
#define TCLAP_NAMESTARTSTRING "~~"
#define TCLAP_FLAGSTARTSTRING "/"
#include <string>
#include <iostream>
#include <algorithm>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object.
CmdLine cmd("Command description message", ' ', "0.9");
// Define a value argument and add it to the command line.
ValueArg<string> nameArg("n","name","Name to print",true,"homer","string");
cmd.add( nameArg );
// Define a switch and add it to the command line.
SwitchArg reverseSwitch("r","reverse","Print name backwards", false);
cmd.add( reverseSwitch );
// Parse the args.
cmd.parse( argc, argv );
// Get the value parsed by each arg.
string name = nameArg.getValue();
bool reverseName = reverseSwitch.getValue();
// Do what you intend too...
if ( reverseName )
{
reverse(name.begin(),name.end());
cout << "My name (spelled backwards) is: " << name << endl;
}
else
cout << "My name is: " << name << endl;
} catch (ArgException &e) // catch any exceptions
{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
}

View File

@ -0,0 +1,47 @@
#include <string>
#include <iostream>
#include <algorithm>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
// Wrap everything in a try block. Do this every time,
// because exceptions will be thrown for problems.
try {
// Define the command line object.
CmdLine cmd("Command description message", ' ', "0.9");
cmd.ignoreUnmatched(true);
// Define a value argument and add it to the command line.
ValueArg<string> nameArg("n","name","Name to print",true,"homer","string");
cmd.add( nameArg );
// Define a switch and add it to the command line.
SwitchArg reverseSwitch("r","reverse","Print name backwards", false);
cmd.add( reverseSwitch );
// Parse the args.
cmd.parse( argc, argv );
// Get the value parsed by each arg.
string name = nameArg.getValue();
bool reverseName = reverseSwitch.getValue();
// Do what you intend too...
if ( reverseName )
{
reverse(name.begin(),name.end());
cout << "My name (spelled backwards) is: " << name << endl;
}
else
cout << "My name is: " << name << endl;
} catch (ArgException &e) // catch any exceptions
{ cerr << "error: " << e.error() << " for arg " << e.argId() << endl; }
}

View File

@ -0,0 +1,80 @@
#include "tclap/CmdLine.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
bool _boolTestB;
string _stringTest;
string _utest;
string _ztest;
void parseOptions(int argc, char** argv);
int main(int argc, char** argv)
{
parseOptions(argc,argv);
cout << "for string we got : " << _stringTest<< endl
<< "for bool B we got : " << _boolTestB << endl;
}
void parseOptions(int argc, char** argv)
{
try {
CmdLine cmd("this is a message", '=', "0.99" );
cmd.ignoreUnmatched(true);
//
// Define arguments
//
SwitchArg btest("B","existTestB", "exist Test B", cmd, false);
ValueArg<string> stest("s", "stringTest", "string test", true, "homer",
"string", cmd );
MultiArg<int> itest("i", "intTest", "multi int test", false,"int", cmd );
MultiArg<float> ftest("f", "floatTest", "multi float test", false,"float",
cmd );
UnlabeledMultiArg<string> mtest("fileName","file names", false,
"fileNameString", cmd);
//
// Parse the command line.
//
cmd.parse(argc,argv);
//
// Set variables
//
_stringTest = stest.getValue();
_boolTestB = btest.getValue();
vector<int> vi = itest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < vi.size(); i++ )
cout << "[-i] " << i << " " << vi[i] << endl;
vector<float> vf = ftest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < vf.size(); i++ )
cout << "[-f] " << i << " " << vf[i] << endl;
vector<string> v = mtest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < v.size(); i++ )
cout << "[ ] " << i << " " << v[i] << endl;
} catch ( ArgException& e )
{ cout << "ERROR: " << e.error() << " " << e.argId() << endl; }
}

View File

@ -0,0 +1,67 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
// Test various Arg properties such as invalid flag/names
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main() {
CmdLine cmd("Command description message", ' ', "0.9");
try { // Argument with two character 'flag'
ValueArg<string> nameArg("nx","name","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // space as flag
ValueArg<string> nameArg(" ","name","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // - as flag
ValueArg<string> nameArg("-","name","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // -- as flag
ValueArg<string> nameArg("--","name","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // space as name
ValueArg<string> nameArg("n"," ","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // - as flag
ValueArg<string> nameArg("n","-","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
try { // -- as flag
ValueArg<string> nameArg("n","--","Name to print",true,
"homer","string");
return EXIT_FAILURE;
} catch(SpecificationException &e) {
cout << e.what() << std::endl; // Expected
}
}

View File

@ -0,0 +1,37 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include "tclap/DocBookOutput.h"
#include "tclap/ZshCompletionOutput.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
CmdLine cmd("this is a message", ' ', "0.99" );
DocBookOutput docoutput;
ZshCompletionOutput zshoutput;
CmdLineOutput *output = &zshoutput;
if (argc > 2)
output = &docoutput;
cmd.setOutput(output);
SwitchArg btest("B","sB", "exist Test B", false);
MultiArg<int> atest("A","sA", "exist Test A", false, "integer");
ValueArg<string> stest("s", "Bs", "string test", true, "homer",
"string");
cmd.xorAdd(stest, btest);
cmd.add( atest );
cmd.parse(argc,argv);
}

View File

@ -0,0 +1,42 @@
#include "tclap/CmdLine.h"
#include <iterator>
using namespace TCLAP;
// Define a simple 3D vector type
struct Vect3D {
double v[3];
std::ostream& print(std::ostream &os) const
{
std::copy(v, v + 3, std::ostream_iterator<double>(os, " "));
return os;
}
};
// operator>> will be used to assign to the vector since the default
// is that all types are ValueLike.
std::istream &operator>>(std::istream &is, Vect3D &v)
{
if (!(is >> v.v[0] >> v.v[1] >> v.v[2]))
throw TCLAP::ArgParseException(" Argument is not a 3D vector");
return is;
}
int main(int argc, char *argv[])
{
CmdLine cmd("Command description message", ' ', "0.9");
ValueArg<Vect3D> vec("v", "vect", "vector",
true, Vect3D(), "3D vector", cmd);
try {
cmd.parse(argc, argv);
} catch(std::exception &e) {
std::cout << e.what() << std::endl;
return EXIT_FAILURE;
}
vec.getValue().print(std::cout);
std::cout << std::endl;
}

View File

@ -0,0 +1,26 @@
#include "tclap/CmdLine.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
CmdLine cmd("test arg conversion operator");
SwitchArg falseSwitch("f","false", "test false condition", cmd, false);
SwitchArg trueSwitch("t","true", "tests true condition", cmd, true);
ValueArg<string> strArg("s","str", "test string arg", false, "defStr", "string", cmd);
ValueArg<int> intArg("i","int", "tests int arg", false, 4711, "integer", cmd);
cmd.parse(argc, argv);
string s = strArg;
int i = intArg;
cout << "for falseSwitch we got : " << falseSwitch << endl
<< "for trueSwitch we got : " << trueSwitch << endl
<< "for strArg we got : " << s << endl
<< "for intArg we got : " << i << endl;
}

View File

@ -0,0 +1,35 @@
#include <iostream>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main()
{
try {
CmdLine cmd("test constraint bug");
ValueArg<int> arg("i","int", "tests int arg", false, 4711, NULL, cmd);
cout << "Expected exception" << endl;
} catch(std::logic_error &e) { /* expected */ }
try {
CmdLine cmd("test constraint bug");
ValueArg<int> arg1("i","int", "tests int arg", false, 4711, NULL, NULL);
cout << "Expected exception" << endl;
} catch(std::logic_error &e) { /* expected */ }
try {
CmdLine cmd("test constraint bug");
MultiArg<int> arg1("i","int", "tests int arg", false, NULL, NULL);
cout << "Expected exception" << endl;
} catch(std::logic_error &e) { /* expected */ }
try {
CmdLine cmd("test constraint bug");
MultiArg<int> arg1("i","int", "tests int arg", false, NULL, cmd);
cout << "Expected exception" << endl;
} catch(std::logic_error &e) { /* expected */ }
cout << "Passed" << endl;
}

View File

@ -0,0 +1,13 @@
#include "tclap/CmdLine.h"
#include <vector>
#include <string>
using namespace TCLAP;
using namespace std;
// https://sourceforge.net/p/tclap/bugs/30/
int main() {
CmdLine cmd("test empty argv");
std::vector<string> args;
cmd.parse(args);
}

View File

@ -0,0 +1,95 @@
// -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
#include "tclap/CmdLine.h"
#include <iostream>
#include <string>
using namespace TCLAP;
using namespace std;
bool _boolTestB;
string _stringTest;
string _utest;
string _ztest;
void parseOptions(int argc, char** argv);
int main(int argc, char** argv)
{
parseOptions(argc,argv);
cout << "for string we got : " << _stringTest<< endl
<< "for ulabeled one we got : " << _utest << endl
<< "for ulabeled two we got : " << _ztest << endl
<< "for bool B we got : " << _boolTestB << endl;
}
void parseOptions(int argc, char** argv)
{
try {
CmdLine cmd("this is a message", '=', "0.99" );
//
// Define arguments
//
SwitchArg btest("B","existTestB", "exist Test B", false);
cmd.add( btest );
ValueArg<string> stest("", "stringTest", "string test", true, "homer",
"string");
cmd.add( stest );
UnlabeledValueArg<string> utest("unTest1","unlabeled test one", true,
"default","string");
cmd.add( utest );
UnlabeledValueArg<string> ztest("unTest2","unlabeled test two", true,
"default","string");
cmd.add( ztest );
MultiArg<int> itest("i", "intTest", "multi int test", false,"int" );
cmd.add( itest );
MultiArg<float> ftest("f", "floatTest", "multi float test", false,"float" );
cmd.add( ftest );
UnlabeledMultiArg<string> mtest("fileName","file names",false,
"fileNameString");
cmd.add( mtest );
//
// Parse the command line.
//
cmd.parse(argc,argv);
//
// Set variables
//
_stringTest = stest.getValue();
_boolTestB = btest.getValue();
_utest = utest.getValue();
_ztest = ztest.getValue();
vector<int> vi = itest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < vi.size(); i++ )
cout << "[-i] " << i << " " << vi[i] << endl;
vector<float> vf = ftest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < vf.size(); i++ )
cout << "[-f] " << i << " " << vf[i] << endl;
vector<string> v = mtest.getValue();
for ( int i = 0; static_cast<unsigned int>(i) < v.size(); i++ )
cout << "[ ] " << i << " " << v[i] << endl;
} catch ( ArgException& e )
{ cout << "ERROR: " << e.error() << " " << e.argId() << endl; }
}

Some files were not shown because too many files have changed in this diff Show More