Skip to content

Commit 8ae4eaf

Browse files
committed
Fix inconsistent indentation (buildhelper)
1 parent 28f8de9 commit 8ae4eaf

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

cmd/buildhelper.um

+51-51
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
import (
2-
"std.um"
2+
"std.um"
33
)
44

55
fn peekstr(f: std.File, next: int): str {
6-
tr := ""
7-
var c: char
8-
for i:=0; i < next; i++ {
9-
fscanf(f, "%c", &c)
10-
tr += str(c)
11-
}
12-
13-
return tr
6+
tr := ""
7+
var c: char
8+
for i:=0; i < next; i++ {
9+
fscanf(f, "%c", &c)
10+
tr += str(c)
11+
}
12+
13+
return tr
1414
}
1515

1616
fn peekn(f: std.File, next: int): int {
17-
tr := 0
18-
var c: char
19-
for i:=0; i < next; i++ {
20-
fscanf(f, "%c", &c)
21-
ic := int(c)
22-
if ic < 0 { ic += 256 }
23-
tr += ic << (8 * (next - i - 1))
24-
}
25-
26-
return tr
17+
tr := 0
18+
var c: char
19+
for i:=0; i < next; i++ {
20+
fscanf(f, "%c", &c)
21+
ic := int(c)
22+
if ic < 0 { ic += 256 }
23+
tr += ic << (8 * (next - i - 1))
24+
}
25+
26+
return tr
2727
}
2828

2929
fn loadFF*(path: str): ([]uint32, int, int, int) {
30-
f, err := std.fopen(path, "r")
30+
f, err := std.fopen(path, "r")
3131
std.exitif(err)
32-
if f == null { return []uint32{}, -1, -1, 1 }
33-
var w, h: int
34-
var tr: []uint32
35-
36-
if val := peekstr(f, 8); val != "farbfeld" { return []uint32{}, -1, -1, 2 }
37-
w = peekn(f, 4)
38-
h = peekn(f, 4)
39-
tr = make([]uint32, w * h)
40-
var c: char
41-
for j:=0; j < w * h; j++ {
42-
for h:=0; h < 4; h++ {
43-
fscanf(f, "%c", &c)
44-
fscanf(f, "%c", &c)
45-
ic := int(c)
46-
if ic < 0 { ic += 256 }
47-
tr[j] += ic << (8 * (3 - h))
48-
}
49-
}
50-
51-
std.fclose(f)
52-
return tr, w, h, 0
32+
if f == null { return []uint32{}, -1, -1, 1 }
33+
var w, h: int
34+
var tr: []uint32
35+
36+
if val := peekstr(f, 8); val != "farbfeld" { return []uint32{}, -1, -1, 2 }
37+
w = peekn(f, 4)
38+
h = peekn(f, 4)
39+
tr = make([]uint32, w * h)
40+
var c: char
41+
for j:=0; j < w * h; j++ {
42+
for h:=0; h < 4; h++ {
43+
fscanf(f, "%c", &c)
44+
fscanf(f, "%c", &c)
45+
ic := int(c)
46+
if ic < 0 { ic += 256 }
47+
tr[j] += ic << (8 * (3 - h))
48+
}
49+
}
50+
51+
std.fclose(f)
52+
return tr, w, h, 0
5353
}
5454

5555
fn readall(f: std.File): str {
56-
const blockSize = 16
57-
res := ""
56+
const blockSize = 16
57+
res := ""
5858

59-
for ok := true; ok {
60-
var buff: [blockSize + 1]char
61-
ok = std.fread(f, ^[blockSize]char(&buff)).item1.code == 0
62-
res += str([]char(buff))
63-
}
59+
for ok := true; ok {
60+
var buff: [blockSize + 1]char
61+
ok = std.fread(f, ^[blockSize]char(&buff)).item1.code == 0
62+
res += str([]char(buff))
63+
}
6464

65-
return res
65+
return res
6666
}
6767

6868
fn chcnt(chars: str, c: str): bool {
@@ -105,15 +105,15 @@ fn main() {
105105
// embeds contents of a file as a string. TODO just as bytes
106106
if mode == "em" {
107107
printf("const char *%s[] = {\n", std.argv(2))
108-
108+
109109
for i:=3; i < std.argc(); i++ {
110110
f, err := std.fopen(std.argv(i), "r")
111111
std.exitif(err)
112112
data := readall(f)
113113
printf("%s\n", strtoc(data)+",")
114114
std.fclose(f)
115115
}
116-
116+
117117
printf("};\n")
118118
// creates a string array with args as values
119119
} else if mode == "argarr" {

0 commit comments

Comments
 (0)