MiKTeX 26.5-next
A scalable TeX distribution
Loading...
Searching...
No Matches
MetafontMemoryHandlerImpl.h
Go to the documentation of this file.
1
13
14#pragma once
15
16#include <miktex/TeXAndFriends/config.h>
17
19
20MIKTEX_TEXMF_BEGIN_NAMESPACE;
21
22namespace mfapp {
23#include <miktex/mfapp.defaults.h>
24}
25
26template<class PROGRAM_CLASS> class MetafontMemoryHandlerImpl :
27 public TeXMFMemoryHandlerImpl<PROGRAM_CLASS>
28{
29
30public:
31
32 MetafontMemoryHandlerImpl(PROGRAM_CLASS& program, TeXMFApp& texmfapp) :
33 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>(program, texmfapp)
34 {
35 }
36
37 void Allocate(const std::unordered_map<std::string, int>& userParams) override
38 {
39 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Allocate(userParams);
40
41 this->program.bistacksize = this->GetCheckedParameter("bistack_size", this->program.infbistacksize, this->program.supbistacksize, userParams, mfapp::mfapp::bistack_size());
42 this->program.ligtablesize = this->GetCheckedParameter("lig_table_size", this->program.infligtablesize, this->program.supligtablesize, userParams, mfapp::mfapp::lig_table_size());
43 this->program.pathsize = this->GetCheckedParameter("path_size", this->program.infpathsize, this->program.suppathsize, userParams, mfapp::mfapp::path_size());
44
45 this->AllocateArray("bisectstack", this->program.bisectstack, this->program.bistacksize);
46 this->AllocateArray("delta", this->program.delta, this->program.pathsize);
47 this->AllocateArray("deltax", this->program.deltax, this->program.pathsize);
48 this->AllocateArray("deltay", this->program.deltay, this->program.pathsize);
49 this->AllocateArray("ligkern", this->program.ligkern, this->program.ligtablesize);
50 this->AllocateArray("psi", this->program.psi, this->program.pathsize);
51 this->AllocateArray("strref", this->program.strref, this->program.maxstrings);
52 this->AllocateArray("theta", this->program.theta, this->program.pathsize);
53 this->AllocateArray("uu", this->program.uu, this->program.pathsize);
54 this->AllocateArray("vv", this->program.vv, this->program.pathsize);
55 this->AllocateArray("ww", this->program.ww, this->program.pathsize);
56
57#if defined(TRAPMF)
58 this->AllocateArray("free", this->program.c4p_free, this->program.memmax);
59 this->AllocateArray("wasfree", this->program.wasfree, this->program.memmax);
60#endif
61 }
62
63 void Free() override
64 {
65 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Free();
66 this->FreeArray("bisectstack", this->program.bisectstack);
67 this->FreeArray("delta", this->program.delta);
68 this->FreeArray("deltax", this->program.deltax);
69 this->FreeArray("deltay", this->program.deltay);
70 this->FreeArray("ligkern", this->program.ligkern);
71 this->FreeArray("psi", this->program.psi);
72 this->FreeArray("strref", this->program.strref);
73 this->FreeArray("theta", this->program.theta);
74 this->FreeArray("uu", this->program.uu);
75 this->FreeArray("vv", this->program.vv);
76 this->FreeArray("ww", this->program.ww);
77#if defined(TRAPMF)
78 this->FreeArray("c4p_free", this->program.c4p_free);
79 this->FreeArray("wasfree", this->program.wasfree);
80#endif
81 }
82
83 void Check() override
84 {
85 TeXMFMemoryHandlerImpl<PROGRAM_CLASS>::Check();
86 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.bisectstack);
87 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.delta);
88 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.deltax);
89 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.deltay);
90 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.ligkern);
91 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.psi);
92 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.strref);
93 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.theta);
94 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.uu);
95 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.vv);
96 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.ww);
97#if defined(TRAPMF)
98 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.c4p_free);
99 MIKTEX_ASSERT_VALID_HEAP_POINTER_OR_NIL(this->program.wasfree);
100#endif
101 }
102};
103
104MIKTEX_TEXMF_END_NAMESPACE;
MiKTeX TeXMF memory handler implementation.
Definition TeXMFApp.h:75