From ebf438edad3f6c9337827c85988431844186b48a Mon Sep 17 00:00:00 2001 From: Altareos Date: Sun, 5 Jun 2022 00:26:52 +0200 Subject: [PATCH] stl documentation --- doc/stl.md | 373 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 doc/stl.md diff --git a/doc/stl.md b/doc/stl.md new file mode 100644 index 0000000..034b4d4 --- /dev/null +++ b/doc/stl.md @@ -0,0 +1,373 @@ +# Standard Library + +The PL/XML Standard Library allows access to system functions +such as input/output, file access and array manipulation. + +## Table of Contents + +- [PRINT](#print) +- [PRINT-LINE](#print-line) +- [INPUT](#input) +- [STRING-SPLIT](#string-split) +- [ARRAY-SET](#array-set) +- [ARRAY-PUSH](#array-push) +- [ARRAY-POP](#array-pop) +- [ARRAY-GET](#array-get) +- [ARRAY-LENGTH](#array-length) +- [TO-ASCII](#to-ascii) +- [FROM-ASCII](#from-ascii) +- [GET-ARGS](#get-args) +- [WRITE-FILE](#write-file) +- [READ-FILE](#read-file) + +## Functions + +### PRINT + +Writes a string as-is to the standard output + +#### Arguments + +- `string` value to print + +#### Returns + +Nothing + +#### Minimal example + +```xml + + + + + +``` + +### PRINT-LINE + +Writes a string to the standard output, appending a new line + +#### Arguments + +- `string` value to print + +#### Returns + +Nothing + +#### Minimal example + +```xml + + + + + +``` + +### INPUT + +Reads from the standard input + +#### Arguments + +Nothing + +#### Returns + +`string` value read + +#### Minimal example + +```xml + + + +``` + +### STRING-SPLIT + +Splits a string into a vector of single-character strings + +#### Arguments + +- `string` value to split + +#### Returns + +`array` value of strings + +#### Minimal examples + +```xml + + + + + + +``` +```xml + + + + + + +``` + +### ARRAY-SET + +Sets a value at a specific index of an array. + +#### Arguments + +- `array` to update +- `integer` index +- `any` value to set + +#### Returns + +Nothing + +#### Minimal example + +```xml + + + + + + + + + + + + +``` + +### ARRAY-PUSH + +Pushes a value at the end of an array + +#### Arguments + +- `array` to update +- `any` value to push + +#### Returns + +Nothing + +#### Minimal example + +```xml + + + + + + + + + + + +``` + +### ARRAY-POP + +Removes and returns the value at the end of an array + +#### Arguments + +- `array` to update + +#### Returns + +`any` value + +#### Minimal example + +```xml + + + + + + + + + + +``` + +### ARRAY-GET + +Returns the value at index of an array + +#### Arguments + +- `array` to query +- `integer` index + +#### Returns + +`any` value + +#### Minimal example + +```xml + + + + + + + + + + + +``` + +### ARRAY-LENGTH + +Returns the length of an array + +#### Arguments + +- `array` to query + +#### Returns + +`integer` length + +#### Minimal example + +```xml + + + + + + + + + + +``` + +### TO-ASCII + +Converts an integer value into an ASCII character string + +#### Arguments + +- `integer` to convert + +#### Returns + +`string` corresponding ASCII character + +#### Minimal example + +```xml + + + + + +``` + +### FROM-ASCII + +Converts a one-character string into its ASCII integer value + +#### Arguments + +- `string` character to convert + +#### Returns + +`integer` ASCII value + +#### Minimal example + +```xml + + + + + +``` + +### GET-ARGS + +Returns an array of arguments passed to the program + +#### Arguments + +Nothing + +#### Returns + +`array` of strings + +#### Minimal example + +```xml + + + +``` + +### WRITE-FILE + +Writes a string to a file, optionally appending + +#### Arguments + +- `string` filename +- `string` to write +- `any` falsy to replace, truthy to append + +#### Returns + +Nothing + +#### Minimal example + +```xml + + + + + + + +``` + +### READ-FILE + +Reads a file into a string + +#### Arguments + +- `string` filename + +#### Returns + +- `string` file contents + +#### Minimal example + +```xml + + + + + +``` \ No newline at end of file