MiKTeX 26.5-next
A scalable TeX distribution
Loading...
Searching...
No Matches
Emulation.h
Go to the documentation of this file.
1
16
18
19#pragma once
20
21#if !defined(AA9CDF05506A4A07827B1144C4755C06)
23#define AA9CDF05506A4A07827B1144C4755C06
25
26#if defined(__cplusplus)
27#else
28#include <miktex/Core/c/api.h>
29#endif
30#include <miktex/Definitions>
31#include <miktex/Core/Debug>
32#include <miktex/Core/IntegerTypes>
33#include <miktex/Version>
34#include <miktex/KPSE/Emulation>
35
36#include "pre.h"
37
38#if defined(__cplusplus)
39MIKTEX_WEB2C_BEGIN_NAMESPACE;
40
41MIKTEXW2CCEEAPI(char*) GetCurrentFileName();
42MIKTEXW2CCEEAPI(void) GetSecondsAndMicros(int* seconds, int* micros);
43MIKTEXW2CCEEAPI(int) RunSystemCommand(const char* cmd);
44
45MIKTEX_WEB2C_END_NAMESPACE;
46#endif
47
48
49/* _________________________________________________________________________
50 *
51 * c-auto.h
52 *
53 */
54
55#include "../../c-auto.h"
56
57 /* _________________________________________________________________________
58 *
59 * w2c/config.h
60 *
61 */
62
63#include "../../w2c/config.h"
64
65 /* _________________________________________________________________________
66 *
67 * lib/lib.h
68 *
69 */
70
71#include "../../lib/lib.h"
72
73 /* _________________________________________________________________________
74 *
75 * texmfmp.h
76 *
77 */
78
82
83#if defined(__cplusplus)
84inline char* generic_synctex_get_current_name()
85{
86 return MiKTeX::Web2C::GetCurrentFileName();
87}
88#endif
89
90#if defined(__cplusplus)
91inline int runsystem(const char* cmd)
92{
93 return MiKTeX::Web2C::RunSystemCommand(cmd);
94}
95#endif
96
97#if defined(__cplusplus)
98inline void secondsandmicros(integer& s, integer& m)
99{
100 MiKTeX::Web2C::GetSecondsAndMicros(&s, &m);
101}
102#endif
103
105
106/* _________________________________________________________________________
107 *
108 * cpascal.h
109 *
110 */
111
115
116#if defined(__cplusplus)
117template<class T> T* addressof(T& x)
118{
119 return &x;
120}
121#else
122#define addressof(x) (&(x))
123#endif
124
125#if defined(__cplusplus)
126template<class T> const char* conststringcast(T* s)
127{
128 MIKTEX_ASSERT(sizeof(s[0]) == sizeof(char));
129 return (const char*)s;
130}
131#endif
132
133#define decr(x) --(x)
134
135#define incr(x) ++(x)
136
137#define halfp(i) ((i) >> 1)
138
139#define ISDIRSEP IS_DIR_SEP
140
141#define libcfree free
142
143#define odd(x) ((x) & 1)
144
145#define round(x) miktex_zround((double) (x))
146
147#define xmallocarray(type, size) \
148 ((type*)xmalloc(((size) + 1) * sizeof(type)))
149
150#define xreallocarray(ptr, type, size) \
151 ((type*)xrealloc(ptr, ((size) + 1) * sizeof(type)))
152
153#if defined(__cplusplus)
154# define nil nullptr
155#else
156# define nil ((void*)0)
157#endif
158
159#define kpsevarvalue kpse_var_value
160
161#define kpseinitprog kpse_init_prog
162
163#define kpsesetprogramenabled kpse_set_program_enabled
164
165#define kpsepkformat kpse_pk_format
166
167#define kpsesrccmdline kpse_src_cmdline
168
169#define kpsemaketexdiscarderrors kpse_make_tex_discard_errors
170
171typedef double real;
172
173#define intcast(x) ((integer)(x))
174
175#define stringcast(x) ((char *) (x))
176
177#define ucharcast(x) ((unsigned char)(x))
178#define ustringcast(x) ((unsigned char *) (x))
179
180#if defined(MIKTEX_WINDOWS)
181# define promptfilenamehelpmsg "(Press Enter to retry, or Control-Z to exit"
182#else
183# define promptfilenamehelpmsg "(Press Enter to retry, or Control-D to exit"
184#endif
185
186#define vgetc(f) (void)getc(f)
187
188#define cinttype int
189
191
192/* _________________________________________________________________________ */
193
194#if defined(__cplusplus)
195MIKTEX_BEGIN_EXTERN_C_BLOCK
196#endif
197
198MIKTEXW2CCEEAPI(integer) miktex_zround(double r);
199
200MIKTEX_END_EXTERN_C_BLOCK
201
202#endif
203
Web2C emulation.
Web2C emulation.