27template<
class PROGRAM_CLASS>
class TeXMemoryHandlerImpl :
28 public TeXMFMemoryHandlerImpl<PROGRAM_CLASS>
33 TeXMemoryHandlerImpl(PROGRAM_CLASS& program,
TeXMFApp& texmfapp) :
34 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>(program, texmfapp)
38 void Allocate(
const std::unordered_map<std::string, int>& userParams)
override
40 this->program.membot = this->GetParameter(
"mem_bot", userParams, 0);
42 if (this->program.membot < 0 || this->program.membot > 1)
44 MIKTEX_FATAL_ERROR(MIKTEXTEXT(
"mem_bot must be 0 or 1."));
47 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Allocate(userParams);
49 this->program.maxinopen = this->GetCheckedParameter(
"max_in_open", this->program.infmaxinopen, this->program.supmaxinopen, userParams, texapp::texapp::max_in_open());
50 this->program.nestsize = this->GetCheckedParameter(
"nest_size", this->program.infnestsize, this->program.supnestsize, userParams, texapp::texapp::nest_size());
51 this->program.savesize = this->GetCheckedParameter(
"save_size", this->program.infsavesize, this->program.supsavesize, userParams, texapp::texapp::save_size());
52 this->program.triesize = this->GetCheckedParameter(
"trie_size", this->program.inftriesize, this->program.suptriesize, userParams, texapp::texapp::trie_size());
54 this->program.expanddepth = this->GetCheckedParameter(
"expand_depth", this->program.infexpanddepth, this->program.supexpanddepth, userParams, texapp::texapp::expand_depth());
56 this->program.hashextra = this->GetParameter(
"hash_extra", userParams, texapp::texapp::hash_extra());
58 this->AllocateArray(
"sourcefilenamestack", this->program.sourcefilenamestack, this->program.maxinopen);
59 this->AllocateArray(
"linestack", this->program.linestack, this->program.maxinopen);
60 this->AllocateArray(
"fullsourcefilenamestack", this->program.fullsourcefilenamestack, this->program.maxinopen);
61 this->AllocateArray(
"inputfile", this->program.inputfile, this->program.maxinopen);
62 this->AllocateArray(
"nest", this->program.nest, this->program.nestsize + 1);
63 this->AllocateArray(
"savestack", this->program.savestack, this->program.savesize + 1);
64 this->AllocateArray(
"triehash", this->program.triehash, this->program.triesize + 1);
65 this->AllocateArray(
"triel", this->program.triel, this->program.triesize + 1);
66 this->AllocateArray(
"trieo", this->program.trieo, this->program.triesize + 1);
67 this->AllocateArray(
"trier", this->program.trier, this->program.triesize + 1);
68 this->AllocateArray(
"trietaken", this->program.trietaken, this->program.triesize);
70 this->program.hyphsize = this->GetCheckedParameter(
"hyph_size", this->program.infhyphsize, this->program.suphyphsize, userParams, texapp::texapp::hyph_size());
71 this->program.fontmax = this->GetParameter(
"font_max", userParams, texapp::texapp::font_max());
72 this->program.fontmemsize = this->GetCheckedParameter(
"font_mem_size", this->program.inffontmemsize, this->program.supfontmemsize, userParams, texapp::texapp::font_mem_size());
74 this->AllocateArray(
"trietrl", this->program.trietrl, this->program.triesize);
75 this->AllocateArray(
"trietro", this->program.trietro, this->program.triesize);
76 this->AllocateArray(
"trietrc", this->program.trietrc, this->program.triesize);
78 this->AllocateArray(
"hyphword", this->program.hyphword, this->program.hyphsize);
79 this->AllocateArray(
"hyphlist", this->program.hyphlist, this->program.hyphsize);
80 this->AllocateArray(
"hyphlink", this->program.hyphlink, this->program.hyphsize);
82 this->AllocateArray(
"bcharlabel", this->program.bcharlabel, this->program.fontmax - this->program.constfontbase);
83 this->AllocateArray(
"charbase", this->program.charbase, this->program.fontmax - this->program.constfontbase);
84 this->AllocateArray(
"depthbase", this->program.depthbase, this->program.fontmax - this->program.constfontbase);
85 this->AllocateArray(
"extenbase", this->program.extenbase, this->program.fontmax - this->program.constfontbase);
86 this->AllocateArray(
"fontarea", this->program.fontarea, this->program.fontmax - this->program.constfontbase);
87 this->AllocateArray(
"fontbc", this->program.fontbc, this->program.fontmax - this->program.constfontbase);
88 this->AllocateArray(
"fontbchar", this->program.fontbchar, this->program.fontmax - this->program.constfontbase);
89 this->AllocateArray(
"fontcheck", this->program.fontcheck, this->program.fontmax - this->program.constfontbase);
90 this->AllocateArray(
"fontdsize", this->program.fontdsize, this->program.fontmax - this->program.constfontbase);
91 this->AllocateArray(
"fontec", this->program.fontec, this->program.fontmax - this->program.constfontbase);
92 this->AllocateArray(
"fontfalsebchar", this->program.fontfalsebchar, this->program.fontmax - this->program.constfontbase);
93 this->AllocateArray(
"fontglue", this->program.fontglue, this->program.fontmax - this->program.constfontbase);
94 this->AllocateArray(
"fontname", this->program.fontname, this->program.fontmax - this->program.constfontbase);
95 this->AllocateArray(
"fontparams", this->program.fontparams, this->program.fontmax - this->program.constfontbase);
96 this->AllocateArray(
"fontsize", this->program.fontsize, this->program.fontmax - this->program.constfontbase);
97 this->AllocateArray(
"fontused", this->program.fontused, this->program.fontmax - this->program.constfontbase);
98 this->AllocateArray(
"heightbase", this->program.heightbase, this->program.fontmax - this->program.constfontbase);
99 this->AllocateArray(
"hyphenchar", this->program.hyphenchar, this->program.fontmax - this->program.constfontbase);
100 this->AllocateArray(
"italicbase", this->program.italicbase, this->program.fontmax - this->program.constfontbase);
101 this->AllocateArray(
"kernbase", this->program.kernbase, this->program.fontmax - this->program.constfontbase);
102 this->AllocateArray(
"ligkernbase", this->program.ligkernbase, this->program.fontmax - this->program.constfontbase);
103 this->AllocateArray(
"parambase", this->program.parambase, this->program.fontmax - this->program.constfontbase);
104 this->AllocateArray(
"skewchar", this->program.skewchar, this->program.fontmax - this->program.constfontbase);
105 this->AllocateArray(
"triec", this->program.triec, this->program.triesize);
106 this->AllocateArray(
"widthbase", this->program.widthbase, this->program.fontmax - this->program.constfontbase);
108 if (this->texmfapp.IsInitProgram())
111 this->program.yhash =
nullptr;
112 this->program.zeqtb =
nullptr;
115 if (this->texmfapp.IsInitProgram() || !this->texmfapp.AmI(TeXEngine))
117 this->AllocateArray(
"fontinfo", this->program.fontinfo, this->program.fontmemsize);
123 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Free();
125 this->FreeArray(
"linestack", this->program.linestack);
126 this->FreeArray(
"inputfile", this->program.inputfile);
127 this->FreeArray(
"fullsourcefilenamestack", this->program.fullsourcefilenamestack);
128 this->FreeArray(
"sourcefilenamestack", this->program.sourcefilenamestack);
129 this->FreeArray(
"nest", this->program.nest);
130 this->FreeArray(
"savestack", this->program.savestack);
131 this->FreeArray(
"triec", this->program.triec);
132 this->FreeArray(
"triehash", this->program.triehash);
133 this->FreeArray(
"triel", this->program.triel);
134 this->FreeArray(
"trieo", this->program.trieo);
135 this->FreeArray(
"trier", this->program.trier);
136 this->FreeArray(
"trietaken", this->program.trietaken);
138 this->FreeArray(
"hyphword", this->program.hyphword);
139 this->FreeArray(
"hyphlist", this->program.hyphlist);
140 this->FreeArray(
"hyphlink", this->program.hyphlink);
142 this->FreeArray(
"trietrl", this->program.trietrl);
143 this->FreeArray(
"trietro", this->program.trietro);
144 this->FreeArray(
"trietrc", this->program.trietrc);
146 this->FreeArray(
"bcharlabel", this->program.bcharlabel);
147 this->FreeArray(
"charbase", this->program.charbase);
148 this->FreeArray(
"depthbase", this->program.depthbase);
149 this->FreeArray(
"extenbase", this->program.extenbase);
150 this->FreeArray(
"fontarea", this->program.fontarea);
151 this->FreeArray(
"fontbc", this->program.fontbc);
152 this->FreeArray(
"fontbchar", this->program.fontbchar);
153 this->FreeArray(
"fontcheck", this->program.fontcheck);
154 this->FreeArray(
"fontdsize", this->program.fontdsize);
155 this->FreeArray(
"fontec", this->program.fontec);
156 this->FreeArray(
"fontfalsebchar", this->program.fontfalsebchar);
157 this->FreeArray(
"fontglue", this->program.fontglue);
158 this->FreeArray(
"fontinfo", this->program.fontinfo);
159 this->FreeArray(
"fontname", this->program.fontname);
160 this->FreeArray(
"fontparams", this->program.fontparams);
161 this->FreeArray(
"fontsize", this->program.fontsize);
162 this->FreeArray(
"fontused", this->program.fontused);
163 this->FreeArray(
"heightbase", this->program.heightbase);
164 this->FreeArray(
"hyphenchar", this->program.hyphenchar);
165 this->FreeArray(
"italicbase", this->program.italicbase);
166 this->FreeArray(
"kernbase", this->program.kernbase);
167 this->FreeArray(
"ligkernbase", this->program.ligkernbase);
168 this->FreeArray(
"parambase", this->program.parambase);
169 this->FreeArray(
"skewchar", this->program.skewchar);
170 this->FreeArray(
"widthbase", this->program.widthbase);
173 void Check()
override
175 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Check();
177 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.linestack);
178 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.inputfile);
179 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fullsourcefilenamestack);
180 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.sourcefilenamestack);
181 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.nest);
182 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.savestack);
183 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.triec);
184 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.triehash);
185 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.triel);
186 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trieo);
187 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trier);
188 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trietaken);
190 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.hyphword);
191 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.hyphlist);
192 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.hyphlink);
194 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trietrl);
195 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trietro);
196 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.trietrc);
198 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.bcharlabel);
199 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.charbase);
200 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.depthbase);
201 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.extenbase);
202 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontarea);
203 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontbc);
204 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontbchar);
205 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontcheck);
206 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontdsize);
207 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontec);
208 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontfalsebchar);
209 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontglue);
210 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontinfo);
211 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontname);
212 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontparams);
213 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontsize);
214 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.fontused);
215 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.heightbase);
216 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.hyphenchar);
217 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.italicbase);
218 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.kernbase);
219 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.ligkernbase);
220 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.parambase);
221 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.skewchar);
222 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.widthbase);