Functions

Functions defined in SIRTX

Functions provide functionallity to the system. They are similar in concept to programs on other operating systems. Functions can be called by other functions including the line command interpreter (lci) which is the default shell on SIRTX.

Examples
~> echo "Hello World!"
Hello World!
~> show null
T:  6517 "/dev/null"
   Relation                        Related/Type                    Data
   # Context                         Encoding
   ────────────────────────────────────────────────────────────────────
M:     1 "also-shares-id..."           2 "uuid"                    '44c76593-2d72-57bc-b3f9-a85a0c75832b'
M:     1 "also-shares-id..."           3 "tagname"                 '/dev/null'
M:     1 "also-shares-id..."           4 "wikidata-ident..."       'Q14671'
M:     1 "also-shares-id..."       10981 "sirtx-logical"           'null'
R:  4580 "instance of"             <none>                           6518 "device file"
R:  4580 "instance of"             <none>                           6519 "zero-byte file"

Index

Functions

Below you find a list of a selected list of functions. Not all functions may be listed here as this is operating system in active development.

back

Returns to the last tag in the history.

Example
~> back

beep

Beeps (rings the bell) of the current terminal.

Example
~> beep

bool

Converts between different boolean formats.

Example
~> echo (bool)"true"
21492 (* 1) "true"

cls

Clears the screen. Optionally sets the current tag.

Examples
~> cls
~> cls 1234

context

Displays the current context

Example
40 (* 0) "Welcome to SIRTX" ~> context
 Context: 0x3fd8
  |- Session: 0x017a
  |   |- done: false
  |   |- term: (0x01b1) <none>
  |   |- local IDs: 1 used
  |   |  |-  0:    40 (* 0) "Welcome to SIRTX"
  |   |- history: 1 fill
  |   |  |-  0: #    40 (* 0) "Welcome to SIRTX"
  |- Ports: 1 total, 0 free, writeable: true
  |   |-  0: <none>                          = (0x4904/v)     0/f/ 1027 (* 1) "context"
 Context: 0x3fe3
  |- Session: 0x017a
  |- Ports: 3 total, 3 free, writeable: true
 Context: 0x40d3
  |- Session: 0x017a
  |- Ports: 7 total, 0 free, writeable: true
  |   |-  0:    50 (* 2) "standard input"    = (0x01b1/R)     0/f/<none>
  |   |-  1:    51 (* 3) "standard output"   = (0x01b1/R)     0/f/<none>
  |   |-  2:    52 (* 4) "standard error"    = (0x01b1/R)     0/f/<none>
  |   |-  3:    61 (* 5) "SHELL"             = (0x490d/v)     0/f/ 1036 (* 6) "lci"
  |   |-  4:    72 (* 7) "accumulator"       = (0x0000/R)     0/f/<invalid>
  |   |-  5:    53 (* 8) "program-text"      = (0x01b1/R)     0/f/<none>
  |   |-  6:    62 (* 9) "PS1"               = (0x02f3/R)     0/f/"$.~$G \0\0\0\0\0"

control

Allows to send control commands to an open handle.

Example
~> control @ctty uuid:[36e66023-277f-4839-87d1-4188d074343d]

debug

Prints debug information.

Example
~> debug

declare

Declares a variable.

Example
~> declare ac

dir

Prints the content of a tag. The tag must be opened with the driver online.

Examples
~> dir @1234
T: 12464 (* 0) "tmp"
 Inode  Size    Tag
            12464 (* 0) "tmp"
            12463 (* 9) "test-file"
~> dir @*0

echo

Prints it's input. A new line is added.

Examples
~> echo "Hello World!"
Hello World!
~> echo <1234

equal

Compares the inputs for equalness.

