public
/
Ack-5.5.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Pristine Ack-5.5
[Ack-5.5.git]
/
include
/
occam
/
printd.ocm
1
proc printd(chan out, value fmt[], d)=
2
-- Like fprintf(out, fmt, d), with only %d or %<width>d in fmt[]
3
4
def otherwise=true:
5
var i, len:
6
seq
7
len:=fmt[byte 0]
8
i:=1
9
10
while i<=len
11
if
12
fmt[byte i] = '%'
13
var w:
14
seq
15
i:=i+1
16
w:=0
17
while (i<=len) and ('0'<=fmt[byte i]) and (fmt[byte i]<='9')
18
seq
19
w:=(w*10)+(fmt[byte i]-'0')
20
i:=i+1
21
if
22
i<=len
23
var key:
24
seq
25
key:=fmt[byte i]
26
if
27
key='d'
28
decout(out, d, w)
29
otherwise
30
out ! key
31
i:=i+1
32
otherwise
33
seq
34
out ! fmt[byte i]
35
i:=i+1
36
: