Skip to content

Commit

Permalink
ext/MiniScript: synced MiniScript
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasdr committed Jan 13, 2024
1 parent ef90693 commit d24bf16
Show file tree
Hide file tree
Showing 8 changed files with 503 additions and 19 deletions.
34 changes: 31 additions & 3 deletions README-MiniScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -1042,22 +1042,46 @@ end
| <sub><b>static</b> HTTPDownloadClient(): HTTPDownloadClient</sub> |
| &nbsp; |
| <b>NON STATIC METHODS</b> |
| Execute request |
| <sub>execute(): Null</sub> |
| Cancel download |
| <sub>cancel(): Null</sub> |
| Get file URI |
| <sub>getFile(): String</sub> |
| Get GET parameters |
| <sub>getGETParameters(): Map</sub> |
| Get headers |
| <sub>getHeaders(): Map</sub> |
| Get password |
| <sub>getPassword(): String</sub> |
| Get progress |
| <sub>getProgress(): Float</sub> |
| Get response headers |
| <sub>getResponseHeaders(): Map</sub> |
| Get HTTP status code |
| <sub>getStatusCode(): Integer</sub> |
| Get URL |
| <sub>getURL(): String</sub> |
| Get username |
| <sub>getUserName(): String</sub> |
| Returns if download has been finished |
| <sub>isFinished(): Boolean</sub> |
| Wait until download thread has finished working |
| <sub>join(): Null</sub> |
| Reset HTTP download client |
| <sub>reset(): Null</sub> |
| Set file |
| Set file to save file downloaded to |
| <sub>setFile($url: String): Null</sub> |
| Set GET parameters |
| <sub>setGETParameters($getParameters: Map): Null</sub> |
| Set headers |
| <sub>setHeaders($headers: Map): Null</sub> |
| Set password |
| <sub>setPassword($password: String): Null</sub> |
| Set URL |
| <sub>setURL($url: String): Null</sub> |
| Set user name |
| <sub>setUserName($userName: String): Null</sub> |
| Start download |
| <sub>start(): Null</sub> |

## 6.7. Transform class

Expand Down Expand Up @@ -1334,6 +1358,10 @@ end
| <sub>console.dump($value: Mixed): Null</sub> |
| Print to console |
| <sub>console.log(...): Null</sub> |
| Print to console |
| <sub>console.print(...): Null</sub> |
| Print to console with a trailing new line |
| <sub>console.println(...): Null</sub> |

## 7.4. Cryptography Base64 methods

Expand Down
43 changes: 43 additions & 0 deletions ext/miniscript/src/miniscript/miniscript/ConsoleMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,47 @@ void ConsoleMethods::registerMethods(MiniScript* miniScript) {
};
miniScript->registerMethod(new MethodConsoleDump(miniScript));
}
{
//
class MethodConsolePrint: public MiniScript::Method {
private:
MiniScript* miniScript { nullptr };
public:
MethodConsolePrint(MiniScript* miniScript): MiniScript::Method(), miniScript(miniScript) {}
const string getMethodName() override {
return "console.print";
}
void executeMethod(span<MiniScript::Variable>& arguments, MiniScript::Variable& returnValue, const MiniScript::Statement& statement) override {
for (const auto& argument: arguments) {
_Console::print(argument.getValueAsString());
}
}
bool isVariadic() const override {
return true;
}
};
miniScript->registerMethod(new MethodConsolePrint(miniScript));
}
{
//
class MethodConsolePrintln: public MiniScript::Method {
private:
MiniScript* miniScript { nullptr };
public:
MethodConsolePrintln(MiniScript* miniScript): MiniScript::Method(), miniScript(miniScript) {}
const string getMethodName() override {
return "console.println";
}
void executeMethod(span<MiniScript::Variable>& arguments, MiniScript::Variable& returnValue, const MiniScript::Statement& statement) override {
for (const auto& argument: arguments) {
_Console::print(argument.getValueAsString());
}
_Console::println();
}
bool isVariadic() const override {
return true;
}
};
miniScript->registerMethod(new MethodConsolePrintln(miniScript));
}
}
Loading

0 comments on commit d24bf16

Please sign in to comment.