]> ocean-lang.org Git - ocean-D/blob - Ocean-IO
updates
[ocean-D] / Ocean-IO
1 file io
2
3 File io will use methods on a file object.  some are obvious like
4 binary read/write once we have records and text once we have string buffers.
5
6 An interesting aspect is sprintf functionality, which isn't necessarily
7 file related at all.
8
9 In C the format provides
10  - min width and alignment
11  - precision aka max width of some part
12  - data type: int long pointer float etc
13  - conversion style: caps base padchar
14
15 some of these can come from numeric args.
16
17 In ocean there is a conversion interface that accepts width, precision and
18 style. Only things with  this interface can be formatted.
19 Interface can be called directly. It returns a string with same interface
20 Format string can contain same info and method will be called on each
21 arg as appropriate.
22 So a value can be formatted twice, once by explicit call to method once
23 by implicit.
24
25 function can register a compile-time handler to verify the format string
26
27 Everything from % to a space is processed.
28  - leading - means left justify
29  - 0 means 0 pad
30  - N means min width
31  - .M means precision
32  - $P means which arg
33  - remainder is style