print (format, *)|
Write text to the standard output. Return the number of bytes transmitted or a negative value if an error was encountered when writing the output.|
fprint (fd, *)|
Write to the fd file descriptor. Return the number of bytes transmitted or a negative value, if an error was encountered when writing the output.|
sprint (format, *)|
Format text into a string and return the string. Returns the formatted string.|
Each of these functions converts, formats, and prints its trailing arguments under control of a format string. The format contains two types of objects:
Plain characters are simply copied to the output stream.|
Each conversion results in fetching of zero or more arguments.|
The Limbo compiler recognizes calls to these functions and checks that the arguments match the format specifications in number and type.
The numeric verbs d and x format their int arguments in decimal and hexadecimal, respectively. Address values of lists, arrays, etc. can also be printed|
Each verb interprets the flags # and - to mean alternate format and left justified and the flag b is used to allow big's to be printed.
If f2 is not omitted, the number is padded on the left with zeros until at least f2 digits appear. If alternate format is specified for x conversion, the number is preceded by 16r. Finally, if f1 is not omitted, the number is padded on the left (or right, if left justification is specified) with enough blanks to make the field at least f1 characters long.
e, f, g|
The floating point verbs e, f, and g take a real argument. |
Each interprets the flags +, -, and # to mean always print a sign, left justified, and alternate format.
The e conversion appends an exponent e[-]digits.
The f verb produces output of the form [-]digits [.digits].
The g verb will output the argument in either e or f with the goal of producing the smallest output. Also, trailing zeros are omitted from the fraction part of the output, and a trailing decimal point appears only if it is followed by a digit. When alternate format is specified, the result will always contain a decimal point, and for g conversions, trailing zeros are not removed.
The f1 flag is the minimum field width and, if the converted value takes up less than f1 characters, it is padded on the left (or right, if 'left justified') with spaces.
The f2 flag is the number of digits that are converted after the decimal place for e and f conversions, and f2 is the maximum number of significant digits for g conversions.
The c verb copies a single character (integer) argument justified within a field of f1 characters as described above.|
The r verb takes no arguments. It prints the error string associated with the most recent system error.|
The s verb copies a string to the output. The number of characters copied (n) is the minimum of the size of the string and f2. These n characters are justified within a field of f1 characters as described above.|
The u verb treats the argument as unsigned.|
The % verb is used for printing a literal.|
The E verb is the same as e, but specify exponent using E rather than e.|
The G verb is the same as g , but specify exponent using E rather than e.|
The X verb is the same as x, but print hex digits in upper-case (and print 0X rather than 0x if # flag present).|
init: fn(ctxt: ref Draw->Context, argv: list of string);
init(ctxt: ref Draw->Context, argv: list of string)
sys = load Sys sys->PATH;
i : int = 16rab9cd;
r : real = 0.00000345;
i = -1;
Output longer than 256 bytes is truncated.
Limbo System Module and open, create - open/create a file for reading or writing