49 |
try parse_format false 1 with Failure _ -> bad_format format 0 in |
try parse_format false 1 with Failure _ -> bad_format format 0 in |
50 |
if String.length s < p then begin |
if String.length s < p then begin |
51 |
let res = String.make p ' ' in |
let res = String.make p ' ' in |
52 |
if neg |
if neg |
53 |
then String.blit s 0 res 0 (String.length s) |
then String.blit s 0 res 0 (String.length s) |
54 |
else String.blit s 0 res (p - String.length s) (String.length s); |
else String.blit s 0 res (p - String.length s) (String.length s); |
55 |
res |
res |
91 |
rely on the fact that we'll get a "nul" character if we access |
rely on the fact that we'll get a "nul" character if we access |
92 |
one past the end of the string. These "nul" characters are then |
one past the end of the string. These "nul" characters are then |
93 |
caught by the [_ -> bad_format] clauses below. |
caught by the [_ -> bad_format] clauses below. |
94 |
Don't do this at home, kids. *) |
Don't do this at home, kids. *) |
95 |
|
|
96 |
let scan_format fmt pos cont_s cont_a cont_t = |
let scan_format fmt pos cont_s cont_a cont_t = |
97 |
let rec scan_flags widths i = |
let rec scan_flags widths i = |
163 |
| _ -> |
| _ -> |
164 |
bad_format fmt pos |
bad_format fmt pos |
165 |
in scan_flags [] (pos + 1) |
in scan_flags [] (pos + 1) |
166 |
|
|
167 |
let cprintf kont fmt = |
let cprintf kont fmt = |
168 |
let fmt = (Obj.magic fmt : string) in |
let fmt = (Obj.magic fmt : string) in |
169 |
let len = String.length fmt in |
let len = String.length fmt in |
222 |
ignore (Fifo.take lprintf_fifo) |
ignore (Fifo.take lprintf_fifo) |
223 |
else |
else |
224 |
incr lprintf_size; |
incr lprintf_size; |
225 |
Fifo.put lprintf_fifo s |
Fifo.put lprintf_fifo s |
226 |
) |
) |
227 |
|
|
228 |
let detach () = |
let detach () = |