Compare commits

...

2 Commits

Author SHA1 Message Date
ebcb2a2202 some more stuff 2022-12-03 14:28:22 +01:00
95ee020c37 lol guess what... rewriting it in rust!! 2022-12-03 14:10:41 +01:00
393 changed files with 300 additions and 34019 deletions

View File

@ -1,15 +0,0 @@
---
BasedOnStyle: Microsoft
AlignAfterOpenBracket: Align
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: 'true'
PointerAlignment: Left
SpaceAfterCStyleCast: 'false'
SpaceAfterTemplateKeyword: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInSquareBrackets: 'false'
TabWidth: '4'
UseTab: Never
...

6
.gitignore vendored
View File

@ -1,3 +1,7 @@
build/
.vscode
.cache
.cache
# Added by cargo
target

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "external/doxygen-awesome-css"]
path = external/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git

View File

@ -1,91 +0,0 @@
cmake_minimum_required(VERSION 3.18...3.22)
project(sapphire-compiler LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
include_directories(${LLVM_INCLUDE_DIRS})
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
add_definitions(${LLVM_DEFINITIONS_LIST})
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/external/FormatString/FormatString.hpp
src/FileIO.h
src/FileIO.cpp
src/Arguments.cpp
src/Arguments.h
src/AST/ASTNode.cpp
src/AST/ASTNode.h
src/AST/BinaryOpNode.cpp
src/AST/BinaryOpNode.h
src/AST/ExprNode.cpp
src/AST/ExprNode.h
src/AST/MulNode.cpp
src/AST/MulNode.h
src/AST/StatementNode.cpp
src/AST/StatementNode.h
src/AST/NumberNode.cpp
src/AST/NumberNode.h
src/AST/SumNode.cpp
src/AST/SumNode.h
src/AST/SyscallNode.cpp
src/AST/SyscallNode.h
src/AST/UnaryOpNode.cpp
src/AST/UnaryOpNode.h
src/AST/ProgramNode.cpp
src/AST/ProgramNode.h
src/AST/TopLevelNode.cpp
src/AST/TopLevelNode.h
src/AST/FunctionPrototype.cpp
src/AST/FunctionPrototype.h
src/AST/FunctionNode.cpp
src/AST/FunctionNode.h
src/AST/EmptyFunctionNode.cpp
src/AST/EmptyFunctionNode.h
src/GlobalContext.cpp
src/GlobalContext.h
src/utils.cpp
src/utils.h
src/Parser.cpp
src/Parser.h
src/sapphirepch.h
src/IRBuilder.cpp
src/IRBuilder.h
src/Result.h
)
target_include_directories(sapphirec PUBLIC src)
target_include_directories(sapphirec PUBLIC src/external/tclap-1.2.5/include)
target_include_directories(sapphirec PUBLIC src/external)
target_precompile_headers(sapphirec PUBLIC src/sapphirepch.h)
set_property(TARGET sapphirec PROPERTY COMPILE_WARNING_AS_ERROR ON)
target_compile_options(sapphirec PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic>
)
llvm_map_components_to_libnames(llvm_libs all core support irreader x86asmparser x86codegen x86desc x86disassembler x86info x86targetmca aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils)
target_link_libraries(sapphirec ${llvm_libs})
install(TARGETS sapphirec)
include_directories(src src/tclap-1.2.5/include)
include(cmake/clang-dev-tools.cmake)

231
Cargo.lock generated Normal file
View File

@ -0,0 +1,231 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]]
name = "clap"
version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [
"bitflags",
"clap_lex",
"is-terminal",
"strsim",
"termcolor",
]
[[package]]
name = "clap_lex"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
dependencies = [
"os_str_bytes",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "libc"
version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "rustix"
version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "sapphire"
version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]]
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]]
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"

9
Cargo.toml Normal file
View File

@ -0,0 +1,9 @@
[package]
name = "sapphire"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = "4.0.29"

View File

