Skip to content

Commit

Permalink
ext: MiniScript: updated to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Jan 2, 2024
1 parent c29187d commit fc44b1e
Show file tree
Hide file tree
Showing 57 changed files with 1,319 additions and 480 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ using miniscript::miniscript::MiniScript;
using _Console = miniscript::utilities::Console;
using _StringTools = miniscript::utilities::StringTools;

void ApplicationMethods::registerConstants(MiniScript* miniScript) {
}

const string ApplicationMethods::execute(const string& command) {
// see: https://stackoverflow.com/questions/478898/how-to-execute-a-command-and-get-output-of-command-within-c-using-posix
array<char, 128> buffer;
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ApplicationMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ using std::string;
*/
class miniscript::miniscript::ApplicationMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ArrayMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using miniscript::miniscript::MiniScript;

using _Console = miniscript::utilities::Console;

void ArrayMethods::registerConstants(MiniScript* miniScript) {
}

void ArrayMethods::registerMethods(MiniScript* miniScript) {
// array methods
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ArrayMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::ArrayMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/BaseMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ using miniscript::miniscript::MiniScript;
using _Console = miniscript::utilities::Console;
using _Time = miniscript::utilities::Time;

void BaseMethods::registerConstants(MiniScript* miniScript) {
}

void BaseMethods::registerMethods(MiniScript* miniScript) {
// base methods
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/BaseMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::BaseMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ByteArrayMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using miniscript::miniscript::MiniScript;

using _Console = miniscript::utilities::Console;

void ByteArrayMethods::registerConstants(MiniScript* miniScript) {
}

void ByteArrayMethods::registerMethods(MiniScript* miniScript) {
// array methods
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ByteArrayMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::ByteArrayMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ConsoleMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using miniscript::miniscript::MiniScript;

using _Console = miniscript::utilities::Console;

void ConsoleMethods::registerConstants(MiniScript* miniScript) {
}

void ConsoleMethods::registerMethods(MiniScript* miniScript) {
// console
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ConsoleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::ConsoleMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ContextMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ using miniscript::miniscript::MiniScript;

using _Console = miniscript::utilities::Console;

void ContextMethods::registerConstants(MiniScript* miniScript) {
}

void ContextMethods::registerMethods(MiniScript* miniScript) {
if (miniScript->getContext() == nullptr) return;
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ContextMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::ContextMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ using _Console = miniscript::utilities::Console;
using _SHA256 = miniscript::utilities::SHA256;
using _StringTools = miniscript::utilities::StringTools;

void CryptographyMethods::registerConstants(MiniScript* miniScript) {
}

void CryptographyMethods::registerMethods(MiniScript* miniScript) {
// base64
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::CryptographyMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
33 changes: 32 additions & 1 deletion ext/miniscript/src/miniscript/miniscript/Documentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,41 @@ const string Documentation::generateOperatorsDocumentation(
//
string result;
result+= string() + "\n";
result+= string() + "# 10. Operators" + "\n";
result+= string() + "# " + to_string(mainHeadingIdx) + ". " + heading + "\n";
result+= string() + "\n";
result+= string() + "| Op | Method |" + "\n";
result+= string() + "|----|---------------------------------------------------------------------------------------------|" + "\n";
for (const auto& method: operators) result+= string() + method + "\n";
return result;
}

const string Documentation::generateVariablesDocumentation(
const string& heading,
int mainHeadingIdx,
MiniScript* miniScript
) {
//
vector<string> variables;
for (const auto& [variableName, variable]: miniScript->getRootScriptState().variables) {
string variableString;
variableString = "| ";
variableString+= variableName;
while (variableString.size() < 62) variableString+= " ";
variableString+= "| ";
auto idx = variableString.size();
variableString+= variable->getValueAsString();
while (variableString.size() - idx < 35) variableString+= " ";
variableString+= "|";
variables.push_back(variableString);
}
sort(variables.begin(), variables.end());
//
string result;
result+= string() + "\n";
result+= string() + "# " + to_string(mainHeadingIdx) + ". " + heading + "\n";
result+= string() + "\n";
result+= string() + "| Name | Value |" + "\n";
result+= string() + "|-------------------------------------------------------------|------------------------------------|" + "\n";
for (const auto& method: variables) result+= string() + method + "\n";
return result;
}
14 changes: 14 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/Documentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,18 @@ class miniscript::miniscript::Documentation {
int mainHeadingIdx,
MiniScript* miniScript
);

/**
* Generate variables documentation
* @param heading heading
* @param mainHeadingIdx main heading index
* @param miniScript MiniScript script instance
* @return documentation
*/
static const string generateVariablesDocumentation(
const string& heading,
int mainHeadingIdx,
MiniScript* miniScript
);

};
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ using _Console = miniscript::utilities::Console;
using _Exception = miniscript::utilities::Exception;
using _ExceptionBase = miniscript::utilities::ExceptionBase;

void FileSystemMethods::registerConstants(MiniScript* miniScript) {
}

void FileSystemMethods::registerMethods(MiniScript* miniScript) {
// file system methods
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/FileSystemMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::FileSystemMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/JSONMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ using miniscript::miniscript::MiniScript;
using _Console = miniscript::utilities::Console;
using _StringTools = miniscript::utilities::StringTools;

void JSONMethods::registerConstants(MiniScript* miniScript) {
}

void JSONMethods::registerMethods(MiniScript* miniScript) {
// json
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/JSONMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::JSONMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MapMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using miniscript::miniscript::MiniScript;

using _Console = miniscript::utilities::Console;

void MapMethods::registerConstants(MiniScript* miniScript) {
}

void MapMethods::registerMethods(MiniScript* miniScript) {
// map
{
Expand Down
6 changes: 6 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MapMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ using miniscript::miniscript::MiniScript;
*/
class miniscript::miniscript::MapMethods {
public:
/**
* Register constants
* @param miniScript miniScript
*/
static void registerConstants(MiniScript* miniScript);

/**
* Register methods
* @param miniScript miniScript
Expand Down
3 changes: 3 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MathMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ void MathMethods::registerDataType(MiniScript::DataType* dataType) {
dataTypes.push_back(dataType);
}

void MathMethods::registerConstants() {
}

void MathMethods::registerMethods() {
// operator methods
{
Expand Down
5 changes: 5 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/MathMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class miniscript::miniscript::MathMethods {
*/
void registerDataType(MiniScript::DataType* dataType);

/**
* Register constants
*/
void registerConstants();

/**
* Register methods
*/
Expand Down
Loading

0 comments on commit fc44b1e

Please sign in to comment.