1if not modules then modules = { } end modules ['luat-fio'] = {
2 version = 1.001,
3 comment = "companion to luat-lib.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9local format = string.format
10local concat = table.concat
11
12texconfig.kpse_init = false
13texconfig.shell_escape = 't'
14texconfig.max_print_line = 100000
15texconfig.max_in_open = 1000
16
17if not resolvers.initialized() then
18
19 resolvers.reset()
20
21
22
23
24
25 resolvers.load()
26
27
28 local findbinfile, loadbinfile = resolvers.findbinfile, resolvers.loadbinfile
29 local findtexfile, opentexfile = resolvers.findtexfile, resolvers.opentexfile
30
31 if callback then
32
33 local register = callbacks.register
34
35 local addsuffix = file.addsuffix
36 local join = file.join
37
38 local function findpk(font,dpi)
39 local dpi = dpi or 600
40
41 local name = addsuffix(font,"pk")
42
43 local temp = join(dpi,name)
44 local okay = findbinfile(temp,"pk")
45
46 if okay and okay ~= "" then
47 return okay
48 end
49
50 local temp = join(dpi..".dpi",name)
51 local okay = findbinfile(temp,"pk")
52
53 if okay and okay ~= "" then
54 return okay
55 end
56
57 local name = addsuffix(font,dpi.."pk")
58
59 local temp = name
60 local okay = findbinfile(temp,"pk")
61
62 if okay and okay ~= "" then
63 return okay
64 end
65
66 local temp = join(dpi..".dpi",name)
67 local okay = findbinfile(temp,"pk")
68
69 return okay or ""
70 end
71
72 resolvers.findpk = findpk
73
74
75
76 register('find_read_file' , function(id,name) return findtexfile(name) end, true)
77 register('open_read_file' , function( name) return opentexfile(name) end, true)
78
79 register('find_data_file' , function(name) return findbinfile(name,"tex") end, true)
80 register('open_data_file' , function(name) return opentexfile(name) end, true)
81
82 register('find_enc_file' , function(name) return findbinfile(name,"enc") end, true)
83 register('find_font_file' , function(name) return findbinfile(name,"tfm") end, true)
84
85 register('find_image_file' , function(name) return findbinfile(name,"tex") end, true)
86 register('find_map_file' , function(name) return findbinfile(name,"map") end, true)
87 register('find_opentype_file' , function(name) return findbinfile(name,"otf") end, true)
88 register('find_output_file' , function(name) return name end, true)
89 register('find_pk_file' , findpk, true)
90
91 register('find_truetype_file' , function(name) return findbinfile(name,"ttf") end, true)
92 register('find_type1_file' , function(name) return findbinfile(name,"pfb") end, true)
93 register('find_vf_file' , function(name) return findbinfile(name,"vf") end, true)
94 register('find_cidmap_file' , function(name) return findbinfile(name,"cidmap") end, true)
95
96 register('read_data_file' , function(file) return loadbinfile(file,"tex") end, true)
97 register('read_enc_file' , function(file) return loadbinfile(file,"enc") end, true)
98 register('read_font_file' , function(file) return loadbinfile(file,"tfm") end, true)
99
100
101 register('read_map_file' , function(file) return loadbinfile(file,"map") end, true)
102
103 register('read_pk_file' , function(file) return loadbinfile(file,"pk") end, true)
104
105 register('read_vf_file' , function(file) return loadbinfile(file,"vf" ) end, true)
106
107
108
109
110
111
112
113
114
115
116
117
118 register('find_write_file' , function(id,name) return name end, true)
119
120 register('find_log_file' , function(name) return name end, true)
121 register('find_format_file' , function(name) return name end, true)
122
123 end
124
125end
126
127statistics.register("resource resolver", function()
128 local scandata = resolvers.scandata()
129 return format("loadtime %s seconds, %s scans with scantime %s seconds, %s shared scans, %s found files, scanned paths: %s",
130 resolvers.loadtime(),
131 scandata.n,
132 scandata.time,
133 scandata.shared,
134 #resolvers.foundintrees(),
135 #scandata.paths > 0 and concat(scandata.paths," ") or "<none>"
136 )
137end)
138 |