@ -1,9 +0,0 @@
file(GLOB ALL_SOURCE_FILES src/*.cpp src/*.h src/AST/*.cpp src/AST/*.h)
add_custom_target(
clang-format
COMMAND /usr/bin/clang-format
-style=file
-i
${ALL_SOURCE_FILES}
)

View File

@ -1,7 +0,0 @@
let @memalloc (u64 size) : void* in {
}
let @memfree (void* ptr) in {
}

View File

@ -1,7 +0,0 @@
import core/linux;
import core/string;
namespace io {
}

View File

@ -1,19 +0,0 @@
let @sys_read (u32 fd, i8* buf, u64 size) in {
syscall3(0,fd,buf,size);
}
let @sys_write (u32 fd, i8* buf, u64 size) in {
syscall3(1,fd,buf,size);
}
let @sys_open (i8* name, i32 flags, u16 mode) in {
syscall3(2,name,flags,mode);
}
let @sys_close (u32 fd) in {
syscall1(3,fd);
}
let @sys_exit (i32 code) in {
syscall1(60,code);
}

View File

@ -1 +0,0 @@
import core/__internal/allocate/linux;

View File

@ -1,10 +0,0 @@
let compmacro('ifsystem','linux') in {
let { posix } in @'core/linux';
}
let compmacro('ifsystem','darwin') in {
let { posix } in @'core/darwin';
}
let @exit (i32 code) in {
posix.sys_exit(code);
}

View File

@ -1 +0,0 @@
let { os } in @'core/os';

View File

@ -1,13 +0,0 @@
let { flow } in @'core/flow';
let _libcore_Argc : i32;
let _libcore_Argv : i8**;
let @__libcore_call_init (i32 _Argc, i8** _Argv) in {
_libcore_Argc = _Argc;
_libcore_Argv = _Argv;
main();
flow.exit(0);
}

View File

@ -1,17 +0,0 @@
let { os } in @'core/os';
let { string } in @'core/string';
let { alloc } in @'core/allocate';
let @out (String str) in {
os.write(1,(i8*)str,string.len(str));
}
let @in : String in {
i8* buffer = cast(i8*,alloc.memalloc(256));
os.read(0,buffer,256);
return (String)buffer;
}
let @outln (String str) in {
out(string.concat(str,'\n'));
}

View File

@ -1,3 +0,0 @@
let compmacro('ifarch','x86-64') in {
let {} in @'core/__internal/linux/x64';
}

View File

@ -1,7 +0,0 @@
let compmacro('ifposix') in {
let {} in @'core/__internal/os/posix';
}
let compmacro('ifnt') in {
let {} in @'core/__internal/os/nt';
}

View File

@ -1,32 +0,0 @@
let { alloc } in @'core/allocate';
let @len (String string) : u64 in {
let ptr = cast(i8*,string);
let length : u64 = 0;
while(ptr[length] != 0)
{
length += 1;
}
return length;
}
let @concat (String a, String b) : String in {
let len_a = len(a);
let len_b = len(b);
let final_size = len_a + len_b;
let chars = cast(i8*,alloc.memalloc(final_size + 1));
clone(a,chars,len_a);
clone(b,chars + len_a,len_b);
chars[final_size] = 0;
return (String)chars;
}
let @clone (str string, i8* buffer, u64 max_copy_size) in {
let chars_cloned : u64 = 0;
let ptr = cast(i8*,string);
while(chars_cloned <= max_copy_size and ptr[chars_cloned] != 0)
{
buffer[chars_cloned] = ptr[chars_cloned];
chars_cloned += 1;
}
}

View File

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

View File

@ -1,9 +0,0 @@
# 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

@ -1,65 +0,0 @@
# 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

@ -1,23 +0,0 @@
{
"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

@ -1,25 +0,0 @@
{
"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

@ -1,68 +0,0 @@
{
"$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(let|in|syscall0|syscall1|syscall2|syscall3|syscall4|syscall5)\\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": "\\b(in|;)\\b"
},
"variables": {
"name": "variable.name",
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
}
},
"scopeName": "source.sp"
}

View File

@ -1,29 +0,0 @@
# 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.

View File

@ -1,5 +0,0 @@
const { exit } from @'core/os';
let @main : i32 in {
exit(1);
}

View File

@ -1,10 +0,0 @@
const io from @'core/io';
const { open } from @'core/fs';
let @main : i32 in {
io.out('What is your name? ');
let name = io.in();
let file = open('name.txt');
file.write(name);
file.close();
}

View File

@ -1,9 +0,0 @@
const io from @'core/io';
const { concat } from @'core/string';
const { toString } from @'core/float_utils';
let @main : i32 in {
let float1 : f128 = 234.6;
f128 float2 : f128 = 2934748348291930404.5;
io.outln(concat('Result is: ',toString(float1 + float2)));
}

View File

@ -1,5 +0,0 @@
const io from @'core/io';
let @main : i32 in {
io.outln('Hello world!');
}

View File

@ -1,9 +0,0 @@
const io from @'core/io';
let @main : i32 in {
io.out('What\'s your name? ');
let name = io.in();
io.out('Hello, ');
io.out(name);
io.out('!!');
}

View File

@ -1,10 +0,0 @@
const { io } from @'core/io';
const good_food : String = 'watermelon';
let @main : i32 in {
io.outln('Hello world!');
io.outf('My favorite food is %s\n',good_food);
}

View File

@ -1 +0,0 @@
2 2 6+

View File

@ -1,8 +0,0 @@
const io from @'core/io';
let @main : i32 in {
let age : i32 = 64;
io.out('I am ');
io.out(age);
io.outln(' years old.');
}

View File

@ -1,25 +0,0 @@
#!/usr/bin/env sh
cd $(dirname $0)
usage()
{
echo "Sapphire utility script"
echo "-----------------------"
echo "sapphire.sh build <config>: build the project"
echo "sapphire.sh generate <generator> <config>: regenerate build files"
echo "sapphire.sh format: run clang-format on source files"
echo "sapphire.sh clean: clean build files"
echo "sapphire.sh install <path>: install the project"
echo "sapphire.sh new-ast-node <name>: create a new AST node"
}
case $1 in
"build") tools/build.sh "$2";;
"generate") tools/generate.sh "$2" "$3";;
"format") tools/format.sh;;
"clean") rm -rf build;;
"install") tools/install.sh "$2";;
"new-ast-node") tools/generateASTNode.sh $2;;
"help") usage;;
*) echo "Invalid action, run './sapphire.sh help' for a list of available options.";;
esac

View File

@ -1,9 +0,0 @@
#include "ASTNode.h"
ASTNode::ASTNode()
{
}
ASTNode::~ASTNode()
{
}

View File

@ -1,13 +0,0 @@
#pragma once
#include "llvm/IR/Value.h"
class IRBuilder;
class ASTNode
{
public:
ASTNode();
~ASTNode();
virtual llvm::Value* codegen(IRBuilder* generator) = 0;
};

View File

@ -1,10 +0,0 @@
#include "BinaryOpNode.h"
BinaryOpNode::BinaryOpNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right)
: ExprNode(), left(left), right(right)
{
}
BinaryOpNode::~BinaryOpNode()
{
}

View File

@ -1,13 +0,0 @@
#pragma once
#include "ExprNode.h"
class BinaryOpNode : public ExprNode
{
protected:
std::shared_ptr<ExprNode> left;
std::shared_ptr<ExprNode> right;
public:
BinaryOpNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right);
~BinaryOpNode();
};

View File

@ -1,27 +0,0 @@
#include "EmptyFunctionNode.h"
#include "../Error.h"
#include "../utils.h"
EmptyFunctionNode::EmptyFunctionNode(FunctionPrototype prototype) : TopLevelNode(), prototype(prototype)
{
}
void EmptyFunctionNode::codegen([[maybe_unused]] IRBuilder* generator, llvm::Module* module)
{
llvm::Function* Function = module->getFunction(prototype.name);
if (!Function)
{
llvm::FunctionType* Type = prototype.toFunctionType();
Function = llvm::Function::Create(Type, llvm::Function::ExternalLinkage, prototype.name, *module);
}
else
{
if (!equals(Function->getFunctionType(), prototype.toFunctionType()))
{
// FIXME: add location information to AST nodes, to add information to these errors
Error::throw_error_without_location(
format_string("Function %s redefined with different prototype", prototype.name.c_str()));
}
}
}

View File

@ -1,16 +0,0 @@
#pragma once
#include "../IRBuilder.h"
#include "FunctionPrototype.h"
#include "TopLevelNode.h"
class EmptyFunctionNode final : public TopLevelNode
{
private:
FunctionPrototype prototype;
public:
EmptyFunctionNode(FunctionPrototype prototype);
~EmptyFunctionNode() = default;
void codegen(IRBuilder* generator, llvm::Module* module) override;
};

View File

@ -1,13 +0,0 @@
#include "ExprNode.h"
ExprNode::ExprNode(std::shared_ptr<ExprNode> child) : ASTNode(), child(child)
{
}
ExprNode::ExprNode() : ASTNode()
{
}
ExprNode::~ExprNode()
{
}

View File

@ -1,12 +0,0 @@
#pragma once
#include "ASTNode.h"
class ExprNode : public ASTNode
{
std::shared_ptr<ExprNode> child;
public:
ExprNode(std::shared_ptr<ExprNode> child);
ExprNode();
~ExprNode();
};

View File

@ -1,78 +0,0 @@
#include "FunctionNode.h"
#include "../Error.h"
#include "../IRBuilder.h"
#include "../utils.h"
#include "llvm/IR/Verifier.h"
FunctionNode::FunctionNode(FunctionPrototype prototype, std::shared_ptr<ExprNode> body)
: prototype(prototype), body(body)
{
}
void FunctionNode::codegen(IRBuilder* builder, llvm::Module* module)
{
llvm::Function* Function = module->getFunction(prototype.name);
if (!Function)
{
llvm::FunctionType* Type = prototype.toFunctionType();
Function = llvm::Function::Create(Type, llvm::Function::ExternalLinkage, prototype.name, *module);
}
else
{
if (!equals(Function->getFunctionType(), prototype.toFunctionType()))
{
// FIXME: add location information to AST nodes, to add information to these errors
Error::throw_error_without_location(
format_string("Function %s redefined with different prototype", prototype.name.c_str()));
}
}
if (!Function) return;
if (!Function->empty())
{
Error::throw_error_without_location(format_string("Function %s already has a body", prototype.name.c_str()));
}
llvm::BasicBlock* BB = llvm::BasicBlock::Create(builder->getBuilder()->getContext(), "entry", Function);
builder->getBuilder()->SetInsertPoint(BB);
if (llvm::Value* retVal = body->codegen(builder))
{
if (retVal->getType() != prototype.returnType)
{
if (retVal->getType()->isIntegerTy() && prototype.returnType->isIntegerTy())
{
retVal = builder->getBuilder()->CreateIntCast(retVal, prototype.returnType, true);
}
else if (retVal->getType()->isFloatingPointTy() && prototype.returnType->isFloatingPointTy())
{
retVal = builder->getBuilder()->CreateFPCast(retVal, prototype.returnType);
}
else if (retVal->getType()->isIntegerTy() && prototype.returnType->isFloatingPointTy())
{
retVal = builder->getBuilder()->CreateCast(llvm::Instruction::SIToFP, retVal, prototype.returnType);
}
else if (retVal->getType()->isFloatingPointTy() && prototype.returnType->isIntegerTy())
{
retVal = builder->getBuilder()->CreateCast(llvm::Instruction::FPToSI, retVal, prototype.returnType);
}
else
{
Error::throw_error_without_location(
format_string("The %s function's body type does not match its return type", prototype.name));
}
}
builder->getBuilder()->CreateRet(retVal);
if (llvm::verifyFunction(*Function))
{
Error::throw_error_without_location(format_string("Invalid function %s", prototype.name.c_str()));
}
return;
}
Function->eraseFromParent();
Error::throw_error_without_location(format_string("Error generating code of function %s", prototype.name.c_str()));
}

View File

@ -1,17 +0,0 @@
#pragma once
#include "ExprNode.h"
#include "FunctionPrototype.h"
#include "TopLevelNode.h"
class FunctionNode final : public TopLevelNode
{
private:
FunctionPrototype prototype;
std::shared_ptr<ExprNode> body;
public:
FunctionNode(FunctionPrototype prototype, std::shared_ptr<ExprNode> body);
~FunctionNode() = default;
void codegen(IRBuilder* builder, llvm::Module* module) override;
};

View File

@ -1,18 +0,0 @@
#include "FunctionPrototype.h"
llvm::FunctionType* FunctionPrototype::toFunctionType()
{
if (arguments.size() == 0)
{
return llvm::FunctionType::get(returnType, false);
}
else
{
std::vector<llvm::Type*> args;
for (auto& item : arguments)
{
args.push_back(item.first);
}
return llvm::FunctionType::get(returnType, args, false);
}
}

View File

@ -1,12 +0,0 @@
#pragma once
#include "llvm/IR/Function.h"
#include "llvm/IR/Type.h"
struct FunctionPrototype
{
llvm::Type* returnType;
std::string name;
std::vector<std::pair<llvm::Type*, std::string>> arguments;
llvm::FunctionType* toFunctionType();
};

View File

@ -1,29 +0,0 @@
#include "MulNode.h"
#include "../IRBuilder.h"
#include "../Error.h"
MulNode::MulNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right, char op)
: BinaryOpNode(left, right), op(op)
{
if(op != '*' && op != '/')
{
Error::throw_error(CURRENT_LOCATION, "BUG: MulNode expects op to be either * or /");
}
}
MulNode::~MulNode()
{
}
llvm::Value* MulNode::codegen(IRBuilder* generator)
{
switch (op)
{
case '*':
return generator->getBuilder()->CreateMul(left->codegen(generator), right->codegen(generator));
case '/':
return generator->getBuilder()->CreateSDiv(left->codegen(generator), right->codegen(generator));
default:
__builtin_unreachable();
}
}

View File

@ -1,13 +0,0 @@
#pragma once
#include "BinaryOpNode.h"
class MulNode final : public BinaryOpNode
{
char op;
public:
MulNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right, char op);
~MulNode();
llvm::Value* codegen(IRBuilder* generator) override;
};

View File

@ -1,9 +0,0 @@
#include "NumberNode.h"
NumberNode::NumberNode()
{
}
NumberNode::~NumberNode()
{
}

View File

@ -1,61 +0,0 @@
#pragma once
#include "../IRBuilder.h"
#include "ExprNode.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Type.h"
#include <string>
class NumberNode : public ExprNode
{
public:
NumberNode();
~NumberNode();
virtual bool is_floating()
{
return false;
}
virtual bool is_integral()
{
return false;
}
};
template<typename T> class BasicNumberNode : public NumberNode
{
T value;
public:
BasicNumberNode(T value) : value(value)
{
}
~BasicNumberNode()
{
}
constexpr bool is_floating() override
{
return std::is_floating_point<T>::value;
}
constexpr bool is_integral() override
{
return std::is_integral<T>::value;
}
llvm::Value* codegen(IRBuilder* generator) override
{
if (is_integral())
{
return llvm::ConstantInt::getSigned(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()),
value);
}
else
{
return llvm::ConstantFP::get(llvm::Type::getFloatTy(generator->getBuilder()->getContext()), value);
}
}
};
using IntegerNode = BasicNumberNode<int>;
using FloatNode = BasicNumberNode<float>;

View File

@ -1,18 +0,0 @@
#include "ProgramNode.h"
ProgramNode::ProgramNode() : TopLevelNode()
{
}
void ProgramNode::append(std::shared_ptr<TopLevelNode> item)
{
program.push_back(item);
}
void ProgramNode::walk(std::function<void(std::shared_ptr<TopLevelNode>)> callback)
{
for (auto& item : program)
{
callback(item);
}
}

View File

@ -1,16 +0,0 @@
#pragma once
#include "TopLevelNode.h"
class ProgramNode final : public TopLevelNode
{
private:
std::vector<std::shared_ptr<TopLevelNode>> program;
public:
ProgramNode();
~ProgramNode() = default;
void append(std::shared_ptr<TopLevelNode>);
void walk(std::function<void(std::shared_ptr<TopLevelNode>)> callback);
};

View File

@ -1,9 +0,0 @@
#include "StatementNode.h"
StatementNode::StatementNode(std::shared_ptr<ExprNode> child) : ASTNode(), child(child)
{
}
StatementNode::~StatementNode()
{
}

View File

@ -1,11 +0,0 @@
#pragma once
#include "ExprNode.h"
class StatementNode : public ASTNode
{
std::shared_ptr<ExprNode> child;
public:
StatementNode(std::shared_ptr<ExprNode> child);
~StatementNode();
};

View File

@ -1,29 +0,0 @@
#include "SumNode.h"
#include "../IRBuilder.h"
#include "../Error.h"
SumNode::SumNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right, char op)
: BinaryOpNode(left, right), op(op)
{
if(op != '+' && op != '-')
{
Error::throw_error(CURRENT_LOCATION, "BUG: SumNode expects op to be either + or -");
}
}
SumNode::~SumNode()
{
}
llvm::Value* SumNode::codegen(IRBuilder* generator)
{
switch (op)
{
case '+':
return generator->getBuilder()->CreateAdd(left->codegen(generator), right->codegen(generator));
case '-':
return generator->getBuilder()->CreateSub(left->codegen(generator), right->codegen(generator));
default:
__builtin_unreachable();
}
}

View File

@ -1,13 +0,0 @@
#pragma once
#include "BinaryOpNode.h"
class SumNode final : public BinaryOpNode
{
char op;
public:
SumNode(std::shared_ptr<ExprNode> left, std::shared_ptr<ExprNode> right, char op);
~SumNode();
llvm::Value* codegen(IRBuilder* generator) override;
};

View File

@ -1,263 +0,0 @@
#include "SyscallNode.h"
#include "../Arguments.h"
#include "../Error.h"
#include "../IRBuilder.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InlineAsm.h"
// FIXME: This API is HIGHLY Linux-specific. The right thing to be done should be to expose an inline assembly expression, to do this kind of stuff freely
// depending on the platform in core and any project that wants to use inline assembly, such as an OS kernel or embedded program :^)
Syscall0Node::Syscall0Node(int syscall_number) : ExprNode(), sys_num(syscall_number)
{
}
Syscall0Node::~Syscall0Node()
{
}
Syscall1Node::Syscall1Node(int syscall_number, std::shared_ptr<ASTNode> arg1)
: ExprNode(), sys_num(syscall_number), arg1(arg1)
{
}
Syscall1Node::~Syscall1Node()
{
}
Syscall2Node::Syscall2Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2)
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2)
{
}
Syscall2Node::~Syscall2Node()
{
}
Syscall3Node::Syscall3Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3)
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3)
{
}
Syscall3Node::~Syscall3Node()
{
}
Syscall4Node::Syscall4Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4)
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4)
{
}
Syscall4Node::~Syscall4Node()
{
}
Syscall5Node::Syscall5Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4, std::shared_ptr<ASTNode> arg5)
: ExprNode(), sys_num(syscall_number), arg1(arg1), arg2(arg2), arg3(arg3), arg4(arg4), arg5(arg5)
{
}
Syscall5Node::~Syscall5Node()
{
}
llvm::Value* Syscall0Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}
llvm::Value* Syscall1Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax},{rdi}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
arg1->codegen(generator)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i,{ebx}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80),
arg1->codegen(generator)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}
llvm::Value* Syscall2Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax},{rdi},{rsi}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
arg1->codegen(generator), arg2->codegen(generator)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i,{ebx},{ecx}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80),
arg1->codegen(generator), arg2->codegen(generator)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}
llvm::Value* Syscall3Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax},{rdi},{rsi},{rcx}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i,{ebx},{ecx},{edx}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}
llvm::Value* Syscall4Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax},{rdi},{rsi},{rdx},{rcx}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator), arg4->codegen(generator)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i,{ebx},{ecx},{edx},{esi}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator), arg4->codegen(generator)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}
llvm::Value* Syscall5Node::codegen(IRBuilder* generator)
{
switch (Arguments::TargetTriple.getArch())
{
case llvm::Triple::x86_64: {
auto i64Type =
llvm::FunctionType::get(llvm::IntegerType::getInt64Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i64Type, "syscall", "=r,{rax},{rdi},{rsi},{rdx},{rcx},{r8}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator), arg4->codegen(generator),
arg5->codegen(generator)});
break;
}
case llvm::Triple::x86: {
auto i32Type =
llvm::FunctionType::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), false);
auto inlineAsm = llvm::InlineAsm::get(i32Type, "int $2", "=r,{eax},i,{ebx},{ecx},{edx},{esi},{edi}", true);
return generator->getBuilder()->CreateCall(
inlineAsm,
{llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), sys_num),
llvm::ConstantInt::get(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0x80),
arg1->codegen(generator), arg2->codegen(generator), arg3->codegen(generator), arg4->codegen(generator),
arg5->codegen(generator)});
break;
}
default:
Error::throw_error_without_location(
std::string("Unsupported arch for syscalls: ") +
Arguments::TargetTriple.getArchName(Arguments::TargetTriple.getArch()).str());
break;
}
}

View File

@ -1,86 +0,0 @@
#pragma once
#include "ExprNode.h"
class Syscall0Node final : public ExprNode
{
int sys_num;
public:
Syscall0Node(int syscall_number);
~Syscall0Node();
llvm::Value* codegen(IRBuilder* generator) override;
};
class Syscall1Node final : public ExprNode
{
int sys_num;
std::shared_ptr<ASTNode> arg1;
public:
Syscall1Node(int syscall_number, std::shared_ptr<ASTNode> arg1);
~Syscall1Node();
llvm::Value* codegen(IRBuilder* generator) override;
};
class Syscall2Node final : public ExprNode
{
int sys_num;
std::shared_ptr<ASTNode> arg1;
std::shared_ptr<ASTNode> arg2;
public:
Syscall2Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2);
~Syscall2Node();
llvm::Value* codegen(IRBuilder* generator) override;
};
class Syscall3Node final : public ExprNode
{
int sys_num;
std::shared_ptr<ASTNode> arg1;
std::shared_ptr<ASTNode> arg2;
std::shared_ptr<ASTNode> arg3;
public:
Syscall3Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3);
~Syscall3Node();
llvm::Value* codegen(IRBuilder* generator) override;
};
class Syscall4Node final : public ExprNode
{
int sys_num;
std::shared_ptr<ASTNode> arg1;
std::shared_ptr<ASTNode> arg2;
std::shared_ptr<ASTNode> arg3;
std::shared_ptr<ASTNode> arg4;
public:
Syscall4Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4);
~Syscall4Node();
llvm::Value* codegen(IRBuilder* generator) override;
};
class Syscall5Node final : public ExprNode
{
int sys_num;
std::shared_ptr<ASTNode> arg1;
std::shared_ptr<ASTNode> arg2;
std::shared_ptr<ASTNode> arg3;
std::shared_ptr<ASTNode> arg4;
std::shared_ptr<ASTNode> arg5;
public:
Syscall5Node(int syscall_number, std::shared_ptr<ASTNode> arg1, std::shared_ptr<ASTNode> arg2,
std::shared_ptr<ASTNode> arg3, std::shared_ptr<ASTNode> arg4, std::shared_ptr<ASTNode> arg5);
~Syscall5Node();
llvm::Value* codegen(IRBuilder* generator) override;
};

View File

@ -1,11 +0,0 @@
#include "TopLevelNode.h"
void TopLevelNode::codegen(IRBuilder*, llvm::Module*)
{
return;
}
llvm::Value* TopLevelNode::codegen(IRBuilder*)
{
return nullptr;
}

View File

@ -1,15 +0,0 @@
#pragma once
#include "ASTNode.h"
#include "llvm/IR/Module.h"
class IRBuilder;
class TopLevelNode : public ASTNode
{
public:
TopLevelNode() = default;
~TopLevelNode() = default;
virtual void codegen(IRBuilder* builder, llvm::Module* module);
llvm::Value* codegen(IRBuilder* builder) override;
};

View File

@ -1,9 +0,0 @@
#include "UnaryOpNode.h"
UnaryOpNode::UnaryOpNode(std::shared_ptr<ExprNode> operand) : ExprNode(), operand(operand)
{
}
UnaryOpNode::~UnaryOpNode()
{
}

View File

@ -1,12 +0,0 @@
#pragma once
#include "ExprNode.h"
class UnaryOpNode : public ExprNode
{
protected:
std::shared_ptr<ExprNode> operand;
public:
UnaryOpNode(std::shared_ptr<ExprNode> operand);
~UnaryOpNode();
};

View File

@ -1,86 +0,0 @@
#include "Arguments.h"
#include "Error.h"
#include "tclap/CmdLine.h"
#include "utils.h"
#include "llvm/Support/Host.h"
std::map<std::string, bool> Arguments::flags;
std::map<std::string, std::string> Arguments::values;
llvm::Triple Arguments::TargetTriple;
void Arguments::parse(int argc, char** argv)
{
__benchmark_impl::init();
try
{
TCLAP::CmdLine command_line("The Sapphire compiler.", ' ', "0.1");
#define CreateValueArgument(name, value_short, value_long, help, default_value) \
TCLAP::ValueArg<std::string> name##_Argument(value_short, value_long, help, false, default_value, "string"); \
command_line.add(name##_Argument)
#define CreateFlagArgument(name, value_short, value_long, help) \
TCLAP::SwitchArg name##_FlagArgument(value_short, value_long, help); \
command_line.add(name##_FlagArgument)
#define SaveValueArgument(name) Arguments::values[#name] = name##_Argument.getValue()
#define SaveFlagArgument(name) Arguments::flags[#name] = name##_FlagArgument.getValue()
TCLAP::UnlabeledValueArg<std::string> input_Argument("file", "Input file.", true, "program.sp", "string");
command_line.add(input_Argument);
CreateValueArgument(output, "o", "output", "Output file.", "output.o");
CreateValueArgument(arch, "", "arch", "Architecture to compile for.", "native");
CreateValueArgument(cpu, "", "cpu", "CPU to compile for.", "generic");
CreateValueArgument(system, "", "system", "Operating System to compile for.", "native");
CreateValueArgument(entry, "e", "entry", "Name of entry function.", "main");
CreateFlagArgument(emit_llvm, "", "emit-llvm", "Emit LLVM IR instead of an object file.");
CreateFlagArgument(omit_entry, "", "omit-entry", "Do not check for an entry point.");
#ifndef NO_BENCHMARKING
CreateFlagArgument(profile, "", "profile", "Show execution times for functions.");
#endif
command_line.parse(argc, argv);
SaveValueArgument(output);
SaveValueArgument(input);
SaveValueArgument(arch);
SaveValueArgument(system);
SaveValueArgument(cpu);
SaveValueArgument(entry);
SaveFlagArgument(emit_llvm);
SaveFlagArgument(omit_entry);
setTriple(values["arch"], values["system"]);
#ifndef NO_BENCHMARKING
SaveFlagArgument(profile);
if (flags["profile"]) __benchmark_impl::enable();
#endif
}
catch (TCLAP::ArgException& e)
{
Error::throw_error_without_location(e.error());
}
}
void Arguments::setTriple(const std::string& arch, const std::string& system)
{
std::string triple = llvm::sys::getDefaultTargetTriple();
llvm::Triple targetTriple(triple);
if (arch != "native")
{
targetTriple.setArchName(arch);
}
if (system != "native")
{
targetTriple.setOSName(system);
}
targetTriple.setVendor(llvm::Triple::VendorType::UnknownVendor); // let's leave it like that
targetTriple.setEnvironment(llvm::Triple::EnvironmentType::UnknownEnvironment);
TargetTriple = targetTriple;
}

View File

@ -1,16 +0,0 @@
#pragma once
#include "sapphirepch.h"
#include <llvm/ADT/Triple.h>
#include <map>
struct Arguments
{
static void parse(int argc, char** argv);
static std::map<std::string, bool> flags;
static std::map<std::string, std::string> values;
static llvm::Triple TargetTriple;
private:
static void setTriple(const std::string& arch, const std::string& system);
};

View File

@ -1,147 +0,0 @@
#include "Error.h"
#include "utils.h"
#include <algorithm>
#include <iostream>
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.str();
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);
}
}
// FIXME: Seems like the cursor that indicates where the error is is a bit offset to the right.
[[noreturn]] 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 line = to_string(loc.line);
std::cerr << "\033[1;1m";
std::cerr << loc.str();
std::cerr << ": ";
std::cerr << "\033[31;49m";
std::cerr << "error: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
std::cerr << line;
std::cerr << std::string(4, ' ');
std::cerr << line_text;
std::cerr << std::endl;
std::cerr << std::string(4 + line.size() + loc.column - 1, ' ');
std::cerr << "\033[31;49m";
std::cerr << "^";
std::cerr << "\033[0;0m";
std::cerr << std::endl;
exit(1);
}
[[noreturn]] void Error::throw_error(const Location& loc, const std::string& details)
{
std::cerr << "\033[1;1m";
std::cerr << loc.str();
std::cerr << ": ";
std::cerr << "\033[31;49m";
std::cerr << "error: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
exit(1);
}
[[noreturn]] 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_without_location(const std::string& details)
{
std::cerr << "\033[1;1m";
std::cerr << "\033[33;49m";
std::cerr << "warning: ";
std::cerr << "\033[0;0m";
std::cerr << details;
std::cerr << std::endl;
}
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 line = to_string(loc.line);
std::cout << "\033[1;1m";
std::cout << loc.str();
std::cout << ": ";
std::cout << "\033[33;49m";
std::cout << "warning: ";
std::cout << "\033[0;0m";
std::cout << details;
std::cout << std::endl;
std::cout << line;
std::cout << std::string(4, ' ');
std::cout << line_text;
std::cout << std::endl;
std::cout << std::string(4 + line.size() + loc.column - 1, ' ');
std::cout << "\033[33;49m";
std::cout << "^";
std::cout << "\033[0;0m";
std::cout << std::endl;
}

View File

@ -1,20 +0,0 @@
#pragma once
#include "Location.h"
namespace Error
{
void show_import_line(const Location& loc, std::ostream& output_stream);
[[noreturn]] void throw_error(const Location& loc, const std::string line_text, const std::string& details);
[[noreturn]] void throw_error(const Location& loc, const std::string& details);
[[noreturn]] 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 throw_warning_without_location(const std::string& details);
void show_import_lines(const Location& loc, void (*import_line_printer)(const Location&, std::ostream&),
std::ostream& stream);
} // namespace Error

View File

@ -1,45 +0,0 @@
#include "FileIO.h"
#include "Error.h"
#include "sapphirepch.h"
#include <cstring>
#include <errno.h>
#include <filesystem>
#include <fstream>
std::string FileIO::read_all(const std::string& filename)
{
if (std::filesystem::is_directory(std::filesystem::status(filename)))
Error::throw_error_without_location("unable to open file " + filename + ": Is a directory");
std::ifstream file;
file.exceptions(std::ios::badbit | std::ios::failbit);
try
{
file.open(filename);
}
catch (const std::exception& e)
{
Error::throw_error_without_location("unable to open file " + filename + ": " + strerror(errno));
}
file.exceptions(std::ios::goodbit);
std::vector<char> file_chars;
char fchar;
while (file.good())
{
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();
}
std::string FileIO::remove_file_extension(const std::string& filename)
{
return filename.substr(0, filename.find_last_of('.'));
}

View File

@ -1,13 +0,0 @@
#pragma once
#include "sapphirepch.h"
/* Namespace for simple file operations. */
namespace FileIO
{
/* Helper function to read all of a file's contents. */
std::string read_all(const std::string& filename);
/* Helper function to write a string to a file. */
void write_all(const std::string& filename, const std::string& contents);
/* Return a filename without its extension. */
std::string remove_file_extension(const std::string& filename);
} // namespace FileIO

View File

@ -1,8 +0,0 @@
#include "GlobalContext.h"
std::shared_ptr<llvm::LLVMContext> globalContext;
void initGlobalContext()
{
globalContext = std::make_shared<llvm::LLVMContext>();
}

View File

@ -1,5 +0,0 @@
#include "llvm/IR/LLVMContext.h"
extern std::shared_ptr<llvm::LLVMContext> globalContext;
void initGlobalContext();

View File

@ -1,121 +0,0 @@
#include "IRBuilder.h"
#include "Arguments.h"
#include "Error.h"
#include "FormatString/FormatString.hpp"
#include "GlobalContext.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/Verifier.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
IRBuilder::IRBuilder()
{
context = globalContext;
builder = std::unique_ptr<llvm::IRBuilder<>>(new llvm::IRBuilder<>(*context));
module = std::make_unique<llvm::Module>(Arguments::values["input"], *context);
}
llvm::IRBuilder<>* IRBuilder::getBuilder()
{
return builder.get();
}
void IRBuilder::create_program(std::shared_ptr<ProgramNode> program)
{
program->walk([&](std::shared_ptr<TopLevelNode> node) { node->codegen(this, module.get()); });
if (!Arguments::flags["omit_entry"])
{
if (!module->getFunction(Arguments::values["entry"]))
{
Error::throw_error_without_location(format_string("Missing entry point: %s", Arguments::values["entry"]));
}
if (module->getFunction(Arguments::values["entry"])->empty())
{
Error::throw_error_without_location(
format_string("Entry point %s has no body", Arguments::values["entry"]));
}
}
}
void IRBuilder::resolveToLLVMIR(std::string_view path)
{
std::error_code EC;
llvm::raw_fd_ostream dest(path, EC, llvm::sys::fs::OF_None);
if (EC)
{
Error::throw_error_without_location(
format_string("Could not open file %s: %s", Arguments::values["output"], EC.message()));
}
module->print(dest, nullptr);
dest.flush();
}
void IRBuilder::resolveToObjectFile(std::string_view path)
{
// edit this section when adding support for more architectures
LLVMInitializeX86TargetInfo();
LLVMInitializeAArch64TargetInfo();
LLVMInitializeX86Target();
LLVMInitializeAArch64Target();
LLVMInitializeX86TargetMC();
LLVMInitializeAArch64TargetMC();
LLVMInitializeX86AsmParser();
LLVMInitializeAArch64AsmParser();
LLVMInitializeX86AsmPrinter();
LLVMInitializeAArch64AsmPrinter();
std::string TargetTriple = Arguments::TargetTriple.getTriple();
module->setTargetTriple(TargetTriple);
std::string err;
auto Target = llvm::TargetRegistry::lookupTarget(TargetTriple, err);
if (!Target)
{
Error::throw_error_without_location(err);
}
std::string CPU;
if (Arguments::values["mcpu"] == "native")
{
CPU = llvm::sys::getHostCPUName();
Error::throw_warning_without_location("Using host CPU: " + CPU);
}
else
CPU = Arguments::values["mcpu"];
auto Features = "";
llvm::TargetOptions opt;
auto RM = llvm::Optional<llvm::Reloc::Model>();
auto TheTargetMachine = Target->createTargetMachine(TargetTriple, CPU, Features, opt, RM);
module->setDataLayout(TheTargetMachine->createDataLayout());
std::error_code EC;
llvm::raw_fd_ostream dest(path, EC, llvm::sys::fs::OF_None);
if (EC)
{
Error::throw_error_without_location("Could not open file " + Arguments::values["output"] + " :" + EC.message());
}
llvm::legacy::PassManager pass;
auto FileType = llvm::CGFT_ObjectFile;
if (TheTargetMachine->addPassesToEmitFile(pass, dest, nullptr, FileType))
{
Error::throw_error_without_location("Cannot emit object file");
}
pass.run(*module);
dest.flush();
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "AST/ProgramNode.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
class ASTNode;
class IRBuilder
{
std::shared_ptr<llvm::LLVMContext> context;
std::unique_ptr<llvm::IRBuilder<>> builder;
std::unique_ptr<llvm::Module> module;
public:
IRBuilder();
void create_program(std::shared_ptr<ProgramNode> program);
llvm::IRBuilder<>* getBuilder();
void resolveToLLVMIR(std::string_view path);
void resolveToObjectFile(std::string_view path);
};

View File

@ -1,335 +0,0 @@
#include "Lexer.h"
#include "Error.h"
#include "utils.h"
#define WHITESPACE "\t \n"
#define LETTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ_"
#define IDENTIFIERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYZ_0123456789"
#define DIGITS "0123456789"
Lexer::Lexer(const std::string& fname) : location(1, 0, fname), previous_location(1, 0, fname), index(-1)
{
}
Lexer::~Lexer()
{
}
int Lexer::advance()
{
previous_location = Location{ location };
++index;
location.advance();
if (index >= (ssize_t)current_lexed_text.size()) return 0;
current_char = current_lexed_text[index];
location.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()
{
location = previous_location;
--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)
{
ssize_t idx = index;
std::string final_str;
++idx;
while (idx != (ssize_t)text.size() && text[idx] != '\n')
{
final_str += text[idx];
++idx;
}
return final_str;
}
std::unique_ptr<Lexer> Lexer::make_lexer(const std::string& fname)
{
return std::unique_ptr<Lexer>(new Lexer(fname)); // not using make_shared because the constructor is private
}
void Lexer::assign_parent_location(std::unique_ptr<Lexer>& lexer, const std::shared_ptr<Location>& loc)
{
lexer->location.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 != (ssize_t)current_lexed_text.size())
{
if (current_lexed_text[index + 1] == '/')
{
comment = true;
break;
}
}
result.push_back(Token::make_with_line({TT_Div, location}, current_line_text));
break;
case '+':
result.push_back(Token::make_with_line({TT_Plus, location}, current_line_text));
break;
case '-':
result.push_back(Token::make_with_line({TT_Minus, location}, current_line_text));
break;
case '*':
result.push_back(Token::make_with_line({TT_Mul, location}, current_line_text));
break;
case '@':
result.push_back(Token::make_with_line({TT_At, location}, current_line_text));
break;
case '=':
result.push_back(Token::make_with_line({TT_Equal, location}, current_line_text));
break;
case '>':
result.push_back(Token::make_with_line({TT_GreaterThan, location}, current_line_text));
break;
case '<':
result.push_back(Token::make_with_line({TT_LessThan, location}, current_line_text));
break;
case '(':
result.push_back(Token::make_with_line({TT_LParen, location}, current_line_text));
break;
case ')':
result.push_back(Token::make_with_line({TT_RParen, location}, current_line_text));
break;
case '{':
result.push_back(Token::make_with_line({TT_LBracket, location}, current_line_text));
break;
case '}':
result.push_back(Token::make_with_line({TT_RBracket, location}, current_line_text));
break;
case ';':
result.push_back(Token::make_with_line({TT_Semicolon, location}, current_line_text));
break;
case '.':
result.push_back(Token::make_with_line({TT_Period, location}, current_line_text));
break;
case ',':
result.push_back(Token::make_with_line({TT_Comma, location}, current_line_text));
break;
case '!':
result.push_back(Token::make_with_line({TT_Exclamation, location}, current_line_text));
break;
case '[':
result.push_back(Token::make_with_line({TT_Exclamation, location}, current_line_text));
break;
case ']':
result.push_back(Token::make_with_line({TT_Exclamation, location}, current_line_text));
break;
case ':':
result.push_back(Token::make_with_line({TT_Colon, location}, current_line_text));
break;
case '\377':
result.push_back(Token(TT_EOF, location));
return result;
default:
Error::throw_error(location, current_line_text, "unknown character");
}
}
result.push_back(Token(TT_EOF, location));
return result;
}
Token Lexer::create_identifier()
{
std::vector<char> characters;
int prev_line = location.line;
int prev_column = location.column;
Location saved_loc = this->location;
Location saved_prev_loc = this->previous_location;
characters.push_back(current_char);
while (this->advance())
{
if (is_in_string(IDENTIFIERS, current_char))
{
characters.push_back(current_char);
}
else
{
this->rewind();
goto end;
}
}
end:
std::string identifier(characters.begin(), characters.end());
if (identifier == "syscall0")
return std::move(
Token::make_with_line({TT_Syscall0, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "syscall1")
return std::move(
Token::make_with_line({TT_Syscall1, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "syscall2")
return std::move(
Token::make_with_line({TT_Syscall2, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "syscall3")
return std::move(
Token::make_with_line({TT_Syscall3, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "syscall4")
return std::move(
Token::make_with_line({TT_Syscall4, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "syscall5")
return std::move(
Token::make_with_line({TT_Syscall5, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "let")
return std::move(
Token::make_with_line({TT_Let, {prev_line, prev_column, location.filename}}, current_line_text));
if (identifier == "in")
return std::move(
Token::make_with_line({TT_In, {prev_line, prev_column, location.filename}}, current_line_text));
return std::move(Token::make_with_line({TT_Identifier, identifier, {prev_line, prev_column, location.filename}},
current_line_text));
}
Token Lexer::create_number()
{
std::vector<char> characters;
int prev_line = location.line;
int prev_column = location.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(location, current_line_text, "floats can only have one dot");
this->rewind();
goto end;
}
}
else
{
this->rewind();
goto end;
}
}
end:
if (dot_count != 0)
{
float value = std::stof(std::string(characters.begin(), characters.end()).c_str());
return std::move(
Token::make_with_line({TT_Float, value, {prev_line, prev_column, location.filename}}, current_line_text));
}
int value = std::atoi(std::string(characters.begin(), characters.end()).c_str());
return std::move(
Token::make_with_line({TT_Number, value, {prev_line, prev_column, location.filename}}, current_line_text));
}
Token Lexer::create_string()
{
std::vector<char> characters;
int prev_line = location.line;
int prev_column = location.column;
while (this->advance())
{
if (current_char == '\n')
{
this->rewind();
Error::throw_error(location, current_line_text, "expected end of string but got newline");
}
if (current_char == '\'')
{
std::string identifier(characters.begin(), characters.end());
return std::move(Token::make_with_line({TT_String, identifier, {prev_line, prev_column, location.filename}},
current_line_text));
}
if (current_char == '\\')
{
if (index + 1 == (ssize_t)current_lexed_text.size())
{
Error::throw_error(location, 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(location, current_line_text, "unknown escape sequence");
}
++index;
++location.column;
continue;
}
characters.push_back(current_char);
}
this->rewind();
Error::throw_error(location, current_line_text, "expected end of string but got EOF");
return *(Token*)nullptr; // unreachable
}

View File

@ -1,50 +0,0 @@
#pragma once
#include "Token.h"
#include "sapphirepch.h"
#include <array>
/* Let's redefine TokenStream, as if it wasn't already defined in Token.h*/
typedef std::vector<Token> TokenStream;
/* The number of data types currently in Sapphire. */
#define TYPE_COUNT 14
/* The Lexer for the Sapphire compiler. A Lexer reads source code from a file, and turns it into a stream of tokens the
* compiler can understand. */
class Lexer
{
private:
Location location;
Location previous_location;
int advance();
int rewind();
char current_char;
ssize_t index;
Lexer(const std::string& filename);
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:
~Lexer();
/* Lex the given text, turning it into a stream of tokens. */
TokenStream lex(const std::string& text);
/* Create a new Lexer and return a pointer to it. */
static std::unique_ptr<Lexer> make_lexer(const std::string& filename);
/* If the Lexer is lexing an impòrted file, give it the location in the parent file at which it was imported. */
static void assign_parent_location(std::unique_ptr<Lexer>& lexer, const std::shared_ptr<Location>& loc);
};

View File

@ -1,48 +0,0 @@
#include "Location.h"
#include "FormatString/FormatString.hpp"
#include <sstream>
Location::Location(int line, int column, std::string filename)
: line(line), column(column), filename(std::move(filename))
{
}
Location::~Location()
{
}
std::string Location::str() const
{
return format_string("%s:%d:%d", filename, line, column);
}
void Location::advance()
{
++column;
}
void Location::pos_from_char(const char& character)
{
if (character == '\n')
{
++line;
column = 0;
}
}
Location::Location(const Location& other)
: line(other.line), column(other.column), filename(other.filename), parent(other.parent)
{
}
Location::Location(Location&& other)
: line(other.line), column(other.column), filename(std::move(other.filename)), parent(std::move(other.parent))
{
}
Location Location::copy(const Location& other)
{
Location result(other.line, other.column, other.filename);
result.parent = other.parent;
return result;
}

View File

@ -1,40 +0,0 @@
#pragma once
#include "sapphirepch.h"
/* Struct to represent a location in a file. */
struct Location
{
int line;
int column;
std::string filename;
/* The location at which this location was imported, for error traces in imported files. */
std::shared_ptr<Location> parent = nullptr;
/* Creates a Location with the given parameters. */
Location(int line, int column, std::string filename);
Location(Location&& other);
Location(const Location& other);
Location operator=(const Location& other)
{
return Location(other);
}
~Location();
/* Returns a string of the format FILE:LINE:COL. */
std::string str() const;
/* Advance to the next column in the file. */
void advance();
/* Advance to the next line if provided a newline. */
void pos_from_char(const char& character);
/* Returns a copy of the original Location. */
static Location copy(const Location& other);
};
#define CURRENT_LOCATION (Location {__LINE__, 0, __FILE__})

View File

@ -1,162 +0,0 @@
#include "Parser.h"
#include "AST/EmptyFunctionNode.h"
#include "AST/FunctionNode.h"
#include "AST/MulNode.h"
#include "AST/SumNode.h"
#include "FormatString/FormatString.hpp"
#include "GlobalContext.h"
Parser::Parser(const TokenStream& tokens) : tokens(tokens)
{
m_type_map = {{"void", llvm::Type::getVoidTy(*globalContext)}, {"bool", llvm::Type::getInt1Ty(*globalContext)},
{"i8", llvm::Type::getInt8Ty(*globalContext)}, {"i16", llvm::Type::getInt16Ty(*globalContext)},
{"i32", llvm::Type::getInt32Ty(*globalContext)}, {"i64", llvm::Type::getInt64Ty(*globalContext)},
{"f32", llvm::Type::getFloatTy(*globalContext)}, {"f64", llvm::Type::getDoubleTy(*globalContext)}};
}
std::shared_ptr<Parser> Parser::new_parser(const TokenStream& tokens)
{
return std::shared_ptr<Parser>(
new Parser(tokens)); // As always, not using std::make_shared 'cause constructor is private
}
std::shared_ptr<ProgramNode> Parser::parse()
{
advance();
std::shared_ptr<ProgramNode> final_result = std::make_shared<ProgramNode>();
while (true)
{
auto result = toplevel();
if (result.is_error()) result.ethrow();
final_result->append(result.get());
if (current_token->type == TT_EOF) break;
}
return final_result;
}
int Parser::advance()
{
++index;
if (index < (ssize_t)tokens.size())
{
current_token = &tokens[index];
}
return 1;
}
Result<ExprNode> Parser::factor()
{
Token& token = *current_token;
if (token.type == TT_Number)
{
advance();
assert(token.int_value.has_value());
return Ok<ExprNode>(new IntegerNode(token.int_value.value()), &token);
}
if (token.type == TT_Float)
{
advance();
assert(token.float_value.has_value());
return Ok<ExprNode>(new FloatNode(token.float_value.value()), &token);
}
return Err<ExprNode>("expected a number", &token);
}
Result<ExprNode> Parser::term()
{
Result<ExprNode> left = factor();
if (left.is_error()) return left;
while (current_token->type == TT_Mul || current_token->type == TT_Div)
{
Token& op = *current_token;
advance();
Result<ExprNode> right = factor();
if (right.is_error()) return right;
left = Ok<ExprNode>(new MulNode(left.get(), right.get(), op.type == TT_Mul ? '*' : '/'), &op);
}
return left;
}
Result<ExprNode> Parser::expr()
{
Result<ExprNode> left = term();
if (left.is_error()) return left;
while (current_token->type == TT_Plus || current_token->type == TT_Minus)
{
Token& op = *current_token;
advance();
Result<ExprNode> right = term();
if (right.is_error()) return right;
left = Ok<ExprNode>(new SumNode(left.get(), right.get(), op.type == TT_Plus ? '+' : '-'), &op);
}
return left;
}
Result<TopLevelNode> Parser::toplevel()
{
// FIXME: Add more top-level stuff later, for now it's only functions.
return function();
}
Result<TopLevelNode> Parser::function()
{
FunctionPrototype proto;
Token* start_token = current_token;
proto.returnType = m_type_map["void"]; // FIXME: allow specifying return type
proto.arguments = {}; // FIXME: allow specifying arguments
if (current_token->type != TT_Let) return Err<TopLevelNode>("Expected let", current_token);
advance();
if (current_token->type != TT_At) return Err<TopLevelNode>("Expected @", current_token);
advance();
if (current_token->type != TT_Identifier) return Err<TopLevelNode>("Expected an identifier", current_token);
else
{
assert(current_token->string_value.has_value());
proto.name = current_token->string_value.value();
}
advance();
if (current_token->type != TT_In && current_token->type != TT_Semicolon && current_token->type != TT_Colon)
return Err<TopLevelNode>("Expected 'in', colon or semicolon", current_token);
if (current_token->type == TT_Semicolon)
{
advance();
return Ok<TopLevelNode>(new EmptyFunctionNode(proto), start_token);
}
if (current_token->type == TT_Colon)
{
advance();
if (current_token->type != TT_Identifier)
{
return Err<TopLevelNode>("Expected type name", current_token);
}
try
{
proto.returnType = m_type_map.at(current_token->string_value.value());
}
catch (const std::out_of_range&)
{
return Err<TopLevelNode>("Expected type name", current_token);
}
advance();
if (current_token->type != TT_In && current_token->type != TT_Semicolon)
return Err<TopLevelNode>("Expected 'in' or semicolon", current_token);
if (current_token->type == TT_Semicolon)
{
advance();
return Ok<TopLevelNode>(new EmptyFunctionNode(proto), start_token);
}
}
advance();
if (current_token->type != TT_LBracket)
return Err<TopLevelNode>("Invalid syntax",
current_token); // FIXME: Do not be lazy and return a meaningful error message.
advance();
Result<ExprNode> body = expr();
if (body.is_error()) return Err<TopLevelNode>(body.error(), body.token());
if (current_token->type != TT_RBracket) return Err<TopLevelNode>("Invalid syntax", current_token);
advance();
return Ok<TopLevelNode>(new FunctionNode(proto, body.get()), start_token);
}

View File

@ -1,35 +0,0 @@
#pragma once
#include "AST/NumberNode.h"
#include "AST/ProgramNode.h"
#include "AST/SumNode.h"
#include "Error.h"
#include "Lexer.h"
#include "Result.h"
#include "sapphirepch.h"
#include "llvm/IR/Type.h"
/* Parser class for the Sapphire compiler. */
class Parser
{
private:
Parser(const TokenStream& tokens);
TokenStream tokens;
ssize_t index = -1;
int advance();
Token* current_token;
std::unordered_map<std::string, llvm::Type*> m_type_map;
Result<ExprNode> factor();
Result<ExprNode> expr();
Result<ExprNode> term();
Result<TopLevelNode> toplevel();
Result<TopLevelNode> function();
public:
/* Construct a new Parser with the given TokenStream. */
static std::shared_ptr<Parser> new_parser(const TokenStream& tokens);
/* Parse the stored TokenStream and return the top-level node of the result Abstract Syntax Tree. */
std::shared_ptr<ProgramNode> parse();
};

View File

@ -1,60 +0,0 @@
#pragma once
#include "Error.h"
#include "Token.h"
// Kinda copying Rust here, but it's a great idea.
template<typename T> class Result
{
public:
Result() = default;
bool is_error() const
{
return m_is_error;
}
void ethrow()
{
Error::throw_error(m_token->location, m_token->line(), m_error);
}
Token* token()
{
return m_token;
}
std::shared_ptr<T> get()
{
return m_result;
}
std::string error()
{
return m_error;
}
protected:
Token* m_token;
std::shared_ptr<T> m_result;
bool m_is_error;
std::string m_error;
Result(T* result, Token* token) : m_token(token), m_result(result), m_is_error(false)
{
}
Result(std::string&& error, Token* token) : m_token(token), m_is_error(true), m_error(error)
{
}
};
template<typename T> class Ok final : public Result<T>
{
public:
Ok(T* result, Token* token) : Result<T>(result, token)
{
}
};
template<typename T> class Err final : public Result<T>
{
public:
Err(std::string error, Token* token) : Result<T>(std::move(error), token)
{
}
};

View File

@ -1,94 +0,0 @@
#include "Token.h"
#include "utils.h"
Token::Token(const Token& other) : type(other.type), location(other.location), m_line_text(other.m_line_text)
{
if (other.int_value.has_value())
{
int_value = other.int_value.value();
}
else if (other.float_value.has_value())
{
float_value = other.float_value.value();
}
else if (other.string_value.has_value())
{
string_value = other.string_value.value();
}
}
Token::Token(TokenType type) : type(type), location(0, 0, "")
{
}
Token::Token(TokenType type, const Location& location) : type(type), location(location)
{
}
Token::Token(TokenType type, std::string value) : type(type), string_value(std::move(value)), location(0, 0, "")
{
}
Token::Token(TokenType type, int value, const Location& location) : type(type), int_value(value), location(location)
{
}
Token::Token(TokenType type, std::string value, const Location& location)
: type(type), string_value(std::move(value)), location(location)
{
}
Token::Token(TokenType type, float value, const Location& location) : type(type), float_value(value), location(location)
{
}
Token Token::copy_with_new_type(const TokenType& type) const
{
Token result(type, location);
result.m_line_text = m_line_text;
if (int_value.has_value())
{
result.int_value = int_value.value();
}
else if (float_value.has_value())
{
result.float_value = float_value.value();
}
else if (string_value.has_value())
{
result.string_value = string_value.value();
}
return result;
}
Token Token::make_with_line(const Token& origin, const std::string& line_text)
{
Token result = origin.copy_with_new_type(origin.type);
result.m_line_text = line_text;
return result;
}
void Token::operator=(const Token& other)
{
type = other.type;
location = other.location;
m_line_text = other.m_line_text;
if (other.int_value.has_value())
{
int_value = other.int_value.value();
}
else if (other.float_value.has_value())
{
float_value = other.float_value.value();
}
else if (other.string_value.has_value())
{
string_value = other.string_value.value();
}
}

View File

@ -1,97 +0,0 @@
#pragma once
#include "Location.h"
#include "sapphirepch.h"
/* All current token types. Will change in the future. */
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_Equals,
TT_GTE,
TT_LTE,
TT_Period,
TT_Comma,
TT_Exclamation,
TT_NEqual,
TT_LSQB,
TT_RSQB,
TT_Syscall0,
TT_Syscall1,
TT_Syscall2,
TT_Syscall3,
TT_Syscall4,
TT_Syscall5,
TT_Let,
TT_In,
TT_Colon,
};
/* Struct to represent tokens generated by the Lexer. */
struct Token
{
TokenType type;
std::optional<int> int_value;
std::optional<std::string> string_value;
std::optional<float> float_value;
Location location;
Token(const Token& other);
Token(TokenType type);
Token(TokenType type, const Location& location);
Token(TokenType type, int value, const Location& location);
Token(TokenType type, std::string value, const Location& location);
Token(TokenType type, std::string value);
Token(TokenType type, float val, const Location& location);
~Token() = default;
/* Return the contents of the line where the Token was located. */
std::string line() const
{
return m_line_text;
}
/* Return a copy of the original token, but adding the contents of the line where
the token was located. */
static Token make_with_line(const Token& origin, const std::string& line_text);
void operator=(const Token& other);
/* Return a copy of this Token, but with its TokenType changed. */
Token copy_with_new_type(const TokenType& type) const;
private:
// FIXME: this should be moved to Location, to remove all Token* that are only used to throw errors at a certain
// location.
std::string m_line_text;
};
/* typedef to make it easier to see a what a std::vector of tokens is being used for. */
typedef std::vector<Token> TokenStream;

View File

@ -1,44 +0,0 @@
// 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))...);
}

View File

@ -1,21 +0,0 @@
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.

View File

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

View File

@ -1,27 +0,0 @@
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.

File diff suppressed because it is too large Load Diff

View File

@ -1,182 +0,0 @@
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

@ -1,10 +0,0 @@
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

View File

@ -1,830 +0,0 @@
# 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:

View File

View File

@ -1,12 +0,0 @@
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/

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,494 +0,0 @@
# 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

@ -1,19 +0,0 @@
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

@ -1,25 +0,0 @@
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

@ -1,28 +0,0 @@
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

@ -1,22 +0,0 @@
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

@ -1,31 +0,0 @@
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

@ -1,18 +0,0 @@
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)
])

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