|
9 | 9 | #include "tectonic_bridge_core.h" |
10 | 10 | #include "xetex_bindings.h" |
11 | 11 |
|
12 | | -/* |
13 | | -void |
14 | | -sprint_cs(int32_t p) |
15 | | -{ |
16 | | - if (p < HASH_BASE) { |
17 | | - if (p < SINGLE_BASE) |
18 | | - print_char(p - 1); |
19 | | - else if (p < NULL_CS) |
20 | | - print_esc(p - SINGLE_BASE); |
21 | | - else { |
22 | | - print_esc_cstr("csname"); |
23 | | - print_esc_cstr("endcsname"); |
24 | | - } |
25 | | - } else if (p >= PRIM_EQTB_BASE && p < FROZEN_NULL_FONT) { |
26 | | - print_esc(prim(p - PRIM_EQTB_BASE).s1 - 1); |
27 | | - } else { |
28 | | - print_esc(hash(p).s1); |
29 | | - } |
30 | | -} |
31 | | -*/ |
32 | | - |
33 | | -void |
34 | | -print_file_name(int32_t n, int32_t a, int32_t e) |
35 | | -{ |
36 | | - bool must_quote = false; |
37 | | - int32_t quote_char = 0; |
38 | | - pool_pointer j; |
39 | | - |
40 | | - if (a != 0) { |
41 | | - j = str_start((a) - 0x10000); |
42 | | - while (((!must_quote) || (quote_char == 0)) && (j < str_start((a + 1) - 0x10000))) { |
43 | | - if (str_pool(j) == ' ' ) |
44 | | - must_quote = true; |
45 | | - else if ((str_pool(j) == '"' ) || (str_pool(j) == '\'' )) { |
46 | | - must_quote = true; |
47 | | - quote_char = 73 /*""" 39 */ - str_pool(j); |
48 | | - } |
49 | | - j++; |
50 | | - } |
51 | | - } |
52 | | - |
53 | | - if (n != 0) { |
54 | | - j = str_start((n) - 0x10000); |
55 | | - while (((!must_quote) || (quote_char == 0)) && (j < str_start((n + 1) - 0x10000))) { |
56 | | - if (str_pool(j) == ' ' ) |
57 | | - must_quote = true; |
58 | | - else if ((str_pool(j) == '"' ) || (str_pool(j) == '\'' )) { |
59 | | - must_quote = true; |
60 | | - quote_char = 73 /*""" 39 */ - str_pool(j); |
61 | | - } |
62 | | - j++; |
63 | | - } |
64 | | - } |
65 | | - |
66 | | - if (e != 0) { |
67 | | - j = str_start((e) - 0x10000); |
68 | | - while (((!must_quote) || (quote_char == 0)) && (j < str_start((e + 1) - 0x10000))) { |
69 | | - if (str_pool(j) == ' ' ) |
70 | | - must_quote = true; |
71 | | - else if ((str_pool(j) == '"' ) || (str_pool(j) == '\'' )) { |
72 | | - must_quote = true; |
73 | | - quote_char = 73 /*""" 39 */ - str_pool(j); |
74 | | - } |
75 | | - j++; |
76 | | - } |
77 | | - } |
78 | | - |
79 | | - if (must_quote) { |
80 | | - if (quote_char == 0) |
81 | | - quote_char = '"' ; |
82 | | - print_char(quote_char); |
83 | | - } |
84 | | - |
85 | | - if (a != 0) { |
86 | | - register int32_t for_end; |
87 | | - j = str_start((a) - 0x10000); |
88 | | - for_end = str_start((a + 1) - 0x10000) - 1; |
89 | | - if (j <= for_end) |
90 | | - do { |
91 | | - if (str_pool(j) == quote_char) { |
92 | | - print(quote_char); |
93 | | - quote_char = 73 /*""" 39 */ - quote_char; |
94 | | - print(quote_char); |
95 | | - } |
96 | | - print(str_pool(j)); |
97 | | - } |
98 | | - while (j++ < for_end); |
99 | | - } |
100 | | - |
101 | | - if (n != 0) { |
102 | | - register int32_t for_end; |
103 | | - j = str_start((n) - 0x10000); |
104 | | - for_end = str_start((n + 1) - 0x10000) - 1; |
105 | | - if (j <= for_end) |
106 | | - do { |
107 | | - if (str_pool(j) == quote_char) { |
108 | | - print(quote_char); |
109 | | - quote_char = 73 /*""" 39 */ - quote_char; |
110 | | - print(quote_char); |
111 | | - } |
112 | | - print(str_pool(j)); |
113 | | - } |
114 | | - while (j++ < for_end); |
115 | | - } |
116 | | - |
117 | | - if (e != 0) { |
118 | | - register int32_t for_end; |
119 | | - j = str_start((e) - 0x10000); |
120 | | - for_end = str_start((e + 1) - 0x10000) - 1; |
121 | | - if (j <= for_end) |
122 | | - do { |
123 | | - if (str_pool(j) == quote_char) { |
124 | | - print(quote_char); |
125 | | - quote_char = 73 /*""" 39 */ - quote_char; |
126 | | - print(quote_char); |
127 | | - } |
128 | | - print(str_pool(j)); |
129 | | - } |
130 | | - while (j++ < for_end); |
131 | | - } |
132 | | - |
133 | | - if (quote_char != 0) |
134 | | - print_char(quote_char); |
135 | | -} |
136 | | - |
137 | | - |
138 | 12 | void |
139 | 13 | print_size(int32_t s) |
140 | 14 | { |
|
0 commit comments