slow.monster

STUDIO HAZE · image

Topaz source

Open by house policy. Topaz is our own language.

Topaz 5.9 · 42 files

topaz/src/plan.tpz

Topaz · 27988 B · Original file

1// Image request validation and page planning.
3import std.bytes { Bytes }
4import std.json
5import util { 작은값, 큰값 }
7export record 이미지배치 {
8 너비: int,
9 높이: int,
10 판행수: int,
11 판높이: int,
12 띠위: int,
13 띠행수: int,
14 꼬리높이: int
17export record 이미지쪽계획 {
18 쪽번호: int,
19 노드시작: int,
20 노드끝: int,
21 논리시작: int,
22 논리끝: int,
23 보호길이: int,
24 패리티길이: int,
25 배치: 이미지배치
28export record 이미지계획 {
29 쪽들: Array<이미지쪽계획>,
30 세트해시: string
33function 큰바이트로(입력: Array<int>) -> Result<Bytes, string> {
34 let 숫자들 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
35 let mut 결과 = Bytes.fromHex("")?
36 let mut 시작 = 0
37 while 시작 < 입력.length {
38 let 끝 = 작은값(시작 + 4096, 입력.length)
39 let mut 글 = ""
40 let mut 색인 = 시작
41 while 색인 < 끝 {
42 let 값 = 입력[색인]
43 if 값 < 0 || 값 > 255 { return Err("바이트 범위를 벗어났습니다") }
44 글 = 글 + 숫자들[값 / 16] + 숫자들[값 % 16]
45 색인 = 색인 + 1
46 }
47 결과 = Bytes.concat(결과, Bytes.fromHex(글)?)
48 시작 = 끝
49 }
50 Ok(결과)
53function 십육쓰기(출력: Array<int>, 값: int) -> Array<int> {
54 let mut 결과 = 출력
55 결과.push((값 / 256) % 256)
56 결과.push(값 % 256)
57 결과
60function 십육읽기(입력: Array<int>, 위치: int) -> int { 입력[위치] * 256 + 입력[위치 + 1] }
62function 작은십육쓰기(출력: Array<int>, 값: int) -> Array<int> {
63 let mut 결과 = 출력
64 결과.push(값 % 256)
65 결과.push((값 / 256) % 256)
66 결과
69function 작은삼십이쓰기(출력: Array<int>, 값: int) -> Array<int> {
70 let mut 결과 = 출력
71 결과.push(값 % 256)
72 결과.push((값 / 256) % 256)
73 결과.push((값 / 65536) % 256)
74 결과.push((값 / 16777216) % 256)
75 결과
78export function 이미지팔레트(언어번호: int) -> Array<int> {
79 if 언어번호 == 1 {
80 return [16170304, 15790315, 7324761, 3715756, 11888088, 6782698, 1581104, 15093571]
81 }
82 if 언어번호 == 2 {
83 return [1581104, 6782698, 11888088, 3715756, 16170304, 15790315, 15093571, 7324761]
84 }
85 if 언어번호 == 4 {
86 return [1388868, 44504, 16119280, 16764216, 5488253, 15558746, 9925846, 7375511]
87 }
88 if 언어번호 == 5 {
89 return [13852726, 15657436, 4680860, 14790209, 1974826, 6661724, 10250416, 12730695]
90 }
91 if 언어번호 == 6 {
92 return [2303786, 5472929, 16316658, 15359060, 16036864, 7384391, 9922485, 7964046]
93 }
94 if 언어번호 == 7 {
95 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
96 }
97 if 언어번호 == 8 {
98 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
99 }
100 if 언어번호 == 9 {
101 return [1840679, 6824314, 16052984, 4160191, 15445556, 6073197, 13390435, 8287371]
102 }
103 if 언어번호 == 10 {
104 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
105 }
106 if 언어번호 == 11 {
107 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
108 }
109 if 언어번호 == 12 {
110 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
111 }
112 if 언어번호 == 13 {
113 return [1579040, 8344319, 16053241, 16220518, 4364769, 6732650, 15489918, 7896206]
114 }
115 if 언어번호 == 14 {
116 return [1579040, 14430272, 16053241, 16220518, 4364769, 6732650, 15489918, 7896206]
117 }
118 if 언어번호 == 15 {
119 return [858922, 46296, 95682, 15923194, 4576767, 4635008, 16034608, 7898258]
120 }
121 if 언어번호 == 16 {
122 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
123 }
124 if 언어번호 == 17 {
125 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
126 }
127 if 언어번호 == 18 {
128 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
129 }
130 if 언어번호 == 19 {
131 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
132 }
133 if 언어번호 == 21 {
134 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
135 }
136 if 언어번호 == 20 {
137 return [2039856, 9787570, 4219864, 3708966, 13319219, 15921911, 16170569, 5987695]
138 }
139 if 언어번호 == 22 {
140 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
141 }
142 if 언어번호 == 23 {
143 return [1254195, 3762865, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
144 }
145 if 언어번호 == 24 {
146 return [1254195, 4224448, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
147 }
148 if 언어번호 == 25 {
149 return [1254195, 31487, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
150 }
151 if 언어번호 == 26 {
152 return [1254195, 8280002, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
153 }
154 if 언어번호 == 27 {
155 return [1254195, 3552822, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
156 }
157 if 언어번호 == 28 {
158 return [1254195, 16229405, 15658728, 16098851, 6076508, 14043722, 9725885, 6979469]
159 }
160 if 언어번호 == 29 {
161 return [1910324, 14437953, 16039490, 6863992, 3650220, 5276100, 7694533, 15526108]
162 }
163 if 언어번호 == 30 {
164 return [1712688, 13781309, 15708480, 6074737, 3450029, 4420542, 8281274, 15657176]
165 }
166 [3715756, 15790315, 6782698, 16170304, 1581104, 7324761, 11888088, 15093571]
169export function 형식팔레트() -> Array<int> { [2105376, 6710886, 11184810, 15790320] }
170export function 띠팔레트() -> Array<int> { [2306107, 6255723, 11636610, 14607308] }
172export function 이역할팔레트() -> Array<int> {
173 [0, 2763306, 4473924, 6052956, 7697781, 9539985, 11645361, 14013909, 16777215]
176export function 팔그물팔레트() -> Array<int> {
177 [15093571, 16170304, 7324761, 3715756, 5080774, 6782698, 11888088, 14245773, 9203014]
180export function 범위씻김팔레트() -> Array<int> { [14342095, 13488071, 12568512] }
182export function 프로필해시(언어번호: int) -> string {
183 if 언어번호 == 1 { return "1fa3f5b3b0d3422e39b0eb8807b6ee44da1b0545da5f8dd1560bd0e69dfc92cc" }
184 if 언어번호 == 2 { return "c5c215334bfc8d8803d771e997b05e6093179cfaa4ebc82de5f06e8d2f3de2a6" }
185 if 언어번호 == 3 { return "70df4222bcdd747d8d72e39333273174a3d9d6b4b402e54776000dd2e80bd85a" }
186 if 언어번호 == 4 { return "5f9de14502494593c178310efe921bc1863e52e606b49dc8f73ffba78eebc7df" }
187 if 언어번호 == 5 { return "83f96dda7e896274168b40288b730fbe3fab1ec79adfc5bd04ee4f350fb24de9" }
188 if 언어번호 == 6 { return "f3cab03da81a066a6f9a626f764730b7e578976a70b3db66999266f7cb3e6472" }
189 if 언어번호 == 7 { return "c2f63075652bc9bfba7e2a8597e06c76a99e087baa2c9e755d9cb9fdf923668b" }
190 if 언어번호 == 8 { return "284d950655b6be34129cb88357b1d10dc07e7b928684fa05c1f2230130fd478f" }
191 if 언어번호 == 10 { return "736b26bd60139cf3bba2b44702b86fe4c67c0fd10410f73adfbdf9027eb42784" }
192 if 언어번호 == 11 { return "d0427ff7f04d50b6ffd9e7582d16bdec2cd36e4e90feb9721b961992f66f0418" }
193 if 언어번호 == 12 { return "5325b5751c17bd1fc9bdc9bb838c437b89acd5ffbd120d233c657a5e2eb239a8" }
194 if 언어번호 == 13 { return "1d8b58fcce9849d9a5cdcde082a5bd0957c03f9e32d098299d3ab4ae0e1352fe" }
195 if 언어번호 == 14 { return "2493b61ddd30e1fe638cabfea5ad9aa129326c7ecae209b97e007a1052e921a2" }
196 if 언어번호 == 15 { return "ee39d7021081a8eb765fcf04f8f01910a1f41b58e51f4f04f8c8253c3f5cb6c8" }
197 if 언어번호 == 16 { return "26e8cc038ac235f7f21e54786c0986343008bfbdaf9b1f3c00ee5cc6879756d3" }
198 if 언어번호 == 17 { return "bd8ccddcb1e65e3706031bd6f8fc98ca3be8c1141a69be671de4c08000ba5949" }
199 if 언어번호 == 18 { return "0a75ea3fb381c217d95bd147272864dec1024878912d5f03bfd78bd6573f6618" }
200 if 언어번호 == 19 { return "58b0dc5f2a17b45972c92efe3988f495cb01265437e30f60a0f070f6e3f7526a" }
201 if 언어번호 == 21 { return "6d1e9b453a4472672dbb9c9ed9e1aca347fbe8ecdb3c099dfab079708dd91701" }
202 if 언어번호 == 20 { return "6c57d09598b0fd51922e39408fe1dbb559ae6b3f682e9ad2d153f70495cda276" }
203 if 언어번호 == 22 { return "c053682a4b8ba9993ab5ad08ec1fcb050f602608993b1301944bb0ec8c636d02" }
204 if 언어번호 == 23 { return "bc843caf58ef8228fe6e8bad3bea7be1dc02f0227020f39e7a528ff2b04602bd" }
205 if 언어번호 == 24 { return "640c89f30f547cf3ba1089ed373880780f3d0cac9efe9fb434711f8b46be7370" }
206 if 언어번호 == 25 { return "cd0148389b740b6c1d14121d3a1b2f2300c258e104a0d9c6ab0794beb0b85d39" }
207 if 언어번호 == 26 { return "35484caafa313594b3c05996e2955c1abbffaf365be10ce04045f384cb1ac83f" }
208 if 언어번호 == 27 { return "f6e4049cb0f313607167be8ccb18d929240dc62bd2cf5b53139584ede8451021" }
209 if 언어번호 == 28 { return "30a15ace395aaa68d6d0fc8537e5a742acb120e05b34e53c2d8ebf49415814ac" }
210 if 언어번호 == 29 { return "c5ea789d8298997b93578278b859ae859a745d2fe21eb5a7bd271fd5783d2824" }
211 if 언어번호 == 30 { return "ed0c51aea4f0f649eda47668c03e242e07f85ec8c2e920f3025d63a29870fdea" }
212 "ad04188529524dd09c81cf65d40a673d26de49369581e31787544b374ff209d8"
215export function 이미지프로필해시맞음(언어번호: int, 해시: string) -> bool {
216 if 언어번호 == 1 {
217 return 해시 == 프로필해시(언어번호) ||
218 해시 == "229be6c2ed935738c75c7458baa19c4cce0a7d1df8abdbb32cf82582175f11b2"
219 }
220 if 언어번호 == 2 {
221 return 해시 == 프로필해시(언어번호) ||
222 해시 == "3bbe416c28fbebf8d0845e5df32d055bab21be2e89d27fad1b87db207bc4bff7"
223 }
224 if 언어번호 == 3 {
225 return 해시 == 프로필해시(언어번호) ||
226 해시 == "0612e39566dbed4cfd14b833bf34e42c67ffebdff7c9950079cea4f2414b8121"
227 }
228 if 언어번호 == 4 {
229 return 해시 == 프로필해시(언어번호) ||
230 해시 == "2b5e642f239298736443a031e577654b6ea169067cd7ac9acb76e154bc714513"
231 }
232 if 언어번호 == 5 {
233 return 해시 == 프로필해시(언어번호) ||
234 해시 == "bfeb028a351670e31f1a5b3ee08362d9b48dd2a380fd811645d248e0e32792e9"
235 }
236 if 언어번호 == 6 {
237 return 해시 == 프로필해시(언어번호) ||
238 해시 == "691f972f1910f41ebad040a7df7e476caa7dc7804d0e3aeddb741b87bde81a7a"
239 }
240 if 언어번호 == 7 {
241 return 해시 == 프로필해시(언어번호) ||
242 해시 == "2c2a94174438fa58b4cd9d8410b9e920744fb7eb89683adee686ebe881113a70"
243 }
244 if 언어번호 == 8 {
245 return 해시 == 프로필해시(언어번호) ||
246 해시 == "f1c4d0173fa29dba8ed9de1be9078b1026c818e632b914e16416c4a7834fcf84"
247 }
248 if 언어번호 == 9 {
249 return 해시 == 프로필해시(언어번호) ||
250 해시 == "fc2d4f6d835c0eaab781d13047812e998f3416ad9b94b1470b78111b3a68e4e7"
251 }
252 if 언어번호 == 10 {
253 return 해시 == 프로필해시(언어번호) ||
254 해시 == "14b680b294d36fca30ba6c9d2a466c45afbc62de9fbc572fdad68b05bf95c502"
255 }
256 if 언어번호 == 11 {
257 return 해시 == 프로필해시(언어번호) ||
258 해시 == "04e2d104948d2f2b19c30e957c1da39d64562353aeb32f77761004ac6a0aa505"
259 }
260 if 언어번호 == 12 {
261 return 해시 == 프로필해시(언어번호) ||
262 해시 == "26d5681f3e6b8f438721b9981ae12c1d5a27b971f826025e165fb5d00d1c1a30"
263 }
264 if 언어번호 == 13 {
265 return 해시 == 프로필해시(언어번호) ||
266 해시 == "e17c4ceee236086fdccf627eab4580b51b2f2eae1d88cb199ce5724036cc5b3c"
267 }
268 if 언어번호 == 14 {
269 return 해시 == 프로필해시(언어번호) ||
270 해시 == "5e466bca2f7eacc14d72d9d9d43181ddca4077105604bf4ff3856420279a2a70"
271 }
272 if 언어번호 == 15 {
273 return 해시 == 프로필해시(언어번호) ||
274 해시 == "ade0d3b29a6937bf9417202e7ef3bbf34d0ed993df5b852d9890ccee6c9294be"
275 }
276 if 언어번호 == 16 {
277 return 해시 == 프로필해시(언어번호) ||
278 해시 == "c0c24fe0387c00db24380c9390bdb042df30ba683a82b57d3552f0b4b987b42a"
279 }
280 if 언어번호 == 17 {
281 return 해시 == 프로필해시(언어번호) ||
282 해시 == "c68be5eeef2ad90c3dffac79635a710b12976281c868c7647577b158681f6a17"
283 }
284 if 언어번호 == 18 {
285 return 해시 == 프로필해시(언어번호) ||
286 해시 == "82ef222bdafce8a2b75b341148ea5c47c59a96460f6b50bfdf50a5cc82a10e37"
287 }
288 if 언어번호 == 19 {
289 return 해시 == 프로필해시(언어번호) ||
290 해시 == "a48dfc56c48f7b348cb35d2b99600e45e8079049ae4a614c644c7ccb1643294e"
291 }
292 if 언어번호 == 21 {
293 return 해시 == 프로필해시(언어번호) ||
294 해시 == "11cbaea1865e3ee10616a823e5ade7a1f7bbce51b079aaab5de06a65cc013907"
295 }
296 if 언어번호 == 20 {
297 return 해시 == 프로필해시(언어번호) ||
298 해시 == "0cd672b3d723396b73ad715748829e3c1c0ccee03748cd1436a1caff46e7271d"
299 }
300 if 언어번호 == 22 {
301 return 해시 == 프로필해시(언어번호) ||
302 해시 == "5765d97a1cfa05f82dc0ba98758f9832c6838d98d47372516bf0f660947f08a3"
303 }
304 if 언어번호 == 23 {
305 return 해시 == 프로필해시(언어번호) ||
306 해시 == "8000923ad434d7623a8abe74802cc73bde081ab931de14ffd162da85618dafa2"
307 }
308 if 언어번호 == 24 {
309 return 해시 == 프로필해시(언어번호) ||
310 해시 == "786c7f51e3a9343d09e66e4a8d5b8698b4478eb69d94637009af2bb57f4ec6d3"
311 }
312 if 언어번호 == 25 {
313 return 해시 == 프로필해시(언어번호) ||
314 해시 == "d9238804d40604de7e8a859e5fe7820698b71644efb1f3cca6a653d4344aa9af"
315 }
316 if 언어번호 == 26 {
317 return 해시 == 프로필해시(언어번호) ||
318 해시 == "709ce0c4ebd1aa41a3baeb8aecfa8c2bd0fd938860be0a061c095d4c9e40b6d3"
319 }
320 if 언어번호 == 27 {
321 return 해시 == 프로필해시(언어번호) ||
322 해시 == "e9ef6119924ebcd7e943010feda0b1cb83f4c19168763a6c76c343291c8a6cd3"
323 }
324 if 언어번호 == 28 {
325 return 해시 == 프로필해시(언어번호) ||
326 해시 == "4cd5cc449f6b8770983d936ff0329ae886b59be6c1fac94dfb5acebb26eeffa8"
327 }
328 if 언어번호 == 29 {
329 return 해시 == 프로필해시(언어번호) ||
330 해시 == "a16808e3e3104e88d968e1a3109e9d3b6880eac67375a140bc4adc14917b44f5"
331 }
332 if 언어번호 == 30 {
333 return 해시 == 프로필해시(언어번호) ||
334 해시 == "504196b395c1fd82a46efbd937b33ab9ddac7d86aaff12eb201eff92429ae1ca"
335 }
336 false
339export record 글꼴자모 {
340 글자: string,
341 줄들: Array<string>
344// 책 제목을 찍는 3x5 픽셀 글꼴. 각 자모의 다섯 줄을 그대로 눕혀 두었으니
345// 소스에서 글자 모양이 보인다. 표가 곧 그림이다.
346let 픽셀자모들 = [
347 글꼴자모 { 글자: " ", 줄들: ["000",
348 "000",
349 "000",
350 "000",
351 "000"] },
352 글꼴자모 { 글자: "A", 줄들: ["010",
353 "101",
354 "111",
355 "101",
356 "101"] },
357 글꼴자모 { 글자: "B", 줄들: ["110",
358 "101",
359 "110",
360 "101",
361 "110"] },
362 글꼴자모 { 글자: "C", 줄들: ["011",
363 "100",
364 "100",
365 "100",
366 "011"] },
367 글꼴자모 { 글자: "D", 줄들: ["110",
368 "101",
369 "101",
370 "101",
371 "110"] },
372 글꼴자모 { 글자: "E", 줄들: ["111",
373 "100",
374 "110",
375 "100",
376 "111"] },
377 글꼴자모 { 글자: "F", 줄들: ["111",
378 "100",
379 "110",
380 "100",
381 "100"] },
382 글꼴자모 { 글자: "G", 줄들: ["011",
383 "100",
384 "101",
385 "101",
386 "011"] },
387 글꼴자모 { 글자: "H", 줄들: ["101",
388 "101",
389 "111",
390 "101",
391 "101"] },
392 글꼴자모 { 글자: "I", 줄들: ["111",
393 "010",
394 "010",
395 "010",
396 "111"] },
397 글꼴자모 { 글자: "J", 줄들: ["001",
398 "001",
399 "001",
400 "101",
401 "010"] },
402 글꼴자모 { 글자: "K", 줄들: ["101",
403 "101",
404 "110",
405 "101",
406 "101"] },
407 글꼴자모 { 글자: "L", 줄들: ["100",
408 "100",
409 "100",
410 "100",
411 "111"] },
412 글꼴자모 { 글자: "M", 줄들: ["101",
413 "111",
414 "111",
415 "101",
416 "101"] },
417 글꼴자모 { 글자: "N", 줄들: ["101",
418 "111",
419 "111",
420 "111",
421 "101"] },
422 글꼴자모 { 글자: "O", 줄들: ["010",
423 "101",
424 "101",
425 "101",
426 "010"] },
427 글꼴자모 { 글자: "P", 줄들: ["110",
428 "101",
429 "110",
430 "100",
431 "100"] },
432 글꼴자모 { 글자: "Q", 줄들: ["010",
433 "101",
434 "101",
435 "111",
436 "011"] },
437 글꼴자모 { 글자: "R", 줄들: ["110",
438 "101",
439 "110",
440 "101",
441 "101"] },
442 글꼴자모 { 글자: "S", 줄들: ["011",
443 "100",
444 "010",
445 "001",
446 "110"] },
447 글꼴자모 { 글자: "T", 줄들: ["111",
448 "010",
449 "010",
450 "010",
451 "010"] },
452 글꼴자모 { 글자: "U", 줄들: ["101",
453 "101",
454 "101",
455 "101",
456 "111"] },
457 글꼴자모 { 글자: "V", 줄들: ["101",
458 "101",
459 "101",
460 "101",
461 "010"] },
462 글꼴자모 { 글자: "W", 줄들: ["101",
463 "101",
464 "111",
465 "111",
466 "101"] },
467 글꼴자모 { 글자: "X", 줄들: ["101",
468 "101",
469 "010",
470 "101",
471 "101"] },
472 글꼴자모 { 글자: "Y", 줄들: ["101",
473 "101",
474 "010",
475 "010",
476 "010"] },
477 글꼴자모 { 글자: "Z", 줄들: ["111",
478 "001",
479 "010",
480 "100",
481 "111"] },
482 글꼴자모 { 글자: "0", 줄들: ["111",
483 "101",
484 "101",
485 "101",
486 "111"] },
487 글꼴자모 { 글자: "1", 줄들: ["010",
488 "110",
489 "010",
490 "010",
491 "111"] },
492 글꼴자모 { 글자: "2", 줄들: ["110",
493 "001",
494 "111",
495 "100",
496 "111"] },
497 글꼴자모 { 글자: "3", 줄들: ["110",
498 "001",
499 "110",
500 "001",
501 "110"] },
502 글꼴자모 { 글자: "4", 줄들: ["101",
503 "101",
504 "111",
505 "001",
506 "001"] },
507 글꼴자모 { 글자: "5", 줄들: ["111",
508 "100",
509 "110",
510 "001",
511 "110"] },
512 글꼴자모 { 글자: "6", 줄들: ["011",
513 "100",
514 "110",
515 "101",
516 "010"] },
517 글꼴자모 { 글자: "7", 줄들: ["111",
518 "001",
519 "010",
520 "010",
521 "010"] },
522 글꼴자모 { 글자: "8", 줄들: ["010",
523 "101",
524 "010",
525 "101",
526 "010"] },
527 글꼴자모 { 글자: "9", 줄들: ["010",
528 "101",
529 "011",
530 "001",
531 "110"] },
532 글꼴자모 { 글자: ".", 줄들: ["000",
533 "000",
534 "000",
535 "000",
536 "010"] },
537 글꼴자모 { 글자: ",", 줄들: ["000",
538 "000",
539 "000",
540 "010",
541 "100"] },
542 글꼴자모 { 글자: ":", 줄들: ["000",
543 "010",
544 "000",
545 "010",
546 "000"] },
547 글꼴자모 { 글자: ";", 줄들: ["000",
548 "010",
549 "000",
550 "010",
551 "100"] },
552 글꼴자모 { 글자: "!", 줄들: ["010",
553 "010",
554 "010",
555 "000",
556 "010"] },
557 글꼴자모 { 글자: "?", 줄들: ["110",
558 "001",
559 "010",
560 "000",
561 "010"] },
562 글꼴자모 { 글자: "/", 줄들: ["001",
563 "001",
564 "010",
565 "100",
566 "100"] },
567 글꼴자모 { 글자: "+", 줄들: ["000",
568 "010",
569 "111",
570 "010",
571 "000"] },
572 글꼴자모 { 글자: "-", 줄들: ["000",
573 "000",
574 "111",
575 "000",
576 "000"] },
577 글꼴자모 { 글자: "_", 줄들: ["000",
578 "000",
579 "000",
580 "000",
581 "111"] },
582 글꼴자모 { 글자: "=", 줄들: ["000",
583 "111",
584 "000",
585 "111",
586 "000"] },
587 글꼴자모 { 글자: "(", 줄들: ["001",
588 "010",
589 "010",
590 "010",
591 "001"] },
592 글꼴자모 { 글자: ")", 줄들: ["100",
593 "010",
594 "010",
595 "010",
596 "100"] },
597 글꼴자모 { 글자: "#", 줄들: ["101",
598 "111",
599 "101",
600 "111",
601 "101"] },
602 글꼴자모 { 글자: "&", 줄들: ["010",
603 "101",
604 "010",
605 "101",
606 "011"] },
609export function 픽셀글꼴(글자: string) -> string {
610 for 자모 in 픽셀자모들 {
611 if 자모.글자 == 글자 {
612 let mut 비트들 = ""
613 for 줄 in 자모.줄들 { 비트들 = 비트들 + 줄 }
614 return 비트들
615 }
616 }
617 ""
620export function 보호길이(논리길이: int) -> int { ((논리길이 + 222) / 223) * 255 }
622export function 이미지배치계산(노드수: int, 보호바이트수: int, 크롬번호: int) -> Result<이미지배치, string> {
623 if 노드수 <= 0 { return Err("쪽에는 노드가 하나 이상 있어야 합니다") }
624 let 판행수 = (노드수 + 11) / 12
625 let 판높이 = 판행수 * 36 - 6
626 let 띠위 = 71 + 판높이 + 24
627 let 띠행수 = 큰값(1, (보호바이트수 + 161) / 162)
628 let 꼬리높이 = if 크롬번호 == 1 { 64 } else { 24 }
629 let 높이 = 띠위 + 띠행수 * 2 + 꼬리높이
630 if 높이 > 2800 || 높이 > 65535 || 띠행수 > 65535 { return Err("쪽이 2800픽셀 예산을 넘습니다") }
631 Ok(이미지배치 { 너비: 1304, 높이: 높이, 판행수: 판행수, 판높이: 판높이, 띠위: 띠위, 띠행수: 띠행수, 꼬리높이: 꼬리높이 })
634export function 배열에있음(값들: Array<int>, 찾기: int) -> bool {
635 for 값 in 값들 { if 값 == 찾기 { return true } }
636 false
639export function 범위코드(언어번호: int, 코드: int) -> bool {
640 if 언어번호 == 1 { return 배열에있음([141, 419, 307, 188], 코드) && 코드 != 239 && 코드 != 419 }
641 if 언어번호 == 2 { return 배열에있음([398, 128, 281, 65, 232, 75, 359, 413], 코드) && 코드 != 209 && 코드 != 128 }
642 if 언어번호 == 24 { return 코드 == 201 }
643 if 언어번호 == 26 { return 코드 == 37 }
644 if 언어번호 == 29 { return 코드 == 53 }
645 if 언어번호 == 30 { return 코드 == 101 || 코드 == 350 }
646 false
649export function 파일프로그램코드(언어번호: int, 코드: int) -> bool {
650 if 언어번호 == 1 { return 코드 == 239 || 코드 == 419 }
651 if 언어번호 == 2 { return 코드 == 209 || 코드 == 128 }
652 if 언어번호 == 3 { return 코드 == 243 }
653 if 언어번호 == 4 { return 코드 == 47 }
654 if 언어번호 == 5 { return 코드 == 297 }
655 if 언어번호 == 6 { return 코드 == 357 }
656 if 언어번호 == 7 { return 코드 == 289 }
657 if 언어번호 == 8 { return 코드 == 232 }
658 if 언어번호 == 9 { return 코드 == 229 }
659 if 언어번호 == 10 { return 코드 == 184 }
660 if 언어번호 == 11 { return 코드 == 168 }
661 if 언어번호 == 24 { return 코드 == 200 }
662 if 언어번호 == 25 { return 코드 == 220 }
663 코드 == 36
666export function 쪽투영문자열(쪽들: Array<이미지쪽계획>) -> Result<string, string> {
667 let mut 글 = "["
668 let mut 색인 = 0
669 while 색인 < 쪽들.length {
670 if 색인 > 0 { 글 = 글 + "," }
671 let 쪽 = 쪽들[색인]
672 글 = 글 + "\{" + JSON.stringify("logicalEnd")? + ":" + "{쪽.논리끝}" + "," + JSON.stringify("logicalStart")? + ":" + "{쪽.논리시작}" +
673 "," + JSON.stringify("nodeEnd")? + ":" + "{쪽.노드끝}" + "," + JSON.stringify("nodeStart")? + ":" + "{쪽.노드시작}" +
674 "," + JSON.stringify("pageIndex")? + ":" + "{쪽.쪽번호}" + "\}"
675 색인 = 색인 + 1
676 }
677 Ok(글 + "]")

SHA256 178684428a62f390ea8b7d83a2140e2558a8e039d061bbb70c8c831669daaee9