Skip to content

Commit

Permalink
[Ant4C] updated README.md, added sources of first release - v2019.10.21.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheVice committed Oct 22, 2019
1 parent 2f72e71 commit 1cc4044
Show file tree
Hide file tree
Showing 44 changed files with 13,069 additions and 0 deletions.
99 changes: 99 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
cmake_minimum_required(VERSION 2.8.12)

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "Configuration process cannot start from project source directory.")
endif()

project("Ant4C")

# ant4c

add_library(ant4c STATIC
"${CMAKE_SOURCE_DIR}/argument_parser.c"
"${CMAKE_SOURCE_DIR}/argument_parser.h"
"${CMAKE_SOURCE_DIR}/buffer.c"
"${CMAKE_SOURCE_DIR}/buffer.h"
"${CMAKE_SOURCE_DIR}/common.c"
"${CMAKE_SOURCE_DIR}/common.h"
"${CMAKE_SOURCE_DIR}/conversion.c"
"${CMAKE_SOURCE_DIR}/conversion.h"
"${CMAKE_SOURCE_DIR}/date_time.c"
"${CMAKE_SOURCE_DIR}/date_time.h"
"${CMAKE_SOURCE_DIR}/echo.c"
"${CMAKE_SOURCE_DIR}/echo.h"
"${CMAKE_SOURCE_DIR}/environment.c"
"${CMAKE_SOURCE_DIR}/environment.h"
"${CMAKE_SOURCE_DIR}/exec.c"
"${CMAKE_SOURCE_DIR}/exec.h"
"${CMAKE_SOURCE_DIR}/file_system.c"
"${CMAKE_SOURCE_DIR}/file_system.h"
"${CMAKE_SOURCE_DIR}/interpreter.c"
"${CMAKE_SOURCE_DIR}/interpreter.h"
"${CMAKE_SOURCE_DIR}/math_unit.c"
"${CMAKE_SOURCE_DIR}/math_unit.h"
"${CMAKE_SOURCE_DIR}/operating_system.c"
"${CMAKE_SOURCE_DIR}/operating_system.h"
"${CMAKE_SOURCE_DIR}/path.c"
"${CMAKE_SOURCE_DIR}/path.h"
"${CMAKE_SOURCE_DIR}/project.c"
"${CMAKE_SOURCE_DIR}/project.h"
"${CMAKE_SOURCE_DIR}/property.c"
"${CMAKE_SOURCE_DIR}/property.h"
"${CMAKE_SOURCE_DIR}/range.c"
"${CMAKE_SOURCE_DIR}/range.h"
"${CMAKE_SOURCE_DIR}/string_unit.c"
"${CMAKE_SOURCE_DIR}/string_unit.h"
"${CMAKE_SOURCE_DIR}/target.c"
"${CMAKE_SOURCE_DIR}/target.h"
"${CMAKE_SOURCE_DIR}/version.c"
"${CMAKE_SOURCE_DIR}/version.h"
"${CMAKE_SOURCE_DIR}/xml.c"
"${CMAKE_SOURCE_DIR}/xml.h")

# ant4c_app

add_executable(ant4c_app
"${CMAKE_SOURCE_DIR}/main.c")

target_link_libraries(ant4c_app ant4c)

if(DEFINED PROGRAM_VERSION AND DEFINED PROGRAM_VERSION_LENGTH)
target_compile_definitions(ant4c PRIVATE -DPROGRAM_VERSION=${PROGRAM_VERSION})
target_compile_definitions(ant4c PRIVATE -DPROGRAM_VERSION_LENGTH=${PROGRAM_VERSION_LENGTH})

target_compile_definitions(ant4c_app PRIVATE -DPROGRAM_VERSION=${PROGRAM_VERSION})
target_compile_definitions(ant4c_app PRIVATE -DPROGRAM_VERSION_LENGTH=${PROGRAM_VERSION_LENGTH})
endif()

if(NOT MSVC)
target_link_libraries(ant4c_app m)
endif()

if(MSVC)
# (${MSVC_VERSION} LESS 1901)
# (${MSVC_TOOLSET_VERSION} LESS 141(142))
if (("v140_clang_c2" STREQUAL CMAKE_GENERATOR_TOOLSET) OR ("v141_clang_c2" STREQUAL CMAKE_GENERATOR_TOOLSET))
set(FLAGS "${FLAGS} -Wall /GS")
else()
set(FLAGS "${FLAGS} /W4 /GS")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEFAULT_CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DEFAULT_CMAKE_CXX_FLAGS} ${FLAGS}")
if(CMAKE_CL_64)
set(LINK_FLAGS "${LINK_FLAGS} /DynamicBase /NXCompat")
else()
set(LINK_FLAGS "${LINK_FLAGS} /SafeSEH /DynamicBase /NXCompat")
endif()
else()
set(FLAGS "${FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEFAULT_CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DEFAULT_CMAKE_CXX_FLAGS} ${FLAGS}")
if(${CMAKE_VERSION} LESS 3.0)
if(("GNU" STREQUAL "${CMAKE_CXX_COMPILER_ID}") AND ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "6.0"))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
208 changes: 208 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,210 @@
# Ant4C
Tool that interprets scenarios. Similar to Apache Ant and NAnt. Written in C.

