/*
    Official Module `std.io`
    Library/std/io/io.fig

    Copyright © 2025 PuqiAR. All rights reserved.
*/

import _builtins;
import noSpace; // sub module `no space print`

import std.formater; // format

// outputs

public func print(objects...) -> Int
{
    var length := objects.length();
    for var i:=0; i < length; i += 1
    {
        if i > 0
        {
            __fstdout_print(" ");
        }
        __fstdout_print(objects[i]);
    }
    return length;
}

public func println(objects...) -> Int
{
    var length := objects.length();
    for var i:=0; i < length; i += 1
    {
        if i > 0
        {
            __fstdout_print(" ");
        }
        __fstdout_print(objects[i]);
    }
    __fstdout_print("\n");
    return length + 1;
}

public func printf(objects...) -> Any
{
    var result := formater.formatByListArgs(objects);
    __fstdout_print(result);
}

// inputs

public func read() -> String
{
    return __fstdin_read();
}

public func readln() -> String
{
    return __fstdin_readln();
}