Examples
~> echo (equal "b")"a"
21212 (* 1) "false"
~> echo (equal "a")"a"
21492 (* 2) "true"
~> echo (equal '5)'7
21212 (* 1) "false"

findtag

Finds a tag and stores it in a variable.

Examples
~> findtag &ac uuid "36e66023-277f-4839-87d1-4188d074343d"
~> findtag &ac sid '1

flatten

Flattens a list of lists into a single list.

Example
~> dir (flatten)(repeat '2)(seq '3)[]
T: <none>
 Inode  Size    Tag
           0 1
           0 2
           0 3
           0 1
           0 2
           0 3

forward

Moves forward to the next tag in the history (after the user returned by using the back function).

Example
~> forward

ftutf8

This provides abstraction of character sets other than UTF-8. A proxy handle is created that uses UTF-8 while using a non-UTF-8 handle as the backend.

go

Go to a tag, making it the current tag and adding it to the history.

Example
~> go 1234

hello_world

Prints "Hello World!". This is an example function.

Example
~> hello_world
Hello World!

help

Shows help about any topic. If no topic is given lists known functions.

Examples
~> help
~> help hello_world

hexdump

Prints a hexdump of an input. The input must be open for read.

Examples
~> hexdump "Hello World!"
T: <none>
I:   255 with size    12 Bytes
  Block │   0  1  2  3  4  5  6  7 │ ASCII
  ──────┼──────────────────────────┼─────────
      0 │  48 65 6c 6c 6f 20 57 6f │ Hello Wo
      1 │  72 6c 64 21             │ rld!
~> hexdump <1234

history

Show the current history.

Example
6517 (* 0) "/dev/null" ~> history
  0:   10982 (* 1) "Welcome to SIRTX"
  1: #  6517 (* 0) "/dev/null"

intro

Shows a small intro that is printed on login.

Example
~> intro
T: 86548 (* 1) "Welcome to SIRTX"
 ┌────────────────────────────────────────────────────────────────────────────┐
 │                              Welcome to SIRTX                              │
 │                                                                            │
…

lci

The line command interpreter.

Example
~> lci

listof

Creates a handle that contains a list of other handles.

Example
~> listof &ac "abc" '5 true

more

Filter output for page wise viewing.

Example
~> context -stdout=(more)&stdout
 Context: 0x00007ffd2fd33430
  |- Session: 0x00007ffd2fd35110
  |   |- done: false
  |   |- term: (0x0000563be2b6b2d0) <none>
  |   |- local IDs: 1 used
  |   |  |-  0: 86548 (* 0) "Welcome to SIRTX"
  |   |- history: 1 fill
  |   |  |-  0: # 86548 (* 0) "Welcome to SIRTX"
  |- Call to: 86509 (* 1) "context"
  |- Ports: 2 total, 0 free, writeable: true
  |   |-  0: <none>                          = (0x00007f5b00c631ed/v)     0/f/86509 (* 1) "context"
  |   |-  1: 21339 (* 2) "standard output"   = (0x0000563be2b6b420/R)     0/f/<none>
--space for more, q for quit, f for flush--

nton

Converts between different number formats.

Example
~> echo (nton)"1234"
1234

outro

Similar to intro, displays a message when the user logs out.

Example
~> outro
END OF LINE.

pause

Waits for the user to press a key.

Example
~> pause
Press any key to continue. . .

prompt

Displays or sets the prompt.

Example
~> prompt "$$ "
$ 

quit

Quits the current shell. If this is a login shell quits the session.

Example
~> quit

rem

Ignores all arguments. This can be used for comments.

Example
~> rem "Any comment"

render

Renders a tag as a page of a book. This can be used to show formatted and navigable pages to the user.

Example
~> render 1234

repeat

Creates a list that repeats a handle a number of times.

Example
~> dir (repeat '5)"Hello World!"
T: <none>
 Inode  Size    Tag
          12 "Hello World!"
          12 "Hello World!"
          12 "Hello World!"
          12 "Hello World!"
          12 "Hello World!"

rot13

Implements caesar cipher. Rotates the input by 13 letters (or a given value).

Example
~> echo "rot13:" (rot13)"Hello world!" "\nrot1:" (rot13 '1)"abc"
rot13: Uryyb jbeyq!
rot1: bcd

seek

Seeks in a handle.

Example
~> seek &ac '123

seq

Create a sequence of numbers.

Examples
~> dir (seq '3)[]
T: <none>
 Inode  Size    Tag
            1
            2
            3
~> dir (seq '5 '7)[]
T: <none>
 Inode  Size    Tag
            5
            6
            7

set

Sets a variable

Examples
~> set &ac @ctty
~> set &ac '5
~> set &ac []

shell

Starts a new shell on a different terminal.

Examples
~> shell com1
~> shell com1 -SHELL=myshell

show

Shows a tag from the database.

Examples
~> show 4213
T:  4213 (* 0) "lion"
   Relation                        Related/Type                    Data
   # Context                         Encoding
   ────────────────────────────────────────────────────────────────────
M:     1 (* 1) "also-shares-id..."     2 (* 2) "uuid"              '4b9fdbd5-0c6b-5e63-a927-22a853204a8b'
M:     1 (* 1) "also-shares-id..."     3 (* 3) "tagname"           'lion'
M:     1 (* 1) "also-shares-id..."     4 (* 4) "wikidata-ident..." 'Q140'
M:    34 (* 5) "tag-links"           131 (* 6) "gnd-identifier"    '4140572-9'
M:    34 (* 5) "tag-links"           139 (* 7) "factgrid-ident..." 'Q410026'
M:    34 (* 5) "tag-links"           144 (* 8) "aev-identifier"    'scot/9244'
M:  4583 (* 9) "Unicode charac..." <none>                          '🦁'
M: 11030 (*10) "generator-requ..." <none>                          'Q140 lion'
R:     9 (*11) "has-type"          <none>                            413 (*12) "Wikidata-item"
R:    34 (* 5) "tag-links"         <none>                           4212 (*13) "Lion"
R:    34 (* 5) "tag-links"         <none>                          11608 (*14) "lion"
R:  4580 (*15) "instance of"       <none>                           4895 "taxon"
R:  4587 "subclass of"             <none>                           4896 "big cat"
R: 11055 "generated-by"            <none>                          12419 "Wikidata-item-..."
~> show null
T:  6517 (* 0) "/dev/null"
   Relation                        Related/Type                    Data
   # Context                         Encoding
   ────────────────────────────────────────────────────────────────────
M:     1 (* 1) "also-shares-id..."     2 (* 2) "uuid"              '44c76593-2d72-57bc-b3f9-a85a0c75832b'
M:     1 (* 1) "also-shares-id..."     3 (* 3) "tagname"           '/dev/null'
M:     1 (* 1) "also-shares-id..."     4 (* 4) "wikidata-ident..." 'Q14671'
M:     1 (* 1) "also-shares-id..." 10981 (* 5) "sirtx-logical"     'null'
R:  4580 (* 6) "instance of"       <none>                           6518 (* 7) "device file"
R:  4580 (* 6) "instance of"       <none>                           6519 (* 8) "zero-byte file"

swap

Swaps to variables

Example
~> swap &stdout &ac

tell

Reports the current position of a handle. If no output is given the result is printed. Note that the result might not be a number.

Examples
~> tell &aci
Offset: 2
~> echo (tell)&ac
2

term

Creates a new terminal abstraction layer. The abstraction layer is used to provide support for terminal specific calls on character devices.

Normally this is done automatically. However, setting options on the user's terminal may improve the user experience.

Example
~> debug
...
Term:
 UTF-8:  21104 (*13) "true"
 ANSI:   21104 (*13) "true"
 Charset:86588 (*14) "UTF-8"
 Rows:   64
 Cols:   235
 Colour: 86605 (*15) "8-bit"
...

terminfo

Reports settings of a terminal (the standard output by default).

Example
~> terminfo
Size:           178 x 59
Flags:          UTF-8 [X]   ANSI [X]   DEC SG [X]   Safe [ ]   Interactive [X]
Character set:    319 (* 3) "UTF-8"
Colour mode:     3646 (* 4) "8-bit"

termtest

Reports settings of a terminal (the standard output by default).

Example
~> terminfo
Lines:
 ┌────────────────────────────────────────────────────────────────────────────┐
 ├────────────────────────────────────────────────────────────────────────────┤
 └────────────────────────────────────────────────────────────────────────────┘
 ──────────────────────────────────────────────────────────────────────────────
Attributes:
   561 (* 1) "italic"             │ unset ### │ set ###
   562 (* 2) "bold"               │ unset ### │ set ###
   563 (* 3) "underline"          │ unset ### │ set ###
   564 (* 4) "strike-through"     │ unset ### │ set ###
   565 (* 5) "dim"                │ unset ### │ set ###
Colours:
   329 (* 6) "black"              │ unset ### │ foreground ###background ###
   330 (* 7) "white"              │ unset ### │ foreground ###background ###
   331 (* 8) "red"                │ unset ### │ foreground ###background ###
   332 (* 9) "green"              │ unset ### │ foreground ###background ###
   333 (*10) "blue"               │ unset ### │ foreground ###background ###
   334 (*11) "cyan"               │ unset ### │ foreground ###background ###
   335 (*12) "magenta"            │ unset ### │ foreground ###background ###
   336 (*13) "yellow"             │ unset ### │ foreground ###background ###
   337 (*14) "grey"               │ unset ### │ foreground ###background ###
   338 (*15) "orange"             │ unset ### │ foreground ###background ###
   339 "savannah"                 │ unset ### │ foreground ###background ###
                        

transfer

Used to transfer a tag to another. The target must have the driver in online state. Then performing character transfers this is similar to echo, however no new line character is added.

Examples
~> transfer true @gpio27
~> transfer "a=b" @driver15_settings
~> transfer "Hello World!" >1234

webterm

Driver for webterm based terminals. Normally the user will not need to start this manually.

Example
~> 
8391 (* 0) "Line command interpreter" ~>