Handbook
Glossary
build-zim ( zim-path -- )
Vocabulary
zim
.
builder
Inputs
zim-path
an
object
Outputs
None
Definition
USING:
accessors
alien.c-types
io.directories
io.encodings.string
io.encodings.utf8
io.files.info
io.files.types
kernel
math
math.statistics
mime.types
sequences
sets
sorting
zim
;
IN:
zim.builder
::
build-zim
( zim-path -- )
"."
recursive-directory-entries
[
type>>
+directory+
=
]
reject
[
name>>
]
map
sort
:>
paths paths
[
mime-type
]
map
:>
mime-types paths
[
utf8
encode
]
map
:>
urls paths
[
file-info
size>>
]
map
:>
sizes mime-types
members
sort
:>
mime-type-list
mime-type-list
length
65535
<
t
assert=
{
"index.htm"
"index.html"
"main.htm"
"main.html"
}
[
paths
index
]
map-find
drop
:>
main-page
zim-header
heap-size
:>
header-len
mime-type-list
[
utf8
encode
length
1
+
]
map-sum
1
+
:>
mime-type-len paths
length
8
*
:>
url-ptr-len paths
length
4
*
:>
title-ptr-len urls
[
length
18
+
]
map
:>
entry-len entry-len
cum-sum0
:>
entry-ptrs entry-len
sum
:>
entries-len sizes
binpack-clusters
:>
( bins blobs ) bins
[
[
paths
nth
]
map
cluster-files
]
map
:>
clusters clusters
length
8
*
:>
cluster-ptr-len clusters
[
length
]
map
:>
cluster-len cluster-len
cum-sum0
:>
cluster-ptrs
cluster-len
sum
:>
clusters-len header-len
dup
:>
mime-list-ptr-pos mime-type-len
+
dup
:>
url-ptr-pos url-ptr-len
+
dup
:>
title-ptr-pos title-ptr-len
+
~24 more~
;