#Overview
Ant for C is C-based script tool. Source of script should be written in XML-based code.
For understanding why tools with such vision was written read [Apache Ant Introduction](http://jakarta.apache.org/ant/manual/) or/and [NAnt help](http://nant.sourceforge.net/).

Name of program just reference to language on which source was written.

For first initial release echo and exec tasks support. Targets are not support. Functions from name spaces bool, cygpath, datetime, double, environment, int, int64, long, math, operating_system, path, platform, program, project, property, string, timespan and version are available.

Developing was started in August of 2019 and first present to the public in October of 2019.

#Downloads
Binaries for Windows, Ubuntu 16.04, OpenBSD 6.5 and FreeBSD 12.0 are available on [release page](https://github.com/TheVice/Ant4C/releases).
Also library available to use ant4c with other C/C++ projects.
For Windows binaries present after compiled with MinGW and Visual Studio 2019.

#Differences from NAnt
Some name space have addition functions (like is64bit-operating-system from environment) and addition version (like substring with two arguments from string addition to version with three arguments) comparing to NAnt implementation. Some functions are missed.

#Building
Build can be done by one of C compilers - MSVC, MinGW, GCC or CLang, after configuring with [CMake](http://www.cmake.org/download/).
For release configuration, without version information, Ant4C script can be used.
* ant4c_app -buildfile:build.build -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:VS2019="" -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:VS2019="" -D:cmake_tool="ClangCL" -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:VS2017="" -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:VS2017="" -D:cmake_arch="Win64" -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:VS2017="" -D:cmake_tool="v141_clang_c2" -D:cmake=cmake
* ant4c_app -buildfile:build.build -D:MinGW="" -D:cmake=cmake

Of course full path to cmake (for example -D:cmake=/usr/local/bin/cmake or -D:cmake="C:\Program Files\cmake\bin\cmake.exe") and build file should be provided.

#List of functions
```
bool::parse
bool::to-string
```
```
double::parse
double::to-string
```
```
int::parse
int::to-string
```
```
long::parse
long::to-string
```
```
datetime::format-to-string
datetime::parse
datetime::to-string
```
```
datetime::get-day
datetime::get-day-of-year
datetime::get-days-in-month
datetime::get-hour
datetime::get-minute
datetime::get-month
datetime::get-second
datetime::get-year
datetime::is-leap-year
datetime::now
datetime::from-input
```
```
timespan::parse
timespan::to-string
```
```
timespan::from-days
timespan::from-hours
timespan::from-minutes
timespan::from-seconds
timespan::get-days
timespan::get-hours
timespan::get-minutes
timespan::get-seconds
timespan::get-total-days
timespan::get-total-hours
timespan::get-total-minutes
timespan::get-total-seconds
```
```
environment::get-folder-path
environment::get-machine-name
environment::get-operating-system
environment::get-user-name
environment::get-variable
environment::get-version
environment::newline
environment::variable-exists
```
```
math::abs
math::ceiling
math::floor
math::round
math::acos
math::asin
math::atan
math::atan2
math::cos
math::cosh
math::exp
math::log
math::log10
math::max
math::min
math::pow
math::sign
math::sin
math::sinh
math::sqrt
math::tan
math::tanh
math::cot
math::coth
math::truncate
math::PI
math::E
math::degrees
math::radians
math::addition
math::subtraction
math::multiplication
math::division
math::near
math::less
math::greater
```
```
program::version
program::current_directory
```
```
platform::get-name
platform::is-unix
platform::is-windows
```
```
project::get-base-directory
project::get-buildfile-path
project::get-buildfile-uri
project::get-default-target
project::get-name
```
```
property::exists
property::get-value
property::is-dynamic
property::is-readonly
```
```
operating-system::get-platform
operating-system::get-version
operating-system::to-string
```
```
path::change-extension
path::combine
path::get-directory-name
path::get-extension
path::get-file-name
path::get-file-name-without-extension
path::get-full-path
path::get-path-root
path::get-temp-file-name
path::get-temp-path
path::has-extension
path::is-path-rooted
```
```
string::contains
string::empty
string::ends-with
string::equal
string::get-length
string::index-of
string::last-index-of
string::pad-left
string::pad-right
string::quote
string::replace
string::starts-with
string::substring
string::to-lower
string::to-upper
string::trim
string::trim-end
string::trim-start
string::un-quote
```
```
cygpath::get-dos-path
cygpath::get-unix-path
cygpath::get-windows-path
```
```
version::parse
version::to-string
version::get-build
version::get-major
version::get-minor
version::get-revision
```
Loading

0 comments on commit 1cc4044

Please sign in to comment.