-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathutils.m
58 lines (41 loc) · 1.51 KB
/
utils.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Utils: module
{
PATH: con "/dis/git/utils.dis";
QIDSZ: con 16;
BIGSZ: con 8;
INTSZ: con 4;
SHALEN: con 20;
INDEXPATH: con "index";
OBJECTSTOREPATH: con "objects";
CONFIGFILEPATH: con "config";
Config: adt
{
attr, val: string;
};
init: fn(repopath: string);
writesha1file: fn(ch: chan of (int, array of byte));
readsha1file: fn(path: string): (string, int, array of byte);
filesha1: fn (path: string): array of byte;
bufsha1: fn(buf: array of byte): array of byte;
int2string: fn(num: int): string;
save2file: fn(path: string, buf: array of byte): int;
string2path: fn(filename: string): string;
sha2string: fn(sha: array of byte): string;
exists: fn(shaname: string): int;
bytes2int: fn(buf: array of byte, offset: int): int;
bytes2big: fn(buf: array of byte, offset: int): big;
big2bytes: fn(n: big): array of byte;
int2bytes: fn(number: int): array of byte;
allocnr: fn(num: int): int;
copyarray: fn(dst: array of byte, doffset: int, src: array of byte, soffset, count : int);
equalqids: fn(q1,q2: Sys->Qid): int;
extractfile: fn(shafilename: string): string;
equalshas: fn(sha1, sha2: array of byte): int;
getuserinfo: fn():ref Strhash[ref Config];
chomp: fn(s: string): string;
readline: fn(ibuf: ref Iobuf): string;
fail: fn(s: string);
warn: fn(s: string);
isdir: fn(mode: int): int;
bytepos: fn(a: array of byte, offset: int, delim: byte): int;
};