Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ Checks: ['bugprone-*',
'readability-*',
'zircon-*',
# Remove the following:
'-bugprone-easily-swappable-parameters',
'-bugprone-suspicious-semicolon',
'-cert-dcl37-c',
'-cert-dcl50-cpp',
'-cert-dcl51-cpp',
'-cppcoreguidelines-avoid-magic-numbers',
'-cppcoreguidelines-avoid-do-while',
'-cppcoreguidelines-pro-bounds-array-to-pointer-decay',
'-cppcoreguidelines-pro-type-vararg',
'-modernize-use-trailing-return-type',
Expand Down
3 changes: 2 additions & 1 deletion .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Diagnostics:
'cert-dcl51-cpp',
'cppcoreguidelines-pro-type-vararg',
'readability-braces-around-statements',
'readability-identifier-length'
'readability-identifier-length',
'cppcoreguidelines-avoid-do-while'
]

---
Expand Down
7 changes: 7 additions & 0 deletions .idea/runConfigurations/Run_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 2 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,11 @@ SET(COMPONENTS
calc::root
calc::subtract
calc::trig
matrix::ref)
matrix::ref
)
# NEW_COMPONENT: PATCH Do NOT remove the previous comment.

SET(TARGETS ${COMPONENTS} util)
SET(TEST_TARGETS_TEMP util fraction number mat2d factors format ${COMPONENTS})

FOREACH(TEST_TARGET IN LISTS TEST_TARGETS_TEMP)
SET(TARGET_NAME "test")
STRING(REPLACE "::" ";" COMPONENT_PARTS ${TEST_TARGET})
LIST(LENGTH COMPONENT_PARTS LEN)
IF(LEN EQUAL 2)
LIST(GET COMPONENT_PARTS 1 TEST_TARGET)
ENDIF()

CAPITALIZE(${TEST_TARGET} FILE_NAME)
STRING(CONCAT TARGET_NAME ${TARGET_NAME} ${FILE_NAME})
LIST(APPEND TEST_TARGETS ${TARGET_NAME})
ENDFOREACH()

ADD_SUBDIRECTORY(src/)
ADD_SUBDIRECTORY(lib/)
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
[![CMake Build](https://github.com/ZCG-coder/Steppable/actions/workflows/cmake-multi-platform.yml/badge.svg)](https://github.com/ZCG-coder/Steppable/actions/workflows/cmake-multi-platform.yml)
[![Doxygen Deploy](https://github.com/ZCG-coder/Steppable/actions/workflows/doxygen-gh-pages.yml/badge.svg)](https://github.com/ZCG-coder/Steppable/actions/workflows/doxygen-gh-pages.yml)

This project aims to make a Computer Algebra System (CAS) from scratch, and without any external libraries.
This project aims to build a Computer Algebra System (CAS) from scratch, without any external libraries.

All documentation, usage instructions, and developer guides are available in the [project Wiki](https://github.com/ZCG-coder/Steppable/wiki).

---
For contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
11 changes: 11 additions & 0 deletions include/colors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#pragma once

#include <functional>
#include <ostream>

/**
Expand All @@ -61,6 +62,8 @@

namespace steppable::__internals::utils
{
using ColorFunc = std::function<std::ostream&(std::ostream&)>;

/**
* @brief Check if the output stream is a terminal.
*
Expand All @@ -87,6 +90,14 @@ namespace steppable::__internals::utils
*/
namespace colors
{
/**
* @brief Does nothing.
*
* @param[in] stream The output stream to modify.
* @return The modified output stream.
*/
std::ostream& keepOriginal(std::ostream& stream);

/**
* @brief Set the text color to black.
*
Expand Down
40 changes: 40 additions & 0 deletions include/conPlot/conPlot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**************************************************************************************************
* Copyright (c) 2023-2025 NWSOFT *
* *
* 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. *
**************************************************************************************************/

#pragma once

#include "conPlot/conPlotTypes.hpp"

/**
* @namespace steppable::graphing
* @brief Graphing utilities for showing graphs in the console.
*/
namespace steppable::graphing
{
void conPlot(const std::vector<GraphFn>& f,
const GraphOptions& graphOptions,
const std::vector<LineOptions>& linesOptions);

void conPlotBar(const std::vector<std::vector<Number>>& numbers,
const BarGraphOptions& graphOptions,
const std::vector<BarOptions>& barsOptions);
} // namespace steppable::graphing
51 changes: 51 additions & 0 deletions include/conPlot/conPlotInternals.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**************************************************************************************************
* Copyright (c) 2023-2025 NWSOFT *
* *
* 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. *
**************************************************************************************************/

#pragma once

#include "conPlot/conPlotTypes.hpp"
#include "steppable/number.hpp"

#include <map>

/**
* @namespace steppable::graphing::__internals
* @brief Graphing utilities for showing graphs in the console.
*/
namespace steppable::graphing::__internals
{
void conPlotLine(const Number& xGridSize,
const Number& yGridSize,
const Number& yMax,
const GraphOptions* graphOptions,
const LineOptions* lineOptions,
prettyPrint::ConsoleOutput* canvas,
std::map<Number, Number>& fnValues);

void drawTicks(prettyPrint::ConsoleOutput* canvas,
const Number& xGridSize,
const Number& yGridSize,
const Number& yMax,
const GraphOptionsBase* graphOptions);

void drawGrid(prettyPrint::ConsoleOutput* canvas, const GraphOptionsBase* graphOptions);
} // namespace steppable::graphing::__internals
46 changes: 46 additions & 0 deletions include/conPlot/conPlotInterpolation.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**************************************************************************************************
* Copyright (c) 2023-2025 NWSOFT *
* *
* 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. *
**************************************************************************************************/

#pragma once

#include <map>

namespace steppable::graphing
{
/**
* @brief Fill in integral values with linear interpolation.
*
* @param data An x-y corresponding table of values. Must have at least 2 items.
* @param xMin Minimum `x` value.
* @param xMax Maximum `x` value.
*/
void linearInterpolateFill(std::map<long long, long long>* data, long long xMin, long long xMax);

/**
* @brief Fill in integral values with cubic interpolation.
*
* @param data An x-y corresponding table of values. Must have at least 4 items.
* @param xMin Minimum `x` value.
* @param xMax Maximum `x` value.
*/
void cubicInterpolateFill(std::map<long long, long long>* data, long long xMin, long long xMax);
} // namespace steppable::graphing
Loading
Loading