// //------------------ DOK FILE -------------------------------------------------- +Header echoLib =pkg bios =title Output =short write text in the terminal =desc // // //------------------ PROTO ----------------------------------------------------- dump +Proto dump =type fun a1 -> a1 =mode keyword =pkg language =impl keyword =link =desc Contrary to [[echo]], this function displays a low-level representation of the element, including type. - echo 1 // write "1" on the output - dump 1 // write "-> Int: 1 (0x1)" on the output // +arg element =type a1 =desc Any element of any type // +arg result =type a1 =desc The same element // // //------------------ PROTO ----------------------------------------------------- hexDump +Proto hexDump =type fun Str -> Str =mode keyword =pkg language =impl keyword =link =desc This function prints the binary content of a string as the usual hexadecimal dump format. It relies on the [[echo]] function. It returns the string src itself, so that it is easy to insert it anywhere in the code for debugging. > hexDump "minimacy Top-level - Sylvain Huet - 2020\nReady" >00000000 6C 61 6D 62 64 61 73 69 63 20 54 6F 70 2D 6C 65 minimacy Top-le >00000010 76 65 6C 20 2D 20 53 79 6C 76 61 69 6E 20 48 75 vel - Sylvain Hu >00000020 65 74 20 2D 20 32 30 32 30 0A 52 65 61 64 79 et - 2020.Ready >-> Str: "minimacy Top-level - Sylvain Huet - 2020\\nReady" // +arg src =type Str =desc A string // +arg result =type Str =desc The same string // // //------------------ PROTO ----------------------------------------------------- hexDumpBytes +Proto hexDumpBytes =type fun Bytes -> Bytes =mode keyword =pkg language =impl keyword =link =desc This function is similar to [[hexDump]] and works on bytes instead of string. // // //------------------ PROTO ----------------------------------------------------- echo +Proto echo =type fun a1 -> a1 =mode keyword =pkg language =impl keyword =link =desc This function echoes the element. See [[strBuild]], as 'echo element' prints the same thing as 'echo strBuild element'. // +arg element =type a1 =desc Any element of any type // +arg result =type a1 =desc The same element // // //------------------ PROTO ----------------------------------------------------- echoEnable +Proto echoEnable =type fun Bool -> Bool =mode function =pkg bios =impl mcy =link =desc This function enables or disables the echo output. // +arg enable =type Bool =desc A boolean // +arg result =type Bool =desc The same boolean // // //------------------ PROTO ----------------------------------------------------- echoHexLn +Proto echoHexLn =type fun Str -> Str =mode keyword =pkg language =impl keyword =link =desc This function echoes the string src in hexadecimal followed by a carriage return. > echoHexLn "foobar" >666f6f626172 // +arg src =type Str =desc A string // +arg result =type Str =desc The same string // // //------------------ PROTO ----------------------------------------------------- echoLn +Proto echoLn =type fun a1 -> a1 =mode keyword =pkg language =impl keyword =link =desc This function echoes the element followed by a carriage return. See [[strBuild]], as 'echoLn element' prints the same thing as 'echoLn strBuild element'. // +arg element =type a1 =desc Any element of any type // +arg result =type a1 =desc The same element // // //------------------ PROTO ----------------------------------------------------- echoTime +Proto echoTime =type fun a1 -> a1 =mode keyword =pkg language =impl keyword =link =desc This function echoes the current execution time (in seconds), a colon, the element and a carriage return. > echoTime "foobar" >> 577.250: foobar The execution time is counted since the VM startup. // +arg element =type a1 =desc Any element of any type // +arg result =type a1 =desc The same element // // //------------------ PROTO ----------------------------------------------------- systemLogEnable +Proto systemLogEnable =type fun Bool -> Bool =mode function =pkg bios =impl mcy =link =desc This function enables or disables the console output of system messages. // +arg enable =type Bool =desc A boolean // +arg result =type Bool =desc The same boolean