1use super::error::CodeGenError;
8use std::collections::HashMap;
9use std::fmt::Write as _;
10use std::sync::LazyLock;
11
12pub struct RuntimeDecl {
14 pub decl: &'static str,
16 pub category: Option<&'static str>,
18}
19
20pub static RUNTIME_DECLARATIONS: LazyLock<Vec<RuntimeDecl>> = LazyLock::new(|| {
23 vec![
24 RuntimeDecl {
26 decl: "declare ptr @patch_seq_push_int(ptr, i64)",
27 category: Some("; Runtime function declarations"),
28 },
29 RuntimeDecl {
30 decl: "declare ptr @patch_seq_push_string(ptr, ptr)",
31 category: None,
32 },
33 RuntimeDecl {
34 decl: "declare ptr @patch_seq_push_symbol(ptr, ptr)",
35 category: None,
36 },
37 RuntimeDecl {
38 decl: "declare ptr @patch_seq_push_interned_symbol(ptr, ptr)",
39 category: None,
40 },
41 RuntimeDecl {
43 decl: "declare ptr @patch_seq_write(ptr)",
44 category: None,
45 },
46 RuntimeDecl {
47 decl: "declare ptr @patch_seq_write_line(ptr)",
48 category: None,
49 },
50 RuntimeDecl {
51 decl: "declare ptr @patch_seq_read_line(ptr)",
52 category: None,
53 },
54 RuntimeDecl {
55 decl: "declare ptr @patch_seq_read_line_plus(ptr)",
56 category: None,
57 },
58 RuntimeDecl {
59 decl: "declare ptr @patch_seq_read_n(ptr)",
60 category: None,
61 },
62 RuntimeDecl {
64 decl: "declare ptr @patch_seq_int_to_string(ptr)",
65 category: None,
66 },
67 RuntimeDecl {
68 decl: "declare ptr @patch_seq_symbol_to_string(ptr)",
69 category: None,
70 },
71 RuntimeDecl {
72 decl: "declare ptr @patch_seq_string_to_symbol(ptr)",
73 category: None,
74 },
75 RuntimeDecl {
77 decl: "declare ptr @patch_seq_add(ptr)",
78 category: None,
79 },
80 RuntimeDecl {
81 decl: "declare ptr @patch_seq_subtract(ptr)",
82 category: None,
83 },
84 RuntimeDecl {
85 decl: "declare ptr @patch_seq_multiply(ptr)",
86 category: None,
87 },
88 RuntimeDecl {
89 decl: "declare ptr @patch_seq_divide(ptr)",
90 category: None,
91 },
92 RuntimeDecl {
93 decl: "declare ptr @patch_seq_modulo(ptr)",
94 category: None,
95 },
96 RuntimeDecl {
98 decl: "declare ptr @patch_seq_eq(ptr)",
99 category: None,
100 },
101 RuntimeDecl {
102 decl: "declare ptr @patch_seq_lt(ptr)",
103 category: None,
104 },
105 RuntimeDecl {
106 decl: "declare ptr @patch_seq_gt(ptr)",
107 category: None,
108 },
109 RuntimeDecl {
110 decl: "declare ptr @patch_seq_lte(ptr)",
111 category: None,
112 },
113 RuntimeDecl {
114 decl: "declare ptr @patch_seq_gte(ptr)",
115 category: None,
116 },
117 RuntimeDecl {
118 decl: "declare ptr @patch_seq_neq(ptr)",
119 category: None,
120 },
121 RuntimeDecl {
123 decl: "declare ptr @patch_seq_and(ptr)",
124 category: Some("; Boolean operations"),
125 },
126 RuntimeDecl {
127 decl: "declare ptr @patch_seq_or(ptr)",
128 category: None,
129 },
130 RuntimeDecl {
131 decl: "declare ptr @patch_seq_not(ptr)",
132 category: None,
133 },
134 RuntimeDecl {
136 decl: "declare ptr @patch_seq_band(ptr)",
137 category: Some("; Bitwise operations"),
138 },
139 RuntimeDecl {
140 decl: "declare ptr @patch_seq_bor(ptr)",
141 category: None,
142 },
143 RuntimeDecl {
144 decl: "declare ptr @patch_seq_bxor(ptr)",
145 category: None,
146 },
147 RuntimeDecl {
148 decl: "declare ptr @patch_seq_bnot(ptr)",
149 category: None,
150 },
151 RuntimeDecl {
152 decl: "declare ptr @patch_seq_shl(ptr)",
153 category: None,
154 },
155 RuntimeDecl {
156 decl: "declare ptr @patch_seq_shr(ptr)",
157 category: None,
158 },
159 RuntimeDecl {
160 decl: "declare ptr @patch_seq_popcount(ptr)",
161 category: None,
162 },
163 RuntimeDecl {
164 decl: "declare ptr @patch_seq_clz(ptr)",
165 category: None,
166 },
167 RuntimeDecl {
168 decl: "declare ptr @patch_seq_ctz(ptr)",
169 category: None,
170 },
171 RuntimeDecl {
172 decl: "declare ptr @patch_seq_int_bits(ptr)",
173 category: None,
174 },
175 RuntimeDecl {
177 decl: "declare i64 @llvm.ctpop.i64(i64)",
178 category: None,
179 },
180 RuntimeDecl {
181 decl: "declare i64 @llvm.ctlz.i64(i64, i1)",
182 category: None,
183 },
184 RuntimeDecl {
185 decl: "declare i64 @llvm.cttz.i64(i64, i1)",
186 category: None,
187 },
188 RuntimeDecl {
189 decl: "declare void @llvm.memmove.p0.p0.i64(ptr, ptr, i64, i1)",
190 category: None,
191 },
192 RuntimeDecl {
193 decl: "declare void @llvm.trap() noreturn nounwind",
194 category: None,
195 },
196 RuntimeDecl {
198 decl: "declare ptr @patch_seq_dup(ptr)",
199 category: Some("; Stack operations"),
200 },
201 RuntimeDecl {
202 decl: "declare ptr @patch_seq_drop_op(ptr)",
203 category: None,
204 },
205 RuntimeDecl {
206 decl: "declare ptr @patch_seq_swap(ptr)",
207 category: None,
208 },
209 RuntimeDecl {
210 decl: "declare ptr @patch_seq_over(ptr)",
211 category: None,
212 },
213 RuntimeDecl {
214 decl: "declare ptr @patch_seq_rot(ptr)",
215 category: None,
216 },
217 RuntimeDecl {
218 decl: "declare ptr @patch_seq_nip(ptr)",
219 category: None,
220 },
221 RuntimeDecl {
222 decl: "declare void @patch_seq_clone_value(ptr, ptr)",
223 category: None,
224 },
225 RuntimeDecl {
226 decl: "declare ptr @patch_seq_tuck(ptr)",
227 category: None,
228 },
229 RuntimeDecl {
230 decl: "declare ptr @patch_seq_2dup(ptr)",
231 category: None,
232 },
233 RuntimeDecl {
234 decl: "declare ptr @patch_seq_pick_op(ptr)",
235 category: None,
236 },
237 RuntimeDecl {
238 decl: "declare ptr @patch_seq_roll(ptr)",
239 category: None,
240 },
241 RuntimeDecl {
242 decl: "declare ptr @patch_seq_push_value(ptr, %Value)",
243 category: None,
244 },
245 RuntimeDecl {
247 decl: "declare ptr @patch_seq_push_quotation(ptr, i64, i64)",
248 category: Some("; Quotation operations"),
249 },
250 RuntimeDecl {
251 decl: "declare ptr @patch_seq_call(ptr)",
252 category: None,
253 },
254 RuntimeDecl {
255 decl: "declare i64 @patch_seq_peek_is_quotation(ptr)",
256 category: None,
257 },
258 RuntimeDecl {
259 decl: "declare i64 @patch_seq_peek_quotation_fn_ptr(ptr)",
260 category: None,
261 },
262 RuntimeDecl {
263 decl: "declare ptr @patch_seq_spawn(ptr)",
264 category: None,
265 },
266 RuntimeDecl {
267 decl: "declare ptr @patch_seq_weave(ptr)",
268 category: None,
269 },
270 RuntimeDecl {
271 decl: "declare ptr @patch_seq_resume(ptr)",
272 category: None,
273 },
274 RuntimeDecl {
275 decl: "declare ptr @patch_seq_weave_cancel(ptr)",
276 category: None,
277 },
278 RuntimeDecl {
279 decl: "declare ptr @patch_seq_yield(ptr)",
280 category: None,
281 },
282 RuntimeDecl {
283 decl: "declare ptr @patch_seq_cond(ptr)",
284 category: None,
285 },
286 RuntimeDecl {
288 decl: "declare ptr @patch_seq_create_env(i32)",
289 category: Some("; Closure operations"),
290 },
291 RuntimeDecl {
292 decl: "declare void @patch_seq_env_set(ptr, i32, %Value)",
293 category: None,
294 },
295 RuntimeDecl {
296 decl: "declare %Value @patch_seq_env_get(ptr, i64, i32)",
297 category: None,
298 },
299 RuntimeDecl {
300 decl: "declare i64 @patch_seq_env_get_int(ptr, i64, i32)",
301 category: None,
302 },
303 RuntimeDecl {
304 decl: "declare i64 @patch_seq_env_get_bool(ptr, i64, i32)",
305 category: None,
306 },
307 RuntimeDecl {
308 decl: "declare double @patch_seq_env_get_float(ptr, i64, i32)",
309 category: None,
310 },
311 RuntimeDecl {
312 decl: "declare i64 @patch_seq_env_get_quotation(ptr, i64, i32)",
313 category: None,
314 },
315 RuntimeDecl {
316 decl: "declare ptr @patch_seq_env_get_string(ptr, i64, i32)",
317 category: None,
318 },
319 RuntimeDecl {
320 decl: "declare ptr @patch_seq_env_push_string(ptr, ptr, i64, i32)",
321 category: None,
322 },
323 RuntimeDecl {
324 decl: "declare %Value @patch_seq_make_closure(i64, ptr)",
325 category: None,
326 },
327 RuntimeDecl {
328 decl: "declare ptr @patch_seq_push_closure(ptr, i64, i32)",
329 category: None,
330 },
331 RuntimeDecl {
332 decl: "declare ptr @patch_seq_push_seqstring(ptr, ptr)",
333 category: None,
334 },
335 RuntimeDecl {
337 decl: "declare ptr @patch_seq_make_channel(ptr)",
338 category: Some("; Concurrency operations"),
339 },
340 RuntimeDecl {
341 decl: "declare ptr @patch_seq_chan_send(ptr)",
342 category: None,
343 },
344 RuntimeDecl {
345 decl: "declare ptr @patch_seq_chan_receive(ptr)",
346 category: None,
347 },
348 RuntimeDecl {
349 decl: "declare ptr @patch_seq_close_channel(ptr)",
350 category: None,
351 },
352 RuntimeDecl {
353 decl: "declare ptr @patch_seq_yield_strand(ptr)",
354 category: None,
355 },
356 RuntimeDecl {
357 decl: "declare void @patch_seq_maybe_yield()",
358 category: None,
359 },
360 RuntimeDecl {
362 decl: "declare void @patch_seq_scheduler_init()",
363 category: Some("; Scheduler operations"),
364 },
365 RuntimeDecl {
366 decl: "declare ptr @patch_seq_scheduler_run()",
367 category: None,
368 },
369 RuntimeDecl {
370 decl: "declare i64 @patch_seq_strand_spawn(ptr, ptr)",
371 category: None,
372 },
373 RuntimeDecl {
375 decl: "declare void @patch_seq_args_init(i32, ptr)",
376 category: Some("; Command-line argument operations"),
377 },
378 RuntimeDecl {
379 decl: "declare ptr @patch_seq_arg_count(ptr)",
380 category: None,
381 },
382 RuntimeDecl {
383 decl: "declare ptr @patch_seq_arg_at(ptr)",
384 category: None,
385 },
386 RuntimeDecl {
388 decl: "declare ptr @patch_seq_file_slurp(ptr)",
389 category: Some("; File operations"),
390 },
391 RuntimeDecl {
392 decl: "declare ptr @patch_seq_file_exists(ptr)",
393 category: None,
394 },
395 RuntimeDecl {
396 decl: "declare ptr @patch_seq_file_for_each_line_plus(ptr)",
397 category: None,
398 },
399 RuntimeDecl {
401 decl: "declare ptr @patch_seq_list_make(ptr)",
402 category: Some("; List operations"),
403 },
404 RuntimeDecl {
405 decl: "declare ptr @patch_seq_list_push(ptr)",
406 category: None,
407 },
408 RuntimeDecl {
409 decl: "declare ptr @patch_seq_list_get(ptr)",
410 category: None,
411 },
412 RuntimeDecl {
413 decl: "declare ptr @patch_seq_list_set(ptr)",
414 category: None,
415 },
416 RuntimeDecl {
417 decl: "declare ptr @patch_seq_list_map(ptr)",
418 category: None,
419 },
420 RuntimeDecl {
421 decl: "declare ptr @patch_seq_list_filter(ptr)",
422 category: None,
423 },
424 RuntimeDecl {
425 decl: "declare ptr @patch_seq_list_fold(ptr)",
426 category: None,
427 },
428 RuntimeDecl {
429 decl: "declare ptr @patch_seq_list_each(ptr)",
430 category: None,
431 },
432 RuntimeDecl {
433 decl: "declare ptr @patch_seq_list_length(ptr)",
434 category: None,
435 },
436 RuntimeDecl {
437 decl: "declare ptr @patch_seq_list_empty(ptr)",
438 category: None,
439 },
440 RuntimeDecl {
442 decl: "declare ptr @patch_seq_make_map(ptr)",
443 category: Some("; Map operations"),
444 },
445 RuntimeDecl {
446 decl: "declare ptr @patch_seq_map_get(ptr)",
447 category: None,
448 },
449 RuntimeDecl {
450 decl: "declare ptr @patch_seq_map_set(ptr)",
451 category: None,
452 },
453 RuntimeDecl {
454 decl: "declare ptr @patch_seq_map_has(ptr)",
455 category: None,
456 },
457 RuntimeDecl {
458 decl: "declare ptr @patch_seq_map_remove(ptr)",
459 category: None,
460 },
461 RuntimeDecl {
462 decl: "declare ptr @patch_seq_map_keys(ptr)",
463 category: None,
464 },
465 RuntimeDecl {
466 decl: "declare ptr @patch_seq_map_values(ptr)",
467 category: None,
468 },
469 RuntimeDecl {
470 decl: "declare ptr @patch_seq_map_size(ptr)",
471 category: None,
472 },
473 RuntimeDecl {
474 decl: "declare ptr @patch_seq_map_empty(ptr)",
475 category: None,
476 },
477 RuntimeDecl {
479 decl: "declare ptr @patch_seq_tcp_listen(ptr)",
480 category: Some("; TCP operations"),
481 },
482 RuntimeDecl {
483 decl: "declare ptr @patch_seq_tcp_accept(ptr)",
484 category: None,
485 },
486 RuntimeDecl {
487 decl: "declare ptr @patch_seq_tcp_read(ptr)",
488 category: None,
489 },
490 RuntimeDecl {
491 decl: "declare ptr @patch_seq_tcp_write(ptr)",
492 category: None,
493 },
494 RuntimeDecl {
495 decl: "declare ptr @patch_seq_tcp_close(ptr)",
496 category: None,
497 },
498 RuntimeDecl {
500 decl: "declare ptr @patch_seq_getenv(ptr)",
501 category: Some("; OS operations"),
502 },
503 RuntimeDecl {
504 decl: "declare ptr @patch_seq_home_dir(ptr)",
505 category: None,
506 },
507 RuntimeDecl {
508 decl: "declare ptr @patch_seq_current_dir(ptr)",
509 category: None,
510 },
511 RuntimeDecl {
512 decl: "declare ptr @patch_seq_path_exists(ptr)",
513 category: None,
514 },
515 RuntimeDecl {
516 decl: "declare ptr @patch_seq_path_is_file(ptr)",
517 category: None,
518 },
519 RuntimeDecl {
520 decl: "declare ptr @patch_seq_path_is_dir(ptr)",
521 category: None,
522 },
523 RuntimeDecl {
524 decl: "declare ptr @patch_seq_path_join(ptr)",
525 category: None,
526 },
527 RuntimeDecl {
528 decl: "declare ptr @patch_seq_path_parent(ptr)",
529 category: None,
530 },
531 RuntimeDecl {
532 decl: "declare ptr @patch_seq_path_filename(ptr)",
533 category: None,
534 },
535 RuntimeDecl {
536 decl: "declare ptr @patch_seq_exit(ptr)",
537 category: None,
538 },
539 RuntimeDecl {
540 decl: "declare ptr @patch_seq_os_name(ptr)",
541 category: None,
542 },
543 RuntimeDecl {
544 decl: "declare ptr @patch_seq_os_arch(ptr)",
545 category: None,
546 },
547 RuntimeDecl {
549 decl: "declare ptr @patch_seq_signal_trap(ptr)",
550 category: Some("; Signal handling"),
551 },
552 RuntimeDecl {
553 decl: "declare ptr @patch_seq_signal_received(ptr)",
554 category: None,
555 },
556 RuntimeDecl {
557 decl: "declare ptr @patch_seq_signal_pending(ptr)",
558 category: None,
559 },
560 RuntimeDecl {
561 decl: "declare ptr @patch_seq_signal_default(ptr)",
562 category: None,
563 },
564 RuntimeDecl {
565 decl: "declare ptr @patch_seq_signal_ignore(ptr)",
566 category: None,
567 },
568 RuntimeDecl {
569 decl: "declare ptr @patch_seq_signal_clear(ptr)",
570 category: None,
571 },
572 RuntimeDecl {
573 decl: "declare ptr @patch_seq_signal_sigint(ptr)",
574 category: None,
575 },
576 RuntimeDecl {
577 decl: "declare ptr @patch_seq_signal_sigterm(ptr)",
578 category: None,
579 },
580 RuntimeDecl {
581 decl: "declare ptr @patch_seq_signal_sighup(ptr)",
582 category: None,
583 },
584 RuntimeDecl {
585 decl: "declare ptr @patch_seq_signal_sigpipe(ptr)",
586 category: None,
587 },
588 RuntimeDecl {
589 decl: "declare ptr @patch_seq_signal_sigusr1(ptr)",
590 category: None,
591 },
592 RuntimeDecl {
593 decl: "declare ptr @patch_seq_signal_sigusr2(ptr)",
594 category: None,
595 },
596 RuntimeDecl {
597 decl: "declare ptr @patch_seq_signal_sigchld(ptr)",
598 category: None,
599 },
600 RuntimeDecl {
601 decl: "declare ptr @patch_seq_signal_sigalrm(ptr)",
602 category: None,
603 },
604 RuntimeDecl {
605 decl: "declare ptr @patch_seq_signal_sigcont(ptr)",
606 category: None,
607 },
608 RuntimeDecl {
610 decl: "declare ptr @patch_seq_terminal_raw_mode(ptr)",
611 category: Some("; Terminal operations"),
612 },
613 RuntimeDecl {
614 decl: "declare ptr @patch_seq_terminal_read_char(ptr)",
615 category: None,
616 },
617 RuntimeDecl {
618 decl: "declare ptr @patch_seq_terminal_read_char_nonblock(ptr)",
619 category: None,
620 },
621 RuntimeDecl {
622 decl: "declare ptr @patch_seq_terminal_width(ptr)",
623 category: None,
624 },
625 RuntimeDecl {
626 decl: "declare ptr @patch_seq_terminal_height(ptr)",
627 category: None,
628 },
629 RuntimeDecl {
630 decl: "declare ptr @patch_seq_terminal_flush(ptr)",
631 category: None,
632 },
633 RuntimeDecl {
635 decl: "declare ptr @patch_seq_string_concat(ptr)",
636 category: Some("; String operations"),
637 },
638 RuntimeDecl {
639 decl: "declare ptr @patch_seq_string_length(ptr)",
640 category: None,
641 },
642 RuntimeDecl {
643 decl: "declare ptr @patch_seq_string_byte_length(ptr)",
644 category: None,
645 },
646 RuntimeDecl {
647 decl: "declare ptr @patch_seq_string_char_at(ptr)",
648 category: None,
649 },
650 RuntimeDecl {
651 decl: "declare ptr @patch_seq_string_substring(ptr)",
652 category: None,
653 },
654 RuntimeDecl {
655 decl: "declare ptr @patch_seq_char_to_string(ptr)",
656 category: None,
657 },
658 RuntimeDecl {
659 decl: "declare ptr @patch_seq_string_find(ptr)",
660 category: None,
661 },
662 RuntimeDecl {
663 decl: "declare ptr @patch_seq_string_split(ptr)",
664 category: None,
665 },
666 RuntimeDecl {
667 decl: "declare ptr @patch_seq_string_contains(ptr)",
668 category: None,
669 },
670 RuntimeDecl {
671 decl: "declare ptr @patch_seq_string_starts_with(ptr)",
672 category: None,
673 },
674 RuntimeDecl {
675 decl: "declare ptr @patch_seq_string_empty(ptr)",
676 category: None,
677 },
678 RuntimeDecl {
679 decl: "declare ptr @patch_seq_string_trim(ptr)",
680 category: None,
681 },
682 RuntimeDecl {
683 decl: "declare ptr @patch_seq_string_chomp(ptr)",
684 category: None,
685 },
686 RuntimeDecl {
687 decl: "declare ptr @patch_seq_string_to_upper(ptr)",
688 category: None,
689 },
690 RuntimeDecl {
691 decl: "declare ptr @patch_seq_string_to_lower(ptr)",
692 category: None,
693 },
694 RuntimeDecl {
695 decl: "declare ptr @patch_seq_string_equal(ptr)",
696 category: None,
697 },
698 RuntimeDecl {
699 decl: "declare ptr @patch_seq_json_escape(ptr)",
700 category: None,
701 },
702 RuntimeDecl {
703 decl: "declare ptr @patch_seq_string_to_int(ptr)",
704 category: None,
705 },
706 RuntimeDecl {
708 decl: "declare ptr @patch_seq_base64_encode(ptr)",
709 category: Some("; Encoding operations"),
710 },
711 RuntimeDecl {
712 decl: "declare ptr @patch_seq_base64_decode(ptr)",
713 category: None,
714 },
715 RuntimeDecl {
716 decl: "declare ptr @patch_seq_base64url_encode(ptr)",
717 category: None,
718 },
719 RuntimeDecl {
720 decl: "declare ptr @patch_seq_base64url_decode(ptr)",
721 category: None,
722 },
723 RuntimeDecl {
724 decl: "declare ptr @patch_seq_hex_encode(ptr)",
725 category: None,
726 },
727 RuntimeDecl {
728 decl: "declare ptr @patch_seq_hex_decode(ptr)",
729 category: None,
730 },
731 RuntimeDecl {
733 decl: "declare ptr @patch_seq_sha256(ptr)",
734 category: Some("; Crypto operations"),
735 },
736 RuntimeDecl {
737 decl: "declare ptr @patch_seq_hmac_sha256(ptr)",
738 category: None,
739 },
740 RuntimeDecl {
741 decl: "declare ptr @patch_seq_constant_time_eq(ptr)",
742 category: None,
743 },
744 RuntimeDecl {
745 decl: "declare ptr @patch_seq_random_bytes(ptr)",
746 category: None,
747 },
748 RuntimeDecl {
749 decl: "declare ptr @patch_seq_random_int(ptr)",
750 category: None,
751 },
752 RuntimeDecl {
753 decl: "declare ptr @patch_seq_uuid4(ptr)",
754 category: None,
755 },
756 RuntimeDecl {
757 decl: "declare ptr @patch_seq_crypto_aes_gcm_encrypt(ptr)",
758 category: None,
759 },
760 RuntimeDecl {
761 decl: "declare ptr @patch_seq_crypto_aes_gcm_decrypt(ptr)",
762 category: None,
763 },
764 RuntimeDecl {
765 decl: "declare ptr @patch_seq_crypto_pbkdf2_sha256(ptr)",
766 category: None,
767 },
768 RuntimeDecl {
769 decl: "declare ptr @patch_seq_crypto_ed25519_keypair(ptr)",
770 category: None,
771 },
772 RuntimeDecl {
773 decl: "declare ptr @patch_seq_crypto_ed25519_sign(ptr)",
774 category: None,
775 },
776 RuntimeDecl {
777 decl: "declare ptr @patch_seq_crypto_ed25519_verify(ptr)",
778 category: None,
779 },
780 RuntimeDecl {
782 decl: "declare ptr @patch_seq_http_get(ptr)",
783 category: Some("; HTTP client operations"),
784 },
785 RuntimeDecl {
786 decl: "declare ptr @patch_seq_http_post(ptr)",
787 category: None,
788 },
789 RuntimeDecl {
790 decl: "declare ptr @patch_seq_http_put(ptr)",
791 category: None,
792 },
793 RuntimeDecl {
794 decl: "declare ptr @patch_seq_http_delete(ptr)",
795 category: None,
796 },
797 RuntimeDecl {
799 decl: "declare ptr @patch_seq_symbol_equal(ptr)",
800 category: Some("; Symbol operations"),
801 },
802 RuntimeDecl {
804 decl: "declare ptr @patch_seq_variant_field_count(ptr)",
805 category: Some("; Variant operations"),
806 },
807 RuntimeDecl {
808 decl: "declare ptr @patch_seq_variant_tag(ptr)",
809 category: None,
810 },
811 RuntimeDecl {
812 decl: "declare ptr @patch_seq_variant_field_at(ptr)",
813 category: None,
814 },
815 RuntimeDecl {
816 decl: "declare ptr @patch_seq_variant_append(ptr)",
817 category: None,
818 },
819 RuntimeDecl {
820 decl: "declare ptr @patch_seq_variant_last(ptr)",
821 category: None,
822 },
823 RuntimeDecl {
824 decl: "declare ptr @patch_seq_variant_init(ptr)",
825 category: None,
826 },
827 RuntimeDecl {
828 decl: "declare ptr @patch_seq_make_variant_0(ptr)",
829 category: None,
830 },
831 RuntimeDecl {
832 decl: "declare ptr @patch_seq_make_variant_1(ptr)",
833 category: None,
834 },
835 RuntimeDecl {
836 decl: "declare ptr @patch_seq_make_variant_2(ptr)",
837 category: None,
838 },
839 RuntimeDecl {
840 decl: "declare ptr @patch_seq_make_variant_3(ptr)",
841 category: None,
842 },
843 RuntimeDecl {
844 decl: "declare ptr @patch_seq_make_variant_4(ptr)",
845 category: None,
846 },
847 RuntimeDecl {
848 decl: "declare ptr @patch_seq_make_variant_5(ptr)",
849 category: None,
850 },
851 RuntimeDecl {
852 decl: "declare ptr @patch_seq_make_variant_6(ptr)",
853 category: None,
854 },
855 RuntimeDecl {
856 decl: "declare ptr @patch_seq_make_variant_7(ptr)",
857 category: None,
858 },
859 RuntimeDecl {
860 decl: "declare ptr @patch_seq_make_variant_8(ptr)",
861 category: None,
862 },
863 RuntimeDecl {
864 decl: "declare ptr @patch_seq_make_variant_9(ptr)",
865 category: None,
866 },
867 RuntimeDecl {
868 decl: "declare ptr @patch_seq_make_variant_10(ptr)",
869 category: None,
870 },
871 RuntimeDecl {
872 decl: "declare ptr @patch_seq_make_variant_11(ptr)",
873 category: None,
874 },
875 RuntimeDecl {
876 decl: "declare ptr @patch_seq_make_variant_12(ptr)",
877 category: None,
878 },
879 RuntimeDecl {
880 decl: "declare ptr @patch_seq_unpack_variant(ptr, i64)",
881 category: None,
882 },
883 RuntimeDecl {
884 decl: "declare ptr @patch_seq_symbol_eq_cstr(ptr, ptr)",
885 category: None,
886 },
887 RuntimeDecl {
889 decl: "declare ptr @patch_seq_push_float(ptr, double)",
890 category: Some("; Float operations"),
891 },
892 RuntimeDecl {
893 decl: "declare ptr @patch_seq_f_add(ptr)",
894 category: None,
895 },
896 RuntimeDecl {
897 decl: "declare ptr @patch_seq_f_subtract(ptr)",
898 category: None,
899 },
900 RuntimeDecl {
901 decl: "declare ptr @patch_seq_f_multiply(ptr)",
902 category: None,
903 },
904 RuntimeDecl {
905 decl: "declare ptr @patch_seq_f_divide(ptr)",
906 category: None,
907 },
908 RuntimeDecl {
909 decl: "declare ptr @patch_seq_f_eq(ptr)",
910 category: None,
911 },
912 RuntimeDecl {
913 decl: "declare ptr @patch_seq_f_lt(ptr)",
914 category: None,
915 },
916 RuntimeDecl {
917 decl: "declare ptr @patch_seq_f_gt(ptr)",
918 category: None,
919 },
920 RuntimeDecl {
921 decl: "declare ptr @patch_seq_f_lte(ptr)",
922 category: None,
923 },
924 RuntimeDecl {
925 decl: "declare ptr @patch_seq_f_gte(ptr)",
926 category: None,
927 },
928 RuntimeDecl {
929 decl: "declare ptr @patch_seq_f_neq(ptr)",
930 category: None,
931 },
932 RuntimeDecl {
933 decl: "declare ptr @patch_seq_int_to_float(ptr)",
934 category: None,
935 },
936 RuntimeDecl {
937 decl: "declare ptr @patch_seq_float_to_int(ptr)",
938 category: None,
939 },
940 RuntimeDecl {
941 decl: "declare ptr @patch_seq_float_to_string(ptr)",
942 category: None,
943 },
944 RuntimeDecl {
945 decl: "declare ptr @patch_seq_string_to_float(ptr)",
946 category: None,
947 },
948 RuntimeDecl {
950 decl: "declare ptr @patch_seq_test_init(ptr)",
951 category: Some("; Test framework operations"),
952 },
953 RuntimeDecl {
954 decl: "declare ptr @patch_seq_test_finish(ptr)",
955 category: None,
956 },
957 RuntimeDecl {
958 decl: "declare ptr @patch_seq_test_has_failures(ptr)",
959 category: None,
960 },
961 RuntimeDecl {
962 decl: "declare ptr @patch_seq_test_assert(ptr)",
963 category: None,
964 },
965 RuntimeDecl {
966 decl: "declare ptr @patch_seq_test_assert_not(ptr)",
967 category: None,
968 },
969 RuntimeDecl {
970 decl: "declare ptr @patch_seq_test_assert_eq(ptr)",
971 category: None,
972 },
973 RuntimeDecl {
974 decl: "declare ptr @patch_seq_test_assert_eq_str(ptr)",
975 category: None,
976 },
977 RuntimeDecl {
978 decl: "declare ptr @patch_seq_test_fail(ptr)",
979 category: None,
980 },
981 RuntimeDecl {
982 decl: "declare ptr @patch_seq_test_pass_count(ptr)",
983 category: None,
984 },
985 RuntimeDecl {
986 decl: "declare ptr @patch_seq_test_fail_count(ptr)",
987 category: None,
988 },
989 RuntimeDecl {
991 decl: "declare ptr @patch_seq_time_now(ptr)",
992 category: Some("; Time operations"),
993 },
994 RuntimeDecl {
995 decl: "declare ptr @patch_seq_time_nanos(ptr)",
996 category: None,
997 },
998 RuntimeDecl {
999 decl: "declare ptr @patch_seq_time_sleep_ms(ptr)",
1000 category: None,
1001 },
1002 RuntimeDecl {
1004 decl: "declare ptr @patch_seq_stack_dump(ptr)",
1005 category: Some("; Stack introspection"),
1006 },
1007 RuntimeDecl {
1009 decl: "declare ptr @patch_seq_son_dump(ptr)",
1010 category: Some("; SON serialization"),
1011 },
1012 RuntimeDecl {
1013 decl: "declare ptr @patch_seq_son_dump_pretty(ptr)",
1014 category: None,
1015 },
1016 RuntimeDecl {
1018 decl: "declare ptr @patch_seq_regex_match(ptr)",
1019 category: Some("; Regex operations"),
1020 },
1021 RuntimeDecl {
1022 decl: "declare ptr @patch_seq_regex_find(ptr)",
1023 category: None,
1024 },
1025 RuntimeDecl {
1026 decl: "declare ptr @patch_seq_regex_find_all(ptr)",
1027 category: None,
1028 },
1029 RuntimeDecl {
1030 decl: "declare ptr @patch_seq_regex_replace(ptr)",
1031 category: None,
1032 },
1033 RuntimeDecl {
1034 decl: "declare ptr @patch_seq_regex_replace_all(ptr)",
1035 category: None,
1036 },
1037 RuntimeDecl {
1038 decl: "declare ptr @patch_seq_regex_captures(ptr)",
1039 category: None,
1040 },
1041 RuntimeDecl {
1042 decl: "declare ptr @patch_seq_regex_split(ptr)",
1043 category: None,
1044 },
1045 RuntimeDecl {
1046 decl: "declare ptr @patch_seq_regex_valid(ptr)",
1047 category: None,
1048 },
1049 RuntimeDecl {
1051 decl: "declare ptr @patch_seq_compress_gzip(ptr)",
1052 category: Some("; Compression operations"),
1053 },
1054 RuntimeDecl {
1055 decl: "declare ptr @patch_seq_compress_gzip_level(ptr)",
1056 category: None,
1057 },
1058 RuntimeDecl {
1059 decl: "declare ptr @patch_seq_compress_gunzip(ptr)",
1060 category: None,
1061 },
1062 RuntimeDecl {
1063 decl: "declare ptr @patch_seq_compress_zstd(ptr)",
1064 category: None,
1065 },
1066 RuntimeDecl {
1067 decl: "declare ptr @patch_seq_compress_zstd_level(ptr)",
1068 category: None,
1069 },
1070 RuntimeDecl {
1071 decl: "declare ptr @patch_seq_compress_unzstd(ptr)",
1072 category: None,
1073 },
1074 RuntimeDecl {
1076 decl: "declare i64 @patch_seq_peek_int_value(ptr)",
1077 category: Some("; Helpers for conditionals"),
1078 },
1079 RuntimeDecl {
1080 decl: "declare i1 @patch_seq_peek_bool_value(ptr)",
1081 category: None,
1082 },
1083 RuntimeDecl {
1084 decl: "declare ptr @patch_seq_pop_stack(ptr)",
1085 category: None,
1086 },
1087 RuntimeDecl {
1089 decl: "declare ptr @seq_stack_new_default()",
1090 category: Some("; Tagged stack operations"),
1091 },
1092 RuntimeDecl {
1093 decl: "declare void @seq_stack_free(ptr)",
1094 category: None,
1095 },
1096 RuntimeDecl {
1097 decl: "declare ptr @seq_stack_base(ptr)",
1098 category: None,
1099 },
1100 RuntimeDecl {
1101 decl: "declare i64 @seq_stack_sp(ptr)",
1102 category: None,
1103 },
1104 RuntimeDecl {
1105 decl: "declare void @seq_stack_set_sp(ptr, i64)",
1106 category: None,
1107 },
1108 RuntimeDecl {
1109 decl: "declare void @seq_stack_grow(ptr, i64)",
1110 category: None,
1111 },
1112 RuntimeDecl {
1113 decl: "declare void @patch_seq_set_stack_base(ptr)",
1114 category: None,
1115 },
1116 ]
1117});
1118
1119pub static BUILTIN_SYMBOLS: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
1126 HashMap::from([
1127 ("io.write", "patch_seq_write"),
1129 ("io.write-line", "patch_seq_write_line"),
1130 ("io.read-line", "patch_seq_read_line"),
1131 ("io.read-line+", "patch_seq_read_line_plus"),
1132 ("io.read-n", "patch_seq_read_n"),
1133 ("int->string", "patch_seq_int_to_string"),
1134 ("symbol->string", "patch_seq_symbol_to_string"),
1135 ("string->symbol", "patch_seq_string_to_symbol"),
1136 ("args.count", "patch_seq_arg_count"),
1138 ("args.at", "patch_seq_arg_at"),
1139 ("i.add", "patch_seq_add"),
1141 ("i.subtract", "patch_seq_subtract"),
1142 ("i.multiply", "patch_seq_multiply"),
1143 ("i.divide", "patch_seq_divide"),
1144 ("i.modulo", "patch_seq_modulo"),
1145 ("i.+", "patch_seq_add"),
1147 ("i.-", "patch_seq_subtract"),
1148 ("i.*", "patch_seq_multiply"),
1149 ("i./", "patch_seq_divide"),
1150 ("i.%", "patch_seq_modulo"),
1151 ("i.=", "patch_seq_eq"),
1153 ("i.<", "patch_seq_lt"),
1154 ("i.>", "patch_seq_gt"),
1155 ("i.<=", "patch_seq_lte"),
1156 ("i.>=", "patch_seq_gte"),
1157 ("i.<>", "patch_seq_neq"),
1158 ("i.eq", "patch_seq_eq"),
1160 ("i.lt", "patch_seq_lt"),
1161 ("i.gt", "patch_seq_gt"),
1162 ("i.lte", "patch_seq_lte"),
1163 ("i.gte", "patch_seq_gte"),
1164 ("i.neq", "patch_seq_neq"),
1165 ("and", "patch_seq_and"),
1167 ("or", "patch_seq_or"),
1168 ("not", "patch_seq_not"),
1169 ("band", "patch_seq_band"),
1171 ("bor", "patch_seq_bor"),
1172 ("bxor", "patch_seq_bxor"),
1173 ("bnot", "patch_seq_bnot"),
1174 ("shl", "patch_seq_shl"),
1175 ("shr", "patch_seq_shr"),
1176 ("popcount", "patch_seq_popcount"),
1177 ("clz", "patch_seq_clz"),
1178 ("ctz", "patch_seq_ctz"),
1179 ("int-bits", "patch_seq_int_bits"),
1180 ("dup", "patch_seq_dup"),
1182 ("swap", "patch_seq_swap"),
1183 ("over", "patch_seq_over"),
1184 ("rot", "patch_seq_rot"),
1185 ("nip", "patch_seq_nip"),
1186 ("tuck", "patch_seq_tuck"),
1187 ("2dup", "patch_seq_2dup"),
1188 ("drop", "patch_seq_drop_op"),
1189 ("pick", "patch_seq_pick_op"),
1190 ("roll", "patch_seq_roll"),
1191 ("chan.make", "patch_seq_make_channel"),
1193 ("chan.send", "patch_seq_chan_send"),
1194 ("chan.receive", "patch_seq_chan_receive"),
1195 ("chan.close", "patch_seq_close_channel"),
1196 ("chan.yield", "patch_seq_yield_strand"),
1197 ("call", "patch_seq_call"),
1199 ("strand.spawn", "patch_seq_spawn"),
1200 ("strand.weave", "patch_seq_weave"),
1201 ("strand.resume", "patch_seq_resume"),
1202 ("strand.weave-cancel", "patch_seq_weave_cancel"),
1203 ("yield", "patch_seq_yield"),
1204 ("cond", "patch_seq_cond"),
1205 ("tcp.listen", "patch_seq_tcp_listen"),
1207 ("tcp.accept", "patch_seq_tcp_accept"),
1208 ("tcp.read", "patch_seq_tcp_read"),
1209 ("tcp.write", "patch_seq_tcp_write"),
1210 ("tcp.close", "patch_seq_tcp_close"),
1211 ("os.getenv", "patch_seq_getenv"),
1213 ("os.home-dir", "patch_seq_home_dir"),
1214 ("os.current-dir", "patch_seq_current_dir"),
1215 ("os.path-exists", "patch_seq_path_exists"),
1216 ("os.path-is-file", "patch_seq_path_is_file"),
1217 ("os.path-is-dir", "patch_seq_path_is_dir"),
1218 ("os.path-join", "patch_seq_path_join"),
1219 ("os.path-parent", "patch_seq_path_parent"),
1220 ("os.path-filename", "patch_seq_path_filename"),
1221 ("os.exit", "patch_seq_exit"),
1222 ("os.name", "patch_seq_os_name"),
1223 ("os.arch", "patch_seq_os_arch"),
1224 ("signal.trap", "patch_seq_signal_trap"),
1226 ("signal.received?", "patch_seq_signal_received"),
1227 ("signal.pending?", "patch_seq_signal_pending"),
1228 ("signal.default", "patch_seq_signal_default"),
1229 ("signal.ignore", "patch_seq_signal_ignore"),
1230 ("signal.clear", "patch_seq_signal_clear"),
1231 ("signal.SIGINT", "patch_seq_signal_sigint"),
1232 ("signal.SIGTERM", "patch_seq_signal_sigterm"),
1233 ("signal.SIGHUP", "patch_seq_signal_sighup"),
1234 ("signal.SIGPIPE", "patch_seq_signal_sigpipe"),
1235 ("signal.SIGUSR1", "patch_seq_signal_sigusr1"),
1236 ("signal.SIGUSR2", "patch_seq_signal_sigusr2"),
1237 ("signal.SIGCHLD", "patch_seq_signal_sigchld"),
1238 ("signal.SIGALRM", "patch_seq_signal_sigalrm"),
1239 ("signal.SIGCONT", "patch_seq_signal_sigcont"),
1240 ("terminal.raw-mode", "patch_seq_terminal_raw_mode"),
1242 ("terminal.read-char", "patch_seq_terminal_read_char"),
1243 (
1244 "terminal.read-char?",
1245 "patch_seq_terminal_read_char_nonblock",
1246 ),
1247 ("terminal.width", "patch_seq_terminal_width"),
1248 ("terminal.height", "patch_seq_terminal_height"),
1249 ("terminal.flush", "patch_seq_terminal_flush"),
1250 ("string.concat", "patch_seq_string_concat"),
1252 ("string.length", "patch_seq_string_length"),
1253 ("string.byte-length", "patch_seq_string_byte_length"),
1254 ("string.char-at", "patch_seq_string_char_at"),
1255 ("string.substring", "patch_seq_string_substring"),
1256 ("char->string", "patch_seq_char_to_string"),
1257 ("string.find", "patch_seq_string_find"),
1258 ("string.split", "patch_seq_string_split"),
1259 ("string.contains", "patch_seq_string_contains"),
1260 ("string.starts-with", "patch_seq_string_starts_with"),
1261 ("string.empty?", "patch_seq_string_empty"),
1262 ("string.trim", "patch_seq_string_trim"),
1263 ("string.chomp", "patch_seq_string_chomp"),
1264 ("string.to-upper", "patch_seq_string_to_upper"),
1265 ("string.to-lower", "patch_seq_string_to_lower"),
1266 ("string.equal?", "patch_seq_string_equal"),
1267 ("string.json-escape", "patch_seq_json_escape"),
1268 ("string->int", "patch_seq_string_to_int"),
1269 ("encoding.base64-encode", "patch_seq_base64_encode"),
1271 ("encoding.base64-decode", "patch_seq_base64_decode"),
1272 ("encoding.base64url-encode", "patch_seq_base64url_encode"),
1273 ("encoding.base64url-decode", "patch_seq_base64url_decode"),
1274 ("encoding.hex-encode", "patch_seq_hex_encode"),
1275 ("encoding.hex-decode", "patch_seq_hex_decode"),
1276 ("crypto.sha256", "patch_seq_sha256"),
1278 ("crypto.hmac-sha256", "patch_seq_hmac_sha256"),
1279 ("crypto.constant-time-eq", "patch_seq_constant_time_eq"),
1280 ("crypto.random-bytes", "patch_seq_random_bytes"),
1281 ("crypto.random-int", "patch_seq_random_int"),
1282 ("crypto.uuid4", "patch_seq_uuid4"),
1283 ("crypto.aes-gcm-encrypt", "patch_seq_crypto_aes_gcm_encrypt"),
1284 ("crypto.aes-gcm-decrypt", "patch_seq_crypto_aes_gcm_decrypt"),
1285 ("crypto.pbkdf2-sha256", "patch_seq_crypto_pbkdf2_sha256"),
1286 ("crypto.ed25519-keypair", "patch_seq_crypto_ed25519_keypair"),
1287 ("crypto.ed25519-sign", "patch_seq_crypto_ed25519_sign"),
1288 ("crypto.ed25519-verify", "patch_seq_crypto_ed25519_verify"),
1289 ("http.get", "patch_seq_http_get"),
1291 ("http.post", "patch_seq_http_post"),
1292 ("http.put", "patch_seq_http_put"),
1293 ("http.delete", "patch_seq_http_delete"),
1294 ("regex.match?", "patch_seq_regex_match"),
1296 ("regex.find", "patch_seq_regex_find"),
1297 ("regex.find-all", "patch_seq_regex_find_all"),
1298 ("regex.replace", "patch_seq_regex_replace"),
1299 ("regex.replace-all", "patch_seq_regex_replace_all"),
1300 ("regex.captures", "patch_seq_regex_captures"),
1301 ("regex.split", "patch_seq_regex_split"),
1302 ("regex.valid?", "patch_seq_regex_valid"),
1303 ("compress.gzip", "patch_seq_compress_gzip"),
1305 ("compress.gzip-level", "patch_seq_compress_gzip_level"),
1306 ("compress.gunzip", "patch_seq_compress_gunzip"),
1307 ("compress.zstd", "patch_seq_compress_zstd"),
1308 ("compress.zstd-level", "patch_seq_compress_zstd_level"),
1309 ("compress.unzstd", "patch_seq_compress_unzstd"),
1310 ("symbol.=", "patch_seq_symbol_equal"),
1312 ("file.slurp", "patch_seq_file_slurp"),
1314 ("file.exists?", "patch_seq_file_exists"),
1315 ("file.for-each-line+", "patch_seq_file_for_each_line_plus"),
1316 ("list.make", "patch_seq_list_make"),
1318 ("list.push", "patch_seq_list_push"),
1319 ("list.get", "patch_seq_list_get"),
1320 ("list.set", "patch_seq_list_set"),
1321 ("list.map", "patch_seq_list_map"),
1322 ("list.filter", "patch_seq_list_filter"),
1323 ("list.fold", "patch_seq_list_fold"),
1324 ("list.each", "patch_seq_list_each"),
1325 ("list.length", "patch_seq_list_length"),
1326 ("list.empty?", "patch_seq_list_empty"),
1327 ("map.make", "patch_seq_make_map"),
1329 ("map.get", "patch_seq_map_get"),
1330 ("map.set", "patch_seq_map_set"),
1331 ("map.has?", "patch_seq_map_has"),
1332 ("map.remove", "patch_seq_map_remove"),
1333 ("map.keys", "patch_seq_map_keys"),
1334 ("map.values", "patch_seq_map_values"),
1335 ("map.size", "patch_seq_map_size"),
1336 ("map.empty?", "patch_seq_map_empty"),
1337 ("variant.field-count", "patch_seq_variant_field_count"),
1339 ("variant.tag", "patch_seq_variant_tag"),
1340 ("variant.field-at", "patch_seq_variant_field_at"),
1341 ("variant.append", "patch_seq_variant_append"),
1342 ("variant.last", "patch_seq_variant_last"),
1343 ("variant.init", "patch_seq_variant_init"),
1344 ("variant.make-0", "patch_seq_make_variant_0"),
1345 ("variant.make-1", "patch_seq_make_variant_1"),
1346 ("variant.make-2", "patch_seq_make_variant_2"),
1347 ("variant.make-3", "patch_seq_make_variant_3"),
1348 ("variant.make-4", "patch_seq_make_variant_4"),
1349 ("variant.make-5", "patch_seq_make_variant_5"),
1350 ("variant.make-6", "patch_seq_make_variant_6"),
1351 ("variant.make-7", "patch_seq_make_variant_7"),
1352 ("variant.make-8", "patch_seq_make_variant_8"),
1353 ("variant.make-9", "patch_seq_make_variant_9"),
1354 ("variant.make-10", "patch_seq_make_variant_10"),
1355 ("variant.make-11", "patch_seq_make_variant_11"),
1356 ("variant.make-12", "patch_seq_make_variant_12"),
1357 ("wrap-0", "patch_seq_make_variant_0"),
1359 ("wrap-1", "patch_seq_make_variant_1"),
1360 ("wrap-2", "patch_seq_make_variant_2"),
1361 ("wrap-3", "patch_seq_make_variant_3"),
1362 ("wrap-4", "patch_seq_make_variant_4"),
1363 ("wrap-5", "patch_seq_make_variant_5"),
1364 ("wrap-6", "patch_seq_make_variant_6"),
1365 ("wrap-7", "patch_seq_make_variant_7"),
1366 ("wrap-8", "patch_seq_make_variant_8"),
1367 ("wrap-9", "patch_seq_make_variant_9"),
1368 ("wrap-10", "patch_seq_make_variant_10"),
1369 ("wrap-11", "patch_seq_make_variant_11"),
1370 ("wrap-12", "patch_seq_make_variant_12"),
1371 ("f.add", "patch_seq_f_add"),
1373 ("f.subtract", "patch_seq_f_subtract"),
1374 ("f.multiply", "patch_seq_f_multiply"),
1375 ("f.divide", "patch_seq_f_divide"),
1376 ("f.+", "patch_seq_f_add"),
1378 ("f.-", "patch_seq_f_subtract"),
1379 ("f.*", "patch_seq_f_multiply"),
1380 ("f./", "patch_seq_f_divide"),
1381 ("f.=", "patch_seq_f_eq"),
1383 ("f.<", "patch_seq_f_lt"),
1384 ("f.>", "patch_seq_f_gt"),
1385 ("f.<=", "patch_seq_f_lte"),
1386 ("f.>=", "patch_seq_f_gte"),
1387 ("f.<>", "patch_seq_f_neq"),
1388 ("f.eq", "patch_seq_f_eq"),
1390 ("f.lt", "patch_seq_f_lt"),
1391 ("f.gt", "patch_seq_f_gt"),
1392 ("f.lte", "patch_seq_f_lte"),
1393 ("f.gte", "patch_seq_f_gte"),
1394 ("f.neq", "patch_seq_f_neq"),
1395 ("int->float", "patch_seq_int_to_float"),
1397 ("float->int", "patch_seq_float_to_int"),
1398 ("float->string", "patch_seq_float_to_string"),
1399 ("string->float", "patch_seq_string_to_float"),
1400 ("test.init", "patch_seq_test_init"),
1402 ("test.finish", "patch_seq_test_finish"),
1403 ("test.has-failures", "patch_seq_test_has_failures"),
1404 ("test.assert", "patch_seq_test_assert"),
1405 ("test.assert-not", "patch_seq_test_assert_not"),
1406 ("test.assert-eq", "patch_seq_test_assert_eq"),
1407 ("test.assert-eq-str", "patch_seq_test_assert_eq_str"),
1408 ("test.fail", "patch_seq_test_fail"),
1409 ("test.pass-count", "patch_seq_test_pass_count"),
1410 ("test.fail-count", "patch_seq_test_fail_count"),
1411 ("time.now", "patch_seq_time_now"),
1413 ("time.nanos", "patch_seq_time_nanos"),
1414 ("time.sleep-ms", "patch_seq_time_sleep_ms"),
1415 ("son.dump", "patch_seq_son_dump"),
1417 ("son.dump-pretty", "patch_seq_son_dump_pretty"),
1418 ("stack.dump", "patch_seq_stack_dump"),
1420 ])
1421});
1422
1423pub fn emit_runtime_decls(ir: &mut String) -> Result<(), CodeGenError> {
1425 for decl in RUNTIME_DECLARATIONS.iter() {
1426 if let Some(cat) = decl.category {
1427 writeln!(ir, "{}", cat)?;
1428 }
1429 writeln!(ir, "{}", decl.decl)?;
1430 }
1431 writeln!(ir)?;
1432 Ok(())
1433}